:root {
  color-scheme: light;
  --ink: #24302f;
  --muted: #61706d;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --panel-soft: #f4f8f5;
  --field: #ffffff;
  --line: #d9e1db;
  --accent-soft: #e8f4ee;
  --stage-top: #eaf6ff;
  --stage-bottom: #f6f0d2;
  --break-bg: #24302f;
  --mint: #bfe8d4;
  --green: #2d7d68;
  --yellow: #ffd86f;
  --coral: #ef7a6b;
  --blue: #78a8e8;
  --plum: #8c6ac8;
  --shadow: 0 18px 50px rgba(42, 58, 54, 0.14);
}

body[data-theme="yellow"] {
  --paper: #fffaf0;
  --panel-soft: #fff6d8;
  --line: #eadfbf;
  --accent-soft: #fff1bc;
  --green: #8a6a12;
  --mint: #f8e6a5;
  --yellow: #ffe084;
  --coral: #ef927d;
  --blue: #9bbfe8;
  --plum: #b497d6;
  --stage-top: #fff8dc;
  --stage-bottom: #f6e8a9;
}

body[data-theme="blue"] {
  --paper: #f2f8ff;
  --panel-soft: #eaf4ff;
  --line: #cadbea;
  --accent-soft: #dfefff;
  --green: #2c6f91;
  --mint: #bfe3ef;
  --yellow: #f7d985;
  --coral: #ef8d85;
  --blue: #8dc2f3;
  --plum: #a49be0;
  --stage-top: #e3f4ff;
  --stage-bottom: #edf7ff;
}

body[data-theme="green"] {
  --paper: #f3fbf6;
  --panel-soft: #e8f7ed;
  --line: #c9dfd0;
  --accent-soft: #def2e5;
  --green: #3f7d55;
  --mint: #bde8ca;
  --yellow: #f5dc90;
  --coral: #ef927d;
  --blue: #9bbfe8;
  --plum: #b497d6;
  --stage-top: #eafff0;
  --stage-bottom: #dff3e6;
}

body[data-theme="pink"] {
  --paper: #fff5f8;
  --panel-soft: #ffeaf1;
  --line: #ead0d9;
  --accent-soft: #ffe1eb;
  --green: #9a5770;
  --mint: #f6c7d9;
  --yellow: #ffe08e;
  --coral: #f18ca4;
  --blue: #aac6f2;
  --plum: #c9a2df;
  --stage-top: #fff0f5;
  --stage-bottom: #ffe4ee;
}

body[data-theme="purple"] {
  --paper: #faf6ff;
  --panel-soft: #f1e9ff;
  --line: #d8caea;
  --accent-soft: #eee3ff;
  --green: #6b5a9a;
  --mint: #d5c5f0;
  --yellow: #f5dc90;
  --coral: #e894a5;
  --blue: #aebff0;
  --plum: #b99adf;
  --stage-top: #f4edff;
  --stage-bottom: #ece4ff;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f2f2f2;
  --muted: #b8b8b8;
  --paper: #050505;
  --panel: #151515;
  --panel-soft: #202020;
  --field: #0b0b0b;
  --line: #343434;
  --accent-soft: #252525;
  --break-bg: #0a0a0a;
  --green: #d8d8d8;
  --mint: #3a3a3a;
  --yellow: #6a6a6a;
  --coral: #8a8a8a;
  --blue: #555555;
  --plum: #747474;
  --stage-top: #161616;
  --stage-bottom: #090909;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--mint) 62%, transparent), color-mix(in srgb, var(--yellow) 32%, transparent)),
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 0.72rem 1rem;
  color: #fff;
  background: var(--green);
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0.72rem 1rem;
  color: #fff;
  background: var(--green);
  font-weight: 800;
  text-decoration: none;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  color: var(--ink);
  background: var(--field);
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.topbar,
.timer-band,
.panel,
.settings-panel,
.settings-page {
  border: 1px solid rgba(36, 48, 47, 0.08);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 128px;
  padding: 24px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 0;
  font-size: clamp(2rem, 6vw, 4.7rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.streak-pill {
  display: grid;
  min-width: 112px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

.streak-number {
  color: var(--coral);
  font-size: 2rem;
  line-height: 1;
}

.timer-band {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  overflow: hidden;
  padding: 18px 20px 24px;
}

.timer-status {
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
}

.timer-status span {
  color: var(--muted);
  font-weight: 800;
}

.timer-status strong {
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1;
}

.timer-controls {
  display: flex;
  align-items: end;
  gap: 10px;
}

.timer-controls label {
  min-width: 128px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.quiet-button {
  color: var(--green);
  background: var(--accent-soft);
}

.timer-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 8px;
  background: var(--line);
}

.timer-progress span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--yellow), var(--coral));
  transition: width 250ms linear;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.12fr) minmax(300px, 0.88fr);
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 18px;
}

