:root {
  --paper: #f3f4f7;
  --card: #ffffff;
  --ink: #16181d;
  --muted: #6d7280;
  --line: #e7e9ef;
  --soft: #f4f5f8;
  --leading: #0e8a56;
  --weakening: #d4890b;
  --lagging: #d64545;
  --improving: #2f6fed;
  --shadow: 0 1px 2px rgba(22, 24, 29, 0.04), 0 18px 44px rgba(22, 24, 29, 0.06);
  --serif: Fraunces, Georgia, "Times New Roman", serif;
  --sans: Outfit, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100vh; min-height: 100dvh; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(880px 420px at -8% -20%, rgba(47, 111, 237, 0.10), transparent 58%),
    radial-gradient(720px 380px at 110% -10%, rgba(14, 138, 86, 0.08), transparent 52%),
    var(--paper);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.top {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 22px 8px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex: 0 0 auto;
}
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.word { font-family: var(--serif); font-size: 26px; font-weight: 560; letter-spacing: -0.03em; }
.tag { margin-top: 4px; color: var(--muted); font-size: 12px; letter-spacing: 0.01em; }
.logo {
  width: 28px;
  height: 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
}
.logo i { display: block; border-radius: 3px; }
.logo i:nth-child(1) { background: var(--improving); }
.logo i:nth-child(2) { background: var(--leading); }
.logo i:nth-child(3) { background: var(--lagging); }
.logo i:nth-child(4) { background: var(--weakening); }

.markets {
  display: flex;
  gap: 2px;
  flex: 0 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  box-shadow: 0 1px 2px rgba(22, 24, 29, 0.04);
}
.markets::-webkit-scrollbar { display: none; }
.markets button, .ghost, .solid, .texty {
  border: 0;
  background: transparent;
}
.markets button {
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--muted);
  white-space: nowrap;
}
.markets button:hover { background: rgba(28, 25, 21, 0.05); color: var(--ink); }
.markets button[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 6px 16px rgba(22, 24, 29, 0.16);
}

