:root {
  --bg: #111216;
  --panel: #191a20;
  --panel-2: #20222a;
  --line: #2b2d36;
  --text: #f4efe7;
  --muted: #a7a29a;
  --accent: #ff8f6b;
  --accent-2: #f5c451;
  --accent-ink: #24120a;
  --good: #62d39f;
  --warn: #f5c451;
  --bad: #ff6b81;
  --radius: 20px;
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(255, 143, 107, 0.10), transparent 60%),
    radial-gradient(120% 60% at 100% 0%, rgba(245, 196, 81, 0.07), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); }
b { font-weight: 650; }
code { background: var(--panel-2); padding: 1px 6px; border-radius: 6px; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.4; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.shell {
  max-width: 560px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.loading { color: var(--muted); text-align: center; margin-top: 40vh; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.accent { color: var(--accent); }
.ico { width: 22px; height: 22px; fill: currentColor; flex: none; }

/* brand */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: 0.02em; font-size: 19px; }
.mark { position: relative; width: 30px; height: 20px; flex: none; }
.mark::before, .mark::after {
  content: ""; position: absolute; top: 0; width: 20px; height: 20px; border-radius: 50%;
  border: 3.5px solid var(--accent);
}
.mark::before { left: 0; }
.mark::after { left: 10px; border-color: var(--accent-2); mix-blend-mode: screen; }
.mark.big { width: 72px; height: 48px; }
.mark.big::before, .mark.big::after { width: 48px; height: 48px; border-width: 6px; }
.mark.big::after { left: 24px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel-2);
  font-weight: 650; text-decoration: none; color: var(--text);
  transition: transform 0.08s ease, background 0.15s ease;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 15px; }
.btn .ico { width: 20px; height: 20px; }
.link { background: none; border: 0; padding: 4px 2px; color: var(--accent); font-weight: 600; }
.link.small { font-size: 14px; display: block; margin: 8px auto 0; }
.icon-btn {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
}
.icon-btn .ico { width: 20px; height: 20px; }
.icon-btn.add-btn { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.icon-btn.add-btn.done { background: var(--panel-2); color: var(--good); border-color: var(--line); }

/* hero screens (signed out / home / notices) */
.hero { display: flex; flex-direction: column; gap: 18px; padding-top: 6vh; }
.hero h1 { font-size: clamp(34px, 9vw, 46px); line-height: 1.05; margin: 12px 0 0; letter-spacing: -0.02em; }
.lede { font-size: 18px; color: var(--muted); margin: 0; }
.lede .code, .code { color: var(--accent-2); letter-spacing: 0.12em; }
.fine { font-size: 13px; color: var(--muted); margin: 0; }
ul.fine { padding-left: 18px; display: grid; gap: 4px; }
.or { text-align: center; color: var(--muted); font-size: 14px; position: relative; }
.or::before, .or::after { content: ""; position: absolute; top: 50%; width: 32%; height: 1px; background: var(--line); }
.or::before { left: 0; } .or::after { right: 0; }
.join-row { display: flex; gap: 10px; }
.code-input {
  flex: 1; min-width: 0; height: 52px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--panel); text-align: center; font-size: 24px; font-weight: 750; letter-spacing: 0.3em;
  text-transform: uppercase;
}
.code-input::placeholder { color: #55575f; }
.note { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); font-size: 15px; }
.note.warn { border-color: rgba(245, 196, 81, 0.45); }
.note.bad { border-color: rgba(255, 107, 129, 0.5); }
.notice { padding-top: 10vh; }
.notice h1 { font-size: 30px; line-height: 1.15; }
.notice p { color: var(--muted); }

/* party header */
.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
}
.pill b { letter-spacing: 0.14em; color: var(--accent-2); }
.pill-label { color: var(--muted); font-size: 14px; }
.pill .ico { width: 18px; height: 18px; color: var(--muted); }

/* banners */
.banner { border-radius: 16px; padding: 14px 16px; margin-bottom: 14px; background: var(--panel); border: 1px solid var(--line); }
.banner.warn { border-color: rgba(245, 196, 81, 0.5); background: linear-gradient(0deg, rgba(245, 196, 81, 0.07), rgba(245, 196, 81, 0.07)), var(--panel); }
.banner.bad { border-color: rgba(255, 107, 129, 0.5); background: linear-gradient(0deg, rgba(255, 107, 129, 0.07), rgba(255, 107, 129, 0.07)), var(--panel); }
.banner-title { font-weight: 750; }
.banner p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.banner-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* now playing */
.card { border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.now { position: relative; overflow: hidden; padding: 20px 18px 16px; isolation: isolate; }
.now::before {
  content: ""; position: absolute; inset: -40px; z-index: -1;
  background-image: var(--art, none); background-size: cover; background-position: center;
  filter: blur(46px) saturate(1.3); opacity: 0.42; transform: scale(1.1);
}
.now::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(17, 18, 22, 0.15), rgba(17, 18, 22, 0.75)); }
.np-art { display: block; width: min(64vw, 248px); aspect-ratio: 1; margin: 0 auto 16px; border-radius: 14px; object-fit: cover; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45); background: var(--panel-2); }
.np-art.blank { background: linear-gradient(135deg, var(--panel-2), #2c2420); }
.np-meta { text-align: center; }
.np-title { font-size: 21px; font-weight: 750; line-height: 1.2; overflow-wrap: anywhere; }
.np-artist { color: var(--text); opacity: 0.8; margin-top: 2px; }
.np-by { color: var(--muted); font-size: 13px; margin-top: 4px; }
.bar { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); margin: 18px 2px 6px; overflow: hidden; }
.fill { height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.times { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; padding: 0 2px; }
.controls { display: flex; align-items: center; justify-content: center; gap: 26px; margin-top: 8px; }
.ctl { width: 54px; height: 54px; border-radius: 50%; border: 0; background: transparent; color: var(--text); display: grid; place-items: center; }
.ctl .ico { width: 28px; height: 28px; }
.ctl.main { width: 70px; height: 70px; background: var(--text); color: var(--bg); }
.ctl.main .ico { width: 34px; height: 34px; }
.ctl:active:not(:disabled) { transform: scale(0.94); }
.now.empty { text-align: center; padding: 30px 18px; }
.empty-art { display: grid; place-items: center; height: 92px; margin-bottom: 8px; }
.now.empty p { margin: 6px 0 0; }

/* sections */
.block { margin-top: 22px; }
.block h2, .sheet h2 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.count { font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 1px 8px; letter-spacing: 0.02em; }
.searchbox {
  display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px;
  border-radius: 16px; border: 1px solid var(--line); background: var(--panel);
}
.searchbox:focus-within { border-color: var(--accent); }
.searchbox .ico { color: var(--muted); }
.searchbox input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none; font-size: 16px; }
.results { margin-top: 8px; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.row { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-radius: 12px; }
.row + .row { border-top: 1px solid rgba(255, 255, 255, 0.04); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.row-sub { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.thumb { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; flex: none; background: var(--panel-2); }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; display: grid; place-items: center; background: var(--panel-2); font-weight: 750; color: var(--accent-2); }
.tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 1px 6px; border-radius: 6px; background: var(--panel-2); color: var(--muted); flex: none; }
.tag.host { color: var(--accent-ink); background: var(--accent-2); }
.tag.e { letter-spacing: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.dot.good { background: var(--good); box-shadow: 0 0 0 3px rgba(98, 211, 159, 0.18); }
.dot.mid { background: var(--warn); }
.dot.bad { background: var(--bad); }
.dot.off { background: #5a5c64; }

/* footer */
.foot { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); display: grid; gap: 14px; }
.device-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 15px; }
.device-line span { flex: 1; min-width: 0; }
.device-line b { color: var(--text); }
.foot-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.switch { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }

/* bottom sheet */
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); opacity: 0; transition: opacity 0.2s; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto;
  max-height: 88dvh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 22px 22px 0 0; padding: 22px 18px max(22px, env(safe-area-inset-bottom));
  display: grid; gap: 12px; transform: translateY(100%); transition: transform 0.22s ease;
}
.sheet.open .sheet-backdrop { opacity: 1; }
.sheet.open .sheet-panel { transform: none; }
.sheet-close { position: absolute; top: 14px; right: 14px; }
.big-code { font-size: 54px; font-weight: 800; letter-spacing: 0.22em; text-align: center; color: var(--accent-2); padding-left: 0.22em; }
.linkbox { font-size: 14px; padding: 12px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; }
.device {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2); margin-bottom: 8px;
}

/* toast */
.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 30;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); font-weight: 650; font-size: 15px;
  padding: 10px 18px; border-radius: 999px; max-width: calc(100% - 32px); text-align: center;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