.settings-panel {
  padding: 18px;
}

.settings-page {
  padding: 18px;
}

.settings-topbar {
  min-height: 188px;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
}

.theme-option {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  background: var(--field);
  text-align: left;
}

.theme-option[aria-checked="true"] {
  outline: 3px solid color-mix(in srgb, var(--green) 42%, transparent);
}

.theme-swatch {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(36, 48, 47, 0.16);
  border-radius: 50%;
}

.theme-name {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 800;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 0;
  font-size: 1.35rem;
}

.task-form {
  display: grid;
  grid-template-columns: minmax(140px, 0.8fr) minmax(180px, 1fr) auto;
  gap: 10px;
  margin-bottom: 16px;
}

.subject-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

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

.subject-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  background: var(--panel-soft);
}

.subject-card h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.98rem;
}

.task-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.task-list {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--line);
}

.task-item {
  display: grid;
  grid-template-columns: 24px 1fr 32px;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 10px;
  background: var(--panel);
}

.task-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.task-item span {
  overflow-wrap: anywhere;
}

.task-item.done span {
  color: var(--muted);
  text-decoration: line-through;
}

.mini-button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
}

.empty-state {
  margin: 0;
  padding: 16px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 58%, transparent);
}

.wheel-panel {
  min-height: 512px;
}

.wheel-wrap {
  position: relative;
  display: grid;
  width: min(340px, 100%);
  aspect-ratio: 1;
  margin: 8px auto 18px;
  place-items: center;
}

.wheel {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border: 10px solid var(--panel);
  border-radius: 50%;
  background: conic-gradient(var(--mint) 0deg 60deg, var(--yellow) 60deg 120deg, var(--coral) 120deg 180deg, var(--blue) 180deg 240deg, var(--plum) 240deg 300deg, #9edbc2 300deg 360deg);
  box-shadow: inset 0 0 0 1px rgba(36, 48, 47, 0.14), var(--shadow);
  transition: transform 2.6s cubic-bezier(0.18, 0.78, 0.18, 1);
}

.wheel::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 84px;
  height: 84px;
  border: 10px solid var(--panel);
  border-radius: 50%;
  background: var(--ink);
  transform: translate(-50%, -50%);
}

.wheel-pointer {
  position: absolute;
  top: -4px;
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 30px solid var(--ink);
  z-index: 3;
}

.picked-task {
  min-height: 76px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 700;
}

.complete-button {
  width: 100%;
  margin-top: 10px;
}

.chick-panel,
.cooldown-panel {
  min-height: 384px;
}

.chick-stage {
  display: grid;
  place-items: end center;
  min-height: 220px;
  padding: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--stage-top), var(--stage-bottom));
  overflow: hidden;
}

.age-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  background: var(--field);
  font-size: 0.84rem;
  font-weight: 800;
}

