/* ============================================================
   POMODORO — Crimson & Void Design System (Dark)
   Flocus-inspired Minimalist Dark Dashboard
   ============================================================ */

:root {
  /* ── Primitive neutrals (tinted hue 250) ── */
  --n-0:   oklch(99% 0.004 250);
  --n-50:  oklch(96% 0.006 250);
  --n-100: oklch(92% 0.008 250);
  --n-200: oklch(84% 0.010 250);
  --n-300: oklch(72% 0.012 250);
  --n-400: oklch(60% 0.014 250);
  --n-500: oklch(48% 0.016 250);
  --n-600: oklch(38% 0.018 250);
  --n-700: oklch(28% 0.020 250);
  --n-800: oklch(20% 0.020 250);
  --n-900: oklch(14% 0.018 250);
  --n-950: oklch(10% 0.016 250);
  --n-1000:oklch(6%  0.014 250);

  /* ── Accent: deep pine green (MLWGS vibe) ── */
  --a-400: oklch(52% 0.12 150);
  --a-500: oklch(40% 0.10 150);
  --a-600: oklch(32% 0.09 150);
  --a-700: oklch(24% 0.08 150);

  /* ── Warm parchment text hue 70 ── */
  --p-0: oklch(96% 0.012 70);

  /* ── Semantic status ── */
  --s-500: oklch(62% 0.14 150);
  --w-500: oklch(72% 0.16 75);
  --d-500: oklch(60% 0.20 24);

  /* ── Typography ── */
  --font: "Inter", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", "Courier New", monospace;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:   cubic-bezier(0.4, 0, 0.2, 1);

  /* Ring geometry */
  --ring-c: 980.18;

  /* Accessible focus ring: ~12:1 on dark surfaces, ~4.5:1 on light */
  --focus-ring: oklch(0.84 0.012 70);
}

/* ── Dark theme (default) ── */
:root, [data-theme="dark"] {
  --surface-base:    #000000;
  --surface-raised:  #0a0a0a;
  --surface-overlay: #111111;
  --surface-sunken:  #050505;

  --text-primary:    var(--p-0);
  --text-secondary:  oklch(80% 0.012 70);
  --text-muted:      oklch(60% 0.012 70);
  --text-disabled:   oklch(45% 0.012 70);

  --border-subtle:   rgb(255 255 255 / 0.08);
  --border-strong:   rgb(255 255 255 / 0.16);

  --accent:          oklch(40% 0.07 150);
  --accent-hover:    oklch(52% 0.12 150);
  --accent-pressed:  oklch(32% 0.06 150);
  --accent-soft:     oklch(40% 0.07 150 / 0.12);
  --accent-glow:     oklch(40% 0.07 150 / 0.24);
  --accent-fg:       var(--n-0);
  --accent-text:     oklch(0.84 0.10 150);

  --success:         var(--s-500);
  --warning:         var(--w-500);
  --danger:          var(--d-500);

  --crimson:         var(--accent);
  --crimson-glow:    var(--accent-soft);
  --crimson-soft:    var(--accent-glow);

  --void:            var(--surface-base);
  --obsidian:        var(--surface-sunken);
  --obsidian-card:   var(--surface-raised);
  --charcoal:        var(--surface-overlay);
  --graphite:        var(--border-strong);
  --steel:           var(--text-muted);
  --ash:             var(--text-secondary);
  --silver:          var(--text-primary);
  --pure-white:      var(--text-primary);

  --shadow-sm: 0 0 0 1px rgb(0 0 0 / 0.06), 0 2px 4px rgb(0 0 0 / 0.10), 0 8px 16px -4px rgb(0 0 0 / 0.14);
  --shadow-md: 0 0 0 1px rgb(0 0 0 / 0.06), 0 4px 8px rgb(0 0 0 / 0.10), 0 12px 28px -6px rgb(0 0 0 / 0.16);
  --shadow-lg: 0 0 0 1px rgb(0 0 0 / 0.06), 0 8px 16px rgb(0 0 0 / 0.10), 0 24px 28px -12px rgb(0 0 0 / 0.16);
}

/* ── Light theme ── */
[data-theme="light"] {
  --surface-base:    var(--n-50);
  --surface-raised:  var(--n-0);
  --surface-overlay: var(--n-100);
  --surface-sunken:  var(--n-200);

  --text-primary:    var(--n-900);
  --text-secondary:  var(--n-600);
  --text-muted:      var(--n-500);
  --text-disabled:   var(--n-400);

  --border-subtle:   rgb(0 0 0 / 0.08);
  --border-strong:   rgb(0 0 0 / 0.16);

  --accent:          var(--a-600);
  --accent-hover:    var(--a-500);
  --accent-pressed:  var(--a-700);
  --accent-soft:     oklch(40% 0.09 150 / 0.10);
  --accent-glow:     oklch(40% 0.09 150 / 0.20);
  --accent-fg:       var(--n-0);
  --accent-text:     oklch(0.52 0.12 150);

  --success:         oklch(52% 0.14 150);
  --warning:         oklch(62% 0.16 75);
  --danger:          oklch(52% 0.20 24);

  --crimson:         var(--accent);
  --crimson-glow:    var(--accent-soft);
  --crimson-soft:    var(--accent-glow);

  --void:            var(--surface-base);
  --obsidian:        var(--surface-sunken);
  --obsidian-card:   var(--surface-raised);
  --charcoal:        var(--surface-overlay);
  --graphite:        var(--border-strong);
  --steel:           var(--text-muted);
  --ash:             var(--text-secondary);
  --silver:          var(--text-primary);
  --pure-white:      var(--text-primary);

  --shadow-sm: 0 0 0 1px rgb(0 0 0 / 0.06), 0 2px 4px rgb(0 0 0 / 0.06), 0 8px 16px -4px rgb(0 0 0 / 0.10);
  --shadow-md: 0 0 0 1px rgb(0 0 0 / 0.06), 0 4px 8px rgb(0 0 0 / 0.08), 0 12px 28px -6px rgb(0 0 0 / 0.12);
  --shadow-lg: 0 0 0 1px rgb(0 0 0 / 0.06), 0 8px 16px rgb(0 0 0 / 0.08), 0 24px 28px -12px rgb(0 0 0 / 0.12);
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html { color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }
html, body {
  min-height: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--surface-base);
  color: var(--text-primary);
  font-family: var(--font);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  -moz-osx-font-smoothing: grayscale;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

::selection {
  background: var(--accent);
  color: var(--accent-fg);
}

/* One visible keyboard focus indicator everywhere */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[contenteditable]:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--focus-ring) !important;
  outline-offset: 2px !important;
}

