@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@500;600;700&family=Noto+Sans+JP:wght@400;500;600;700;800;900&display=swap');

:root {
  color-scheme: dark;
  --bg: #0e131a;
  --panel: #1b242d;
  --cream: #f9ecda;
  --muted: #a0a8a5;
  --gold: #ffba71;
  font-family: 'Noto Sans JP', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--cream); background: radial-gradient(ellipse 72% 31% at 50% 9%, #543b32 0, transparent 80%), var(--bg); }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
button:disabled { cursor: not-allowed; }
.grain { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .09; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.app { position: relative; z-index: 1; width: min(100%, 520px); min-height: 100vh; margin: 0 auto; padding: max(30px, env(safe-area-inset-top)) 23px max(20px, env(safe-area-inset-bottom)); }
.header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.eyebrow, .section-label, footer { font-family: 'DM Sans', sans-serif; font-size: 10px; font-weight: 700; letter-spacing: .23em; }
.eyebrow { margin: 0 0 3px; color: var(--gold); }
h1 { margin: 0; font-size: clamp(42px, 12vw, 58px); font-weight: 900; line-height: 1.18; letter-spacing: -.09em; }
.period { color: var(--gold); }
.subtitle { margin: 5px 0 0; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .15em; }
.people-button { display: grid; place-items: center; align-content: center; gap: 5px; flex: 0 0 76px; height: 68px; margin-top: 4px; padding: 0; border: 1px solid #ffffff1c; border-radius: 18px; color: var(--cream); background: var(--panel); font-size: 10px; font-weight: 700; }
.people-button b { font-weight: 700; }
.people-icon { position: relative; display: block; width: 24px; height: 20px; }
.people-icon i { position: absolute; border: 1.8px solid currentColor; border-radius: 50%; }
.people-icon i:first-child { left: 3px; top: 1px; width: 9px; height: 9px; }
.people-icon i:first-child::after { content: ''; position: absolute; top: 10px; left: -4px; width: 16px; height: 7px; border: 1.8px solid currentColor; border-radius: 8px 8px 3px 3px; }
.people-icon i:last-child { right: 1px; top: 5px; width: 8px; height: 8px; opacity: .7; }
.game { margin-top: 40px; }
.section-label { margin: 0 0 10px 5px; color: var(--muted); }
.categories { display: flex; gap: 3px; width: 100%; padding: 5px; border: 1px solid #ffffff0d; border-radius: 30px; background: var(--panel); }
.category { flex: 1; min-width: 0; min-height: 38px; padding: 0 2px; border: 0; border-radius: 25px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; white-space: nowrap; }
.category.is-active { color: #142029; background: var(--cream); box-shadow: 0 2px 7px #0003; }
.wheel-zone { position: relative; width: min(100%, 400px); aspect-ratio: 1; margin: 18px auto 0; display: grid; place-items: center; }
.orbit { position: absolute; border: 1px solid #ffffff12; border-radius: 50%; pointer-events: none; }
.orbit-outer { inset: 0; }
.orbit-inner { inset: 12px; border-color: #ffffff0a; }
.wheel-shell { position: relative; width: 89%; aspect-ratio: 1; border: 5px solid #f9ecda; border-radius: 50%; background: #18232b; box-shadow: 0 17px 32px #0008, 0 0 0 7px #ffffff0a; overflow: hidden; }
canvas { display: block; width: 100%; height: 100%; transform: rotate(0deg); }
.hub { position: absolute; top: 50%; left: 50%; display: grid; place-items: center; width: 20%; aspect-ratio: 1; transform: translate(-50%, -50%); border: 4px solid var(--cream); border-radius: 50%; color: var(--gold); background: var(--bg); box-shadow: 0 4px 12px #0005; font-family: Georgia, serif; font-size: clamp(27px, 9vw, 41px); font-weight: 700; }
.hub[hidden] { display: none; }
.pointer { position: absolute; top: 2%; left: 50%; z-index: 2; width: 28px; height: 30px; transform: translateX(-50%); background: var(--cream); clip-path: polygon(0 0, 100% 0, 50% 100%); filter: drop-shadow(0 4px 3px #0005); }
.result { min-height: 81px; margin-top: 17px; }
.empty-state { display: grid; place-content: center; min-height: 81px; text-align: center; }
.empty-heading { margin: 0; font-size: 16px; font-weight: 800; }
.empty-detail { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.challenge-card { padding: 21px; border: 1px solid #ffba7147; border-radius: 23px; background: linear-gradient(145deg, #25313a, #1a242d 72%); box-shadow: 0 14px 22px #0002; animation: reveal .35s ease-out; }
.challenge-card[hidden] { display: none; }
.challenge-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: .06em; }
.category-tag { color: var(--cream); font-size: 10px; letter-spacing: 0; }
.challenge-text { margin: 13px 0 11px; font-size: clamp(19px, 5.7vw, 23px); font-weight: 800; line-height: 1.5; letter-spacing: -.03em; }
.again-button { padding: 5px 0; border: 0; color: var(--gold); background: none; font-size: 12px; font-weight: 700; }
.again-button span { margin-left: 3px; }
.pass-note { margin: 13px 0 0; padding-top: 11px; border-top: 1px solid #ffffff15; color: var(--muted); font-size: 11px; line-height: 1.6; }
.spin-button { display: flex; justify-content: center; align-items: center; gap: 10px; width: 100%; height: 63px; margin-top: 22px; border: 0; border-radius: 18px; color: #18212a; background: var(--gold); box-shadow: 0 8px 25px #ffba712b; font-size: 17px; font-weight: 800; transition: transform .15s, opacity .15s; }
.spin-button:active:not(:disabled) { transform: scale(.98); }
.spin-button:disabled { opacity: .47; box-shadow: none; }
.spin-arrow { font-size: 22px; font-weight: 500; }
.footnote { margin: 16px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; text-align: center; }
footer { margin-top: 44px; color: #69777a; text-align: center; font-size: 9px; }
.people-dialog { position: fixed; width: min(calc(100% - 20px), 480px); max-height: min(83dvh, 690px); margin: auto auto 0; padding: 24px 21px max(23px, env(safe-area-inset-bottom)); border: 1px solid #ffffff21; border-radius: 25px 25px 0 0; color: var(--cream); background: #131b23; box-shadow: 0 -20px 60px #0009; }
.people-dialog::backdrop { background: #02060bbf; backdrop-filter: blur(5px); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; }
.dialog-head h2 { margin: 2px 0 0; font-size: 27px; line-height: 1.2; }
.close-button { width: 38px; height: 38px; border: 1px solid #ffffff21; border-radius: 50%; color: var(--cream); background: var(--panel); font-size: 26px; line-height: 1; }
.dialog-help { margin: 16px 0 14px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.add-row { display: flex; gap: 8px; }
.add-row input { min-width: 0; flex: 1; height: 52px; padding: 0 15px; border: 1px solid #ffffff1c; border-radius: 13px; color: var(--cream); background: var(--panel); font-size: 16px; }
.add-row input::placeholder { color: #828d90; }
.add-row button { width: 70px; border: 0; border-radius: 13px; color: var(--bg); background: var(--gold); font-weight: 800; }
.add-row button:disabled { opacity: .45; }
.input-error { min-height: 21px; margin: 5px 0 0; color: #ff9e87; font-size: 11px; }
.player-list { display: grid; gap: 8px; max-height: min(35dvh, 270px); margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.player-list li { display: flex; align-items: center; gap: 13px; min-height: 49px; padding: 0 14px; border-radius: 12px; background: var(--panel); font-size: 14px; font-weight: 700; }
.player-list .number { color: var(--gold); font-family: 'DM Sans', sans-serif; font-size: 11px; }
.player-list .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.remove-button { width: 34px; height: 34px; border: 0; color: var(--muted); background: transparent; font-size: 18px; }
.done-button { width: 100%; height: 50px; margin-top: 17px; border: 1px solid #ffffff24; border-radius: 13px; color: var(--cream); background: #29343d; font-weight: 800; }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 360px) { .app { padding-inline: 15px; } .category { font-size: 11px; } .game { margin-top: 30px; } }
@media (min-width: 700px) { .app { padding-top: 55px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; scroll-behavior: auto !important; } }