.chick {
  position: relative;
  justify-self: center;
  width: var(--chick-size, 112px);
  height: var(--chick-size, 112px);
  border-radius: 48% 48% 44% 44%;
  background: radial-gradient(circle at 36% 28%, #fff2a9 0 18%, var(--yellow) 19% 100%);
  box-shadow: inset -10px -14px 0 rgba(210, 155, 44, 0.16), 0 14px 25px rgba(36, 48, 47, 0.18);
  transition: width 250ms ease, height 250ms ease;
}

.chick::before,
.chick::after {
  content: "";
  position: absolute;
  bottom: -10px;
  width: 28px;
  height: 10px;
  border-radius: 999px;
  background: #d9892f;
}

.chick::before {
  left: 25%;
}

.chick::after {
  right: 25%;
}

.chick-eye {
  position: absolute;
  top: 35%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
}

.chick-eye.left {
  left: 34%;
}

.chick-eye.right {
  right: 34%;
}

.beak {
  position: absolute;
  top: 46%;
  left: 50%;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 18px solid #ee8b3a;
}

.wing {
  position: absolute;
  right: -4%;
  top: 48%;
  width: 34%;
  height: 30%;
  border-radius: 50%;
  background: rgba(218, 167, 49, 0.45);
  transform: rotate(-12deg);
}

.accessory {
  position: absolute;
  display: none;
  z-index: 4;
}

.has-hat .accessory-hat {
  display: block;
  top: -16%;
  left: 30%;
  width: 42%;
  height: 24%;
  border-radius: 8px 8px 3px 3px;
  background: var(--blue);
  box-shadow: 0 10px 0 -6px #2f558f;
}

.has-glasses .accessory-glasses {
  display: block;
  top: 32%;
  left: 25%;
  width: 50%;
  height: 18%;
  border-top: 5px solid var(--ink);
  border-left: 5px solid var(--ink);
  border-right: 5px solid var(--ink);
  border-radius: 16px 16px 0 0;
}

.has-bow .accessory-bow {
  display: block;
  top: 8%;
  right: 10%;
  width: 28%;
  height: 18%;
  background: var(--coral);
  clip-path: polygon(0 0, 45% 45%, 0 100%, 100% 100%, 55% 45%, 100% 0);
}

.has-scarf .accessory-scarf {
  display: block;
  top: 62%;
  left: 22%;
  width: 58%;
  height: 13%;
  border-radius: 999px;
  background: var(--plum);
  box-shadow: 20px 12px 0 -3px color-mix(in srgb, var(--plum) 82%, #000);
}

.has-headphones .accessory-headphones {
  display: block;
  top: 23%;
  left: 18%;
  width: 64%;
  height: 28%;
  border: 6px solid var(--ink);
  border-bottom: 0;
  border-radius: 34px 34px 0 0;
}

.has-headphones .accessory-headphones::before,
.has-headphones .accessory-headphones::after {
  content: "";
  position: absolute;
  top: 56%;
  width: 14px;
  height: 24px;
  border-radius: 8px;
  background: var(--blue);
}

.has-headphones .accessory-headphones::before {
  left: -10px;
}

.has-headphones .accessory-headphones::after {
  right: -10px;
}

.inventory-title {
  margin: 14px 0 8px;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.accessory-tray {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.accessory-chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--field);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-align: left;
}

.accessory-chip.is-equipped {
  color: var(--ink);
  outline: 3px solid color-mix(in srgb, var(--green) 34%, transparent);
}

.break-card {
  min-height: 146px;
  padding: 16px;
  border-radius: 8px;
  background: var(--break-bg);
  color: #fff;
}

.break-card h3 {
  margin-bottom: 8px;
  font-size: 1.25rem;
}

.break-card p {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.5;
}

.break-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.break-option {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--field);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-align: left;
}

.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 20;
}

.confetti-piece {
  position: absolute;
  top: -16px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: confetti-fall 2.35s ease-out forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--drift), 110vh, 0) rotate(580deg);
    opacity: 0;
  }
}