.actions { display: flex; gap: 8px; flex: 0 0 auto; margin-left: auto; }
.ghost, .solid, .texty { border-radius: 999px; padding: 8px 14px; }
.ghost { background: #fff; border: 1px solid var(--line); }
.ghost:hover, .texty:hover { background: var(--soft); }
.solid { background: var(--ink); color: #fff; box-shadow: 0 8px 18px rgba(22, 24, 29, 0.16); }
.solid:hover { background: #000; }
.texty { color: var(--muted); padding-inline: 0; }

/* :not([hidden]) matters here: a plain ".account { display: flex }" has the
   same CSS specificity as the browser's own "[hidden] { display: none }"
   rule, and since this stylesheet loads after the browser's default one, it
   would win -- showing the account box (and the Sign out button inside it)
   even while [hidden] is set, i.e. before anyone has signed in. */
.account:not([hidden]) { display: flex; align-items: center; gap: 8px; }
.account-pic { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.account-name { font-size: 0.9em; color: var(--ink); white-space: nowrap; }
.google-signin { display: flex; align-items: center; gap: 10px; justify-content: center; width: 100%; }

main {
  flex: 1;
  min-height: calc(100vh - 150px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  padding: 8px 22px 18px;
}

.stage, .rail {
  background: var(--card);
  border: 1px solid rgba(22, 24, 29, 0.06);
  border-radius: 24px;
  box-shadow: var(--shadow);
  min-height: 0;
}
.stage {
  display: flex;
  flex-direction: column;
  padding: 18px 18px 14px 12px;
}
.stage-copy {
  padding: 0 8px 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
}
.tune-launch {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  min-width: 248px;
  padding: 10px 16px 10px 10px;
  text-align: left;
  border: 1px solid rgba(22, 24, 29, 0.08);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f7f8fb 100%);
  box-shadow: 0 10px 28px rgba(22, 24, 29, 0.08);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.tune-launch:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(22, 24, 29, 0.12);
}
.tune-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  flex: 0 0 auto;
}
.tune-copy { display: flex; flex-direction: column; min-width: 0; }
.tune-launch strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.tune-launch .tune-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 12.5px; }
.tune-launch[aria-expanded="true"] {
  background: var(--ink);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 14px 30px rgba(22, 24, 29, 0.18);
}
.tune-launch[aria-expanded="true"] .tune-mark { background: rgba(255, 255, 255, 0.12); }
.tune-launch[aria-expanded="true"] .tune-copy span { color: rgba(255, 255, 255, 0.72); }
.tune-sheet {
  margin: 4px 8px 14px 10px;
  padding: 20px 20px 16px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(22, 24, 29, 0.05);
}
.tune-sheet[hidden],
.picks[hidden],
.stock-picks[hidden],
.suggest[hidden] { display: none !important; }
.tune-sheet h2 { font-family: var(--serif); font-size: 28px; margin: 0; font-weight: 560; letter-spacing: -0.03em; }
.tune-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.tune-head p, .defaults, .hint-copy { color: var(--muted); font-size: 14px; line-height: 1.5; }
.tune-grid { display: grid; grid-template-columns: repeat(2, minmax(180px, 280px)); gap: 14px; margin-top: 16px; }
.tune-sheet label, .stock-picks label { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.tune-sheet select, .tune-sheet input[type="text"] {
  width: 100%;
  margin-top: 8px;
  border: 1px solid transparent;
  background: var(--soft);
  border-radius: 14px;
  padding: 13px 14px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0;
  text-transform: none;
}
.tune-sheet select:focus, .tune-sheet input[type="text"]:focus {
  outline: none;
  background: #fff;
  border-color: #d5d8e2;
  box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.12);
}
.combo, .stock-picks { position: relative; }
.suggest {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: calc(100% - 4px);
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 260px;
  overflow: auto;
}
.suggest[hidden] { display: none; }
.suggest button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.suggest button:hover, .suggest button.on { background: rgba(28, 25, 21, 0.06); }
.suggest button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.suggest small { color: var(--muted); flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.empty-suggest { padding: 8px 10px; color: var(--muted); font-size: 14px; }
.picks { border: 0; margin: 16px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.picks label {
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  background: var(--soft);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 12px;
}
.picks label:has(input:checked) { background: #fff; border-color: var(--ink); }
.picks input { margin-right: 6px; accent-color: var(--ink); }
.stock-picks { margin-top: 16px; max-width: 560px; }
.stock-picks label span { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); margin-left: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chips button {
  border: 0;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
}
.site-foot { padding: 4px 22px 18px; color: var(--muted); font-size: 13px; }
.site-foot a { color: var(--ink); }
.pay-actions { display: flex; flex-direction: column; gap: 10px; }
#paypal-slot { min-height: 42px; }
.price-alt { margin-top: 0; }
@media (max-width: 900px) {
  .tune-grid { grid-template-columns: 1fr; }
  .tune-launch { min-width: 0; width: 100%; }
  .stage-copy { flex-direction: column; align-items: stretch; }
}
h1 {
  font-family: var(--serif);
  font-weight: 560;
  font-size: clamp(26px, 3vw, 36px);
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.15;
}
#subhead { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.plot-frame {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 4px;
}
.y-axis, .x-axis {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0 28px;
}
.y-axis span:first-child { writing-mode: vertical-rl; transform: rotate(180deg); }
.y-axis span:last-child { writing-mode: vertical-rl; transform: rotate(180deg); }
.plot-column { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.plot-wrap {
  position: relative;
  flex: 1;
  min-height: 420px;
}
#plot { width: 100%; height: 100%; display: block; touch-action: none; }
.x-axis {
  display: flex;
  justify-content: space-between;
  padding: 4px 8px 0;
}

.loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
}
.loader[hidden] { display: none; }
.loader .logo i { animation: pulse 0.9s ease-in-out infinite alternate; }
.loader .logo i:nth-child(2) { animation-delay: 0.12s; }
.loader .logo i:nth-child(3) { animation-delay: 0.24s; }
.loader .logo i:nth-child(4) { animation-delay: 0.36s; }
@keyframes pulse { from { opacity: 0.35; } to { opacity: 1; } }

.hovercard {
  position: absolute;
  width: 220px;
  padding: 12px 14px;
  background: #16181d;
  color: #fff;
  border-radius: 14px;
  pointer-events: none;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
}
.hovercard strong { display: block; font-size: 15px; }
.hovercard em { font-style: normal; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.hovercard p { margin: 6px 0 0; font-size: 13px; line-height: 1.35; color: #e6dfd2; }
.hovercard .nums { margin-top: 8px; font-variant-numeric: tabular-nums; font-size: 12px; color: #c9c1b4; }

.transport {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 8px 8px 0 8px;
}
.play {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
}
.play svg { width: 18px; height: 18px; fill: currentColor; }
.play.hint { animation: nudge 1.15s ease-in-out 2; }
@keyframes nudge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}
#scrub {
  width: 100%;
  accent-color: var(--ink);
  height: 28px;
}
#when {
  font-family: var(--serif);
  font-size: 18px;
  min-width: 118px;
  text-align: right;
}

.banner {
  margin: 8px 10px 0;
  color: #8a4b12;
  font-size: 13px;
}
.banner[hidden] { display: none; }

.rail {
  padding: 16px 16px 12px;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.cycle {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.group { margin: 0 0 14px; }
.group h2 {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.group h2 span { font-variant-numeric: tabular-nums; color: var(--muted); letter-spacing: 0; text-transform: none; font-size: 12px; }
.group.leading h2 { color: var(--leading); }
.group.weakening h2 { color: var(--weakening); }
.group.lagging h2 { color: var(--lagging); }
.group.improving h2 { color: var(--improving); }
.group button.row {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 7px 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.group button.row:hover, .group button.row.on { background: rgba(28, 25, 21, 0.05); }
.group .empty { margin: 0; padding: 2px 8px 6px; color: var(--muted); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }

.tune h2 { font-family: var(--serif); font-weight: 560; margin: 0; font-size: 28px; }
.tune h3 { margin: 0 0 6px; font-size: 15px; }
.tune-head, .tune-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tune label { display: block; margin: 14px 0; font-size: 14px; }
.tune label output { float: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.tune input[type="range"] { width: 100%; margin-top: 6px; accent-color: var(--ink); }
.hint-copy { color: var(--muted); font-size: 13px; line-height: 1.45; }
.tune hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.field input, .field textarea {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
}
.tune-row { margin-top: 8px; }
.legal { margin-top: auto; padding-top: 16px; color: var(--muted); font-size: 12px; line-height: 1.45; }

#pro[hidden],
#sign-out[hidden] { display: none !important; }

.comments { padding: 4px 22px 8px; }
.comments-card {
  background: #fff;
  border: 1px solid rgba(22, 24, 29, 0.06);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 22px 22px 18px;
}
.comments-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.comments h2 {
  font-family: var(--serif);
  font-weight: 560;
  font-size: 32px;
  letter-spacing: -0.03em;
  margin: 0;
}
.comments-top p { margin: 6px 0 0; color: var(--muted); max-width: 68ch; line-height: 1.5; }
.comment { padding: 14px 0 4px; border-top: 1px solid var(--line); }
.comment.reply { margin-left: 28px; }
.comment header { display: flex; gap: 10px; align-items: baseline; }
.comment time { color: var(--muted); font-size: 12px; }
.comment p { margin: 6px 0 0; line-height: 1.5; }
.comment-actions { display: flex; gap: 14px; margin-top: 8px; }
.comment-actions button, .reply-box button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 13px;
}
.comment-actions button:hover { color: var(--ink); }
.reply-box, #comment-form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
#comment-form { margin-top: 16px; }
#comment-form label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
textarea {
  width: 100%;
  border: 1px solid transparent;
  background: var(--soft);
  border-radius: 14px;
  padding: 12px 14px;
  resize: vertical;
  font: inherit;
  color: inherit;
}
textarea:focus {
  outline: none;
  background: #fff;
  border-color: #d5d8e2;
  box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.12);
}
.comment-submit-row { display: flex; align-items: center; gap: 12px; }
.comment-submit-row .solid { width: auto; }
#comment-signed, .comment-empty { color: var(--muted); font-size: 14px; }
.reply-box button.solid {
  width: auto;
  align-self: flex-start;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
}

#pro-dialog,
#auth-dialog {
  border: 0;
  border-radius: 22px;
  padding: 26px 26px 22px;
  max-width: 440px;
  box-shadow: var(--shadow);
}
#pro-dialog::backdrop, #auth-dialog::backdrop { background: rgba(22, 24, 29, 0.4); }
#pro-dialog h2, #auth-dialog h2 { font-family: var(--serif); font-weight: 560; font-size: 36px; margin: 0 0 8px; letter-spacing: -0.03em; }
#pro-dialog h2 span { font-family: var(--sans); font-size: 16px; color: var(--muted); }
#auth-dialog p { color: var(--muted); line-height: 1.45; }
#google-slot { min-height: 44px; margin: 8px 0 4px; }
.eyebrow { letter-spacing: 0.12em; text-transform: uppercase; font-size: 12px; color: var(--muted); margin: 0; }
#pro-dialog ul { padding-left: 18px; line-height: 1.5; }
#pro-dialog p { color: var(--muted); line-height: 1.45; }
#pro-dialog .solid { width: 100%; padding: 12px; }

.q-label { font-family: var(--serif); font-size: 20px; font-weight: 560; }
.tick { font-size: 11px; fill: #8a847a; }
.dot-label {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  fill: var(--ink);
  stroke: #ffffff;
  stroke-width: 4px;
  paint-order: stroke;
}

@media (max-width: 900px) {
  .top { flex-wrap: wrap; }
  .markets { order: 3; flex-basis: 100%; }
  main { grid-template-columns: 1fr; }
  .plot-wrap { min-height: 460px; height: 68vh; }
  .rail { max-height: none; }
  .tune-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .play.hint, .loader .logo i { animation: none; }
}