input, button, select, textarea {
  font-family: inherit;
  font-weight: inherit;
}


/* ── YouTube Background ────────────────────────────────────── */
.yt-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.yt-bg iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120vw;
  height: 120vh;
  transform: translate(-50%, -50%);
  border: 0;
  pointer-events: none;
}

/* ── Fluid Background Canvas ───────────────────────────────── */
#fluidCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: auto;
}


/* ── Skip link ─────────────────────────────────────────────── */
.skip-link {
  position: fixed; top: -60px; left: 16px; z-index: 200;
  padding: 10px 16px; border-radius: 8px; background: var(--surface-raised);
  color: var(--text-primary); border: 1px solid var(--border-strong);
}
.skip-link:focus { top: 12px; }

/* ── App Shell Overlay ─────────────────────────────────────── */
.app {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}
.app > * { pointer-events: auto; }


/* ── Top Bar ───────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  flex-shrink: 0;
  gap: 16px;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.topbar-right {
  justify-content: flex-end;
}
.topbar-center {
  flex: 0;
  white-space: nowrap;
}

.logo-mark {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  user-select: none;
  transition: color 0.3s;
}

/* Mode pill */
.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px 5px 10px;
  border-radius: 999px;
  background: var(--crimson-glow);
  border: 1px solid var(--crimson-soft);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--crimson);
  text-transform: uppercase;
  transition: color, background-color, border-color, opacity, transform 0.4s var(--ease-out-expo);
  user-select: none;
}
.mode-pill.break-mode {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--ash);
}
.mode-pill.break-mode .mode-dot {
  background: var(--ash);
  box-shadow: none;
}

.mode-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--crimson);
  box-shadow: 0 0 6px var(--crimson);
  transition: color, background-color, border-color, opacity, transform 0.4s var(--ease-out-expo);
}
.mode-dot.pulsing {
  animation: dotPulse 2s ease-in-out infinite;
}

/* Session dots */
.session-tracker {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}
.session-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--graphite);
  transition: color, background-color, border-color, opacity, transform 0.4s var(--ease-out-expo);
}
.session-dot.completed {
  background: var(--crimson);
  box-shadow: 0 0 6px var(--crimson-soft);
}
.session-dot.active {
  background: var(--crimson);
  box-shadow: 0 0 6px var(--crimson-soft);
  animation: dotPulse 2.4s ease-in-out infinite;
}
.session-dot.pop {
  animation: dotPop 0.5s var(--ease-out-expo);
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(1.3); }
}
@keyframes dotPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.8); }
  100% { transform: scale(1); }
}

.topbar-pill-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--graphite);
  color: var(--silver);
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: color, background-color, border-color, opacity, transform 0.2s ease;
  user-select: none;
  pointer-events: auto !important;
}
.topbar-pill-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--pure-white);
  border-color: var(--steel);
}

.topbar-icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--graphite);
  color: var(--silver);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color, background-color, border-color, opacity, transform 0.2s ease;
  pointer-events: auto !important;
  position: relative;
  z-index: 5;
}
.topbar-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--pure-white);
  border-color: var(--steel);
  transform: rotate(20deg);
}


/* ── Dashboard (Centered Workspace) ────────────────────────── */
.dashboard {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  position: relative;
  overflow: hidden;
  pointer-events: none;
}
.dashboard .controls,
.dashboard .tasks-toggle-btn,
.dashboard .settings-bottom-left,
.dashboard .timer-block,
.dashboard .greeting-block {
  pointer-events: auto;
}


/* ── Greeting + Clock Block (Idle state) ───────────────────── */
.greeting-block {
  text-align: center;
  transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
}
.greeting-block.hidden {
  opacity: 0;
  transform: scale(0.96) translateY(-10px);
  pointer-events: none;
  position: absolute;
}

.greeting-text {
  font-size: 17px;
  color: var(--ash);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  font-weight: 400;
}

.clock {
  font-size: clamp(56px, 10vw, 96px);
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text-primary);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: color, background-color, border-color, opacity, transform 0.3s ease;
}

.logo-mark {
  font-family: 'IBM Plex Mono', 'SF Mono', monospace;
  letter-spacing: 0.1em;
}

.greeting-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
  letter-spacing: 0;
}


/* ── Timer Block (Active state) ────────────────────────────── */
.timer-block {
  text-align: center;
  opacity: 0;
  transform: scale(0.96) translateY(10px);
  pointer-events: none;
  position: absolute;
  transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
}
.timer-block.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
  position: relative;
}

/* Super-Pomodoro Phase Badge */
.stage-badge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 16px;
}
.stage-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--accent-text);
  letter-spacing: 0;
}
.stage-hint {
  font-size: 11px;
  color: var(--steel);
}

.timer-ring-wrap {
  position: relative;
  width: 310px;
  height: 310px;
  margin: 0 auto;
}

.timer-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.04);
  stroke-width: 3.5;
}

.ring-progress {
  fill: none;
  stroke: var(--crimson);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: var(--ring-c);
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.15s linear, stroke 0.3s;
  filter: drop-shadow(0 0 10px var(--crimson-soft));
}

.timer-running .ring-progress {
  animation: ringGlow 3.5s ease-in-out infinite;
}

@keyframes ringGlow {
  0%, 100% { filter: drop-shadow(0 0 6px var(--crimson-soft)); }
  50%      { filter: drop-shadow(0 0 18px var(--crimson-glow)); }
}

.timer-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.timer-time {
  font-size: clamp(48px, 8.5vw, 68px);
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--pure-white);
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.timer-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  user-select: none;
}

/* Super-Pomodoro Phase 2 Flowtime Live Earned Rest Badge */
.flowtime-earned-wrap {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.flowtime-earned-text {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--crimson);
  letter-spacing: 0.02em;
}
.flowtime-ratio-hint {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--steel);
}

