:root {
  --orange: #ff5500;
  --bg: #ffffff;
  --surface: #f5f4f2;
  --border: #e4e2de;
  --text: #121212;
  --muted: #5c5853;
  --accent-text: #c43f00;
  --inv: #121212;
  --inv-text: #ffffff;
  --ok: #0f7a55;
  --ok-bg: #e3f5ec;
  --warn: #9a4a00;
  --warn-bg: #fff1e3;
  --rest: #d6d3ce;
  --dot: rgba(18, 18, 18, .1);
  --grain: .035;
  --font: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --hand: "Gaegu", "Comic Sans MS", cursive;
  --page-pad: clamp(20px, 5vw, 72px);
}
[data-theme="dark"] {
  --bg: #0b0b0c;
  --surface: #141415;
  --border: #28282b;
  --text: #f2f2f2;
  --muted: #a1a1a6;
  --accent-text: #ff7a33;
  --inv: #f2f2f2;
  --inv-text: #0b0b0c;
  --ok: #6ee7b7;
  --ok-bg: #10261e;
  --warn: #ffb088;
  --warn-bg: #2a1a10;
  --rest: #3a3a3d;
  --dot: rgba(255, 255, 255, .09);
  --grain: .045;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: var(--grain);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
[data-theme="dark"] body::before { filter: invert(1); }
a { color: var(--accent-text); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; border-radius: 8px; }
[hidden] { display: none !important; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 var(--page-pad); }

/* Header */
.site-header { padding-top: 24px; padding-bottom: 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand img { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; box-shadow: 0 0 0 2px var(--orange); }
.brand span { font-size: 26px; font-weight: 800; letter-spacing: -1px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn .sun { display: none; }
[data-theme="dark"] .icon-btn .sun { display: block; }
[data-theme="dark"] .icon-btn .moon { display: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px; border-radius: 999px; border: 2px solid transparent;
  font-family: inherit; font-size: 16px; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-orange { background: var(--orange); color: #121212; font-weight: 800; }
.btn-orange:hover:not(:disabled) { background: #ff6a1f; }
.btn-inv { background: var(--inv); color: var(--inv-text); }
.btn-ghost { background: var(--bg); color: var(--text); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--text); }
.btn-lg { min-height: 58px; padding: 14px 30px; font-size: 18px; }
.btn-sm { min-height: 40px; padding: 8px 16px; font-size: 14px; }

/* Cards and layout */
.grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 24px; }
.card h2 { margin: 0 0 6px; font-size: 20px; font-weight: 800; }
.card p { margin: 0; color: var(--muted); line-height: 1.55; }
.muted { color: var(--muted); }
.scribble { font-family: var(--hand); font-size: 26px; font-weight: 700; color: var(--accent-text); transform: rotate(-2deg); display: inline-block; }

.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: 14px; font-weight: 700; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill-live { background: var(--orange); color: #121212; }
.pill-off { background: var(--border); color: var(--muted); }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }

.notice { padding: 16px 20px; border-radius: 16px; background: var(--warn-bg); color: var(--warn); font-weight: 600; line-height: 1.5; margin-bottom: 20px; }
.notice code { font-size: 14px; }

/* Now playing */
.track { display: flex; gap: 18px; align-items: center; }
.track .art { width: 96px; height: 96px; flex-shrink: 0; border-radius: 14px; object-fit: cover; background: var(--border); }
.track .title { font-size: 22px; font-weight: 800; line-height: 1.15; margin: 0; overflow-wrap: anywhere; color: var(--text); }
.track .artist { color: var(--muted); margin-top: 4px; }
.progress { margin-top: 18px; }
.bar { height: 6px; border-radius: 999px; background: var(--rest); overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; background: var(--orange); border-radius: 999px; transition: width .9s linear; }
.times { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Profile + link */
.profile { display: flex; align-items: center; gap: 14px; }
.avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: var(--border); flex-shrink: 0; }
.linkbox { display: flex; gap: 8px; align-items: center; margin-top: 14px; padding: 6px 6px 6px 16px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); }
.linkbox code { flex: 1; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: inherit; font-weight: 700; }

.steps-list { margin: 14px 0 0; padding-left: 20px; color: var(--muted); line-height: 1.6; }
.steps-list li + li { margin-top: 6px; }
textarea.code {
  width: 100%; margin-top: 12px; min-height: 84px; resize: vertical; padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); font: 13px/1.4 ui-monospace, Menlo, Consolas, monospace; word-break: break-all;
}
.people { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.people span { padding: 6px 12px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); font-size: 14px; font-weight: 600; }

/* Center hero used on sign-in and listener pages */
.center { text-align: center; max-width: 560px; margin: 40px auto; }
.center h1 { font-size: clamp(34px, 5vw, 52px); letter-spacing: -1.5px; margin: 10px 0 12px; }
.center p { color: var(--muted); font-size: 18px; line-height: 1.55; margin: 0 0 24px; }
.hero-girl { width: 180px; height: auto; display: block; margin: 0 auto 6px;
  -webkit-mask-image: linear-gradient(to bottom, #000 75%, transparent 100%); mask-image: linear-gradient(to bottom, #000 75%, transparent 100%); }

/* Listener page */
.listen-card { max-width: 640px; margin: 20px auto 40px; }
.host { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.host .avatar { width: 44px; height: 44px; }
.tune {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  padding: 28px 26px; margin-top: 18px; border-radius: 22px; overflow: hidden; isolation: isolate;
  background: var(--bg);
}
/* soft orange glow behind the Tune in button */
.tune::before {
  content: ""; position: absolute; left: 50%; top: 55%; width: 360px; height: 360px; translate: -50% -50%; z-index: -1;
  border-radius: 50%; background: radial-gradient(circle, rgba(255, 85, 0, .2), transparent 65%);
  animation: tuneGlow 4s ease-in-out infinite;
}
@keyframes tuneGlow { 0%, 100% { scale: .9; opacity: .8; } 50% { scale: 1.08; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tune::before { animation: none; } }
.player-frame { width: 100%; height: 166px; border: 0; border-radius: 14px; margin-top: 18px; display: block; }
.controls { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.controls input[type="range"] { flex: 1; accent-color: var(--orange); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

footer.site-footer { padding: 28px 0 40px; color: var(--muted); font-size: 14px; text-align: center; }

@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .brand span { font-size: 22px; }
  .track .art { width: 72px; height: 72px; }
  .track .title { font-size: 19px; }
}

/* ---------- Account page ---------- */
.auth-shell {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 28px; align-items: stretch;
  min-height: min(760px, calc(100vh - 150px)); margin: 8px 0 24px;
}
.auth-shell.single { grid-template-columns: minmax(0, 480px); justify-content: center; min-height: 0; margin-top: 40px; }

/* Left: the art panel */
.auth-art {
  position: relative; overflow: hidden; border-radius: 32px; background: var(--surface); border: 1px solid var(--border);
  min-height: 560px; isolation: isolate;
}
.art-dots { position: absolute; inset: 0; background-image: radial-gradient(var(--dot) 1.2px, transparent 1.7px); background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 70% 65% at 55% 45%, #000 25%, transparent 80%); mask-image: radial-gradient(ellipse 70% 65% at 55% 45%, #000 25%, transparent 80%); }
.art-glow { position: absolute; left: 50%; top: 46%; width: 460px; height: 460px; translate: -50% -50%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 85, 0, .22), transparent 65%); animation: breathe 6s ease-in-out infinite; }
.art-back { position: absolute; left: 50%; bottom: -30px; height: 96%; translate: -34% 0; opacity: .38; filter: blur(3px);
  transform-origin: 50% 100%; animation: sway 6.5s ease-in-out infinite -2s;
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent 98%); mask-image: linear-gradient(to bottom, #000 70%, transparent 98%); }
.art-girl { position: absolute; left: 50%; bottom: 120px; height: 64%; translate: -58% 0; transform-origin: 50% 100%; animation: sway 4.5s ease-in-out infinite; }
.art-girl img { height: 100%; width: auto; display: block;
  -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent 100%); mask-image: linear-gradient(to bottom, #000 78%, transparent 100%); }
.art-bubble {
  position: absolute; right: 56%; bottom: 94%; white-space: nowrap; padding: 8px 14px 10px;
  background: var(--bg); color: var(--text); border: 2px solid var(--text); border-radius: 16px 16px 4px 16px;
  font-family: var(--hand); font-size: 22px; font-weight: 700; line-height: 1; animation: bubbleFloat 2.8s ease-in-out infinite;
  transition: opacity .25s ease;
}
.art-bubble::after { content: ""; position: absolute; right: 12px; bottom: -8px; width: 11px; height: 11px; background: var(--bg);
  border-right: 2px solid var(--text); border-bottom: 2px solid var(--text); rotate: 45deg; }
.art-bubble.swap { opacity: 0; }
.art-note { position: absolute; color: var(--orange); font-size: 26px; animation: rise 5s ease-out infinite; }
.art-note.n1 { left: 64%; top: 34%; }
.art-note.n2 { left: 72%; top: 42%; color: var(--text); font-size: 20px; animation-delay: -1.3s; }
.art-note.n3 { left: 58%; top: 46%; font-size: 18px; animation-delay: -2.6s; }
.art-note.n4 { left: 78%; top: 30%; font-size: 22px; animation-delay: -3.8s; }
.art-spark, .art-heart { position: absolute; fill: none; stroke: var(--orange); stroke-width: 2.6; stroke-linejoin: round; }
.art-spark.s1 { width: 34px; left: 8%; top: 7%; animation: twinkle 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.art-spark.s2 { width: 20px; right: 10%; top: 20%; animation: twinkle 3.2s ease-in-out infinite -1.4s; }
.art-heart { width: 28px; right: 14%; top: 56%; rotate: 12deg; }
.auth-art::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 42%; z-index: 1; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--surface) 62%); }
.art-caption { position: absolute; left: 28px; right: 28px; bottom: 26px; z-index: 2; }
.art-caption p { margin: 6px 0 0; font-size: 19px; font-weight: 700; line-height: 1.4; max-width: 380px; color: var(--text); }

@keyframes sway { 0%, 100% { rotate: -1.8deg; } 50% { rotate: 1.8deg; } }
@keyframes breathe { 0%, 100% { scale: .92; opacity: .75; } 50% { scale: 1.06; opacity: 1; } }
@keyframes bubbleFloat { 0%, 100% { translate: 0 0; rotate: -1.5deg; } 50% { translate: 0 -6px; rotate: 1.5deg; } }
@keyframes rise { 0% { transform: translateY(0) rotate(-8deg); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-130px) rotate(10deg); opacity: 0; } }
@keyframes twinkle { 0%, 100% { scale: 1; } 50% { scale: .7; } }

/* Right: the form card */
.auth-card {
  align-self: center; width: 100%; max-width: 460px; justify-self: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 32px; padding: 30px 30px 26px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 30px 60px -30px rgba(0, 0, 0, .35);
}
.auth-card h1 { margin: 2px 0 8px; font-size: clamp(28px, 3vw, 36px); line-height: 1.05; letter-spacing: -1.2px; }
.auth-sub { margin: 0 0 22px; color: var(--muted); font-size: 16px; line-height: 1.5; }
.auth-scribble { font-size: 24px; margin-top: 18px; }

.tabs { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 5px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); }
.tabs button { position: relative; z-index: 1; min-height: 42px; border: 0; background: none; border-radius: 999px; font: inherit; font-weight: 800; font-size: 15px; color: var(--muted); cursor: pointer; transition: color .2s ease; }
.tabs button[aria-selected="true"] { color: #121212; }
.tab-slider { position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc(50% - 5px); border-radius: 999px; background: var(--orange); transition: translate .3s cubic-bezier(.34, 1.4, .64, 1); }
.tabs.login .tab-slider { translate: 100% 0; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-weight: 700; font-size: 14px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.input-wrap {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 14px;
  border-radius: 16px; border: 1.5px solid var(--border); background: var(--bg); transition: border-color .15s ease, box-shadow .15s ease;
}
.input-wrap:focus-within { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(255, 85, 0, .18); }
.input-wrap input { flex: 1; min-width: 0; height: 50px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 16px; outline: none; }
.input-wrap input::placeholder { color: var(--muted); opacity: .7; }
.lead-icon { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.has-prefix { gap: 0; }
.prefix { color: var(--muted); font-weight: 600; font-size: 15px; white-space: nowrap; user-select: none; }
.eye { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin-right: -6px; border: 0; background: none; border-radius: 10px; cursor: pointer; }
.eye svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.eye[aria-pressed="true"] svg { stroke: var(--orange); }
.state-icon { width: 20px; height: 20px; flex-shrink: 0; border-radius: 50%; }
.state-icon.good { background: var(--ok) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M5.5 10.5l3 3 6-7' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/100% no-repeat; }
.state-icon.bad { background: #d93025 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M7 7l6 6M13 7l-6 6' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round'/></svg>") center/100% no-repeat; }
.state-icon.wait { border: 2px solid var(--border); border-top-color: var(--orange); animation: spin .8s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }

.hint { font-size: 13px; color: var(--muted); }
.hint.good { color: var(--ok); font-weight: 600; }
.hint.bad, .form-msg.bad { color: #d93025; font-weight: 600; }
[data-theme="dark"] .hint.bad, [data-theme="dark"] .form-msg.bad { color: #ff8a80; }
.form-msg { margin: 0; padding: 12px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; font-weight: 600; background: var(--ok-bg); color: var(--ok); }
.form-msg.bad { background: rgba(217, 48, 37, .1); }
.auth-submit { width: 100%; margin-top: 4px; transition: transform .15s ease, background-color .15s ease; }
.auth-submit:active:not(:disabled) { transform: scale(.98); }
.switch-line { margin: 2px 0 0; text-align: center; }
.linklike { background: none; border: 0; padding: 4px 0; font: inherit; color: var(--accent-text); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linklike.small { font-size: 13px; }

.avatar.initial { display: inline-flex; align-items: center; justify-content: center; background: var(--orange); color: #121212; font-weight: 800; font-size: 22px; text-transform: uppercase; }
.rename { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.rename input { flex: 1; min-width: 140px; min-height: 40px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; }

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: minmax(0, 1fr); min-height: 0; gap: 16px; }
  .auth-art { min-height: 270px; }
  .auth-art::after { height: 22%; }
  .art-girl { height: 88%; bottom: -8px; translate: -36% 0; }
  .art-bubble { right: 62%; bottom: 80%; }
  .art-back { display: none; }
  .art-caption { display: none; }
  .art-bubble { font-size: 19px; }
}
@media (max-width: 520px) {
  .auth-card { padding: 22px 18px 20px; border-radius: 26px; }
  .prefix { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .art-glow, .art-back, .art-girl, .art-bubble, .art-note, .art-spark, .tab-slider, .state-icon.wait { animation: none; transition: none; }
  .art-note { opacity: .8; }
}