@media (max-width: 980px) {
  .main-grid,
  .timer-band {
    grid-template-columns: 1fr;
  }

  .theme-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .timer-controls {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .timer-controls label {
    flex: 1 1 160px;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 12px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .streak-pill {
    grid-template-columns: auto 1fr;
    align-items: center;
    text-align: left;
  }

  .task-form,
  .break-list,
  .theme-grid {
    grid-template-columns: 1fr;
  }

  .panel,
  .topbar,
  .timer-band,
  .settings-panel {
    padding: 14px;
  }
}

/* ── Study buddy panel ─────────────────────────────────────────────── */
.buddy-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  width: 100%;
}

.choose-buddy-btn {
  display: inline-block;
  padding: 12px 24px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  transition: opacity 150ms;
}
.choose-buddy-btn:hover { opacity: 0.85; }

/* fills the whole stage */
.buddy-display {
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  width: 100%;
  height: 100%;
}

.buddy-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* below-box row */
.buddy-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 2px 0;
}

.buddy-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

.buddy-change-btn {
  font-size: 0.8rem;
}

/* ── Choose buddy page ─────────────────────────────────────────────── */
.choose-buddy-page {
  max-width: 780px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.buddy-pick-hint {
  color: var(--muted);
  margin: 0 0 28px;
  font-size: 0.95rem;
}

.buddy-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.buddy-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 8px 10px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 150ms, transform 150ms;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
}
.buddy-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.buddy-card.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.buddy-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}

.buddy-confirm-bar {
  display: flex;
  justify-content: center;
}

.confirm-buddy-btn {
  padding: 14px 40px;
  background: var(--accent);
  color: #fff;
  border: 2px solid #fff;
  outline: 3px solid var(--accent);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 150ms;
}
.confirm-buddy-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.confirm-buddy-btn:not(:disabled):hover { opacity: 0.85; }

@media (max-width: 520px) {
  .buddy-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Cooldown modal ────────────────────────────────────────────────── */
.cooldown-modal {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 32px 16px 48px;
}
.cooldown-modal[hidden] { display: none; }

.cooldown-modal-inner {
  width: 100%;
  max-width: 560px;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin: auto 0;
}

.cooldown-buddy-row {
  display: flex;
  align-items: flex-end;
  gap: 20px;
}

.cooldown-buddy-img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 16px rgba(255,255,255,0.15));
}

.cooldown-speech-bubble {
  position: relative;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 16px 16px 16px 4px;
  padding: 16px 18px;
  font-size: 0.95rem;
  line-height: 1.55;
  color: #f0f0f0;
}
.cooldown-speech-bubble::before {
  content: "";
  position: absolute;
  left: -10px;
  bottom: 16px;
  border-width: 6px 10px 6px 0;
  border-style: solid;
  border-color: transparent #1a1a1a transparent transparent;
}

.cooldown-modal-heading {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
  border-bottom: 1px solid #333;
  padding-bottom: 12px;
}

.cooldown-break-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cdl-item {
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #ddd;
}
.cdl-item strong {
  color: #fff;
  display: block;
  margin-bottom: 4px;
  font-size: 0.95rem;
}
.cdl-item ul {
  margin: 6px 0 0 16px;
  padding: 0;
  color: #bbb;
}
.cdl-item a {
  display: inline-block;
  margin-top: 8px;
  color: #78a8e8;
  text-decoration: underline;
  font-size: 0.85rem;
}

.cooldown-close-btn {
  align-self: center;
  padding: 14px 32px;
  background: #fff;
  color: #000;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 150ms;
}
.cooldown-close-btn:hover { opacity: 0.85; }