/* Finish Flow CTA Button */
.flow-finish-wrap {
  margin-top: 14px;
}
.flow-finish-btn {
  background: var(--charcoal);
  border: 1px solid var(--graphite);
  color: var(--silver);
  font-size: 12px;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: color, background-color, border-color, opacity, transform 0.2s;
}
.flow-finish-btn:hover {
  background: var(--graphite);
  color: var(--pure-white);
  border-color: var(--crimson);
}

/* Completion flash */
.timer-complete .timer-time {
  animation: flashComplete 1.2s ease;
}
@keyframes flashComplete {
  0%, 100% { opacity: 1; color: var(--pure-white); }
  25%      { opacity: 0.2; color: var(--crimson); }
  50%      { opacity: 1; color: var(--crimson); }
  75%      { opacity: 0.2; }
}


/* ── Quote Block (Top Right Corner) ────────────────────────── */
.quote-corner {
  position: fixed;
  top: 20px;
  right: 28px;
  text-align: right;
  z-index: 10;
  pointer-events: none;
  max-width: 220px;
}
.quote-text-corner {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ash);
  font-style: italic;
  font-weight: 500;
  margin: 0 0 3px 0;
}
.quote-author-corner {
  font-size: 12px;
  color: var(--steel);
  font-weight: 600;
  margin: 0;
}

/* ── Controls ──────────────────────────────────────────────── */
.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
  position: relative;
  z-index: 10;
  pointer-events: auto !important;
}

.ctrl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  transition: color, background-color, border-color, opacity, transform 0.2s ease;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 12;
  pointer-events: auto !important;
}
.ctrl-btn * {
  pointer-events: none;
  transition: opacity 0.18s ease, filter 0.18s ease, transform 0.18s ease;
}
.icon-play, .icon-pause { position: absolute; }
.icon-play.hidden-icon, .icon-pause.hidden-icon { opacity: 0; filter: blur(4px); transform: scale(0.85); }
.ctrl-btn:focus-visible {
  outline: 2px solid var(--crimson);
  outline-offset: 3px;
}
.ctrl-btn:active { transform: scale(0.96); }

.ctrl-primary {
  width: 58px;
  height: 58px;
  background: var(--crimson);
  color: var(--pure-white);
  box-shadow: 0 0 24px var(--crimson-glow);
}
.ctrl-primary:hover {
  filter: brightness(1.15);
  box-shadow: 0 0 36px var(--crimson-soft);
}

.ctrl-secondary {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--silver);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.ctrl-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--pure-white);
}


/* ── Settings Button (Bottom Left) ── */
.settings-bottom-left {
  position: fixed;
  bottom: 80px;
  left: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(20, 20, 20, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--silver);
  cursor: pointer;
  transition: color, background-color, border-color, opacity, transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto !important;
  z-index: 25;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.settings-bottom-left:hover {
  border-color: var(--crimson);
  background: rgba(220, 20, 60, 0.15);
  color: var(--crimson);
  transform: scale(1.05);
}
.settings-bottom-left:active { transform: scale(0.95); }

/* ── Tasks Panel (Slide-out from Right) ────────────────────── */
.tasks-toggle-btn {
  position: fixed;
  bottom: 80px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(20, 20, 20, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--silver);
  cursor: pointer;
  transition: color, background-color, border-color, opacity, transform 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  pointer-events: auto !important;
  z-index: 25;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.tasks-toggle-btn:hover {
  border-color: var(--crimson);
  background: rgba(220, 20, 60, 0.15);
  color: var(--crimson);
  transform: scale(1.05);
}
.tasks-toggle-btn:active { transform: scale(0.95); }
.tasks-toggle-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}
.tasks-count {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 700;
  margin-top: 2px;
  opacity: 0.7;
}

.tasks-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  height: 100vh;
  height: 100dvh;
  background: var(--surface-raised);
  border-left: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 30;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s var(--ease-out-expo);
  pointer-events: none;
  opacity: 0;
  box-shadow: var(--shadow-lg);
}

/* thin scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.tasks-panel.open {
  transform: translateX(0);
  pointer-events: auto;
  opacity: 1;
}
.tasks-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--graphite);
  flex-shrink: 0;
}
.tasks-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--pure-white);
  letter-spacing: -0.02em;
}
.tasks-close-btn {
  background: none;
  border: none;
  color: var(--ash);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.2s;
}
.tasks-close-btn:hover { color: var(--pure-white); }

.tasks-input-wrap {
  display: flex;
  gap: 6px;
  padding: 16px 24px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--graphite);
}
.tasks-input-wrap input {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--obsidian);
  border: 1px solid var(--graphite);
  color: var(--pure-white);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  outline: none;
}
.tasks-input-wrap input:focus { border-color: var(--crimson); }
.tasks-input-wrap select {
  flex: 0 0 86px;
  width: 86px;
  min-width: 0;
  background: var(--obsidian); border: 1px solid var(--graphite); color: var(--text-primary);
  padding: 8px 4px; border-radius: 10px; font-size: 11px; outline: none;
}
.tasks-input-wrap select:focus { border-color: var(--accent); }
.tasks-input-wrap button {
  flex: 0 0 36px;
  min-width: 36px;
  background: var(--crimson);
  border: none;
  color: var(--pure-white);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: filter 0.2s;
}
.tasks-input-wrap button:hover { filter: brightness(1.15); }

.tasks-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}
.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: color, background-color, border-color, opacity, transform 0.2s;
}
.task-item:hover { background: rgba(255, 255, 255, 0.06); }
.task-item.completed { opacity: 0.5; }
.task-item.active-task { border-color: var(--accent); background: var(--accent-soft); }
.task-item.active-task .task-text { color: var(--text-primary); font-weight: 500; }
.task-item.completed .task-text { text-decoration: line-through; }
.task-checkbox {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--graphite);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color, background-color, border-color, opacity, transform 0.2s;
}
.task-checkbox:hover { border-color: var(--crimson); }
.task-checkbox.checked {
  border-color: var(--crimson);
  background: var(--crimson);
}
.task-checkbox.checked::after {
  content: '✓';
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}
.task-text {
  flex: 1;
  font-size: 14px;
  color: var(--silver);
  background: none;
  border: none;
  text-align: left;
  padding: 4px 2px;
  cursor: pointer;
  min-height: 24px;
}
.task-text:hover { color: var(--text-primary); }
.task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.task-rec { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-type {
  background: var(--surface-sunken); border: 1px solid var(--border-subtle); color: var(--text-secondary);
  padding: 4px 6px; border-radius: 8px; font-size: 11px; outline: none; max-width: 100px; flex-shrink: 0;
}
.task-type:focus { border-color: var(--accent); }
.task-item.active-task .task-type { color: var(--accent-text); border-color: var(--accent); }
.task-delete {
  background: none;
  border: none;
  color: var(--graphite);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.2s;
  flex-shrink: 0;
}
.task-delete:hover { color: var(--crimson); }

.tasks-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--ash);
  font-size: 14px;
}


/* ── Hint Bar (Footer) ─────────────────────────────────────── */
.hint-bar {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 16px 24px;
  flex-shrink: 0;
  position: relative;
  z-index: 5;
  pointer-events: auto !important;
}

