/* ═══════════════════════════════════════════════════════
   TOKENS
═══════════════════════════════════════════════════════ */
:root {
  /* Background layers */
  --bg:             oklch(99%  0.002 0);
  --surface:        oklch(96%  0.006 10);
  --surface-mid:    oklch(92%  0.010 12);
  --surface-strong: oklch(87%  0.014 14);

  /* Text */
  --ink:    oklch(22% 0.018 20);
  --muted:  oklch(42% 0.012 15);
  --subtle: oklch(58% 0.008 10);

  /* Structure */
  --line: oklch(88% 0.008 8);

  /* Accent — crimson */
  --accent:      oklch(52% 0.210 22);
  --accent-dim:  oklch(43% 0.170 22);
  --accent-soft: oklch(94% 0.055 18);
  --accent-ink:  oklch(99% 0.002 0);

  /* Semantic */
  --ok:         oklch(44% 0.120 148);
  --success:    oklch(62% 0.11 148);
  --success-soft: oklch(22% 0.06 148);
  --danger:     oklch(62% 0.19 16);
  --danger-soft: oklch(20% 0.06 16);
  --focus-ring: oklch(52% 0.210 22 / 0.22);

  /* Canvas ring */
  --ring-track:    oklch(88% 0.008 8);
  --ring-progress: oklch(52% 0.210 22);

  /* Typography */
  --font-ui:     "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-timer:  var(--font-ui);
  --font-number: var(--font-ui);

  /* Motion */
  --ease:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.64, 0, 0.78, 0);

  color-scheme: light;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
}

/* ═══════════════════════════════════════════════════════
   RESET
═══════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { overflow-x: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-kerning: normal;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overflow-x: hidden;
}

[hidden] { display: none !important; }
h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 0.95rem;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════
   BUTTONS — three-tier hierarchy
═══════════════════════════════════════════════════════ */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  border-radius: 8px;
  transition:
    background 140ms var(--ease),
    color 140ms var(--ease),
    border-color 140ms var(--ease),
    transform 120ms var(--ease),
    opacity 140ms var(--ease);
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.36;
  transform: none !important;
}

@media (hover: hover) {
  button:not(:disabled):hover { transform: translateY(-1px); }
}

/* Primary — amber fill */
.create-room-submit,
.create-room-button,
.action-button.start,
.action-button.resume,
.action-button.pause {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  border-radius: 10px;
}

.create-room-submit.is-danger {
  background: var(--danger);
  color: var(--accent-ink);
}

/* Ghost — muted text */
.settings-button,
.close-button,
.icon-button,
.action-button.ghost,
.home-button {
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  font-size: 0.86rem;
}

/* Shared sizing */
.create-room-button,
.create-room-submit {
  min-height: 52px;
  width: 100%;
  font-size: 0.92rem;
}

.settings-button,
.close-button,
.icon-button {
  min-height: 44px;
  padding: 0 14px;
  font-size: 0.84rem;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.account-badge {
  display: none;
  max-width: 132px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-icon-button {
  width: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.settings-icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-trigger-avatar {
  width: 32px;
  height: 32px;
  font-size: 0.82rem;
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--accent) 34%, var(--line));
}

.settings-icon-button[aria-expanded="true"] .profile-trigger-avatar {
  box-shadow:
    0 0 0 2px var(--surface),
    0 0 0 4px color-mix(in oklch, var(--accent) 45%, transparent);
}

.home-button {
  width: 44px;
  min-height: 44px;
  font-size: 1.1rem;
  border-radius: 8px;
}

.action-button {
  min-height: 52px;
  padding: 0 28px;
  font-size: 0.92rem;
}

.action-button.start,
.action-button.resume,
.action-button.pause {
  min-width: 130px;
}

/* ═══════════════════════════════════════════════════════
   SEGMENTED CONTROLS (tabs)
═══════════════════════════════════════════════════════ */
.auth-tabs,
.entry-tabs {
  display: flex;
  gap: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
}

.entry-button {
  flex: 1;
  min-height: 44px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  border: none;
  padding: 0 12px;
}

.entry-button.is-active {
  background: var(--surface-strong);
  color: var(--ink);
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════
   FORMS & INPUTS
═══════════════════════════════════════════════════════ */
button, input { font: inherit; }

label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 6px;
}

input {
  width: 100%;
  min-width: 0;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-mid);
  color: var(--ink);
  outline: none;
  padding: 0 14px;
  font-weight: 400;
  font-size: 0.93rem;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

input:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

input[readonly] {
  color: var(--muted);
  background: var(--surface);
}

input::placeholder { color: var(--subtle); }

.dialog-message {
  min-height: 1.1rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.pw-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════
   LABELS / KICKERS (no pill badges)
═══════════════════════════════════════════════════════ */
.mode-label {
  display: inline-block;
  margin: 0;
  padding: 0;
  background: none;
  border-radius: 0;
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--muted);
  width: auto;
}

.section-kicker {
  display: none;
}

/* ═══════════════════════════════════════════════════════
   ENTRY SCREEN
═══════════════════════════════════════════════════════ */
.entry-shell,
.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
}

.entry-shell {
  position: relative;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 12% 12%, oklch(94% 0.038 18), transparent 28%),
    linear-gradient(135deg, oklch(98% 0.005 20), oklch(92% 0.014 28));
}

.entry-settings-actions {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 3;
}

.entry-shell.is-auth-view .entry-settings-actions [data-settings-trigger="theme"] {
  display: none;
}

.entry-panel {
  width: min(1220px, 100%);
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(420px, 1.15fr);
  gap: 22px;
  align-items: stretch;
  min-height: min(720px, calc(100dvh - 56px));
  padding: 18px;
  border: 1px solid oklch(82% 0.013 18);
  border-radius: 24px;
  background: oklch(99% 0.003 18 / 0.96);
  box-shadow: 0 28px 80px oklch(32% 0.04 20 / 0.16);
}

.entry-shell.is-mode-view .entry-panel {
  width: min(400px, 100%);
  grid-template-columns: 1fr;
  min-height: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.entry-shell.is-mode-view .auth-showcase {
  display: none;
}

.temporary-home-body {
  overflow-y: auto;
  background:
    radial-gradient(circle at 8% 15%, oklch(93% 0.04 37 / 0.8), transparent 28rem),
    linear-gradient(180deg, oklch(99% 0.004 70), oklch(97% 0.008 68));
}

.temporary-home-body h1,
.temporary-home-body h2,
.temporary-home-body h3,
.temporary-home-body p {
  margin: 0;
}

.temporary-home-shell {
  min-height: 100vh;
  color: oklch(24% 0.035 282);
}

.temporary-home-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 70px;
  padding: 0 max(24px, calc((100vw - 1240px) / 2));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 28px;
  border-bottom: 1px solid oklch(90% 0.012 80);
  background: oklch(99% 0.006 78 / 0.94);
  box-shadow: 0 1px 18px oklch(42% 0.03 270 / 0.08);
  backdrop-filter: blur(16px);
}

.temporary-home-wordmark,
.temporary-home-nav-link,
.temporary-home-cta,
.temporary-home-secondary {
  color: inherit;
  text-decoration: none;
}

.temporary-home-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: oklch(43% 0.16 282);
  font-size: 1.1rem;
  font-weight: 900;
}

.temporary-home-wordmark span span {
  font-weight: 500;
}

.temporary-home-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: oklch(45% 0.16 282);
  color: oklch(99% 0.004 78);
}

.temporary-home-links,
.temporary-home-nav-actions {
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 42px);
}

.temporary-home-nav-actions {
  justify-content: end;
  gap: 18px;
}

.temporary-home-nav-link,
.temporary-home-secondary {
  color: oklch(43% 0.045 282);
  font-size: 0.96rem;
  font-weight: 750;
}

.temporary-home-hero {
  position: relative;
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
  min-height: calc(100dvh - 70px);
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(420px, 0.85fr);
  align-items: center;
  gap: clamp(40px, 7vw, 96px);
  padding: clamp(72px, 10vh, 128px) 0 clamp(54px, 9vh, 96px);
}

.temporary-home-copy {
  display: grid;
  gap: 22px;
}

.temporary-home-eyebrow,
.temporary-home-body .section-kicker {
  display: inline-block;
  color: oklch(45% 0.16 282);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.temporary-home-copy h1 {
  max-width: 12.6ch;
  color: oklch(24% 0.035 282);
  font-size: clamp(3.3rem, 7.8vw, 7.2rem);
  font-weight: 950;
  line-height: 0.9;
}

.temporary-home-lede {
  max-width: 650px;
  color: oklch(42% 0.022 278);
  font-size: clamp(1.05rem, 1.5vw, 1.28rem);
  line-height: 1.55;
}

.temporary-home-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 8px;
}

.temporary-home-cta,
.temporary-home-secondary {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-weight: 850;
}

.temporary-home-cta {
  gap: 8px;
  padding: 0 24px;
  background: oklch(45% 0.16 282);
  color: oklch(99% 0.004 78);
  box-shadow: 0 14px 34px oklch(45% 0.16 282 / 0.22);
}

.temporary-home-nav-cta {
  min-height: 46px;
  padding-inline: 22px;
}

.temporary-home-secondary {
  padding: 0 18px;
  color: oklch(45% 0.16 282);
}

.temporary-home-preview {
  position: relative;
  min-height: 560px;
}

.home-room-window {
  position: relative;
  z-index: 1;
  padding: 18px;
  border: 1px solid oklch(85% 0.045 282);
  border-radius: 28px;
  background: oklch(98% 0.01 80);
  box-shadow: 0 36px 90px oklch(44% 0.07 282 / 0.18);
}

.home-room-titlebar,
.home-room-grid,
.home-room-timer,
.home-room-presence,
.home-room-queue,
.home-room-files,
.home-rhythm-head,
.home-music-copy,
.home-files-board div {
  display: grid;
}

.home-room-titlebar {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 52px;
  padding: 0 6px 14px;
  color: oklch(30% 0.055 282);
  font-weight: 900;
}

.home-avatar-stack {
  display: flex;
  flex-direction: row-reverse;
}

.home-avatar-stack span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin-left: -9px;
  border: 2px solid oklch(98% 0.01 80);
  border-radius: 50%;
  background: oklch(70% 0.12 58);
  color: oklch(22% 0.035 58);
  font-size: 0.8rem;
  font-weight: 900;
}

.home-avatar-stack span:nth-child(2) {
  background: oklch(77% 0.1 158);
}

.home-avatar-stack span:nth-child(3) {
  background: oklch(72% 0.09 250);
}

.home-room-grid {
  grid-template-columns: 1fr 0.84fr;
  gap: 12px;
}

.home-room-timer,
.home-room-presence,
.home-room-queue,
.home-room-files,
.home-rhythm-panel,
.home-social-board,
.home-music-board,
.home-files-board {
  border: 1px solid oklch(86% 0.036 282);
  background: oklch(99% 0.004 78);
}

.home-room-timer {
  min-height: 250px;
  align-content: center;
  gap: 8px;
  padding: 24px;
  border-radius: 22px;
  background: oklch(94% 0.055 282);
}

.home-room-timer span,
.home-room-timer em,
.home-room-queue span,
.home-room-files span,
.home-music-copy span {
  color: oklch(45% 0.06 282);
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 850;
}

.home-room-timer strong {
  color: oklch(32% 0.1 282);
  font-size: clamp(4.2rem, 8vw, 6.2rem);
  font-weight: 950;
  line-height: 0.9;
}

.home-room-presence {
  gap: 10px;
  padding: 14px;
  border-radius: 22px;
}

.home-room-presence div {
  padding: 12px;
  border-radius: 14px;
  background: oklch(96% 0.012 80);
}

