:root {
  --ink: #1f2821;
  --ink-soft: #364039;
  --paper: #f4f0e7;
  --paper-deep: #eae5da;
  --card: #fffdf8;
  --line: rgba(31, 40, 33, 0.14);
  --line-strong: rgba(31, 40, 33, 0.27);
  --lime: #d8f25b;
  --lime-dark: #778a24;
  --orange: #ff8c5a;
  --muted: #6c756e;
  --danger: #a8453b;
  --shadow: 0 24px 70px rgba(45, 48, 34, 0.09);
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 10% 2%, rgba(216, 242, 91, 0.28), transparent 28rem),
    radial-gradient(circle at 92% 24%, rgba(255, 140, 90, 0.1), transparent 24rem),
    var(--paper);
}

body.modal-open { overflow: hidden; }

.name-settings[hidden],
.order-settings[hidden],
.draw-progress[hidden],
.winner-board[hidden],
.quiet-button[hidden],
.toast[hidden],
.binary-stats[hidden],
.locked-notice[hidden],
.choice-actions[hidden],
.list-tools[hidden],
.template-empty[hidden],
.template-search-clear[hidden] { display: none !important; }

button,
input,
textarea,
select { font: inherit; }

button,
select { color: inherit; }

button { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(113, 133, 28, 0.38);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

.skip-link:focus { transform: translateY(0); }

.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;
}

.app-shell {
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
  padding-bottom: max(40px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 2px 20px;
  border-bottom: 1px solid var(--line);
}

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

.language-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.66);
}

.language-switch a {
  display: grid;
  min-width: 34px;
  min-height: 30px;
  place-items: center;
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease;
}

.language-switch a:hover { color: var(--ink); }
.language-switch a.is-active { background: var(--ink); color: white; }

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  font-weight: 780;
  letter-spacing: -0.025em;
}

.brand-name {
  display: inline-flex;
  gap: 7px;
  align-items: baseline;
}

.brand-name strong { font-size: 17px; letter-spacing: -0.035em; }
.brand-name small { color: var(--muted); font-size: 10px; font-weight: 720; letter-spacing: 0.015em; }

.brand-mark {
  display: block;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
}

.status {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #69a940;
  box-shadow: 0 0 0 4px rgba(105, 169, 64, 0.14);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(260px, 0.65fr);
  gap: 60px;
  align-items: end;
  padding: 54px 4px 38px;
}

.hero-copy {
  display: grid;
  grid-template-columns: minmax(145px, 0.45fr) minmax(0, 1.55fr);
  gap: 24px;
  align-items: start;
}

.eyebrow {
  max-width: 175px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

h1 {
  max-width: 730px;
  margin: 0;
  font-size: clamp(48px, 6.2vw, 88px);
  font-weight: 620;
  line-height: 0.9;
  letter-spacing: -0.068em;
}

h1 em {
  display: inline-block;
  color: var(--lime-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.intro {
  max-width: 340px;
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(100%, 930px);
  margin: 0 0 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.66);
}

.mode-button {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 12px 15px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.mode-button:is(:hover, :focus-visible) { z-index: 20; }

.mode-button.is-active {
  background: var(--card);
  box-shadow: 0 6px 20px rgba(31, 40, 33, 0.08);
}

.mode-icon {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--paper-deep);
  font-size: 19px;
}

.mode-button.is-active .mode-icon { background: var(--lime); }
.mode-button strong,
.mode-button small { display: block; }
.mode-button strong { font-size: 13px; letter-spacing: -0.01em; }
.mode-button small { margin-top: 2px; color: var(--muted); font-size: 11px; }

.mode-tooltip {
  position: absolute;
  z-index: 30;
  top: calc(100% + 11px);
  left: 50%;
  width: max-content;
  max-width: min(280px, calc(100vw - 32px));
  padding: 10px 12px;
  border: 1px solid rgba(31, 40, 33, 0.16);
  border-radius: 11px;
  background: #1f2821;
  box-shadow: 0 12px 28px rgba(31, 40, 33, 0.18);
  color: #fffdf8;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.45;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -4px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

.mode-button:first-child .mode-tooltip {
  left: 0;
  transform: translate(0, -4px);
}

.mode-button:last-child .mode-tooltip {
  right: 0;
  left: auto;
  transform: translate(0, -4px);
}

@media (hover: hover) and (pointer: fine) {
  .mode-button:hover .mode-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
  }

  .mode-button:first-child:hover .mode-tooltip,
  .mode-button:last-child:hover .mode-tooltip {
    transform: translate(0, 0);
  }
}

.mode-button:focus-visible .mode-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.mode-button:first-child:focus-visible .mode-tooltip,
.mode-button:last-child:focus-visible .mode-tooltip {
  transform: translate(0, 0);
}

.mode-explanation {
  display: none;
  gap: 9px;
  align-items: flex-start;
  margin: -8px 0 16px;
  padding: 10px 12px;
  border: 1px solid rgba(31, 40, 33, 0.1);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.7);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.45;
}

.mode-explanation-icon {
  display: grid;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--card);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11px;
  font-weight: 700;
}