.hint {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 400;
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--graphite);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ash);
  margin-right: 3px;
  background: var(--obsidian);
}


/* ─────────────────────────────────────────────────────────────
   SETTINGS MODAL (Dark Obsidian Card Dialog)
   ───────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 5, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out-expo), visibility 0.3s var(--ease-out-expo);
}
.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-dialog {
  background: var(--obsidian-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  width: 100%;
  max-width: 640px;
  max-height: min(90vh, 760px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: scale(0.96) translateY(8px);
  transition: transform 0.35s var(--ease-out-expo);
  overflow: hidden;
  pointer-events: none;
  flex-shrink: 0;
}
.modal-dialog .tab-pane {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 40px;
}
.modal-dialog input,
.modal-dialog select,
.modal-dialog textarea {
  background: var(--obsidian);
  color: var(--pure-white);
  border: 1px solid var(--graphite);
}
.modal-dialog input::placeholder,
.modal-dialog select::placeholder,
.modal-dialog textarea::placeholder {
  color: var(--ash);
}
.tab-pane {
  display: none;
  padding: 20px 24px 60px;
  box-sizing: border-box;
}
.modal-backdrop.open .modal-dialog {
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--graphite);
  flex-shrink: 0;
}
.modal-title {
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--pure-white);
}
.modal-close-btn {
  background: none;
  border: none;
  color: var(--ash);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.2s;
}
.modal-close-btn:hover { color: var(--pure-white); }

/* Modal Tabs */
.modal-tabs { 
  display: flex; 
  gap: 8px; 
  padding: 12px 24px 0; 
  border-bottom: 1px solid var(--border-subtle); 
  overflow-x: auto; 
  flex-shrink: 0;
  position: sticky; 
  top: 57px;  /* Below modal-header height */ 
  z-index: 9; 
  background: var(--surface-raised); 
}
.modal-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ash);
  padding: 8px 14px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: color, background-color, border-color, opacity, transform 0.2s;
  white-space: nowrap;
}
.modal-tab:hover { color: var(--pure-white); }
.modal-tab.active {
  color: var(--crimson);
  border-bottom-color: var(--crimson);
}

/* Tab Panes */
.tab-pane {
  display: none;
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}
.tab-pane.active { display: block; }

/* Settings Group */
.settings-group {
  margin-bottom: 24px;
}
.settings-group:last-child { margin-bottom: 0; }
.settings-label {
  display: block;
  font-size: 12px;
  letter-spacing: 0;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 400;
}
.settings-hint {
  font-size: 12px;
  color: var(--steel);
  margin-top: 8px;
}
.settings-hint strong { color: var(--silver); }

/* Text & Number Inputs */
.input-field input {
  width: 100%;
  background: var(--obsidian);
  border: 1px solid var(--graphite);
  color: var(--pure-white);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-field input:focus {
  border-color: var(--crimson);
  box-shadow: 0 0 0 3px var(--crimson-glow);
}

/* Inputs Grid */
.settings-section-header { margin-bottom: 16px; }
.settings-section-header h3 {
  font-size: 15px;
  color: var(--pure-white);
  margin-bottom: 4px;
}
.settings-section-header p {
  font-size: 12px;
  color: var(--ash);
}
.settings-inputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.input-field { display: flex; flex-direction: column; gap: 6px; }
.input-field label {
  font-size: 12px;
  color: var(--silver);
}

/* Method Cards Grid */
.method-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.method-card {
  background: var(--obsidian);
  border: 1px solid var(--graphite);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: color, background-color, border-color, opacity, transform 0.2s ease;
}
.method-card:hover { border-color: var(--steel); background: var(--charcoal); }
.method-card.active {
  border-color: var(--crimson);
  background: rgba(220, 20, 60, 0.06);
  box-shadow: 0 0 16px var(--crimson-glow);
}
.method-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.method-card-title {
  font-size: 14px;
  color: var(--pure-white);
}
.method-card-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--silver);
  text-transform: uppercase;
}
.method-card-badge-special {
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--crimson);
  color: var(--pure-white);
  text-transform: uppercase;
}
.method-card-desc {
  font-size: 11px;
  line-height: 1.5;
  color: var(--ash);
  font-weight: 400;
}

/* Method Explainer Card */
.method-explainer-card {
  margin-top: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--graphite);
  border-radius: 14px;
  padding: 14px 16px;
}
.explainer-title {
  font-size: 13px;
  color: var(--crimson);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.explainer-body {
  font-size: 12px;
  line-height: 1.55;
  color: var(--silver);
  font-weight: 400;
}

/* Accent Color Swatches */
.color-swatches-grid {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--swatch);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  outline: none;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active {
  border-color: var(--pure-white);
  box-shadow: 0 0 12px var(--swatch);
  transform: scale(1.15);
}

.custom-color-picker-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--obsidian);
  border: 1px solid var(--graphite);
  border-radius: 999px;
  cursor: pointer;
}
.custom-color-input {
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 50%;
}
.custom-color-label {
  font-size: 11px;
  color: var(--silver);
}