/* ── Wheel history ─────────────────────────────────────────────────── */
.wheel-history-details {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.wheel-history-details summary {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.wheel-history-details summary::before {
  content: "▸";
  transition: transform 150ms;
}
.wheel-history-details[open] summary::before {
  transform: rotate(90deg);
}

.wheel-history-list {
  margin: 10px 0 0 0;
  padding: 0 0 0 4px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}
.wheel-history-list li {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--panel-soft);
}
.wheel-history-list li.wheel-history-empty {
  font-style: italic;
  background: none;
}
.wh-subject {
  font-weight: 700;
  color: var(--ink);
}
.wh-time {
  font-size: 0.75rem;
  opacity: 0.6;
  margin-left: 6px;
}

/* ── Break sub-list & link (main cooldown panel) ───────────────────── */
.break-sub-list {
  margin: 8px 0 0 18px;
  padding: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.7;
}
.break-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--green);
  text-decoration: underline;
}

/* ── buddy-meta actions row ────────────────────────────────────────── */
.buddy-meta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* ── Welcome onboarding modal ──────────────────────────────────────── */
.welcome-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 16px 40px;
}
.welcome-modal[hidden] { display: none; }

.welcome-card {
  background: var(--panel);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(36, 48, 47, 0.28);
  width: 100%;
  max-width: 680px;
  padding: 40px 36px 36px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex-shrink: 0;
  margin: auto 0;
}

.wm-step { display: flex; flex-direction: column; gap: 18px; }

.wm-heading {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0;
  line-height: 1.2;
}

.wm-hint {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
  line-height: 1.55;
}

/* Step 1 – buddy grid */
.wm-buddy-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.wm-buddy-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 12px;
  background: var(--panel-soft);
  border: 2px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  transition: border-color 140ms, transform 140ms, box-shadow 140ms;
}
.wm-buddy-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}
.wm-buddy-card:hover {
  border-color: var(--accent, #2d7d68);
  transform: translateY(-2px);
}
.wm-buddy-card.selected {
  border-color: var(--accent, #2d7d68);
  background: color-mix(in srgb, var(--accent, #2d7d68) 8%, var(--panel));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #2d7d68) 22%, transparent);
}

/* Step 2 – accessory pick */
.wm-step2-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  align-items: start;
}

.wm-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, var(--stage-top), var(--stage-bottom));
  border-radius: 14px;
  padding: 16px 12px;
}

.wm-preview-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 8px;
}

.wm-preview-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  margin: 0;
}

