/* Just the Spin — styles. System fonts only, brand-green accent,
 * three-state theme via [data-theme], reduced-motion aware. */

:root {
  --bg: #ffffff;
  --fg: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #047857;
  --accent-soft: #ecfdf5;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --spin-duration: 4s;
}

[data-theme="dark"] {
  --bg: #0b0f14;
  --fg: #e5e7eb;
  --muted: #9ca3af;
  --line: #1f2937;
  --accent: #34d399;
  --accent-soft: #064e3b;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0b0f14;
    --fg: #e5e7eb;
    --muted: #9ca3af;
    --line: #1f2937;
    --accent: #34d399;
    --accent-soft: #064e3b;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

h1 { font-size: 18px; margin: 0; font-weight: 600; }
.brand-just { color: var(--muted); font-weight: 500; }
.brand-word { color: var(--accent); }

.toggles button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
}
.toggles button:focus-visible { outline: 2px solid var(--accent); border-radius: 6px; }

main { max-width: 560px; margin: 0 auto; padding: 12px 16px 48px; }

#switcher { position: relative; }
#switch-toggle {
  width: 100%;
  text-align: left;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 14px;
  font: 500 14px var(--font);
  color: var(--fg);
  cursor: pointer;
}
#wheel-menu {
  position: absolute;
  z-index: 5;
  left: 0; right: 0;
  margin-top: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 6px;
}
#wheel-menu button { display: block; width: 100%; text-align: left; background: none;
  border: none; padding: 8px 10px; border-radius: 8px; color: var(--fg); cursor: pointer; font: 400 14px var(--font); }
#wheel-menu button:hover { background: var(--accent-soft); }
#wheel-menu button.danger-text { color: #be123c; }

.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }

.menu-input-row, .menu-confirm { display: flex; gap: 6px; align-items: center; padding: 6px; }
.menu-input-row input {
  flex: 1; min-width: 0;
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px;
  font: 400 14px var(--font); background: var(--bg); color: var(--fg);
}
.menu-input-row input:focus-visible { outline: 2px solid var(--accent); border-color: var(--accent); }
.menu-confirm span { flex: 1; font: 500 13px var(--font); }

/* Inline action buttons (auto-width) override the full-width list-item style. */
#wheel-menu .menu-input-row button,
#wheel-menu .menu-confirm button {
  display: inline-block; width: auto; text-align: center;
  padding: 7px 13px; border-radius: 6px; font: 600 13px var(--font);
}
#wheel-menu button.primary { background: var(--accent); color: #fff; }
#wheel-menu button.primary:hover { background: var(--accent); filter: brightness(1.08); }
#wheel-menu button.danger { background: #be123c; color: #fff; }
#wheel-menu button.danger:hover { background: #be123c; filter: brightness(1.08); }
#wheel-menu button.ghost { background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
#wheel-menu button.ghost:hover { background: var(--accent-soft); }

#stage { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 20px 0; }
#wheel { width: min(78vw, 320px); height: auto; }
.wheel-rotor { transform-origin: 0 0; }
.wheel-rotor.spinning {
  transition: transform var(--spin-duration) cubic-bezier(0.17, 0.67, 0.21, 1);
}

#spin-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 11px 38px;
  font: 600 16px var(--font);
  cursor: pointer;
}
#spin-btn:disabled { opacity: 0.45; cursor: not-allowed; }
#spin-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#winner {
  font: 600 15px var(--font);
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 8px 16px;
  margin: 0;
}

#restore-btn {
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 20px;
  padding: 7px 18px;
  font: 600 13px var(--font);
  cursor: pointer;
}

#editor { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.editor-head { display: flex; justify-content: space-between; align-items: center;
  font: 600 11px var(--font); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
#paste-btn { background: none; border: none; color: var(--accent); cursor: pointer; font: 600 12px var(--font); }

#paste-area { margin-top: 10px; }
#paste-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  font: 400 14px var(--font);
  background: var(--bg);
  color: var(--fg);
  resize: vertical;
}
#paste-input:focus-visible { outline: 2px solid var(--accent); border-color: var(--accent); }
.paste-actions { display: flex; gap: 8px; margin-top: 8px; }
.paste-actions button { border-radius: 8px; padding: 7px 16px; font: 600 13px var(--font); cursor: pointer; }
#paste-add { background: var(--accent); color: #fff; border: none; }
.paste-actions .ghost { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }

#item-list { list-style: none; margin: 10px 0 0; padding: 0; }
#item-list li { display: flex; align-items: center; gap: 8px; padding: 7px 0;
  border-bottom: 1px solid var(--line); font-size: 14px; }
#item-list .grip { color: var(--line); cursor: grab; }
#item-list .label { flex: 1; }
#item-list input.weight { width: 52px; padding: 3px 6px; border: 1px solid var(--line);
  border-radius: 6px; font: 400 13px var(--font); }
#item-list .remove { background: none; border: none; color: var(--muted); cursor: pointer; }

#add-form { display: flex; gap: 8px; margin-top: 10px; }
#add-input { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: 400 14px var(--font); background: var(--bg); color: var(--fg); }
#add-form button { border: 1px solid var(--accent); color: var(--accent); background: var(--bg);
  border-radius: 8px; padding: 0 14px; font: 600 13px var(--font); cursor: pointer; }

.chips { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.chip { font: 500 12px var(--font); border: 1px solid var(--line); border-radius: 16px;
  padding: 5px 12px; color: var(--muted); background: var(--bg); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

#history-list { margin-top: 12px; padding-left: 18px; color: var(--muted); font-size: 13px; }

footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 16px; border-top: 1px solid var(--line); }
footer a { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  :root { --spin-duration: 0.4s; }
  .wheel-rotor.spinning { transition: transform var(--spin-duration) ease-out; }
}