/* Fluid Modes Grid */
.fluid-modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.fluid-mode-card {
  background: var(--obsidian);
  border: 1px solid var(--graphite);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: color, background-color, border-color, opacity, transform 0.2s;
}
.fluid-mode-card:hover { background: var(--charcoal); border-color: var(--steel); }
.fluid-mode-card.active {
  border-color: var(--crimson);
  background: rgba(220, 20, 60, 0.06);
}
.fluid-mode-title {
  display: block;
  font-size: 13px;
  color: var(--pure-white);
  margin-bottom: 4px;
}
.fluid-mode-sub {
  font-size: 11px;
  line-height: 1.45;
  color: var(--ash);
  font-weight: 400;
}

/* App Names Grid */
.name-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.name-card {
  background: var(--obsidian);
  border: 1px solid var(--graphite);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: color, background-color, border-color, opacity, transform 0.2s;
}
.name-card:hover { background: var(--charcoal); border-color: var(--steel); }
.name-card.active {
  border-color: var(--crimson);
  background: rgba(220, 20, 60, 0.06);
}
.name-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.name-title {
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--pure-white);
}
.name-origin {
  font-size: 11px;
  color: var(--crimson);
}
.name-meaning {
  font-size: 11px;
  line-height: 1.45;
  color: var(--ash);
  font-weight: 400;
}

/* Switch Toggle */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  font-size: 13px;
  color: var(--silver);
}
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--graphite);
  border-radius: 24px;
  transition: 0.3s;
}
.slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--pure-white);
  border-radius: 50%;
  transition: 0.3s;
}
input:checked + .slider { background-color: var(--crimson); }
input:checked + .slider::before { transform: translateX(20px); }

/* Modal Footer */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid var(--graphite);
  background: var(--obsidian);
}

/* General Buttons */
.btn {
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: color, background-color, border-color, opacity, transform 0.2s;
  outline: none;
}
.btn:active { transform: scale(0.96); }
.btn-primary {
  background: var(--crimson);
  color: var(--pure-white);
}
.btn-primary:hover { filter: brightness(1.15); }
.btn-secondary {
  background: var(--graphite);
  color: var(--silver);
}
.btn-secondary:hover {
  background: var(--steel);
  color: var(--pure-white);
}


/* ── Clock Customization ── */
.clock-flip {
  display: inline-flex;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}
.clock-flip .flip-digit {
  display: inline-block;
  min-width: 28px;
  text-align: center;
  font-family: var(--font);
  font-weight: 700;
}
.clock-flip .flip-card {
  display: inline-block;
  perspective: 100px;
}
.clock-flip .flip-card-top,
.clock-flip .flip-card-bottom {
  display: inline-block;
  min-width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  background: var(--obsidian);
  border: 1px solid var(--graphite);
  border-bottom: none;
  overflow: hidden;
  position: relative;
}
.clock-flip .flip-card-top {
  border-radius: 4px 4px 0 0;
  z-index: 2;
}
.clock-flip .flip-card-bottom {
  border-radius: 0 0 4px 4px;
  border-top: none;
  border-bottom: 1px solid var(--graphite);
}
.clock-flip .flip-card-top::after,
.clock-flip .flip-card-bottom::after {
  content: attr(data-value);
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(24px, 4vw, 40px);
  font-weight: 700;
}
.clock-flip .flip-card-top::after {
  transform-origin: bottom;
  transform: rotateX(0deg);
}
.clock-flip .flip-card-bottom::after {
  transform-origin: top;
  transform: rotateX(0deg);
}

/* ── Timer Style Variants ── */
.timer-progress-bar {
  width: 260px;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.timer-progress-bar-fill {
  height: 100%;
  background: var(--crimson);
  width: 100%;
  transition: width 0.1s linear;
}
.timer-progress-bar-label {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--ash);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Gauge / Donut */
.timer-gauge {
  width: 200px;
  height: 200px;
  position: relative;
}
.timer-gauge svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.timer-gauge .gauge-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 8;
}
.timer-gauge .gauge-progress {
  fill: none;
  stroke: var(--crimson);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.1s linear;
}
.timer-gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Dot Matrix */
.timer-dot-matrix {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
}
.timer-dot-matrix .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transition: background 0.1s, transform 0.1s;
}
.timer-dot-matrix .dot.active {
  background: var(--crimson);
  box-shadow: 0 0 12px var(--crimson-glow);
  transform: scale(1.2);
}

/* Pie Chart */
.timer-pie {
  width: 180px;
  height: 180px;
  position: relative;
}
.timer-pie svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.timer-pie .pie-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 10;
}
.timer-pie .pie-progress {
  fill: none;
  stroke: var(--crimson);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.1s linear;
}
.timer-pie-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ── Settings Input Extensions ── */
.settings-inputs-grid select {
  width: 100%;
  background: var(--obsidian);
  border: 1px solid var(--graphite);
  color: var(--pure-white);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  outline: none;
  cursor: pointer;
}
.settings-inputs-grid select:focus {
  border-color: var(--crimson);
  box-shadow: 0 0 0 3px var(--crimson-glow);
}
.settings-inputs-grid input[type="color"] {
  width: 100%;
  height: 44px;
  background: none;
  border: none;
  border-radius: 12px;
  padding: 0;
  cursor: pointer;
}


/* ── Responsive Rules ──────────────────────────────────────── */
@media (max-width: 600px) {
  .topbar { padding: 14px 16px; }
  .modal-dialog { max-height: 92vh; border-radius: 16px; }
  .modal-header, .modal-footer, .tab-pane { padding: 14px 16px; }
  .modal-tabs { padding: 8px 16px 0; }

  .timer-ring-wrap { width: 250px; height: 250px; }
  .clock { font-size: 52px; }
  .timer-time { font-size: 46px; }
  .hint-bar { flex-wrap: wrap; gap: 8px 14px; padding: 10px 16px; }

  .controls { gap: 14px; margin-top: 24px; }
  .ctrl-primary { width: 50px; height: 50px; }
  .ctrl-secondary { width: 40px; height: 40px; }
}

@media (max-width: 380px) {
  .timer-ring-wrap { width: 220px; height: 220px; }
  .timer-time { font-size: 40px; }
  .session-tracker { gap: 5px; }
  .session-dot { width: 6px; height: 6px; }
  .topbar-pill-btn { display: none; }
}

/* ── Active task pill ── */
.active-task-pill {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface-overlay);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
}
.active-task-label { color: var(--text-muted); font-weight: 500; }
.active-task-name { color: var(--text-primary); font-weight: 500; }