.home-room-presence strong,
.home-room-presence span,
.home-room-queue span,
.home-room-queue strong,
.home-room-files span,
.home-room-files strong,
.home-files-board strong,
.home-files-board span {
  display: block;
}

.home-room-presence strong {
  color: oklch(28% 0.04 282);
  font-size: 0.95rem;
}

.home-room-presence span {
  margin-top: 3px;
  color: oklch(45% 0.02 278);
  font-size: 0.82rem;
}

.home-room-queue,
.home-room-files {
  min-height: 116px;
  align-content: end;
  gap: 4px;
  padding: 18px;
  border-radius: 22px;
}

.home-room-queue {
  background: oklch(94% 0.05 158);
}

.home-room-files {
  background: oklch(95% 0.06 58);
}

.home-floating-note {
  position: absolute;
  z-index: 2;
  max-width: 220px;
  padding: 14px 16px;
  border: 1px solid oklch(86% 0.038 282);
  border-radius: 18px;
  background: oklch(99% 0.004 78);
  box-shadow: 0 18px 46px oklch(44% 0.06 282 / 0.14);
  color: oklch(35% 0.06 282);
  font-size: 0.92rem;
  font-weight: 850;
}

.home-floating-note-goal {
  top: 48px;
  right: -16px;
}

.home-floating-note-code {
  bottom: 72px;
  left: -22px;
}

.home-problem-band,
.home-feature-stack,
.home-proof-band,
.home-closing-band {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
}

.home-problem-band {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 70px);
  padding: clamp(62px, 10vw, 118px) 0;
  border-top: 1px solid oklch(88% 0.016 80);
}

.home-problem-band h2,
.home-stack-head h2,
.home-proof-band h2,
.home-closing-band h2 {
  color: oklch(25% 0.04 282);
  font-size: clamp(2.2rem, 4.8vw, 4.7rem);
  font-weight: 940;
  line-height: 0.96;
}

.home-problem-band p,
.home-feature-copy p:not(.section-kicker),
.home-proof-band p,
.home-closing-band p {
  color: oklch(42% 0.022 278);
  font-size: clamp(1rem, 1.2vw, 1.12rem);
  line-height: 1.6;
}

.home-feature-stack {
  padding: clamp(62px, 10vw, 118px) 0 0;
  border-top: 1px solid oklch(88% 0.016 80);
}

.home-stack-head {
  display: grid;
  gap: 14px;
  max-width: 840px;
  margin-bottom: clamp(42px, 7vw, 76px);
}

.home-feature-band {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(320px, 0.78fr);
  align-items: center;
  gap: clamp(34px, 7vw, 96px);
  padding: clamp(58px, 9vw, 104px) 0;
  border-top: 1px solid oklch(90% 0.014 80);
}

.home-feature-band:first-of-type {
  border-top: none;
  padding-top: 0;
}

.home-feature-band-timer,
.home-feature-band-music {
  grid-template-columns: minmax(320px, 0.78fr) minmax(0, 0.95fr);
}

.home-feature-copy {
  display: grid;
  gap: 16px;
}

.home-feature-copy h3 {
  max-width: 780px;
  color: oklch(25% 0.04 282);
  font-size: clamp(2rem, 4.2vw, 4rem);
  font-weight: 930;
  line-height: 0.98;
}

.home-callout {
  width: fit-content;
  margin-top: 8px !important;
  padding: 9px 12px;
  border-radius: 999px;
  background: oklch(94% 0.055 282);
  color: oklch(38% 0.12 282) !important;
  font-size: 0.92rem !important;
  font-weight: 900;
}

.home-rhythm-panel,
.home-social-board,
.home-music-board,
.home-files-board {
  border-radius: 26px;
  box-shadow: 0 24px 70px oklch(44% 0.055 282 / 0.1);
}

.home-rhythm-panel {
  padding: clamp(18px, 4vw, 28px);
  background: oklch(99% 0.004 78);
}

.home-rhythm-head {
  gap: 6px;
  padding-bottom: 24px;
}

.home-rhythm-head strong {
  color: oklch(33% 0.12 282);
  font-size: clamp(4rem, 10vw, 6.5rem);
  font-weight: 950;
  line-height: 1;
}

.home-rhythm-head span {
  color: oklch(45% 0.04 282);
  font-weight: 850;
}

.home-rhythm-steps {
  display: grid;
  gap: 8px;
}

.home-rhythm-steps span {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid oklch(87% 0.024 282);
  border-radius: 12px;
  color: oklch(43% 0.035 282);
  font-weight: 850;
}

.home-rhythm-steps .is-current {
  border-color: oklch(45% 0.16 282);
  background: oklch(45% 0.16 282);
  color: oklch(99% 0.004 78);
}

.home-social-board {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.home-social-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 10px 12px;
  border-radius: 16px;
}

.home-social-row.is-active {
  background: oklch(94% 0.055 282);
}

.home-social-row strong,
.home-social-row span {
  display: block;
}

.home-social-row strong {
  color: oklch(28% 0.04 282);
}

.home-social-row div span {
  margin-top: 3px;
  color: oklch(45% 0.02 278);
  font-size: 0.93rem;
}

.home-avatar {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: oklch(20% 0.03 45);
  font-weight: 900;
}

.home-avatar-red {
  background: oklch(72% 0.13 28);
}

.home-avatar-gold {
  background: oklch(78% 0.13 74);
}

.home-avatar-green {
  background: oklch(74% 0.11 154);
}

.home-music-board {
  overflow: hidden;
  padding: 26px;
  background:
    linear-gradient(135deg, oklch(95% 0.05 282), oklch(97% 0.045 158));
}

.home-music-disc {
  width: min(78%, 260px);
  aspect-ratio: 1;
  margin: 0 auto 18px;
  border: 28px solid oklch(28% 0.04 282);
  border-radius: 50%;
  background:
    radial-gradient(circle, oklch(95% 0.055 58) 0 14%, oklch(45% 0.16 282) 15% 28%, transparent 29%),
    repeating-radial-gradient(circle, oklch(34% 0.05 282) 0 5px, oklch(25% 0.035 282) 6px 10px);
}

.home-music-copy {
  gap: 4px;
  margin-bottom: 18px;
}

.home-music-copy strong {
  color: oklch(25% 0.04 282);
  font-size: 1.25rem;
}

.home-music-board ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.home-music-board li {
  padding: 12px 14px;
  border-radius: 14px;
  background: oklch(99% 0.004 78 / 0.72);
  color: oklch(37% 0.035 282);
  font-weight: 850;
}

.home-files-board {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: oklch(99% 0.004 78);
}

.home-files-board div {
  min-height: 82px;
  align-content: center;
  gap: 5px;
  padding: 16px;
  border-radius: 17px;
  background: oklch(96% 0.014 80);
}

.home-files-board div:nth-child(2) {
  background: oklch(94% 0.055 282);
}

.home-files-board div:nth-child(3) {
  background: oklch(95% 0.05 158);
}

.home-files-board strong {
  color: oklch(27% 0.04 282);
}

.home-files-board span {
  color: oklch(45% 0.025 282);
}

.home-proof-band {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(300px, 0.62fr);
  align-items: start;
  gap: clamp(32px, 7vw, 90px);
  padding: clamp(64px, 10vw, 118px) 0;
  border-top: 1px solid oklch(88% 0.016 80);
}

.home-proof-band > div:first-child {
  display: grid;
  gap: 16px;
}

.home-proof-list {
  display: grid;
  gap: 12px;
  counter-reset: proof;
}

.home-proof-list p {
  position: relative;
  min-height: 68px;
  display: flex;
  align-items: center;
  padding: 12px 14px 12px 54px;
  border: 1px solid oklch(87% 0.024 282);
  border-radius: 18px;
  background: oklch(99% 0.004 78);
  color: oklch(30% 0.04 282);
  font-weight: 850;
}

.home-proof-list p::before {
  counter-increment: proof;
  content: counter(proof);
  position: absolute;
  left: 14px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: oklch(45% 0.16 282);
  color: oklch(99% 0.004 78);
  font-size: 0.8rem;
}

.home-closing-band {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) auto;
  align-items: center;
  gap: 30px;
  padding: clamp(54px, 8vw, 92px) 0 clamp(70px, 10vw, 120px);
  border-top: 1px solid oklch(88% 0.016 80);
}

.home-closing-band > div:first-child {
  display: grid;
  gap: 14px;
  max-width: 740px;
}

.empty-marketing-page {
  width: min(1120px, calc(100% - 48px));
  min-height: calc(100dvh - 70px);
  margin: 0 auto;
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 80px 0;
}

.empty-marketing-page h1 {
  max-width: 760px;
  color: oklch(25% 0.04 282);
  font-size: clamp(3rem, 7vw, 6.6rem);
  font-weight: 950;
  line-height: 0.92;
}

.testimonials-page {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(70px, 10vw, 120px) 0 clamp(82px, 12vw, 140px);
}

.testimonials-hero {
  display: grid;
  gap: 14px;
  max-width: 860px;
  margin-bottom: clamp(42px, 7vw, 78px);
}

.testimonials-hero h1 {
  color: oklch(25% 0.04 282);
  font-size: clamp(3rem, 7vw, 6.6rem);
  font-weight: 950;
  line-height: 0.92;
}

.testimonial-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.testimonial-card {
  min-height: 420px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 26px;
  padding: clamp(24px, 4vw, 36px);
  border: 1px solid oklch(86% 0.036 282);
  border-radius: 24px;
  background: oklch(99% 0.004 78);
  box-shadow: 0 24px 70px oklch(44% 0.055 282 / 0.08);
}

.testimonial-card:nth-child(2) {
  background: oklch(95% 0.05 158);
}

.testimonial-card:nth-child(3) {
  background: oklch(95% 0.055 58);
}

.testimonial-card:nth-child(4) {
  background: oklch(94% 0.055 282);
}

.testimonial-type {
  color: oklch(45% 0.16 282);
  font-size: 0.86rem;
  font-weight: 900;
}

.testimonial-card blockquote {
  margin: 0;
}

.testimonial-card blockquote p {
  color: oklch(25% 0.04 282);
  font-size: clamp(1.32rem, 2.1vw, 2rem);
  font-weight: 850;
  line-height: 1.12;
}

.testimonial-card footer {
  display: grid;
  gap: 5px;
  color: oklch(42% 0.022 278);
}

.testimonial-card footer strong {
  color: oklch(25% 0.04 282);
  font-size: 1.02rem;
}

.testimonial-card footer span {
  font-size: 0.94rem;
  line-height: 1.4;
}