@media (hover: none), (pointer: coarse) {
  .mode-explanation { display: flex; }
}

.wheel-manager {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.saved-picker {
  position: relative;
  min-width: min(300px, 38vw);
}

.saved-picker::after {
  position: absolute;
  top: 50%;
  right: 13px;
  content: "⌄";
  pointer-events: none;
  transform: translateY(-58%);
}

.saved-picker select {
  width: 100%;
  min-height: 42px;
  padding: 0 38px 0 13px;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 253, 248, 0.76);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.manager-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.quiet-button {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.7);
  font-size: 12px;
  font-weight: 680;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.quiet-button:hover { border-color: var(--line-strong); background: var(--card); transform: translateY(-1px); }
.quiet-button.accent-button { border-color: transparent; background: var(--ink); color: white; }
.quiet-button.danger-button { color: var(--danger); }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(350px, 0.78fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.wheel-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 705px;
  padding: 36px 50px 42px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0.36)),
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(30, 38, 32, 0.035) 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(30, 38, 32, 0.035) 40px),
    #ebe8de;
}

.active-wheel-heading {
  width: min(100%, 515px);
  margin-bottom: 9px;
  text-align: center;
}

.active-wheel-heading span {
  display: block;
  margin-bottom: 4px;
  color: var(--lime-dark);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.active-wheel-heading h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 760;
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.wheel-heading {
  display: flex;
  width: min(100%, 515px);
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wheel-heading strong { color: var(--ink-soft); }

.wheel-wrap {
  position: relative;
  width: min(100%, 515px);
  aspect-ratio: 1;
  filter: drop-shadow(0 22px 24px rgba(39, 45, 35, 0.17));
}

#wheel {
  display: block;
  width: 100%;
  height: 100%;
}

.pointer {
  position: absolute;
  z-index: 3;
  top: -8px;
  left: 50%;
  width: 38px;
  height: 49px;
  background: var(--ink);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  filter: drop-shadow(0 5px 3px rgba(0, 0, 0, 0.2));
  transform: translateX(-50%);
}

.spin-center {
  position: absolute;
  z-index: 2;
  inset: 50% auto auto 50%;
  width: clamp(86px, 22%, 114px);
  aspect-ratio: 1;
  border: 8px solid var(--card);
  border-radius: 50%;
  background: var(--ink);
  color: white;
  cursor: pointer;
  box-shadow: 0 7px 25px rgba(0, 0, 0, 0.25);
  transform: translate(-50%, -50%);
  transition: transform 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.spin-center:hover { background: #2d382f; transform: translate(-50%, -50%) scale(1.05); }
.spin-center:active { transform: translate(-50%, -50%) scale(0.98); }
.spin-center:disabled { cursor: not-allowed; opacity: 0.58; transform: translate(-50%, -50%); }
.spin-center span { display: block; font-size: 15px; font-weight: 800; letter-spacing: 0.08em; }
.spin-center small { display: block; margin-top: 2px; color: var(--lime); font-size: 20px; }

.primary-button,
.secondary-button {
  border: 0;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 515px);
  min-height: 54px;
  margin-top: 26px;
  padding: 0 20px;
  border-radius: 14px;
  background: var(--lime);
  font-weight: 780;
}

.primary-button:hover { background: #e2fa73; transform: translateY(-2px); }
.primary-button:disabled { cursor: not-allowed; opacity: 0.48; transform: none; }

.hint {
  min-height: 18px;
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.binary-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 8px;
  align-items: stretch;
  width: min(100%, 515px);
  margin-top: 15px;
}

.binary-stats > span,
.binary-stats > em {
  display: flex;
  min-width: 0;
  min-height: 51px;
  flex-direction: column;
  justify-content: center;
  padding: 8px 11px;
  border: 1px solid rgba(31, 40, 33, 0.1);
  border-radius: 11px;
  background: rgba(255, 253, 248, 0.78);
}

.binary-stats small { color: var(--muted); font-size: 9px; }
.binary-stats strong { margin-top: 3px; font-size: 13px; }
.binary-stats em { color: var(--lime-dark); font-size: 10px; font-style: normal; font-weight: 750; line-height: 1.35; }

.draw-progress {
  width: min(100%, 515px);
  margin-top: 17px;
  padding: 14px 15px;
  border: 1px solid rgba(31, 40, 33, 0.1);
  border-radius: 13px;
  background: rgba(255, 253, 248, 0.76);
}

.draw-progress > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.draw-progress span { color: var(--muted); }
.progress-track { height: 6px; margin: 9px 0; overflow: hidden; border-radius: 99px; background: rgba(31, 40, 33, 0.1); }
.progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--lime-dark); transition: width 0.3s ease; }
.draw-progress button { padding: 0; border: 0; background: transparent; color: var(--lime-dark); font-size: 11px; font-weight: 750; cursor: pointer; }
.draw-progress button:disabled { color: var(--muted); cursor: not-allowed; opacity: 0.55; }
.draw-progress-actions { display: flex; gap: 16px; align-items: center; justify-content: space-between; }

.control-panel {
  min-width: 0;
  padding: 31px 30px 34px;
  border-left: 1px solid var(--line);
  background: var(--card);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.panel-heading label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.choice-count { color: var(--muted); font-size: 11px; }

.title-input {
  width: 100%;
  padding: 4px 0 15px;
  border: 0;
  border-bottom: 1px solid var(--line);
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 25px;
  font-weight: 720;
  letter-spacing: -0.035em;
}

.title-input:focus { border-bottom-color: var(--lime-dark); }
.title-input[readonly] { color: var(--ink); cursor: default; }

.panel-tabs {
  display: grid;
  grid-template-columns: 1.15fr 1fr 0.86fr;
  gap: 4px;
  margin: 20px 0 18px;
  padding: 4px;
  border-radius: 11px;
  background: #efebe2;
}

.tab-button {
  min-width: 0;
  padding: 9px 6px;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.tab-button.is-active { background: var(--card); color: var(--ink); box-shadow: 0 3px 12px rgba(31, 40, 33, 0.07); }
.tab-button span { margin-left: 2px; color: var(--lime-dark); }
.tab-panel[hidden] { display: none; }

.name-settings {
  display: grid;
  grid-template-columns: 0.58fr 1.42fr;
  gap: 9px;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.order-settings {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 15px;
  padding: 12px;
  border: 1px solid rgba(119, 138, 36, 0.24);
  border-radius: 11px;
  background: rgba(216, 242, 91, 0.13);
}

.order-settings > span {
  color: var(--lime-dark);
  font-size: 20px;
  line-height: 1;
}

.order-settings p { margin: 0; }
.order-settings strong,
.order-settings small { display: block; }
.order-settings strong { font-size: 11px; }
.order-settings small { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.4; }

.locked-notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 15px;
  padding: 12px;
  border: 1px solid rgba(119, 138, 36, 0.24);
  border-radius: 11px;
  background: rgba(216, 242, 91, 0.13);
  color: var(--lime-dark);
}

.locked-notice > span { font-size: 18px; line-height: 1; }
.locked-notice p { margin: 0; }
.locked-notice strong,
.locked-notice small { display: block; }
.locked-notice strong { color: var(--ink); font-size: 11px; }
.locked-notice small { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.4; }

.name-settings > label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 720;
}

.name-settings input[type="number"] {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  font-weight: 700;
}

.name-settings .check-setting {
  flex-direction: row;
  gap: 9px;
  align-items: center;
  min-height: 42px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  cursor: pointer;
}

.check-setting input { width: 17px; height: 17px; accent-color: var(--lime-dark); }
.check-setting span { min-width: 0; }
.check-setting strong,
.check-setting small { display: block; }
.check-setting strong { color: var(--ink); font-size: 11px; }
.check-setting small { margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 550; line-height: 1.25; }

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 355px;
  padding: 1px 4px 1px 1px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(31, 40, 33, 0.24) transparent;
}

.choice-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 4px 6px 4px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.choice-row.is-excluded { opacity: 0.46; background: #f2efe8; }
.choice-row:focus-within { border-color: #96a83a; box-shadow: 0 0 0 3px rgba(150, 168, 58, 0.12); }
.color-dot { width: 9px; height: 9px; border-radius: 50%; }
.choice-number { width: 18px; color: #9a9f99; font-size: 9px; text-align: right; }

.choice-row input {
  min-width: 0;
  padding: 8px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}

.remove-choice,
.close-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.remove-choice {
  width: 29px;
  height: 29px;
  border-radius: 8px;
  color: #92988f;
  font-size: 19px;
}

.remove-choice:hover { background: #f3eee5; color: var(--ink); }
.remove-choice:disabled { cursor: not-allowed; opacity: 0.3; }

.choice-actions {
  display: grid;
  grid-template-columns: 0.72fr 1.28fr;
  gap: 8px;
  margin-top: 12px;
}

.secondary-button {
  min-height: 42px;
  padding: 0 10px;
  border: 1px dashed rgba(30, 38, 32, 0.3);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.secondary-button:hover { border-color: var(--ink); background: rgba(255, 255, 255, 0.6); color: var(--ink); }
.secondary-button:disabled { cursor: not-allowed; opacity: 0.4; }

.list-tools {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 12px;
}

.list-tools button,
.section-heading button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 680;
  cursor: pointer;
}

.list-tools button:hover,
.section-heading button:hover { color: var(--ink); }

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

.section-heading h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: -0.025em;
}

.winner-board {
  margin-bottom: 23px;
  padding: 15px;
  border: 1px solid rgba(119, 138, 36, 0.24);
  border-radius: 13px;
  background: rgba(216, 242, 91, 0.12);
}

.winner-board ol {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 210px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  counter-reset: winners;
}

.winner-board li {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 680;
  counter-increment: winners;
}

.winner-board li::before {
  display: grid;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: var(--lime);
  content: counter(winners);
  font-size: 9px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 360px;
  overflow: auto;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 11px;
  border-radius: 9px;
  background: #f1ede5;
  font-size: 12px;
  font-weight: 650;
}

.history-item time { color: var(--muted); font-size: 9px; font-weight: 550; }
.empty-state { margin: 8px 0; color: #939a94; font-size: 12px; line-height: 1.55; }

.stat-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.stat-cards article {
  min-width: 0;
  padding: 12px 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
}

.stat-cards span,
.stat-cards strong { display: block; }
.stat-cards span { min-height: 25px; color: var(--muted); font-size: 9px; line-height: 1.25; }
.stat-cards strong { margin-top: 6px; overflow: hidden; font-size: 20px; letter-spacing: -0.04em; text-overflow: ellipsis; }
.stats-heading { margin-top: 23px; }
.stats-list { display: flex; flex-direction: column; gap: 11px; max-height: 310px; overflow: auto; }

.stat-row-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 11px;
}

.stat-row-head strong { max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-row-head span { color: var(--muted); font-size: 9px; }
.stat-bar { height: 6px; overflow: hidden; border-radius: 99px; background: #eeeae1; }
.stat-bar i { display: block; height: 100%; min-width: 3px; border-radius: inherit; background: var(--lime-dark); }

.privacy-note {
  display: flex;
  gap: 7px;
  align-items: center;
  margin: 20px 0 0;
  padding: 11px;
  border-radius: 9px;
  background: #f2efe8;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.templates-section { padding: 76px 2px 36px; }

.templates-heading {
  display: flex;
  gap: 30px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 25px;
}

.templates-heading .eyebrow { margin: 0 0 10px; }
.templates-heading h2 { margin: 0; font-size: clamp(30px, 4vw, 48px); letter-spacing: -0.055em; }

.surprise-button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid var(--ink);
  border-radius: 12px;
  background: var(--ink);
  color: white;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.surprise-button:hover { background: #303b32; transform: translateY(-1px); }
.surprise-button span { color: var(--lime); font-size: 16px; }

.template-discovery {
  display: grid;
  grid-template-columns: minmax(260px, 570px) auto;
  gap: 13px;
  align-items: center;
  margin-bottom: 13px;
}

.template-search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.82);
  box-shadow: 0 8px 24px rgba(31, 40, 33, 0.04);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.template-search:focus-within {
  border-color: rgba(119, 138, 36, 0.68);
  box-shadow: 0 0 0 4px rgba(216, 242, 91, 0.18);
}

.template-search-icon { color: var(--muted); font-size: 22px; line-height: 1; }

.template-search input {
  min-width: 0;
  height: 46px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}

.template-search input::-webkit-search-cancel-button { display: none; }
.template-search input::placeholder { color: #8c938d; }

.template-search-clear {
  width: 29px;
  height: 29px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: var(--paper-deep);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.template-result-count { color: var(--muted); font-size: 10px; font-weight: 680; white-space: nowrap; }

.template-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
  margin-bottom: 18px;
}

.template-filter {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.template-filter.is-active { border-color: var(--ink); background: var(--ink); color: white; }

.template-empty {
  margin: 24px 0 8px;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 15px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

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

.template-card {
  position: relative;
  min-height: 185px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 253, 248, 0.72);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.template-card:hover { border-color: var(--line-strong); box-shadow: 0 14px 32px rgba(31, 40, 33, 0.08); transform: translateY(-3px); }
.template-open {
  display: flex;
  width: 100%;
  min-height: 185px;
  flex-direction: column;
  padding: 18px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.template-open::after { position: absolute; right: 16px; bottom: 14px; content: "→"; font-size: 19px; }

.favorite-toggle {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(31, 40, 33, 0.12);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.86);
  color: var(--muted);
  font-size: 19px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.favorite-toggle:hover { background: white; color: var(--ink); transform: scale(1.05); }
.favorite-toggle.is-favorite { background: var(--lime); color: var(--ink); }
.template-card .template-icon { display: grid; width: 37px; height: 37px; place-items: center; margin-bottom: auto; border-radius: 11px; background: var(--template-color, var(--lime)); font-size: 18px; }
.template-card small { margin: 15px 0 5px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; }
.template-card strong { max-width: 85%; font-size: 17px; letter-spacing: -0.025em; }
.template-card .template-description { margin-top: 6px; padding-right: 21px; color: var(--muted); font-size: 10px; line-height: 1.35; }

.how-section {
  padding: 78px 2px 56px;
  border-top: 1px solid var(--line);
}

.how-heading {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 70px;
  align-items: end;
}

.how-heading .eyebrow,
.faq-heading .eyebrow { margin: 0 0 11px; }

.how-heading h2,
.faq-heading h2 {
  margin: 0;
  font-size: clamp(32px, 4.1vw, 57px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.how-heading > p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.how-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 34px;
}

.how-steps article {
  min-height: 190px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.68);
}

.how-steps article > span {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--lime);
  font-size: 10px;
  font-weight: 820;
}

.how-steps h3 {
  margin: 31px 0 7px;
  font-size: 17px;
  letter-spacing: -0.025em;
}

.how-steps p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.faq-layout {
  display: grid;
  grid-template-columns: minmax(230px, 0.72fr) minmax(420px, 1.28fr);
  gap: 70px;
  align-items: start;
  margin-top: 72px;
  padding-top: 56px;
  border-top: 1px solid var(--line);
}

.faq-heading h2 { font-size: clamp(28px, 3.5vw, 46px); }

.faq-list details { border-bottom: 1px solid var(--line); }
.faq-list details:first-child { border-top: 1px solid var(--line); }

.faq-list summary {
  position: relative;
  padding: 19px 42px 19px 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 760;
  letter-spacing: -0.015em;
  list-style: none;
}

.faq-list summary::-webkit-details-marker { display: none; }

.faq-list summary::after {
  position: absolute;
  top: 50%;
  right: 4px;
  color: var(--lime-dark);
  content: "+";
  font-size: 21px;
  font-weight: 500;
  transform: translateY(-50%);
}

.faq-list details[open] summary::after { content: "−"; }

.faq-list details p {
  max-width: 650px;
  margin: -4px 42px 18px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

footer {
  display: flex;
  justify-content: space-between;
  padding: 24px 2px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.modal[hidden] { display: none; }

.modal {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  overflow: auto;
  place-items: center;
}

.modal-backdrop {
  position: fixed;
  z-index: 0;
  inset: 0;
  border: 0;
  background: rgba(25, 31, 26, 0.68);
  backdrop-filter: blur(5px);
  cursor: default;
}

.result-card,
.import-card {
  position: relative;
  z-index: 1;
  width: min(100%, 460px);
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.3);
  animation: reveal 0.36s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.result-card { padding: 49px 40px 36px; text-align: center; }
.import-card { width: min(100%, 590px); padding: 38px 36px 32px; }

@keyframes reveal {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
}

.close-button {
  position: absolute;
  top: 12px;
  right: 15px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--muted);
  font-size: 25px;
}

.close-button:hover { background: #f1ede5; color: var(--ink); }
.result-label { color: var(--lime-dark); font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.result-card h2 { margin: 14px 0 0; overflow-wrap: anywhere; font-family: Georgia, "Times New Roman", serif; font-size: clamp(38px, 9vw, 54px); font-style: italic; letter-spacing: -0.04em; }
.result-card p { color: var(--muted); line-height: 1.55; }
.result-card .primary-button { width: 100%; margin-top: 24px; }

.import-card h2 { margin: 10px 0 8px; font-size: 31px; letter-spacing: -0.045em; }
.import-card > p { margin: 0 0 20px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.import-card > label { display: block; margin-bottom: 7px; font-size: 10px; font-weight: 760; text-transform: uppercase; letter-spacing: 0.08em; }
.import-card textarea { width: 100%; min-height: 190px; padding: 13px; resize: vertical; border: 1px solid var(--line); border-radius: 11px; outline: 0; background: white; color: var(--ink); font-size: 13px; line-height: 1.5; }
.import-card textarea:focus { border-color: var(--lime-dark); box-shadow: 0 0 0 3px rgba(119, 138, 36, 0.12); }
.import-summary { display: flex; justify-content: space-between; margin-top: 7px; color: var(--muted); font-size: 10px; }
.import-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 19px; }
.import-actions .primary-button { width: 100%; margin: 0; }

.toast {
  position: fixed;
  z-index: 40;
  right: 20px;
  bottom: max(20px, env(safe-area-inset-bottom));
  max-width: min(390px, calc(100% - 40px));
  padding: 12px 15px;
  border-radius: 11px;
  background: var(--ink);
  color: white;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
  font-size: 12px;
  font-weight: 650;
  animation: toast-in 0.24s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

@media (max-width: 1020px) {
  .hero { grid-template-columns: 1fr; gap: 20px; }
  .intro { max-width: 580px; }
  .workspace { grid-template-columns: minmax(0, 1fr) minmax(330px, 0.8fr); }
  .wheel-panel { min-height: 660px; padding-inline: 30px; }
  .template-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .hero-copy { grid-template-columns: 145px 1fr; }
  .workspace { grid-template-columns: 1fr; }
  .wheel-panel { min-height: auto; padding: 35px 54px 38px; }
  .wheel-wrap { width: min(100%, 540px); }
  .wheel-heading,
  .active-wheel-heading,
  .wheel-panel > .primary-button,
  .draw-progress { width: min(100%, 540px); }
  .control-panel { border-top: 1px solid var(--line); border-left: 0; }
  .choice-list { max-height: 420px; }
  .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .how-heading,
  .faq-layout { grid-template-columns: 1fr; gap: 25px; }
  .how-heading > p { max-width: 630px; }
  .faq-layout { margin-top: 55px; padding-top: 45px; }
}

@media (max-width: 620px) {
  .app-shell { width: min(100% - 22px, 520px); }
  .topbar { padding: 17px 1px; }
  .topbar-actions { gap: 6px; }
  .language-switch { padding: 2px; }
  .language-switch a { min-width: 30px; min-height: 27px; font-size: 9px; }
  .status { padding: 7px 9px; font-size: 9px; }
  .hero { padding: 34px 3px 27px; }
  .hero-copy { display: block; }
  .hero .eyebrow { max-width: none; margin: 0 0 17px; }
  h1 { font-size: clamp(46px, 15.3vw, 74px); }
  .intro { margin-top: 18px; font-size: 13px; }
  .mode-switch { grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; border-radius: 15px; }
  .mode-button { gap: 8px; padding: 10px; }
  .mode-icon { width: 31px; height: 31px; }
  .mode-button strong { font-size: 11px; }
  .mode-button small { display: none; }
  .mode-explanation { display: flex; }
  .wheel-manager { display: grid; grid-template-columns: 1fr; }
  .saved-picker { width: 100%; min-width: 0; }
  .manager-actions { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  .quiet-button { min-width: 0; padding-inline: 7px; }
  .workspace { border-radius: 20px; }
  .wheel-panel { padding: 27px 16px 29px; }
  .active-wheel-heading { margin-bottom: 7px; padding-inline: 8px; }
  .active-wheel-heading h2 { font-size: clamp(23px, 7vw, 31px); }
  .wheel-heading { margin-bottom: 19px; padding-inline: 2px; }
  .wheel-wrap { width: min(100%, 430px); }
  .pointer { top: -6px; width: 30px; height: 39px; }
  .spin-center { border-width: 6px; }
  .spin-center span { font-size: 12px; }
  .spin-center small { font-size: 17px; }
  .wheel-panel > .primary-button { min-height: 51px; margin-top: 22px; }
  .binary-stats { grid-template-columns: repeat(3, 1fr); }
  .binary-stats > em { grid-column: 1 / -1; min-height: 38px; text-align: center; }
  .control-panel { padding: 27px 18px 30px; }
  .title-input { font-size: 23px; }
  .panel-tabs { margin-top: 17px; }
  .name-settings { grid-template-columns: 0.65fr 1.35fr; }
  .choice-list { max-height: 355px; }
  .choice-row { gap: 6px; }
  .choice-number { display: none; }
  .choice-actions { grid-template-columns: 0.8fr 1.2fr; }
  .templates-section { padding-top: 57px; }
  .templates-heading { display: block; }
  .surprise-button { width: 100%; justify-content: center; margin-top: 18px; }
  .template-discovery { grid-template-columns: 1fr; gap: 7px; margin-top: 17px; }
  .template-result-count { padding-left: 3px; }
  .template-filters {
    width: calc(100% + 22px);
    flex-wrap: nowrap;
    margin: 14px -11px 17px;
    padding: 0 11px 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .template-filters::-webkit-scrollbar { display: none; }
  .template-filter { flex: 0 0 auto; }
  .template-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .template-card,
  .template-open { min-height: 167px; }
  .template-open { padding: 15px; }
  .favorite-toggle { top: 10px; right: 10px; }
  .template-card strong { max-width: 100%; font-size: 15px; }
  .how-section { padding: 58px 3px 43px; }
  .how-heading h2 { font-size: 39px; }
  .how-heading > p { font-size: 12px; }
  .how-steps { grid-template-columns: 1fr; gap: 9px; margin-top: 25px; }
  .how-steps article { min-height: 0; padding: 18px; }
  .how-steps h3 { margin-top: 22px; }
  .faq-heading h2 { font-size: 34px; }
  .faq-list summary { padding-block: 17px; font-size: 12px; }
  footer { gap: 20px; }
  .result-card { padding: 45px 24px 28px; }
  .import-card { padding: 35px 20px 23px; }
  .import-actions { grid-template-columns: 1fr; }
  .import-actions .secondary-button { order: 2; }
}

@media (max-width: 390px) {
  .brand-name small { display: none; }
  .status { display: none; }
  .mode-button { padding-inline: 8px; }
  .mode-icon { display: none; }
  .manager-actions { grid-template-columns: repeat(3, 1fr); }
  .quiet-button span { display: none; }
  .wheel-heading { font-size: 9px; }
  .panel-tabs { grid-template-columns: 1fr 1fr 0.82fr; }
  .tab-button { font-size: 10px; }
  .name-settings { grid-template-columns: 1fr; }
  .template-grid { grid-template-columns: 1fr; }
  .template-card,
  .template-open { min-height: 150px; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .stat-cards article:last-child { grid-column: 1 / -1; }
}

@media (orientation: landscape) and (max-height: 560px) and (min-width: 621px) {
  .hero { padding-block: 28px; }
  .wheel-panel { min-height: 560px; }
  .wheel-wrap { width: min(62vh, 430px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