/* ── Tasks empty state ── */
.tasks-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; gap: 8px; color: var(--text-muted); text-align: center; }
.tasks-empty-ill { color: var(--text-muted); opacity: 0.6; }
.tasks-empty-title { font-size: 14px; color: var(--text-secondary); font-weight: 400; margin: 0; }
.tasks-empty-sub { font-size: 12px; color: var(--text-muted); margin: 0; }

/* ── Work type + recommendation ── */
.work-type-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 24px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-muted);
}
.work-type-wrap select {
  flex: 1;
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  outline: none;
}
.recommendation-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--accent-soft);
  font-size: 12px;
}
.rec-label { color: var(--text-muted); font-weight: 500; }
.rec-method { color: var(--text-primary); font-weight: 600; }
.rec-reason { color: var(--text-secondary); flex-basis: 100%; font-size: 11px; }
.rec-apply {
  margin-left: auto;
  padding: 4px 10px;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
}

/* ── Session completion toast ── */
.session-toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  z-index: 60; padding: 10px 18px; border-radius: 10px;
  background: var(--surface-overlay); border: 1px solid var(--border-strong);
  color: var(--text-primary); font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-md); pointer-events: none;
  animation: toastIn 0.25s var(--ease-out-expo);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ── Screen reader only ── */
.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; }

@media (pointer: coarse) {
  input, select, textarea { font-size: 16px; }
}
.modal-backdrop, .tasks-panel, .org-modal-backdrop { overscroll-behavior: contain; }

/* ── Accessibility ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .settings-bottom-left, .tasks-toggle-btn, .tasks-panel, .ctrl-secondary {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--surface-raised) !important;
  }
}

/* ============================================================
   MODE RAIL (left sidebar)
   ============================================================ */
.mode-rail {
  position: fixed;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 46px;
  padding: 8px 6px;
  border-radius: 16px;
  background: rgba(20,20,20,0.55);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: width 0.28s var(--ease-out-expo), background 0.2s;
  overflow: hidden;
}
.mode-rail:hover, .mode-rail.expanded {
  width: 172px;
  background: rgba(20,20,20,0.85);
}
.mode-rail-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 24px; border: none; background: transparent; color: var(--text-muted);
  cursor: pointer; border-radius: 8px; flex-shrink: 0;
}
.mode-rail-toggle:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
.mode-rail.expanded .mode-rail-toggle svg { transform: rotate(180deg); }
.mode-rail-toggle svg { transition: transform 0.2s; }
.mode-rail-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}
.mode-rail-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 10px 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.mode-rail-item:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
.mode-rail-item.active { background: var(--accent-soft); color: var(--accent-text); }
.mode-rail-item svg { flex-shrink: 0; }
.mode-rail:not(:hover):not(.expanded) .mode-rail-item span { display: none; }
.mode-rail-item span { opacity: 0; transform: translateX(-6px); transition: opacity 0.2s, transform 0.2s; }
.mode-rail:hover .mode-rail-item, .mode-rail.expanded .mode-rail-item { justify-content: flex-start; }
.mode-rail:hover .mode-rail-item span, .mode-rail.expanded .mode-rail-item span { opacity: 1; transform: translateX(0); }

/* Views */
.view { display: contents; }

/* ============================================================
   ORGANIZATION MODE
   ============================================================ */
.org-shell {
  flex: 1; min-height: 0;
  padding: 24px 24px 24px 80px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.org-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.org-title { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; color: var(--text-primary); }
.org-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.org-actions { display: flex; gap: 8px; }
.org-btn {
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border-subtle);
  background: var(--surface-raised); color: var(--text-primary); font-size: 13px; cursor: pointer;
  transition: color, background-color, border-color, opacity, transform 0.15s;
}
.org-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.org-btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.org-btn.primary:hover { filter: brightness(1.1); }

.org-body { display: flex; gap: 16px; flex: 1; min-height: 0; }
.org-class-list {
  width: 220px; flex-shrink: 0;
  background: var(--surface-raised); border: 1px solid var(--border-subtle); border-radius: 14px;
  padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px;
}
.org-class-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  cursor: pointer; color: var(--text-secondary); font-size: 13px; transition: color, background-color, border-color, opacity, transform 0.15s;
  border: 1px solid transparent;
}
.org-class-item:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }
.org-class-item.active { background: var(--accent-soft); color: var(--accent-text); border-color: var(--border-subtle); }
.org-class-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.org-class-empty { font-size: 12px; color: var(--text-muted); padding: 12px; text-align: center; }

.org-board-wrap { flex: 1; min-width: 0; position: relative; }
.org-board {
  width: 100%; height: 100%;
  background: var(--surface-sunken); border: 1px solid var(--border-subtle); border-radius: 14px;
  position: relative; overflow: auto;
  background-image: radial-gradient(circle, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 24px 24px;
}
.org-board-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text-muted); font-size: 13px; pointer-events: none; text-align: center; }
.org-board-empty .empty-cta { pointer-events: auto; }

.org-card {
  position: absolute; width: 240px; min-height: 80px;
  background: var(--surface-raised); border: 1px solid var(--border-subtle); border-radius: 12px;
  padding: 12px; box-shadow: var(--shadow-sm); cursor: grab; user-select: none;
  display: flex; flex-direction: column; gap: 6px;
}
.org-card:active { cursor: grabbing; }
.org-card.dragging { opacity: 0.85; z-index: 50; }
.org-card-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.org-card-meta { font-size: 11px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 4px; }
.org-card-chip { padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); font-size: 10px; }
.org-card-link { font-size: 11px; color: var(--accent-text); text-decoration: none; word-break: break-all; }
.org-card-actions { display: flex; gap: 6px; margin-top: 4px; }
.org-card-btn { background: none; border: none; color: var(--text-muted); font-size: 11px; cursor: pointer; padding: 8px 10px; min-height: 24px; border-radius: 6px; }
.org-card-btn:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
.org-card-btn.danger:hover { color: var(--danger); }