.faq-page {
  width: min(1040px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(70px, 10vw, 120px) 0 clamp(82px, 12vw, 140px);
}

.faq-hero {
  display: grid;
  gap: 14px;
  max-width: 820px;
  margin-bottom: clamp(42px, 7vw, 78px);
}

.faq-hero h1 {
  color: oklch(25% 0.04 282);
  font-size: clamp(3rem, 7vw, 6.6rem);
  font-weight: 950;
  line-height: 0.92;
}

.faq-list {
  display: grid;
  border-top: 1px solid oklch(86% 0.036 282);
}

.faq-item {
  display: grid;
  grid-template-columns: minmax(240px, 0.52fr) minmax(0, 1fr);
  gap: clamp(22px, 5vw, 64px);
  padding: clamp(28px, 5vw, 46px) 0;
  border-bottom: 1px solid oklch(86% 0.036 282);
}

.faq-item h2 {
  color: oklch(25% 0.04 282);
  font-size: clamp(1.35rem, 2.4vw, 2.15rem);
  font-weight: 920;
  line-height: 1.04;
}

.faq-item p {
  color: oklch(42% 0.022 278);
  font-size: clamp(1rem, 1.25vw, 1.13rem);
  line-height: 1.65;
}

.faq-item a {
  color: oklch(45% 0.16 282);
  font-weight: 850;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

@media (max-width: 780px) {
  .entry-shell {
    align-items: start;
    justify-items: stretch;
    place-items: start stretch;
    min-height: 100dvh;
    padding: max(76px, calc(env(safe-area-inset-top) + 56px)) 18px max(24px, env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .entry-settings-actions {
    top: max(12px, env(safe-area-inset-top));
    right: 12px;
  }

  .entry-panel {
    width: 100%;
    max-width: 520px;
    justify-self: center;
  }

  .mode-panel {
    gap: 24px;
  }

  .temporary-home-nav {
    min-height: auto;
    grid-template-columns: 1fr auto;
    padding: 12px 16px;
    gap: 14px;
  }

  .temporary-home-links {
    display: none;
  }

  .temporary-home-nav-actions {
    gap: 10px;
  }

  .temporary-home-nav-actions .temporary-home-nav-link {
    display: none;
  }

  .temporary-home-nav-cta {
    min-height: 42px;
    padding-inline: 16px;
    font-size: 0.9rem;
  }

  .temporary-home-hero,
  .home-problem-band,
  .home-feature-stack,
  .home-proof-band,
  .home-closing-band {
    width: min(100% - 28px, 560px);
  }

  .temporary-home-hero {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 0;
    gap: 34px;
    padding: 50px 0 54px;
  }

  .temporary-home-copy h1 {
    font-size: clamp(3rem, 16vw, 5.1rem);
  }

  .temporary-home-preview {
    min-height: auto;
  }

  .home-room-grid {
    grid-template-columns: 1fr;
  }

  .home-room-timer {
    min-height: 190px;
  }

  .home-room-timer strong {
    font-size: clamp(3.6rem, 20vw, 5.3rem);
  }

  .home-floating-note {
    position: static;
    margin-top: 12px;
    max-width: none;
  }

  .home-problem-band,
  .home-feature-band,
  .home-feature-band-timer,
  .home-feature-band-music,
  .home-proof-band,
  .home-closing-band {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .home-problem-band,
  .home-feature-stack,
  .home-proof-band {
    padding: 54px 0;
  }

  .home-feature-band {
    padding: 48px 0;
  }

  .home-feature-band-timer .home-rhythm-panel,
  .home-feature-band-music .home-music-board {
    order: 2;
  }

  .home-closing-band {
    padding: 48px 0 64px;
  }

  .home-closing-band .temporary-home-actions {
    align-items: stretch;
  }

  .home-closing-band .temporary-home-cta,
  .home-closing-band .temporary-home-secondary {
    width: 100%;
  }

  .home-proof-list p {
    min-height: 60px;
  }

  .testimonial-grid {
    grid-template-columns: 1fr;
  }

  .testimonial-card {
    min-height: auto;
  }

  .faq-item {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .groups-header {
    min-height: 44px;
  }

  .new-group-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .new-group-form input {
    flex-basis: auto;
  }
}

@media (max-width: 430px) {
  .entry-shell {
    padding-inline: 14px;
  }

  .temporary-home-wordmark {
    font-size: 1rem;
  }

  .temporary-home-mark {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }

  .temporary-home-nav-cta {
    padding-inline: 13px;
  }

  .temporary-home-actions {
    align-items: stretch;
  }

  .temporary-home-actions .temporary-home-cta,
  .temporary-home-actions .temporary-home-secondary {
    width: 100%;
  }

  .new-group-form {
    grid-template-columns: 1fr;
  }

  .new-group-form button {
    width: 100%;
    min-height: 46px;
  }

  .social-login-grid {
    grid-template-columns: repeat(2, 46px);
  }
}

.auth-panel,
.mode-panel {
  display: grid;
  gap: 18px;
}

.auth-panel {
  align-content: center;
  padding: clamp(26px, 5vw, 58px);
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 700;
}

.auth-brand-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-timer);
  font-size: 1.05rem;
  box-shadow: 0 12px 28px oklch(52% 0.17 22 / 0.22);
}

.auth-heading {
  display: grid;
  gap: 9px;
}

.auth-heading h1 {
  max-width: 12ch;
  font-size: 2.18rem;
  line-height: 0.98;
}

.auth-heading p:not(.mode-label) {
  max-width: 34ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.45;
}

.auth-form {
  margin-top: 8px;
}

.auth-form .duration-field input {
  font-family: var(--font-ui);
  font-variant-numeric: normal;
  font-feature-settings: normal;
  text-align: left;
}

.auth-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-field-row label {
  margin: 0;
}

.auth-switch-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.auth-switch-copy a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.auth-switch-copy a:hover {
  color: var(--accent-dim);
}

.auth-showcase {
  position: relative;
  display: grid;
  align-content: space-between;
  gap: 22px;
  min-height: 100%;
  padding: clamp(28px, 5vw, 56px);
  overflow: hidden;
  border-radius: 18px;
  background:
    radial-gradient(circle at 20% 18%, oklch(79% 0.15 22 / 0.34), transparent 32%),
    radial-gradient(circle at 78% 88%, oklch(69% 0.12 54 / 0.25), transparent 35%),
    linear-gradient(145deg, oklch(25% 0.052 20), oklch(38% 0.09 24));
  color: oklch(98% 0.006 24);
}

.auth-showcase::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(oklch(99% 0.002 20 / 0.05) 1px, transparent 1px),
    linear-gradient(90deg, oklch(99% 0.002 20 / 0.04) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(140deg, transparent, black 18%, black 78%, transparent);
  pointer-events: none;
}

.auth-showcase > * {
  position: relative;
  z-index: 1;
}

.auth-showcase-copy {
  display: grid;
  gap: 12px;
}

.auth-showcase-copy .mode-label {
  color: oklch(87% 0.045 32);
}

.auth-showcase-copy h2 {
  max-width: 13ch;
  color: oklch(98% 0.006 24);
  font-size: 3.85rem;
  font-weight: 600;
  line-height: 0.94;
}

.showcase-room-card {
  justify-self: end;
  width: min(390px, 100%);
  display: grid;
  gap: 26px;
  padding: 24px;
  border: 1px solid oklch(97% 0.01 24 / 0.18);
  border-radius: 16px;
  background: oklch(99% 0.006 24 / 0.93);
  color: var(--ink);
  box-shadow: 0 24px 70px oklch(16% 0.035 22 / 0.28);
}

.showcase-room-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.showcase-room-kicker,
.showcase-status-row span,
.showcase-mini-player span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.showcase-room-card h3 {
  margin: 4px 0 0;
  font-size: 1.1rem;
  line-height: 1.15;
}

.showcase-avatar-stack {
  display: flex;
  flex-direction: row-reverse;
  padding-left: 12px;
}

.showcase-avatar-stack span {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-left: -12px;
  border: 2px solid oklch(99% 0.006 24);
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dim);
  font-size: 0.78rem;
  font-weight: 800;
}

.showcase-timer {
  font-family: var(--font-timer);
  font-size: 3.3rem;
  line-height: 1;
}

.showcase-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.showcase-status-row strong {
  font-size: 0.9rem;
}

.showcase-chat-list {
  position: absolute;
  right: clamp(24px, 5vw, 70px);
  bottom: 170px;
  display: grid;
  gap: 9px;
  width: min(300px, 44%);
}

.showcase-chat-bubble {
  width: max-content;
  max-width: 100%;
  padding: 10px 13px;
  border-radius: 16px;
  background: oklch(99% 0.006 24 / 0.9);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 12px 32px oklch(16% 0.035 22 / 0.18);
}

.showcase-chat-bubble.is-right {
  justify-self: end;
  background: var(--accent);
  color: var(--accent-ink);
}

.showcase-mini-player {
  width: max-content;
  max-width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 10px;
  border-radius: 14px;
  background: oklch(99% 0.006 24 / 0.13);
  border: 1px solid oklch(97% 0.01 24 / 0.17);
}

.showcase-album {
  display: block;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 35% 35%, oklch(92% 0.085 38), transparent 34%),
    var(--accent);
}

.showcase-mini-player strong {
  display: block;
  margin-top: 2px;
  color: oklch(98% 0.006 24);
  font-size: 0.92rem;
}

.social-login-grid {
  display: grid;
  grid-template-columns: repeat(2, 46px);
  justify-content: center;
  gap: 12px;
}

.social-login-button {
  width: 46px;
  min-height: 46px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-mid);
  color: var(--ink);
}

.social-login-button:hover {
  background: var(--surface-strong);
  border-color: oklch(78% 0.018 14);
  transform: translateY(-1px);
}

.social-login-button:active {
  transform: translateY(0);
}

.social-login-mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  color: var(--ink);
}

.social-login-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.social-login-mark-google {
  width: 21px;
  height: 21px;
}

.social-login-mark-facebook {
  width: 24px;
  height: 24px;
  color: #1877f2;
}

.auth-divider {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--subtle);
  font-size: 0.72rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.auth-form,
.create-room-form {
  display: grid;
  gap: 14px;
}

.duration-field {
  display: grid;
  gap: 6px;
}

.duration-field input {
  font-family: var(--font-timer);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  text-align: center;
}

/* Multi panel (join / create room options) */
.multi-panel {
  display: grid;
  gap: 12px;
}

.multi-divider {
  text-align: center;
  color: var(--subtle);
  font-size: 0.78rem;
  font-weight: 500;
}

.join-room-form {
  display: flex;
  gap: 8px;
}

.join-room-form input { flex: 1 1 0; }
.join-room-form button {
  flex: 0 0 auto;
  min-width: 72px;
  min-height: 44px;
  padding: 0 16px;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 500;
  border-radius: 9px;
}

/* ═══════════════════════════════════════════════════════
   DIALOGS
═══════════════════════════════════════════════════════ */
.settings-dialog,
.create-dialog {
  width: min(500px, calc(100vw - 28px));
  max-height: min(820px, calc(100dvh - 28px));
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
}

.settings-dialog::backdrop,
.create-dialog::backdrop,
.new-group-dialog::backdrop {
  background: oklch(5% 0.005 55 / 0.72);
}

.settings-shell {
  display: grid;
  gap: 22px;
  padding: 24px;
}

.settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.settings-content {
  display: grid;
  gap: 20px;
  max-height: calc(100dvh - 200px);
  overflow: auto;
  padding-right: 2px;
}

.settings-section {
  display: grid;
  gap: 10px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.settings-section:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.room-input-row {
  display: flex;
  gap: 8px;
}

.identity-form {
  display: grid;
  gap: 14px;
}

.settings-field-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.profile-popover {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 80;
  width: min(340px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  padding: 18px;
  overflow: auto;
  border: 1px solid color-mix(in oklch, var(--accent) 18%, var(--line));
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 18px 54px oklch(18% 0.02 20 / 0.18);
}

.profile-popover-section {
  padding-bottom: 0;
  border-bottom: none;
}

.profile-popover-head {
  display: grid;
  gap: 2px;
}

.profile-popover-head h2 {
  max-width: 100%;
  overflow: hidden;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-id-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.account-id-row code {
  max-width: 58%;
  overflow: hidden;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-account-actions {
  display: flex;
  justify-content: flex-start;
  padding-top: 6px;
}

.profile-logout-button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid color-mix(in oklch, var(--danger) 28%, var(--line));
  border-radius: 10px;
  background: color-mix(in oklch, var(--danger) 9%, transparent);
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 600;
}

@media (hover: hover) {
  .profile-logout-button:not(:disabled):hover {
    background: color-mix(in oklch, var(--danger) 15%, transparent);
  }
}

.avatar-editor {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.avatar-preview {
  width: 72px;
  height: 72px;
  font-size: 1.35rem;
  box-shadow: inset 0 0 0 3px color-mix(in oklch, var(--surface) 70%, white), 0 0 0 1px var(--line);
}

.avatar-controls {
  display: grid;
  gap: 9px;
}

.avatar-controls label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.avatar-input {
  width: min(180px, 100%);
  height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  text-align: left;
  font-size: 1rem;
  font-weight: 700;
}

.color-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-color-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--profile-color);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
  padding: 0;
}

.profile-color-button.is-active {
  box-shadow: 0 0 0 2px var(--accent);
}

.custom-color-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red);
  box-shadow: 0 0 0 1px var(--line);
}

