*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0d0d0e;
  --surface: #141416;
  --surface-hover: #1a1a1e;
  --border: #222228;
  --text: #e8e8ea;
  --text-secondary: #a0a0ab;
  --text-muted: #5c5c6a;
  --green: #4ade80;
  --green-hover: rgba(74, 222, 128, 0.06);
  --purple: #a78bfa;
  --radius: 12px;
  --radius-sm: 8px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(74, 222, 128, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(167, 139, 250, 0.03) 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-x: hidden;
}

#stars {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

header,
main,
footer {
  position: relative;
  z-index: 1;
}

/* ---- Header ---- */

header {
  text-align: center;
  padding: 3.5rem 1.5rem 0.5rem;
}

header h1 {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #fff;
}

header .dot {
  color: var(--green);
}

.tagline {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-top: 0.5rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  margin-bottom: 0.5rem;
}

/* ---- Main ---- */

main {
  width: 100%;
  max-width: 800px;
  padding: 0 1.25rem 3.5rem;
}

/* ---- Selector row ---- */

.selector {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 1.2rem 0 1.6rem;
}

.selector-heading {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.selector-heading h2 {
  font-size: 1.45rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: linear-gradient(135deg, var(--green) 0%, var(--purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 1rem;
  transition: border-color 0.2s;
}

.input-wrap:hover {
  border-color: #333;
}

.input-wrap:focus-within {
  border-color: var(--green);
}

.input-prefix {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 500;
  user-select: none;
  margin-right: 0.15rem;
}

.selector input {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  font-weight: 500;
  padding: 0.6rem 0;
  width: 10ch;
  min-width: 6ch;
  outline: none;
}

.selector input::placeholder {
  color: var(--text-muted);
}

#forecast-btn {
  background: rgba(74, 222, 128, 0.12);
  color: var(--green);
  border: 1px solid rgba(74, 222, 128, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.6rem;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

#forecast-btn:hover {
  background: rgba(74, 222, 128, 0.2);
  border-color: rgba(74, 222, 128, 0.45);
}

.selector-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: -0.8rem;
  margin-bottom: 2rem;
  letter-spacing: 0.02em;
}

/* ---- Table ---- */

.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--surface);
  padding: 0.75rem 1.2rem;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-align: center;
  border-bottom: 1px solid var(--border);
}

thead th:first-child {
  width: 28%;
  text-align: left;
}

thead th:nth-child(2) {
  width: 28%;
}

thead th:nth-child(3) {
  width: 44%;
  text-align: right;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:not(.placeholder-row):hover {
  background: var(--green-hover);
}

tbody td {
  padding: 0.7rem 1.2rem;
  font-size: 0.9rem;
  text-align: center;
  color: var(--text-secondary);
}

tbody td:first-child {
  font-weight: 500;
  color: var(--text);
  text-align: left;
}

tbody td:nth-child(3) {
  text-align: right;
}

.platform-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.platform-logo {
  border-radius: 4px;
  flex-shrink: 0;
  vertical-align: middle;
}

tbody td:nth-child(2) {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--green);
}

.placeholder-row td {
  text-align: center !important;
  color: var(--text-muted);
  font-weight: 400 !important;
  padding: 2.5rem 1rem;
  font-size: 0.88rem;
}

/* ---- Tooltip (header only) ---- */

.tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text-secondary);
  border: 1px solid var(--text-muted);
  border-radius: 50%;
  cursor: help;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}

.tip:hover {
  border-color: var(--text);
  color: var(--text);
}

.tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  background: var(--surface-hover);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 400;
  font-style: normal;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  line-height: 1.5;
  text-align: center;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  width: max-content;
  max-width: 260px;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}

.tip:hover::after {
  opacity: 1;
}

/* ---- Source links ---- */

.source-link {
  display: inline-block;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  text-decoration: none;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: transparent;
  transition: color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.source-link:hover {
  color: var(--green);
}

.no-detail {
  color: var(--border);
}

/* ---- Footer ---- */

footer {
  margin-top: auto;
  padding: 1.5rem 1.25rem;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

footer a:hover {
  color: var(--text);
}

/* ---- Responsive ---- */

@media (max-width: 600px) {
  header h1 {
    font-size: 2rem;
  }

  .tagline {
    font-size: 0.88rem;
  }

  .selector {
    flex-direction: column;
    gap: 0.75rem;
  }

  .input-wrap {
    width: 100%;
  }

  .selector input {
    flex: 1;
    width: auto;
  }

  #forecast-btn {
    width: 100%;
  }

  main {
    padding: 0 0.75rem 2rem;
    max-width: 100%;
  }

  thead th {
    padding: 0.65rem 0.5rem;
    font-size: 0.65rem;
  }

  tbody td {
    padding: 0.6rem 0.5rem;
    font-size: 0.8rem;
  }

  .source-link {
    font-size: 0.68rem;
  }

  .tip::after {
    left: 0;
    transform: translateX(-10%);
  }
}