.org-modal-backdrop {
  position: fixed; inset: 0; background: rgba(5,5,5,0.7); backdrop-filter: blur(8px);
  z-index: 120; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.org-modal {
  background: var(--surface-raised); border: 1px solid var(--border-subtle); border-radius: 16px;
  width: 100%; max-width: 520px; padding: 20px; box-shadow: var(--shadow-lg);
}
.org-modal h3 { font-size: 16px; color: var(--text-primary); margin-bottom: 14px; }
.org-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.org-field label { font-size: 12px; color: var(--text-secondary); }
.org-field input, .org-field select, .org-field textarea {
  background: var(--surface-sunken); border: 1px solid var(--border-subtle); color: var(--text-primary);
  padding: 9px 12px; border-radius: 10px; font-size: 13px; outline: none;
}
.org-field input:focus, .org-field select:focus, .org-field textarea:focus { border-color: var(--accent); }
.org-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.color-picker-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.color-choice {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent;
  background: var(--swatch, transparent); cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s;
}
.color-choice:hover { transform: scale(1.1); }
.color-choice.active { border-color: var(--text-primary); box-shadow: 0 0 0 3px var(--surface-base), 0 0 0 5px var(--focus-ring); }
.color-choice.custom { position: relative; overflow: hidden; border-color: var(--border-strong); background: var(--surface-sunken); color: var(--text-secondary); font-size: 16px; }
.color-choice.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.color-choice.custom span { pointer-events: none; }

/* ============================================================
   NOTES MODE
   ============================================================ */
.notes-shell {
  flex: 1; min-height: 0;
  padding: 24px 24px 24px 80px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.notes-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.notes-title { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; color: var(--text-primary); }
.notes-body { display: flex; gap: 16px; flex: 1; min-height: 0; }
.notes-list {
  width: 260px; flex-shrink: 0;
  background: var(--surface-raised); border: 1px solid var(--border-subtle); border-radius: 14px;
  padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px;
}
.notes-item {
  padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--text-secondary);
  font-size: 13px; border: 1px solid transparent; transition: color, background-color, border-color, opacity, transform 0.15s;
  display: flex; flex-direction: column; gap: 2px;
}
.notes-item:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }
.notes-item.active { background: var(--accent-soft); color: var(--accent-text); border-color: var(--border-subtle); }
.notes-item-title { font-weight: 500; }
.notes-item-meta { font-size: 12px; color: var(--text-muted); }
.notes-editor {
  flex: 1; min-width: 0;
  background: var(--surface-raised); border: 1px solid var(--border-subtle); border-radius: 14px;
  display: flex; flex-direction: column; overflow: hidden;
}
.notes-editor-top {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle); flex-shrink: 0; flex-wrap: wrap;
}
.notes-title-input {
  flex: 1; min-width: 120px; background: var(--surface-sunken); border: 1px solid var(--border-subtle);
  color: var(--text-primary); padding: 8px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; outline: none;
}
.notes-title-input:focus { border-color: var(--accent); }
.notes-toolbar {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 8px 16px; border-bottom: 1px solid var(--border-subtle); flex-shrink: 0;
}
.notes-toolbar button, .notes-toolbar select {
  background: var(--surface-sunken); border: 1px solid var(--border-subtle); color: var(--text-primary);
  padding: 6px 10px; border-radius: 8px; font-size: 12px; cursor: pointer;
}
.notes-toolbar button:hover { background: var(--accent-soft); color: var(--accent-text); }
.notes-toolbar button.active { background: var(--accent); color: var(--accent-fg); }
.notes-content {
  flex: 1; overflow-y: auto; padding: 24px 32px; outline: none;
  font-size: 15px; line-height: 1.6; color: var(--text-primary);
  min-height: 200px;
}
.notes-content h1 { font-size: 24px; margin: 12px 0 6px; }
.notes-content h2 { font-size: 20px; margin: 10px 0 4px; }
.notes-content p { margin: 6px 0; }
.notes-content ul, .notes-content ol { margin: 6px 0 6px 24px; }
.notes-content img { max-width: 100%; height: auto; border-radius: 8px; margin: 8px 0; }
.notes-content video { max-width: 100%; aspect-ratio: 16 / 9; border-radius: 8px; margin: 8px 0; }
.notes-attachments { padding: 12px 16px; border-top: 1px solid var(--border-subtle); display: flex; flex-wrap: wrap; gap: 6px; flex-shrink: 0; }
.notes-attach-chip { padding: 4px 10px; border-radius: 999px; background: var(--surface-sunken); border: 1px solid var(--border-subtle); font-size: 11px; color: var(--text-secondary); }
.notes-footer {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-top: 1px solid var(--border-subtle); flex-shrink: 0; flex-wrap: wrap;
}
.notes-footer select {
  background: var(--surface-sunken); border: 1px solid var(--border-subtle); color: var(--text-primary);
  padding: 8px 12px; border-radius: 10px; font-size: 12px;
}
.notes-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text-muted); font-size: 13px; text-align: center; padding: 24px; }

@media (max-width: 900px) {
  .org-body, .notes-body { flex-direction: column; }
  .org-class-list, .notes-list { width: 100%; max-height: 160px; }
  .org-shell, .notes-shell { padding-left: 70px; }
}

/* ============================================================
   75% minimalist / 12.5% neobrutalism / 12.5% glassmorphism
   ============================================================ */
:root {
  --neo-ink: #0b0b0d;
  --neo-yellow: #f5d90a;
  --neo-pink: #ff5c8a;
  --neo-blue: #3b82f6;
  --glass-tint: rgb(255 255 255 / 0.10);
  --glass-line: rgb(255 255 255 / 0.22);
}

.glass-surface {
  background: var(--glass-tint);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.14), 0 10px 34px rgb(0 0 0 / 0.28);
}
[data-theme="light"] .glass-surface {
  background: rgb(255 255 255 / 0.55);
  border-color: rgb(255 255 255 / 0.75);
}

.neo {
  border: 2px solid var(--neo-ink);
  box-shadow: 4px 4px 0 var(--neo-ink);
  border-radius: 8px;
  font-weight: 700;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.neo:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--neo-ink); }
.neo:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--neo-ink); }