.wm-acc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.wm-acc-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px 10px;
  background: var(--panel-soft);
  border: 2px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
  transition: border-color 140ms, transform 140ms, box-shadow 140ms;
}
.wm-acc-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}
.wm-acc-card:hover {
  border-color: var(--accent, #2d7d68);
  transform: translateY(-2px);
}
.wm-acc-card.selected {
  border-color: var(--accent, #2d7d68);
  background: color-mix(in srgb, var(--accent, #2d7d68) 8%, var(--panel));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #2d7d68) 22%, transparent);
}

.wm-step2-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.wm-primary-btn {
  padding: 13px 28px;
  background: var(--accent, #2d7d68);
  color: #fff;
  border: 2px solid #fff;
  outline: 3px solid var(--accent, #2d7d68);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 150ms;
}
.wm-primary-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
.wm-primary-btn:not(:disabled):hover { opacity: 0.84; }

/* ── Daily accessory picker modal ──────────────────────────────────── */
.acc-picker-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 16px 40px;
}
.acc-picker-modal[hidden] { display: none; }

.acc-picker-card {
  background: var(--panel);
  border-radius: 18px;
  box-shadow: 0 20px 56px rgba(36, 48, 47, 0.24);
  width: 100%;
  max-width: 520px;
  padding: 28px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-shrink: 0;
  margin: auto 0;
}

.apm-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.apm-heading {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
  margin: 4px 0 0;
}

.apm-layout {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  align-items: start;
}

.apm-preview-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: linear-gradient(180deg, var(--stage-top), var(--stage-bottom));
  border-radius: 12px;
  padding: 8px;
}

.apm-acc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

@media (max-width: 560px) {
  .welcome-card { padding: 28px 18px 24px; }
  .wm-step2-layout { grid-template-columns: 1fr; }
  .wm-preview-box { flex-direction: row; padding: 12px; }
  .wm-preview-img { width: 80px; }
  .apm-layout { grid-template-columns: 1fr; }
  .apm-preview-img { width: 80px; align-self: center; }
}

/* ── Tutorial overlay ──────────────────────────────────────────────── */
.tut-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  pointer-events: none; /* clicks pass through to the app */
}
.tut-overlay[hidden] { display: none; }

/* Spotlight: a positioned box whose massive box-shadow dims everything outside it */
.tut-highlight {
  position: fixed;
  z-index: 3001;
  border-radius: 14px;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.58);
  outline: 2.5px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
  transition: top 280ms ease, left 280ms ease, width 280ms ease, height 280ms ease;
}
.tut-highlight[hidden] { display: none; }

/* Pulsing ring when the user needs to interact */
@keyframes tut-ring {
  0%   { outline-color: rgba(255,255,255,0.5); outline-offset: 2px; }
  50%  { outline-color: rgba(255,255,255,0.95); outline-offset: 6px; }
  100% { outline-color: rgba(255,255,255,0.5); outline-offset: 2px; }
}
.tut-highlight.tut-pulse {
  animation: tut-ring 1.6s ease-in-out infinite;
}

/* Tooltip card */
.tut-tooltip {
  position: fixed;
  z-index: 3002;
  width: 300px;
  background: #fff;
  border-radius: 16px;
  padding: 0 0 18px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
  pointer-events: all; /* tooltip itself is clickable */
  overflow: hidden;
  transition: top 280ms ease, left 280ms ease;
}

/* Progress track at top of card */
.tut-progress-track {
  height: 4px;
  background: #eee;
  margin-bottom: 16px;
}
.tut-progress-bar {
  height: 100%;
  background: var(--accent, #2d7d68);
  transition: width 280ms ease;
  border-radius: 0 2px 2px 0;
}

.tut-counter {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted, #61706d);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0 20px;
  margin-bottom: 6px;
}

.tut-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink, #24302f);
  margin: 0 0 8px;
  padding: 0 20px;
  line-height: 1.3;
}

.tut-body {
  font-size: 0.875rem;
  color: var(--muted, #61706d);
  line-height: 1.6;
  margin: 0 0 14px;
  padding: 0 20px;
}

/* Action hint — shown instead of Next when interaction is required */
.tut-hint {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent, #2d7d68);
  margin: 0 0 14px;
  padding: 8px 20px;
  background: color-mix(in srgb, var(--accent, #2d7d68) 10%, transparent);
  border-left: 3px solid var(--accent, #2d7d68);
}

.tut-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  gap: 10px;
}

.tut-skip-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--muted, #61706d);
  cursor: pointer;
  padding: 6px 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.tut-skip-btn:hover { color: var(--ink, #24302f); }

.tut-next-btn {
  padding: 9px 20px;
  background: var(--accent, #2d7d68);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 140ms;
}
.tut-next-btn:hover { opacity: 0.85; }

/* Arrow variants — small triangle pointing at the highlighted element */
.tut-tooltip::before {
  content: '';
  position: absolute;
  width: 0; height: 0;
}
.tut-tooltip[data-arrow="top"]::before {
  top: -12px; left: 50%; transform: translateX(-50%);
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-bottom: 12px solid #fff;
}
.tut-tooltip[data-arrow="bottom"]::before {
  bottom: -12px; left: 50%; transform: translateX(-50%);
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-top: 12px solid #fff;
}
.tut-tooltip[data-arrow="left"]::before {
  left: -12px; top: 36px;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-right: 12px solid #fff;
}
.tut-tooltip[data-arrow="right"]::before {
  right: -12px; top: 36px;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 12px solid #fff;
}
.tut-tooltip[data-arrow="none"]::before { display: none; }