.custom-color-wrap::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--surface);
  pointer-events: none;
}

.color-hex-input {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  inset: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: box-shadow 140ms var(--ease);
}

.custom-color-wrap:has(.color-hex-input:hover),
.custom-color-wrap:has(.color-hex-input:focus-visible) {
  box-shadow: 0 0 0 2px var(--accent);
}

/* Theme picker */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.theme-swatch {
  display: grid;
  gap: 8px;
  align-content: start;
  justify-items: stretch;
  min-height: 74px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
  transition:
    background 140ms var(--ease),
    border-color 140ms var(--ease),
    color 140ms var(--ease),
    box-shadow 140ms var(--ease);
}

.theme-swatch-label {
  color: inherit;
}

.theme-swatch-palette {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
  min-width: 0;
  height: 28px;
  overflow: hidden;
  border: 1px solid var(--theme-preview-line);
  border-radius: 7px;
  background: var(--theme-preview-bg);
}

.theme-swatch-palette span {
  min-width: 0;
}

@media (min-width: 520px) {
  .theme-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.theme-swatch.is-active {
  color: var(--ink);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.theme-swatch:hover {
  color: var(--ink);
  border-color: var(--accent);
  transform: none;
}

/* Duration grid */
.create-duration-grid,
.rhythm-duration-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.rhythm-form {
  display: grid;
  gap: 14px;
}

.music-mode-section {
  gap: 14px;
}

.music-mode-field {
  display: grid;
  gap: 10px;
}

.music-mode-field h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.music-mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
}

.music-mode-option {
  min-width: 0;
}

.music-mode-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.music-mode-card {
  min-height: 78px;
  display: grid;
  place-items: center;
  gap: 7px;
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-mid);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms var(--ease), background 160ms var(--ease), color 160ms var(--ease), transform 160ms var(--ease);
}

.music-mode-card:hover {
  transform: translateY(-1px);
  color: var(--ink);
  border-color: color-mix(in oklch, var(--accent) 44%, var(--line));
}

.music-mode-input:focus-visible + .music-mode-card {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.music-mode-input:checked + .music-mode-card {
  background: var(--accent-soft);
  color: var(--ink);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--accent) 44%, transparent);
}

.music-mode-input:disabled + .music-mode-card {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.music-mode-logo {
  width: 28px;
  height: 28px;
  color: var(--muted);
}

.music-mode-input:checked + .music-mode-card .youtube-logo { color: oklch(56% 0.24 29); }
.music-mode-input:checked + .music-mode-card .spotify-logo { color: oklch(64% 0.18 145); }
.music-mode-input:checked + .music-mode-card .soundcloud-logo { color: oklch(65% 0.20 47); }
.music-mode-input:checked + .music-mode-card .music-mode-logo:not(.youtube-logo):not(.spotify-logo):not(.soundcloud-logo) { color: var(--accent); }

.rhythm-form button {
  min-height: 44px;
  background: var(--surface-strong);
  color: var(--ink);
  font-weight: 500;
  font-size: 0.88rem;
  border-radius: 9px;
}

.history-item span,
.music-meta,
.queue-meta {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 400;
  line-height: 1.35;
}

.history-item {
  display: grid;
  gap: 1px;
}

.history-item strong,
.chat-author,
.music-title,
.queue-title {
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.35;
}

/* ═══════════════════════════════════════════════════════
   APP SHELL
═══════════════════════════════════════════════════════ */
.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  padding: 16px 20px 20px;
  overflow: hidden;
}

/* ─── TOPBAR ───────────────────────────────────────── */
.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding-bottom: 14px;
}


#todoPanel {
  display: none !important;
}

.topbar-actions {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar > .home-button {
  position: relative;
  z-index: 3;
}

/* ─── WORKSPACE ────────────────────────────────────── */
.workspace-shell {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: clamp(12px, 1.6vw, 22px);
  align-items: stretch;
  overflow: hidden;
}

/* ─── SIDE PANELS ──────────────────────────────────── */
.side-panel {
  position: relative;
  min-height: 0;
  height: 100%;
  display: grid;
  gap: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
  width: 280px;
  transition: border-color 180ms var(--ease), background 180ms var(--ease);
}

.side-panel.panel-closed {
  width: 44px;
}

/* Panel tab — visible only when panel is collapsed */
.panel-tab {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: 16px;
  z-index: 10;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.panel-tab span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--muted);
  pointer-events: none;
}

.panel-tab:hover span { color: var(--ink); }

.side-panel.panel-closed .panel-tab { display: flex; }

.side-panel.panel-closed > *:not(.panel-tab) {
  visibility: hidden;
  pointer-events: none;
}

.music-panel {
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  overflow-x: hidden;
}

.side-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.side-title,
.side-label {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
}

.side-section {
  display: grid;
  gap: 8px;
  min-height: 0;
}

.side-section + .side-section {
  padding-top: 12px;
  border-top: 1px solid var(--line);
  margin-top: 12px;
}

.side-section-head,
.queue-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#musicQuotaBadge {
  color: var(--muted);
  font-size: 0.78rem;
}

/* Close panel buttons */
#closeMusicButton,
#closeChatButton {
  width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  border-radius: 8px;
}

/* ─── MUSIC PANEL ──────────────────────────────────── */
.music-now-section h2 {
  font-size: 0.94rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
}

.music-progress {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.music-progress-track {
  height: 3px;
  border-radius: 99px;
  background: var(--surface-strong);
  overflow: hidden;
}

.music-progress-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  width: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 1s linear;
}

.music-progress-times {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.music-queue-remaining {
  margin: 0;
  font-size: 0.75rem;
  color: var(--subtle);
}

.music-now-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.music-now-header h2 {
  flex: 1;
  min-width: 0;
}

.music-search-section {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.music-queue-section {
  grid-template-rows: auto minmax(0, 1fr);
}

.music-search-form,
.chat-form {
  display: flex;
  gap: 6px;
  margin-top: auto;
  flex-shrink: 0;
}

.chat-form {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 26px 44px;
  align-items: end;
  gap: 5px 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chat-attach-button.is-active {
  border-color: color-mix(in oklch, var(--accent) 46%, var(--line));
  background: var(--accent-soft);
  color: var(--accent);
}

.music-search-form input,
.chat-form > input {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  border-radius: 999px;
  border-color: transparent;
  background: color-mix(in oklch, var(--surface-mid) 82%, var(--bg));
  height: 44px;
  padding-inline: 16px;
  font-size: 0.88rem;
}

.music-search-form button,
.chat-form button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 14px;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 8px;
}

.chat-form button {
  grid-column: 2;
  grid-row: 2;
  border-radius: 999px;
}

.announce-toggle {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: color-mix(in oklch, var(--surface-mid) 78%, var(--accent-soft));
  color: var(--muted);
  cursor: pointer;
  transition: border-color 160ms var(--ease), background 160ms var(--ease), color 160ms var(--ease);
}

.announce-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.announce-toggle-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.announce-toggle-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.announce-toggle:has(input:checked) {
  border-color: color-mix(in oklch, var(--accent) 58%, var(--line));
  background: color-mix(in oklch, var(--accent-soft) 82%, var(--surface));
  color: var(--accent);
}

.announce-toggle:has(input:focus-visible) {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.announce-toggle:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.55;
}

/* List reset for semantic <ul> containers */
.music-results,
.music-queue,
.chat-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.music-results,
.music-queue {
  display: grid;
  gap: 0;
  min-height: 0;
  padding-right: 2px;
  overflow: auto;
}

.music-results {
  max-height: min(200px, 26vh);
}

.music-queue { overflow: auto; }

.music-result,
.queue-item {
  display: grid;
  grid-template-columns: 50px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.music-result:last-child,
.queue-item:last-child { border-bottom: none; }

.music-thumb {
  width: 50px;
  height: 38px;
  border-radius: 6px;
  background: var(--surface-strong);
  object-fit: cover;
}

.music-result-actions,
.queue-item-actions {
  display: grid;
  gap: 6px;
}

.music-results:empty::before,
.music-queue:empty::before {
  content: "";
}

/* ─── CHAT PANEL ───────────────────────────────────── */
.chat-list {
  flex: 0 1 auto;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  scroll-behavior: smooth;
  display: grid;
  gap: 10px;
  padding: 2px 2px 14px;
  align-content: end;
}

.chat-jump-button {
  position: absolute;
  z-index: 4;
  left: 16px;
  right: 16px;
  bottom: 76px;
  width: max-content;
  max-width: calc(100% - 32px);
  margin-inline: auto;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid color-mix(in oklch, var(--accent) 24%, var(--line));
  border-radius: 999px;
  background: color-mix(in oklch, var(--surface) 90%, var(--accent-soft));
  color: var(--accent-dim);
  box-shadow: 0 8px 22px color-mix(in oklch, var(--ink) 12%, transparent);
  font-size: 0.78rem;
  font-weight: 700;
  gap: 6px;
  white-space: nowrap;
}

.chat-jump-button[hidden] {
  display: none;
}

@media (hover: hover) {
  .chat-jump-button:not(:disabled):hover {
    background: var(--accent-soft);
    color: var(--accent);
    transform: translate3d(0, -1px, 0);
  }
}

.chat-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  align-items: end;
  max-width: 92%;
  transform-origin: left bottom;
  min-width: 0;
  will-change: transform, opacity;
}

.chat-item.is-own {
  grid-template-columns: minmax(0, 1fr) 34px;
  justify-self: end;
  transform-origin: right bottom;
}

.chat-item.is-new {
  animation: chat-message-rise 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.chat-item.is-own.is-new {
  animation-name: chat-message-rise;
}

.chat-avatar-slot {
  grid-column: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.chat-item.is-own .chat-avatar-slot {
  grid-column: 2;
  grid-row: 1;
}

.chat-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 2px solid var(--surface);
  box-shadow: 0 1px 0 color-mix(in oklch, var(--ink) 8%, transparent);
  font-size: 0.78rem;
}

.chat-main {
  grid-column: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.chat-item.is-own .chat-main {
  grid-column: 1;
  grid-row: 1;
  align-items: flex-end;
}

.chat-heading {
  display: inline-flex;
  align-items: baseline;
  max-width: 100%;
  padding-inline: 4px;
}

.chat-bubble {
  max-width: min(100%, 27ch);
  padding: 9px 12px;
  border-radius: 18px 18px 18px 6px;
  background: color-mix(in oklch, var(--surface-mid) 76%, var(--bg));
  color: var(--ink);
}

.chat-item.is-own .chat-bubble {
  border-radius: 18px 18px 6px 18px;
  background: var(--accent);
  color: var(--accent-ink);
}

.chat-text {
  min-width: 0;
  font-size: 0.86rem;
  line-height: 1.45;
  word-break: break-word;
  color: inherit;
}

.chat-item.is-own .chat-author {
  color: color-mix(in oklch, var(--accent) 54%, var(--muted));
}

@keyframes chat-message-rise {
  from {
    opacity: 0;
    transform: translate3d(0, 9px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.chat-file-picker {
  flex-shrink: 0;
  max-height: 180px;
  overflow-y: auto;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-mid);
  color: var(--subtle);
  font-size: 0.82rem;
}

.chat-file-search {
  height: 34px;
  background: var(--surface);
  border-radius: 8px;
  font-size: 0.82rem;
}

.chat-file-empty {
  padding: 6px 2px;
  color: var(--subtle);
  font-size: 0.8rem;
}

.chat-file-option,
.chat-file-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.chat-file-option {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px;
}

.chat-file-card {
  flex-basis: 100%;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  margin-top: 2px;
  background: color-mix(in oklch, var(--surface) 76%, var(--surface-mid));
}

.chat-file-option-main,
.chat-file-card-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.chat-file-option-name,
.chat-file-card-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 600;
}

.chat-file-option-meta,
.chat-file-card-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--subtle);
  font-size: 0.72rem;
}

.chat-list:empty::before {
  content: "Nothing here yet.";
  color: var(--subtle);
  font-size: 0.82rem;
}

/* ─── TIMER STAGE ──────────────────────────────────── */
.timer-stage {
  --timer-core-size: min(66vh, 540px);
  position: relative;
  min-height: 0;
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: clamp(18px, 3vh, 32px);
  overflow: hidden;
}

#focusCanvas {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--timer-core-size);
  height: var(--timer-core-size);
  max-width: calc(100vw - 40px);
  max-height: calc(100vw - 40px);
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0.62;
}

.announcement-layer {
  --announcement-core-width: var(--timer-core-size);
  --announcement-gap: clamp(10px, 1.4vw, 18px);
  --announcement-item-height: 74px;
  --announcement-side-width: clamp(178px, calc((100% - var(--announcement-core-width) - (var(--announcement-gap) * 2)) / 2), 280px);
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

.announcement-bubble {
  position: absolute;
  top: calc(50% + ((var(--announcement-slot, 0) - 1.5) * var(--announcement-item-height)));
  width: var(--announcement-side-width);
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 10px;
  padding: 9px 12px 9px 9px;
  border: 1px solid color-mix(in oklch, var(--accent) 30%, var(--line));
  border-radius: 999px 999px 999px 18px;
  background: color-mix(in oklch, var(--surface) 92%, var(--accent-soft));
  pointer-events: auto;
  animation: announcement-float-left 1200ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.announcement-bubble[data-side="left"] {
  left: calc(50% - (var(--announcement-core-width) / 2) - var(--announcement-gap));
  border-radius: 999px 999px 18px 999px;
  transform: translate(-100%, -50%) rotate(var(--announce-tilt, 0deg));
  animation-name: announcement-float-left;
}

.announcement-bubble[data-side="right"] {
  left: calc(50% + (var(--announcement-core-width) / 2) + var(--announcement-gap));
  transform: translate(0, -50%) rotate(var(--announce-tilt, 0deg));
  animation-name: announcement-float-right;
}

.announcement-bubble.is-dismissing {
  animation: announcement-drift-away 460ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.announcement-avatar {
  width: 42px;
  height: 42px;
  border: 2px solid color-mix(in oklch, var(--accent) 44%, var(--surface));
  font-size: 0.82rem;
}

.announcement-content {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.announcement-author {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.1;
}

.announcement-text {
  min-width: 0;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.announcement-dismiss {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: color-mix(in oklch, var(--surface-strong) 78%, transparent);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.announcement-dismiss:hover {
  background: color-mix(in oklch, var(--accent-soft) 74%, var(--surface-strong));
  color: var(--ink);
}

.announcement-dismiss:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@keyframes announcement-float-left {
  0% {
    opacity: 0;
    filter: blur(7px);
    transform: translate(calc(-100% + 4px), calc(26vh - 50%)) scale(0.97) rotate(calc(var(--announce-tilt, 0deg) - 0.4deg));
  }
  38% {
    opacity: 0.72;
    filter: blur(2px);
    transform: translate(calc(-100% - 2px), calc(11vh - 50%)) scale(0.99) rotate(calc(var(--announce-tilt, 0deg) + 0.2deg));
  }
  72% {
    opacity: 1;
    filter: blur(0);
    transform: translate(calc(-100% + 1px), calc(2vh - 50%)) scale(1) rotate(var(--announce-tilt, 0deg));
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: translate(-100%, -50%) scale(1) rotate(var(--announce-tilt, 0deg));
  }
}

@keyframes announcement-float-right {
  0% {
    opacity: 0;
    filter: blur(7px);
    transform: translate(-4px, calc(26vh - 50%)) scale(0.97) rotate(calc(var(--announce-tilt, 0deg) + 0.4deg));
  }
  38% {
    opacity: 0.72;
    filter: blur(2px);
    transform: translate(2px, calc(11vh - 50%)) scale(0.99) rotate(calc(var(--announce-tilt, 0deg) - 0.2deg));
  }
  72% {
    opacity: 1;
    filter: blur(0);
    transform: translate(-1px, calc(2vh - 50%)) scale(1) rotate(var(--announce-tilt, 0deg));
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: translate(0, -50%) scale(1) rotate(var(--announce-tilt, 0deg));
  }
}

@keyframes announcement-float-mobile {
  0% {
    opacity: 0;
    filter: blur(7px);
    transform: translate(calc(-50% + 4px), -28%) scale(0.97) rotate(calc(var(--announce-tilt, 0deg) + 0.4deg));
  }
  38% {
    opacity: 0.72;
    filter: blur(2px);
    transform: translate(calc(-50% - 2px), -64%) scale(0.99) rotate(calc(var(--announce-tilt, 0deg) - 0.2deg));
  }
  72% {
    opacity: 1;
    filter: blur(0);
    transform: translate(calc(-50% + 1px), -94%) scale(1) rotate(var(--announce-tilt, 0deg));
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: translate(-50%, -100%) scale(1) rotate(var(--announce-tilt, 0deg));
  }
}

@keyframes announcement-drift-away {
  0% {
    opacity: 1;
    filter: blur(0);
  }
  100% {
    opacity: 0;
    filter: blur(5px);
    scale: 0.98;
  }
}

.timeplate {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

/* Mode label above timer */
.timeplate .mode-label {
  color: var(--accent);
}

/* THE HERO */
.time-readout {
  color: var(--ink);
  font-family: var(--font-timer);
  font-size: clamp(5.8rem, 12vw, 10rem);
  font-weight: 700;
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
  line-height: 0.9;
}

.current-task-card {
  position: absolute;
  z-index: 3;
  top: calc(50% - (var(--timer-core-size) / 2) - 76px);
  left: 50%;
  width: min(360px, calc(100vw - 52px));
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 10px 14px;
  border: 1px solid color-mix(in oklch, var(--accent) 24%, var(--line));
  border-radius: 14px;
  background: color-mix(in oklch, var(--surface) 88%, transparent);
  transform: translateX(-50%);
}

.current-task-label {
  margin: 0;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
}

.current-task-text {
  max-width: 100%;
  margin: 0;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-task-progress {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.current-task-edit,
.current-task-switch {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid color-mix(in oklch, var(--accent) 30%, var(--line));
  border-radius: 999px;
  background: color-mix(in oklch, var(--accent-soft) 70%, var(--surface));
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
}

.current-task-edit:hover:not(:disabled),
.current-task-switch:hover:not(:disabled) {
  background: color-mix(in oklch, var(--accent-soft) 86%, var(--surface));
}

.current-task-edit:disabled,
.current-task-switch:disabled {
  cursor: wait;
  opacity: 0.6;
}

.goal-message {
  min-height: 1.1em;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.host-pause-notice {
  margin: 0;
  padding: 7px 12px;
  border: 1px solid color-mix(in oklch, var(--accent) 34%, var(--line));
  border-radius: 999px;
  background: color-mix(in oklch, var(--accent-soft) 74%, transparent);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}

.subline {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 400;
}

.next-mode {
  margin: 0;
  color: var(--subtle);
  font-size: 0.74rem;
  font-weight: 500;
}

.primary-actions {
  position: absolute;
  z-index: 3;
  top: calc(50% + (var(--timer-core-size) / 2) + 18px);
  left: 50%;
  display: flex;
  justify-content: center;
  gap: 10px;
  width: min(560px, calc(100% - 36px));
  transform: translateX(-50%);
}

.finish-session-button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid color-mix(in oklch, var(--danger) 42%, var(--line));
  border-radius: 8px;
  background: color-mix(in oklch, var(--danger) 14%, var(--surface));
  color: var(--danger);
  font-size: 0.84rem;
  font-weight: 700;
}

.finish-session-button:hover:not(:disabled) {
  background: color-mix(in oklch, var(--danger) 22%, var(--surface-strong));
  border-color: color-mix(in oklch, var(--danger) 62%, var(--line));
}

.finish-session-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.timer-participants {
  position: relative;
  z-index: 2;
  width: min(620px, calc(100% - 36px));
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(10px, 1.5vw, 18px);
  pointer-events: auto;
}

.topbar-participants {
  position: absolute;
  top: 0;
  left: 50%;
  width: min(360px, calc(100% - 220px));
  align-items: center;
  gap: 0;
  transform: translateX(-50%);
}

.topbar-participants .timer-participant + .timer-participant {
  margin-left: -8px;
}

.timer-participant {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 64px;
  max-width: 98px;
  transform: translateY(var(--arc-offset, 0));
  pointer-events: auto;
}

.topbar-participants .timer-participant {
  min-width: 34px;
  max-width: 42px;
  transform: none;
}

.profile-avatar {
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--avatar, var(--accent));
  color: var(--accent-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.timer-participant-avatar {
  width: 54px;
  height: 54px;
  border: 1px solid color-mix(in oklch, var(--accent) 38%, var(--line));
  box-shadow: 0 10px 28px oklch(0% 0 0 / 0.28);
  font-size: 1rem;
}

.topbar-participants .timer-participant-avatar {
  width: 38px;
  height: 38px;
  border-width: 2px;
  box-shadow: 0 8px 20px oklch(0% 0 0 / 0.22);
  font-size: 0.78rem;
}

.timer-participant-name {
  max-width: 98px;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-participants .timer-participant-name {
  display: none;
}

.timer-participant.is-host .timer-participant-avatar {
  border-color: var(--accent);
}

.timer-participant-status {
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  width: max-content;
  max-width: min(220px, 70vw);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.25;
  text-align: center;
  box-shadow: 0 16px 42px oklch(0% 0 0 / 0.34);
  opacity: 0;
  transform: translate(-50%, -4px);
  transition: opacity 140ms var(--ease), transform 140ms var(--ease);
  pointer-events: none;
}

.timer-participant:hover .timer-participant-status,
.timer-participant:focus-within .timer-participant-status {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ─── YOUTUBE HOST ──────────────────────────────────── */
#youtubePlayerHost {
  width: 100%;
  min-height: 200px;
  aspect-ratio: 1 / 1;
  margin-top: 8px;
  background: var(--surface-mid);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

#youtubePlayerHost iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.music-embed-status {
  display: grid;
  min-height: 200px;
  place-items: center;
  padding: 18px;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: center;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */
@media (max-width: 780px) {
  body {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .app-shell {
    height: auto;
    min-height: 100dvh;
    grid-template-rows: auto auto;
    padding: max(12px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: visible;
  }

  .topbar {
    min-height: 48px;
    flex-wrap: nowrap;
    gap: 8px;
    padding-bottom: 10px;
  }

  .topbar-actions { flex-wrap: wrap; }

  .workspace-shell {
    grid-template-columns: 1fr;
    gap: 12px;
    height: auto;
    overflow-x: hidden;
    overflow-y: visible;
  }

  /* Panels: full width, no collapse animation on mobile */
  .side-panel,
  .side-panel.panel-closed {
    width: auto;
    transition: none;
  }

  /* Restore panels on mobile — no collapsed sliding */
  .side-panel.panel-closed > *:not(.panel-tab) {
    visibility: visible;
    pointer-events: auto;
  }

  .side-panel.panel-closed .panel-tab { display: none; }

  .music-panel { order: 2; }
  .chat-panel  { order: 3; }
  .timer-stage { order: 1; }

  .timer-stage,
  .side-panel {
    min-height: auto;
    height: auto;
    overflow-x: hidden;
    overflow-y: visible;
  }

  .timer-stage {
    --timer-core-size: min(82vw, 400px);
    min-height: clamp(360px, 72dvh, 560px);
    padding: clamp(28px, 8vw, 44px) 0 clamp(24px, 7vw, 40px);
    gap: 18px;
  }

  .side-panel {
    padding: 14px;
    border-radius: 14px;
  }

  .side-panel-head {
    padding-bottom: 10px;
    margin-bottom: 10px;
  }

  .announcement-layer {
    --announcement-item-height: 62px;
    --announcement-side-width: min(330px, calc(100% - 28px));
    overflow: visible;
  }

  .announcement-bubble {
    top: calc(100% - 8px - (var(--announcement-index, 0) * var(--announcement-item-height)));
    left: 50%;
    grid-template-columns: 36px minmax(0, 1fr) 22px;
    gap: 8px;
    padding: 8px 9px 8px 8px;
    animation-name: announcement-float-mobile;
  }

  .announcement-bubble[data-side="left"],
  .announcement-bubble[data-side="right"] {
    left: 50%;
    border-radius: 999px 999px 999px 16px;
    transform: translate(-50%, -100%) rotate(var(--announce-tilt, 0deg));
    animation-name: announcement-float-mobile;
  }

  .announcement-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.76rem;
  }

  .announcement-author { font-size: 0.68rem; }
  .announcement-text { font-size: 0.82rem; }

  .announcement-dismiss {
    width: 22px;
    height: 22px;
  }

  .time-readout { font-size: clamp(5.1rem, 20vw, 7.4rem); }

  #focusCanvas {
    max-width: calc(100vw - 32px);
    max-height: calc(100vw - 32px);
    opacity: 0.42;
  }

  .primary-actions {
    position: static;
    transform: none;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    width: min(520px, 100%);
    margin: 0 auto;
  }

  .current-task-card {
    position: static;
    transform: none;
  }

  .action-button {
    min-height: 48px;
    flex: 1 1 142px;
    width: auto;
    padding: 0 16px;
  }

  .action-button.start,
  .action-button.resume,
  .action-button.pause {
    min-width: min(100%, 160px);
  }

  .settings-shell { padding: 18px; }

  .music-result,
  .queue-item { grid-template-columns: 50px 1fr; }

  .music-result-actions,
  .queue-item-actions { grid-column: 1 / -1; }

}

@media (max-width: 430px) {
  .auth-tabs,
  .entry-tabs,
  .create-duration-grid,
  .rhythm-duration-grid { grid-template-columns: 1fr; }

  .music-mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .auth-tabs,
  .entry-tabs { flex-direction: column; }

  .music-search-form { flex-wrap: wrap; }
  .music-search-form button { width: 100%; }

  .chat-form {
    grid-template-columns: 44px 44px minmax(0, 1fr) 64px;
    grid-template-rows: 44px;
    align-items: stretch;
    gap: 6px;
  }

  .announce-toggle {
    grid-column: 1;
    grid-row: 1;
    width: 44px;
    height: 44px;
  }

  .chat-attach-button {
    grid-column: 2;
    grid-row: 1;
    width: 44px;
    padding: 0;
    font-size: 0;
  }

  .chat-attach-button::before {
    content: "+";
    font-size: 1.1rem;
    font-weight: 700;
  }

  .chat-form > input {
    grid-column: 3;
    grid-row: 1;
  }

  .chat-form button[type="submit"] {
    grid-column: 4;
    grid-row: 1;
    width: 64px;
    padding: 0;
  }

  .material-action-buttons {
    grid-template-columns: 1fr;
  }

  .timer-stage {
    --timer-core-size: min(86vw, 360px);
    min-height: clamp(330px, 66dvh, 500px);
    padding-top: 22px;
  }

  .time-readout { font-size: clamp(4.4rem, 21vw, 6.2rem); }

  .primary-actions {
    width: min(100%, 340px);
  }

  .action-button {
    flex-basis: 100%;
  }

  .timer-participants {
    width: 100%;
    gap: 6px;
    flex-wrap: wrap;
  }

  .topbar-participants {
    width: min(220px, calc(100% - 112px));
    gap: 0;
    flex-wrap: nowrap;
  }

  .topbar-participants .timer-participant {
    min-width: 28px;
    max-width: 34px;
  }

  .topbar-participants .timer-participant + .timer-participant {
    margin-left: -10px;
  }

  .timer-participant-avatar {
    width: 38px;
    height: 38px;
    font-size: 0.8rem;
  }

  .topbar-participants .timer-participant-avatar {
    width: 34px;
    height: 34px;
    font-size: 0.72rem;
  }

  .timer-participant-name {
    max-width: 62px;
    font-size: 0.62rem;
  }
}

@media (max-width: 780px) and (orientation: landscape) {
  .app-shell {
    min-height: auto;
  }

  .timer-stage {
    --timer-core-size: min(60dvh, 360px);
    min-height: 320px;
    padding-block: 20px;
  }

  .time-readout {
    font-size: clamp(4rem, 14vw, 6.2rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .announcement-bubble {
    animation: none;
    transition: none;
  }

  .announcement-bubble.is-dismissing {
    animation: none;
    display: none;
  }
}

/* ═══════════════════════════════════════════════════════
   SESSION COMPLETE DIALOG
═══════════════════════════════════════════════════════ */
.complete-dialog {
  width: min(400px, calc(100vw - 28px));
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
}

.material-action-dialog {
  width: min(430px, calc(100vw - 28px));
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
}

.material-action-dialog::backdrop {
  background: oklch(5% 0.005 55 / 0.74);
}

.material-action-shell {
  display: grid;
  gap: 14px;
  padding: 24px;
}

.material-action-shell h1 {
  font-size: 1.08rem;
}

.material-action-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.material-action-buttons {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 10px;
  margin-top: 2px;
}

.material-action-buttons .action-button,
.material-action-buttons .create-room-submit {
  width: 100%;
  min-height: 46px;
  padding: 0 18px;
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 200;
  max-width: min(460px, calc(100vw - 28px));
  transform: translateX(-50%);
  padding: 12px 16px;
  border: 1px solid color-mix(in oklch, var(--accent) 34%, var(--line));
  border-radius: 12px;
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: 0 18px 48px oklch(5% 0.005 55 / 0.36);
  font-size: 0.88rem;
  line-height: 1.35;
}

.app-toast.is-error {
  border-color: color-mix(in oklch, var(--danger) 42%, var(--line));
  background: color-mix(in oklch, var(--danger) 18%, var(--surface));
  color: var(--ink);
}

.complete-dialog::backdrop {
  background: oklch(5% 0.005 55 / 0.88);
}

.complete-shell {
  position: relative;
  overflow: hidden;
  padding: 32px 28px 24px;
  display: grid;
  gap: 14px;
}

.complete-timer {
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: color-mix(in oklch, var(--line) 82%, transparent);
}

.complete-timer span {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(var(--complete-timer-progress, 1));
  transform-origin: left center;
  background: linear-gradient(90deg, var(--accent), var(--danger));
  transition: transform 180ms linear;
}

.complete-shell .section-kicker {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ok);
  margin: 0;
}

.complete-shell h1 {
  font-size: 1.3rem;
  margin: 0;
}

.complete-countdown {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.complete-goal {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
  font-style: italic;
}

.complete-progress {
  display: grid;
  gap: 9px;
  margin-top: 2px;
}

.complete-progress[hidden] {
  display: none;
}

.complete-progress-track {
  height: 14px;
  overflow: hidden;
  border: 1px solid color-mix(in oklch, var(--accent) 24%, var(--line));
  border-radius: 999px;
  background: color-mix(in oklch, var(--surface-mid) 82%, var(--accent-soft));
}

.complete-progress-track span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ok), var(--accent));
  transform: scaleX(var(--complete-progress-to, 0));
  transform-origin: left center;
  animation: complete-progress-grow 1400ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.complete-progress p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.complete-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}

.complete-btn {
  min-height: 72px;
  border-radius: 12px;
  font-size: 1.85rem;
  font-weight: 700;
  border: 2px solid transparent;
  transition: background 140ms var(--ease), border-color 140ms var(--ease), transform 120ms var(--ease);
}

.complete-yes {
  background: color-mix(in oklch, var(--success) 16%, var(--surface));
  color: var(--ok);
  border-color: color-mix(in oklch, var(--success) 42%, var(--line));
}

.complete-no {
  background: var(--surface-mid);
  color: var(--muted);
  border-color: var(--line);
}

.complete-dialog.is-progress-only .complete-timer span {
  transform: scaleX(1);
  background: color-mix(in oklch, var(--ok) 76%, var(--accent));
}

.complete-dialog.is-progress-only .complete-actions {
  display: none;
}

@keyframes complete-progress-grow {
  from { transform: scaleX(var(--complete-progress-from, 0)); }
  to { transform: scaleX(var(--complete-progress-to, 0)); }
}

@media (hover: hover) {
  .complete-yes:hover { background: color-mix(in oklch, var(--success) 22%, var(--surface)); transform: translateY(-2px); }
  .complete-no:hover { background: var(--surface-strong); transform: translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
  .complete-progress-track span {
    animation: none;
  }
}

.review-dialog {
  width: min(920px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  overflow: hidden;
}

.review-dialog::backdrop {
  background: oklch(5% 0.005 55 / 0.84);
}

.review-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
  max-height: min(760px, calc(100vh - 28px));
  padding: 22px;
}

.review-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.review-head .section-kicker {
  margin-bottom: 7px;
}

.review-table-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-mid);
}

.review-table {
  width: 100%;
  min-width: 560px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}

.review-table th,
.review-table td {
  min-width: 132px;
  padding: 13px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
}

.review-table th:first-child,
.review-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 118px;
  text-align: left;
  background: var(--surface-strong);
}

.review-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
}

.review-table thead th:first-child {
  z-index: 3;
}

.review-cell.is-finished {
  color: var(--ok);
  font-weight: 700;
}

.review-cell.is-missed {
  color: var(--danger);
  font-weight: 700;
}

.review-cell.is-partial {
  color: var(--accent);
  font-weight: 700;
}

.review-cell.is-empty,
.review-empty-cell {
  color: var(--subtle);
}

.review-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════
   SESSION VOTE LIST (bottom of timer)
═══════════════════════════════════════════════════════ */
.session-vote-list {
  list-style: none;
  margin: 0;
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

.session-vote-item {
  display: grid;
  align-items: center;
  justify-items: center;
  gap: 5px;
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 2px 4px;
  min-width: 46px;
}

.session-vote-avatar-wrap {
  position: relative;
  display: inline-flex;
}

.session-vote-avatar {
  width: 34px;
  height: 34px;
  box-shadow: 0 0 0 1px var(--line);
}

.session-vote-badge {
  position: absolute;
  right: -6px;
  bottom: -5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--surface);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
}

.session-vote-badge.is-progress {
  min-width: 24px;
  width: max-content;
  padding: 0 4px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--ok) 72%, var(--surface));
  color: var(--surface);
  font-size: 0.56rem;
}

.session-vote-name {
  max-width: 58px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--muted);
}

.session-vote-badge.is-yes {
  background: var(--ok);
  color: var(--surface);
}

.session-vote-badge.is-no {
  background: var(--accent);
  color: var(--accent-ink);
}

.session-vote-badge.is-pending {
  background: var(--surface-strong);
  color: transparent;
}

/* ═══════════════════════════════════════════════════════
   FINISH GROUP DIALOG
═══════════════════════════════════════════════════════ */
.finish-group-dialog {
  width: min(410px, calc(100vw - 28px));
  margin: auto;
  padding: 0;
  border: 1px solid color-mix(in oklch, var(--danger) 20%, var(--line));
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
}

.finish-group-dialog::backdrop {
  background: oklch(5% 0.005 55 / 0.78);
}

.finish-group-shell {
  display: grid;
  gap: 14px;
  padding: 24px;
}

.finish-group-shell .section-kicker {
  margin: 0;
  color: var(--danger);
  font-size: 0.72rem;
  font-weight: 700;
}

.finish-group-shell h1 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.15;
}

.finish-group-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.finish-group-actions {
  display: grid;
  grid-template-columns: 1fr 1.12fr;
  gap: 10px;
  margin-top: 4px;
}

.finish-group-actions .action-button,
.finish-group-actions .create-room-submit {
  width: 100%;
  min-height: 46px;
  padding: 0 16px;
}

/* ═══════════════════════════════════════════════════════
   SESSION GOAL DIALOG
═══════════════════════════════════════════════════════ */
.goal-dialog {
  width: min(420px, calc(100vw - 28px));
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
}

.goal-dialog::backdrop {
  background: oklch(5% 0.005 55 / 0.8);
}

.goal-shell {
  padding: 28px 28px 24px;
  display: grid;
  gap: 18px;
}

.goal-shell .section-kicker {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0;
}

.goal-shell h1 {
  font-size: 1.4rem;
  margin: 0;
}

#sessionGoalForm {
  display: grid;
  gap: 12px;
}

#sessionGoalInput,
#sessionGoalPomodoros {
  font-size: 1rem;
  padding: 12px 14px;
  background: var(--surface-mid);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  width: 100%;
}

#sessionGoalInput:focus,
#sessionGoalPomodoros:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: transparent;
}

#sessionGoalInput::placeholder {
  color: var(--subtle);
}

.goal-pomodoro-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

#sessionGoalPomodoros {
  text-align: center;
  font-weight: 800;
}

/* ═══════════════════════════════════════════════════════
   GROUPS — mode panel list
═══════════════════════════════════════════════════════ */
.groups-section {
  display: grid;
  gap: 10px;
}

.groups-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.groups-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--subtle);
}

.groups-new-btn {
  font-size: 0.8rem;
  color: var(--accent);
  padding: 0 12px;
  border-radius: 6px;
  background: var(--accent-soft);
  min-height: 44px;
}

@media (hover: hover) {
  .groups-new-btn:hover { background: var(--surface-strong); }
}

.groups-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.groups-empty {
  font-size: 0.84rem;
  color: var(--subtle);
  text-align: center;
  padding: 12px 0;
}

.group-list-item {
  display: contents;
}

.group-list-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: left;
  min-height: 48px;
  gap: 10px;
  transition: background 140ms var(--ease), border-color 140ms var(--ease);
}

@media (hover: hover) {
  .group-list-button:hover {
    background: var(--surface-mid);
    border-color: var(--accent);
    transform: none;
  }
}

.group-list-name {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink);
}

.group-list-text {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.group-list-meta {
  overflow: hidden;
  color: var(--subtle);
  font-size: 0.76rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-list-arrow {
  font-size: 0.9rem;
  color: var(--subtle);
}

.new-group-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.new-group-form input {
  flex: 1 1 150px;
  min-width: 0;
}

.new-group-form button {
  flex: 0 0 auto;
}

.join-code-button {
  min-width: 68px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.84rem;
  font-weight: 700;
}

.group-password-dialog {
  width: min(420px, 92vw);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
}

.group-password-shell {
  padding: 28px;
  display: grid;
  gap: 12px;
}

.group-password-shell h1 {
  margin: 0;
  font-size: 1.35rem;
}

.group-password-shell form {
  display: grid;
  gap: 10px;
}

.new-group-dialog {
  width: min(470px, 92vw);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  overflow: hidden;
}

.new-group-shell {
  min-height: 520px;
  display: grid;
}

.new-group-main,
.new-group-loading {
  grid-area: 1 / 1;
  padding: 26px;
}

.new-group-main {
  display: grid;
  gap: 18px;
}

.new-group-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.new-group-head h1,
.new-group-loading h1 {
  margin: 3px 0 0;
  font-size: 1.34rem;
}

.new-group-dialog .new-group-form {
  display: grid;
  gap: 13px;
}

.new-group-field {
  display: grid;
  gap: 7px;
}

.new-group-field > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.new-group-field small {
  color: var(--subtle);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: none;
}

.new-group-field textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-mid);
  color: var(--ink);
  outline: none;
  padding: 12px 14px;
  font: inherit;
  font-size: 0.93rem;
  line-height: 1.35;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

.new-group-field textarea:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.new-group-field textarea::placeholder {
  color: var(--subtle);
}

.new-group-code-card {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid color-mix(in oklch, var(--accent) 24%, var(--line));
  border-radius: 12px;
  background: color-mix(in oklch, var(--accent-soft) 56%, var(--surface));
}

.new-group-code-card span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.new-group-code-card strong {
  color: var(--accent-dim);
  font-family: var(--font-timer);
  font-size: 1rem;
  font-weight: 700;
}

.new-group-loading {
  align-content: center;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.new-group-loading p:last-child {
  max-width: 28ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

@property --group-progress {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

.group-create-progress {
  position: relative;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  --group-progress: 0deg;
}

.group-create-progress::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    conic-gradient(
      from -90deg,
      var(--accent) var(--group-progress),
      color-mix(in oklch, var(--line) 88%, transparent) 0
    );
}

.group-create-progress::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: inherit;
  background: var(--surface);
}

.new-group-dialog.is-creating .group-create-progress::before {
  animation: groupClockFill 2000ms linear forwards;
}

.new-group-dialog.is-complete .group-create-progress {
  --group-progress: 360deg;
}

.new-group-dialog.is-complete .group-create-progress::before {
  background: var(--ok);
  animation: groupCompletePop 440ms var(--ease);
}

.group-create-check {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 18px;
  border-left: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transform: rotate(-45deg) scale(0.72);
  opacity: 0;
}

.new-group-dialog.is-complete .group-create-check {
  border-color: var(--ok);
  animation: groupCheckIn 360ms 120ms var(--ease) forwards;
}

@keyframes groupClockFill {
  from { --group-progress: 0deg; }
  to { --group-progress: 360deg; }
}

@keyframes groupCompletePop {
  0% { transform: scale(0.94); }
  100% { transform: scale(1); }
}

@keyframes groupCheckIn {
  from {
    opacity: 0;
    transform: rotate(-45deg) scale(0.72) translate(4px, -4px);
  }
  to {
    opacity: 1;
    transform: rotate(-45deg) scale(1) translate(0, 0);
  }
}

/* ═══════════════════════════════════════════════════════
   GROUP PAGE
═══════════════════════════════════════════════════════ */
.group-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

.group-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.group-topbar-center {
  flex: 1;
  min-width: 0;
}

.group-topbar-center .section-kicker {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--subtle);
  margin-bottom: 1px;
}

.group-title {
  font-size: 1.1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.group-invite-btn {
  display: flex;
  align-items: center;
  max-width: min(320px, 32vw);
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  cursor: pointer;
}

@media (hover: hover) {
  .group-invite-btn:hover { background: var(--surface); }
}

.group-invite-btn.is-copied {
  color: var(--success);
  border-color: color-mix(in oklch, var(--success) 45%, var(--line));
}

.group-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 36px;
  overflow-y: auto;
  max-width: 1220px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 32px 56px;
}

@media (max-width: 640px) {
  .group-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 22px;
    padding: 20px 16px 36px;
    overflow-y: auto;
  }
}

@media (max-width: 780px) {
  .group-shell {
    min-height: 100dvh;
    height: auto;
    overflow: visible;
  }

  .group-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 8px;
    padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  }

  .group-topbar-center {
    align-self: center;
  }

  .group-invite-btn {
    grid-column: 2 / 3;
    min-width: 0;
    max-width: none;
    width: 100%;
    justify-content: center;
  }

  .group-topbar > .settings-actions {
    grid-column: 3;
    grid-row: 1 / 3;
    align-self: center;
  }

  .group-body {
    max-width: none;
    gap: 28px;
    padding: 22px 14px max(30px, env(safe-area-inset-bottom));
    overflow: visible;
  }

  .group-main-col {
    gap: 34px;
  }

  .group-section-head {
    align-items: flex-start;
  }

  .group-room-head-actions {
    flex-shrink: 0;
  }

  .group-rooms-empty {
    padding: 28px 20px;
    border-radius: 16px;
  }

  .subject-tile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.group-main-col {
  display: grid;
  gap: 44px;
  min-width: 0;
}

.group-section {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
}

.group-section h2 {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--subtle);
}

.group-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.group-room-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-rooms-message {
  min-height: 1.1rem;
  margin: -2px 0 0;
}

.group-rooms-message.is-error {
  color: var(--accent);
}

.group-refresh-rooms-btn {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  font-size: 1rem;
  line-height: 1;
}

.group-refresh-rooms-btn:disabled {
  cursor: progress;
  opacity: 0.7;
}

.group-refresh-rooms-btn.is-refreshing {
  animation: group-refresh-spin 0.8s linear infinite;
}

@keyframes group-refresh-spin {
  to { transform: rotate(360deg); }
}

.group-create-room-btn {
  min-height: 44px;
  padding: 0 18px;
  font-size: 0.84rem;
  width: auto;
  border-radius: 999px;
}

.group-rooms-list,
.group-members-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.group-rooms-empty,
.group-room-item {
  font-size: 0.88rem;
}

.group-rooms-empty {
  color: var(--subtle);
  padding: 36px 28px;
  border: 1px dashed var(--line);
  border-radius: 24px;
  background: var(--surface);
}

.group-room-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 26px 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 26px;
  cursor: pointer;
  transition: transform 150ms var(--ease), border-color 150ms var(--ease), background 150ms var(--ease);
}

@media (hover: hover) {
  .group-room-item:hover {
    transform: translateY(-2px);
    border-color: color-mix(in oklch, var(--accent) 42%, var(--line));
    background: var(--surface-mid);
  }
}

.group-room-info {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.group-room-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-room-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.group-room-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

.group-room-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--subtle);
}

.group-room-status-dot.focus { background: var(--accent); }
.group-room-status-dot.short,
.group-room-status-dot.long { background: var(--success); }

.group-room-timer-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 4px 9px;
  white-space: nowrap;
}

.group-room-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.group-room-avatars {
  display: flex;
  align-items: center;
}

.group-room-avatar {
  width: 32px;
  height: 32px;
  border: 2px solid var(--surface);
  font-size: 0.72rem;
  margin-left: -8px;
}

.group-room-avatar:first-child {
  margin-left: 0;
}

.group-room-count {
  font-size: 0.78rem;
  color: var(--subtle);
  white-space: nowrap;
}

.group-room-join-arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 600;
  flex-shrink: 0;
  transition: transform 150ms var(--ease);
}

@media (hover: hover) {
  .group-room-item:hover .group-room-join-arrow {
    transform: translateX(3px);
  }
}

.group-member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
}

.group-member-item:last-child {
  border-bottom: none;
}

.group-member-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--surface-strong);
  flex-shrink: 0;
}

.group-member-name {
  font-size: 0.88rem;
  color: var(--ink);
}

.group-member-name.is-you {
  color: var(--accent);
}

.group-member-name.is-you::after {
  content: " (you)";
  color: var(--subtle);
  font-size: 0.78rem;
}

.group-members-sidebar {
  position: sticky;
  top: 94px;
  align-self: start;
  padding-top: 4px;
}

@media (max-width: 760px) {
  .group-body {
    grid-template-columns: 1fr;
  }

  .group-members-sidebar {
    position: static;
  }

  .group-room-item {
    grid-template-columns: 1fr;
    padding: 22px;
  }

  .group-room-right {
    justify-content: space-between;
  }
}

@media (max-width: 430px) {
  .profile-popover {
    top: max(10px, env(safe-area-inset-top));
    right: max(10px, env(safe-area-inset-right));
    width: min(320px, calc(100vw - 20px));
    padding: 16px;
  }

  .profile-popover .avatar-editor {
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 12px;
  }

  .profile-popover .avatar-preview {
    width: 60px;
    height: 60px;
  }

  .group-topbar {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .group-topbar > .settings-actions {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
  }

  .group-invite-btn {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .group-section-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .group-room-head-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .group-create-room-btn,
  .groups-new-btn {
    width: 100%;
  }

  .group-room-item {
    padding: 18px;
    border-radius: 16px;
  }

  .group-room-right {
    gap: 10px;
  }

  .group-room-join-arrow {
    width: 44px;
    height: 44px;
  }

  .subject-tile-grid {
    grid-template-columns: 1fr;
  }

  .subject-tile-button {
    min-height: 96px;
  }
}

/* ═══════════════════════════════════════════════════════
   GROUP PAGE — TABS
═══════════════════════════════════════════════════════ */
.group-shell {
  grid-template-rows: auto 1fr;
}

/* ═══════════════════════════════════════════════════════
   SHARED MATERIAL — LAYOUT
═══════════════════════════════════════════════════════ */
.group-body-material {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
  min-height: 0;
  width: min(100%, 1120px);
  justify-self: center;
}

@media (max-width: 640px) {
  .group-body-material {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
}

/* ── Subjects pane ────────────────────────────────── */
.material-subjects-pane {
  overflow: hidden;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

@media (max-width: 640px) {
  .material-subjects-pane {
    padding: 12px;
  }
}

.material-subjects-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.category-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.category-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-mid);
  color: var(--muted);
  padding: 0 14px;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 140ms var(--ease), border-color 140ms var(--ease), color 140ms var(--ease), transform 140ms var(--ease);
}

.category-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.category-icon svg {
  width: 18px;
  height: 18px;
}

@media (hover: hover) {
  .category-btn:hover {
    transform: translateY(-1px);
    color: var(--accent);
    border-color: color-mix(in oklch, var(--accent) 58%, var(--line));
    background: var(--accent-soft);
  }
}

.subject-tile-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}

.subject-tile-button {
  width: 100%;
  min-height: 104px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: transform 150ms var(--ease), border-color 150ms var(--ease), background 150ms var(--ease);
}

.subject-tile-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}

.subject-tile-icon svg {
  width: 22px;
  height: 22px;
}

.subject-tile-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.92rem;
  font-weight: 600;
}

.subject-tile-meta {
  color: var(--subtle);
  font-size: 0.72rem;
}

@media (hover: hover) {
  .subject-tile-button:hover {
    transform: translateY(-2px);
    border-color: color-mix(in oklch, var(--accent) 42%, var(--line));
    background: var(--surface-mid);
  }
}

.subject-detail-view {
  overflow-y: auto;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  padding: 10px 24px 28px;
  display: grid;
  gap: 10px;
  min-height: 0;
  align-content: start;
}

.subject-detail-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.subject-detail-head h1 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--ink);
}

.subject-detail-meta {
  margin: 3px 0 0;
  color: var(--subtle);
  font-size: 0.82rem;
}

.subject-detail-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.subject-file-search {
  width: min(260px, 34vw);
  height: 36px;
  background: var(--surface-mid);
  border-radius: 8px;
  font-size: 0.84rem;
}

.material-subjects-head h2 {
  font-size: 1rem;
  font-weight: 600;
  text-transform: none;
  color: var(--ink);
  margin: 0;
}

.new-subject-form {
  display: flex;
  gap: 8px;
}

.new-subject-form input {
  flex: 1;
  height: 44px;
  font-size: 0.88rem;
}

.subjects-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  min-height: 0;
}

.subjects-empty {
  font-size: 0.84rem;
  color: var(--subtle);
  padding: 6px 0;
}

.subject-list-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px 260px;
  align-items: center;
  padding: 2px 16px 0;
  color: var(--subtle);
  font-size: 0.68rem;
  font-weight: 600;
}

.subject-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.subject-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-mid);
}

.subject-card-title {
  flex: 1;
  display: grid;
  gap: 3px;
  min-width: 0;
}

.subject-card-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subject-card-meta,
.subject-file-meta,
.subject-folder-meta {
  font-size: 0.70rem;
  color: var(--subtle);
  line-height: 1.35;
}

.subject-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.subject-card-actions .icon-button {
  min-height: 44px;
  padding: 0 12px;
  font-size: 0.72rem;
}

.subject-files-list {
  list-style: none;
  margin: 0;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.subject-file-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in oklch, var(--surface) 74%, var(--surface-mid));
}

@media (hover: hover) {
  .subject-file-item:hover {
    background: var(--surface-mid);
    border-color: var(--line);
    transform: none;
  }
}

.subject-file-icon {
  font-size: 1.25rem;
  color: var(--subtle);
}

.subject-file-info {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.subject-file-name {
  font-size: 1rem;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  font: inherit;
  font-weight: 500;
}

@media (hover: hover) {
  .subject-file-name:hover {
    color: var(--accent);
    text-decoration: underline;
    transform: none;
  }
}

.subject-file-action {
  min-height: 44px;
  padding: 0 12px;
  font-size: 0.74rem;
}

.subject-file-delete {
  min-height: 44px;
  padding: 0 12px;
  font-size: 0.74rem;
}

.subject-files-empty {
  color: var(--subtle);
  font-size: 0.95rem;
  padding: 26px 20px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: color-mix(in oklch, var(--surface) 76%, var(--surface-mid));
}

.subject-folder-item {
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in oklch, var(--surface-mid) 70%, transparent);
  overflow: hidden;
}

.subject-folder-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.subject-folder-name {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subject-folder-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.subject-folder-actions .icon-button {
  min-height: 44px;
  padding: 0 12px;
  font-size: 0.72rem;
}

.subject-folder-files {
  list-style: none;
  margin: 0;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.subject-root-label {
  list-style: none;
  color: var(--subtle);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 8px 6px 0;
}

.subject-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 0.79rem;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  min-height: 44px;
  width: calc(100% - 16px);
  margin: 4px 8px 8px;
}

@media (hover: hover) {
  .subject-upload-btn:hover { background: var(--surface-strong); transform: none; }
}

/* ── Threads pane ─────────────────────────────────── */
.material-threads-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 18px 14px 14px;
  gap: 10px;
  background: color-mix(in oklch, var(--surface) 42%, transparent);
}

.material-threads-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.threads-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.threads-empty {
  color: var(--subtle);
  font-size: 0.84rem;
  padding: 8px 0;
}

.thread-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.thread-item.is-resolved {
  border-color: color-mix(in oklch, var(--success) 38%, var(--line));
  opacity: 0.72;
}

.thread-main {
  padding: 10px 11px;
}

.thread-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.thread-author {
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--accent);
}

.thread-time {
  font-size: 0.73rem;
  color: var(--subtle);
}

.thread-resolved-badge {
  font-size: 0.67rem;
  font-weight: 600;
  color: var(--ok);
  padding: 2px 7px;
  background: color-mix(in oklch, var(--success) 16%, var(--surface));
  border-radius: 10px;
}

.thread-text {
  font-size: 0.80rem;
  color: var(--muted);
  line-height: 1.45;
  word-break: break-word;
}

.thread-mention {
  display: inline;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.83rem;
  cursor: pointer;
  border: none;
  font: inherit;
  line-height: inherit;
}

@media (hover: hover) {
  .thread-mention:hover { text-decoration: underline; transform: none; }
}

.thread-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.thread-actions .icon-button {
  min-height: 44px;
  padding: 0 12px;
  font-size: 0.68rem;
}

.thread-replies {
  border-top: 1px solid var(--line);
  background: var(--surface-mid);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.reply-item {
  display: grid;
  gap: 2px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
}

.reply-item:last-of-type { border-bottom: none; }

.reply-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reply-author {
  font-size: 0.77rem;
  font-weight: 600;
  color: var(--muted);
}

.reply-time {
  font-size: 0.71rem;
  color: var(--subtle);
}

.reply-text {
  font-size: 0.84rem;
  color: var(--ink);
  line-height: 1.45;
  word-break: break-word;
}

.reply-form {
  display: flex;
  gap: 6px;
  padding: 8px 14px 10px;
  border-top: 1px solid var(--line);
}

.reply-input {
  flex: 1;
  height: 44px;
  background: var(--surface);
  font-size: 0.86rem;
}

/* New thread form */
.new-thread-form-wrapper {
  flex-shrink: 0;
  position: relative;
}

.new-thread-form {
  display: flex;
  gap: 8px;
}

.new-thread-input {
  flex: 1;
  background: var(--surface-mid);
  height: 44px;
  font-size: 0.80rem;
}

.pdf-preview-dialog {
  width: min(980px, calc(100vw - 28px));
  height: min(820px, calc(100vh - 28px));
  padding: 0;
}

.pdf-preview-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--surface);
}

.pdf-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.pdf-preview-head h1 {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
  color: var(--ink);
}

.pdf-preview-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.pdf-preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--surface-strong);
}

@media (max-width: 900px) {
  .subject-list-header {
    display: none;
  }

  .subject-file-item {
    grid-template-columns: 20px minmax(0, 1fr);
  }

  .subject-file-action,
  .subject-file-delete {
    grid-column: 2;
    width: fit-content;
  }
}

/* Mention dropdown */
.mention-dropdown {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  z-index: 100;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 20px oklch(5% 0.005 55 / 0.4);
}

.mention-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 100ms var(--ease);
}

@media (hover: hover) {
  .mention-option:hover { background: var(--surface-mid); transform: none; }
}

.mention-option.is-highlighted { background: var(--surface-mid); }

.mention-option-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mention-option-subject {
  font-size: 0.73rem;
  color: var(--subtle);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════
   ADAPTIVE FINAL OVERRIDES
═══════════════════════════════════════════════════════ */
@media (max-width: 780px) {
  .entry-shell {
    align-items: start;
    justify-items: stretch;
    place-items: start stretch;
    min-height: 100dvh;
    padding: max(76px, calc(env(safe-area-inset-top) + 56px)) 18px max(24px, env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .entry-panel {
    width: 100%;
    max-width: 520px;
    justify-self: center;
  }

  .new-group-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .new-group-form input {
    flex-basis: auto;
  }

  .group-section-head {
    align-items: flex-start;
  }

  .group-body {
    overflow: visible;
  }
}

@media (max-width: 430px) {
  .entry-shell {
    padding-inline: 14px;
  }

  .new-group-form {
    grid-template-columns: 1fr;
  }

  #joinGroupForm {
    grid-template-columns: minmax(0, 1fr) 46px;
  }

  .new-group-form button {
    width: 100%;
    min-height: 46px;
  }

  #joinGroupForm .join-code-button {
    width: 46px;
  }

  .group-section-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
}

@media (max-width: 980px) {
  .entry-panel {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .auth-showcase {
    min-height: 440px;
  }

  .auth-showcase-copy h2 {
    max-width: 15ch;
    font-size: 2.8rem;
  }
}

@media (max-width: 780px) {
  .entry-shell {
    background: var(--bg);
  }

  .entry-panel {
    max-width: 560px;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .auth-panel {
    padding: 0;
  }

  .auth-heading h1 {
    max-width: 13ch;
    font-size: 1.95rem;
  }

  .auth-showcase {
    display: none;
  }
}

/* ═══════════════════════════════════════════════════════
   REDUCED MOTION
═══════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