/* Apply glass to floating chrome only (≈12.5%) */
.mode-rail { background: rgb(20 20 20 / 0.45); backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%); border-color: var(--glass-line); }
.mode-rail:hover, .mode-rail.expanded { background: rgb(20 20 20 / 0.72); }
.org-modal-backdrop .org-modal,
.modal-dialog { background: rgb(18 18 20 / 0.82); backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%); border-color: var(--glass-line); }
[data-theme="light"] .org-modal-backdrop .org-modal,
[data-theme="light"] .modal-dialog { background: rgb(255 255 255 / 0.82); }

/* Apply neobrutalism to primary actions / active navigation (≈12.5%) */
.org-btn.primary,
.notes-footer .export-btn,
#noteExportBtn { border: 2px solid var(--neo-ink); box-shadow: 3px 3px 0 var(--neo-ink); border-radius: 8px; font-weight: 700; }
.org-btn.primary:hover,
.notes-footer .export-btn:hover,
#noteExportBtn:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--neo-ink); }
.mode-rail-item.active { border: 2px solid var(--neo-ink); box-shadow: 3px 3px 0 var(--neo-ink); border-radius: 8px; font-weight: 700; }
.org-card-chip.neo-chip { border: 2px solid var(--neo-ink); box-shadow: 2px 2px 0 var(--neo-ink); border-radius: 6px; background: var(--neo-yellow); color: var(--neo-ink); font-weight: 700; }

/* Board connectors (assignment ↔ shared website) */
.org-connectors { position: absolute; inset: 0; pointer-events: none; z-index: 1; overflow: visible; }
.org-connectors path { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 4; opacity: 0.85; }
.org-connectors circle { fill: var(--accent); }
.org-card { z-index: 2; }
.org-card.linked { box-shadow: 3px 3px 0 var(--accent), var(--shadow-sm); }
.org-link-chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  padding: 3px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text);
  font-size: 11px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: pointer; border: 1px solid var(--border-subtle);
}
.org-link-chip:hover { background: var(--accent); color: var(--accent-fg); }
.org-empty-cta { margin-top: 0; }
.empty-cta { display: inline-flex; margin-top: 0; }

/* ── Note type interfaces ── */
.notes-editor[data-type="pdf"] .notes-content { padding: 0; background: rgb(0 0 0 / 0.35); }
.note-doc-pdf {
  width: min(760px, 100%); min-height: 940px; margin: 24px auto;
  background: #fffef9; color: #1b1b1b; padding: 64px 68px;
  border-radius: 2px; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.08), 0 2px 6px rgb(0 0 0 / 0.18), 0 18px 44px rgb(0 0 0 / 0.32);
  font-family: Georgia, "Times New Roman", serif; font-size: 16px; line-height: 1.75;
  outline: none;
}
.note-doc-pdf h1 { font-size: 30px; border-bottom: 2px solid #1b1b1b; padding-bottom: 10px; margin: 0 0 18px; }
.note-doc-pdf .note-page-num { display: block; margin-top: 36px; text-align: center; font-size: 11px; color: #777; }

.notes-editor[data-type="pptx"] .notes-content { padding: 0; background: rgb(0 0 0 / 0.32); }
.slide-workspace { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18px; }
.slide-canvas {
  width: min(900px, 100%); aspect-ratio: 16 / 9;
  background: #ffffff; color: #101418; padding: 40px 48px; overflow: auto;
  border: 2px solid var(--neo-ink); box-shadow: 6px 6px 0 var(--neo-ink);
  font-family: "Inter", system-ui, sans-serif; outline: none;
}
.slide-canvas h1 { font-size: 34px; line-height: 1.15; margin: 0 0 12px; }
.slide-canvas h2 { font-size: 24px; margin: 0 0 8px; }
.slide-canvas ul { margin-left: 28px; }
.slide-strip { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.slide-thumb {
  width: 96px; aspect-ratio: 16/9; border: 2px solid var(--border-strong); border-radius: 4px;
  background: #fff; color: #111; font-size: 7px; padding: 6px; overflow: hidden; cursor: default;
}
.slide-thumb.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.slide-add {
  background: var(--surface-raised); border: 1px solid var(--border-subtle); color: var(--text-primary);
  padding: 6px 12px; border-radius: 8px; font-size: 12px; cursor: pointer;
}

.notes-editor[data-type="xlsx"] .notes-content { padding: 0; background: var(--surface-raised); }
.sheet-toolbar-note { padding: 8px 14px; font-size: 11px; color: var(--text-muted); border-bottom: 1px solid var(--border-subtle); }
.sheet-grid {
  display: grid; grid-template-columns: 46px repeat(8, minmax(110px, 1fr));
  min-width: 900px; font-size: 13px; user-select: none;
}
.sheet-cell {
  font-variant-numeric: tabular-nums;
  min-height: 30px; border-right: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle);
  padding: 6px 8px; outline: none; overflow: hidden; text-overflow: ellipsis;
}
.sheet-cell:focus { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.sheet-head {
  background: var(--surface-overlay); color: var(--text-secondary); font-weight: 600; text-align: center;
  position: sticky; top: 0; z-index: 2;
}
.sheet-rowhead {
  background: var(--surface-overlay); color: var(--text-muted); text-align: center; font-size: 11px;
  position: sticky; left: 0; z-index: 1;
}
.sheet-corner { background: var(--surface-overlay); position: sticky; top: 0; left: 0; z-index: 3; }

/* Export destination modal */
.export-option {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px;
  border: 2px solid transparent; border-radius: 10px; cursor: pointer; transition: color, background-color, border-color, opacity, transform 0.15s;
}
.export-option:hover { background: rgb(255 255 255 / 0.04); }
.export-option.selected { border-color: var(--accent); background: var(--accent-soft); }
.export-option input { margin-top: 3px; accent-color: var(--accent); }

.drive-setup-step {
  font-size: 12px; color: var(--text-secondary); line-height: 1.5;
  padding: 8px 0; border-bottom: 1px solid var(--border-subtle);
}
.drive-setup-step strong { color: var(--accent-text); margin-right: 4px; }
.drive-setup-step code {
  display: inline-block; padding: 2px 6px; border-radius: 6px;
  background: var(--surface-sunken); border: 1px solid var(--border-subtle);
  color: var(--text-primary); font-size: 11px; word-break: break-all;
}
.export-option strong { display: block; font-size: 13px; color: var(--text-primary); }
.export-option small { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }
