/* ダーツ寿司 style.css — 構造は docs/design.md */
:root {
  --c-ink: #3b2f2f; --c-ink-sub: #7a675c; --c-paper: #fffdf7; --c-cream: #fff3d8; --c-line: #e6d6bd;
  --c-red: #e8413b; --c-red-deep: #b8302c; --c-blue: #3f86e8; --c-blue-deep: #2a5fb0;
  --c-green: #3fa66a; --c-green-deep: #2b7a4b; --c-gold: #ffc83d; --c-gold-deep: #d99a00;
  --c-indigo: #2f4370; --c-indigo-deep: #22325a; --c-wood: #e8b878; --c-wood-light: #f6d7a4; --c-wood-deep: #b97f45;
  --c-lock: #a7a9b8; --c-bg: #fbe3bd; --c-bg-stripe: #fdeccf;
  --font-base: "Hiragino Maru Gothic ProN", "Hiragino Maru Gothic Pro", "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --font-num: "Arial Rounded MT Bold", "Hiragino Maru Gothic ProN", "SF Pro Rounded", ui-rounded, system-ui, sans-serif;
  --radius-s: 10px; --radius-m: 18px; --radius-l: 28px; --btn-depth: 6px; --dur-mid: .25s;
  --safe-top: env(safe-area-inset-top, 0px); --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px); --safe-left: env(safe-area-inset-left, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-base);
  color: var(--c-ink);
  background: var(--c-bg);
}
button { font: inherit; color: inherit; touch-action: manipulation; }


/* ---------- 画面 ---------- */
.screen {
  position: absolute; inset: 0;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(16px + var(--safe-top)) calc(16px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(16px + var(--safe-left));
  overflow-y: auto;
}
.screen.is-active { display: flex; animation: screen-in var(--dur-mid) ease both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--c-paper);
  border: 4px solid var(--c-ink);
  border-radius: var(--radius-l);
  box-shadow: 0 8px 0 var(--c-ink);
  padding: 20px 22px;
}

/* ---------- ボタン ---------- */
.btn {
  --btn-bg: var(--c-red);
  --btn-edge: var(--c-red-deep);
  --btn-fg: #fff;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 12px 28px;
  border: 3px solid var(--c-ink); border-radius: 999px;
  background: var(--btn-bg); color: var(--btn-fg);
  font-size: 20px; font-weight: 800; letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 var(--btn-depth) 0 var(--btn-edge), 0 var(--btn-depth) 0 3px var(--c-ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter var(--dur-fast);
  margin-bottom: var(--btn-depth);
}
.btn::after {
  content: ""; position: absolute; top: 5px; left: 18%; right: 18%; height: 6px;
  border-radius: 999px; background: rgba(255,255,255,.35); pointer-events: none;
}
.btn:hover { filter: brightness(1.05); }
.btn:active, .btn.is-pressed {
  transform: translateY(var(--btn-depth));
  box-shadow: 0 0 0 var(--btn-edge), 0 0 0 3px var(--c-ink);
}
.btn:disabled { filter: grayscale(.8) opacity(.6); cursor: not-allowed; }
.btn--block { display: flex; width: 100%; }
.btn--blue { --btn-bg: var(--c-blue); --btn-edge: var(--c-blue-deep); }
.btn--green { --btn-bg: var(--c-green); --btn-edge: var(--c-green-deep); }
.btn--gold { --btn-bg: var(--c-gold); --btn-edge: var(--c-gold-deep); --btn-fg: var(--c-ink); }
.btn--ghost { --btn-bg: var(--c-paper); --btn-edge: var(--c-line); --btn-fg: var(--c-ink); }
.btn--small { min-height: 40px; padding: 6px 16px; font-size: 15px; --btn-depth: 4px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  border: 3px solid var(--c-ink); border-radius: 50%;
  background: var(--c-paper);
  font-size: 20px; font-weight: 900; line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--c-ink);
  transition: transform .08s ease, box-shadow .08s ease;
}
.icon-btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--c-ink); }
.icon-btn--pause::before { content: ""; width: 12px; height: 14px; border-left: 4px solid var(--c-ink); border-right: 4px solid var(--c-ink); }
.icon-btn--back::before { content: "‹"; font-size: 26px; margin-top: -3px; }
.icon-btn--help::before { content: "?"; }
.icon-btn--sound::before { content: "♪"; }
.icon-btn--sound.is-off { opacity: .55; }
.btn:focus-visible, .icon-btn:focus-visible {
  outline: 4px solid var(--c-gold); outline-offset: 4px;
}

.icon-btn--close::before { content: "×"; font-size: 26px; }

.app {
  position: fixed; inset: 0; overflow: hidden;
  background: repeating-linear-gradient(90deg, var(--c-indigo-deep) 0 36px, var(--c-indigo) 36px 72px);
}
.stage {
  position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(100%, 66vh); width: min(100%, 66dvh); overflow: hidden;
  background: repeating-linear-gradient(135deg, var(--c-bg) 0 28px, var(--c-bg-stripe) 28px 56px);
}
@media (max-width: 480px) { .stage { width: 100%; } }
@media (min-width: 481px) { .stage { border-left: 4px solid var(--c-ink); border-right: 4px solid var(--c-ink); } }
[hidden] { display: none !important; }

/* ---------- タイトル ---------- */
.screen { touch-action: pan-y; }
.screen--title { gap: 14px; text-align: center; justify-content: safe center; }
.logo { margin: 0; line-height: 1.05; }
.logo__sub { display: inline-block; padding: 4px 16px; margin-bottom: 8px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-paper); font-size: 15px; font-weight: 800; }
.logo__main {
  display: block; font-size: clamp(46px, 13.5vw, 76px); font-weight: 900; letter-spacing: .03em; white-space: nowrap; color: #fff;
  -webkit-text-stroke: 10px var(--c-ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--c-ink);
}
.logo__main .is-red { color: var(--c-red); }
.logo__main .is-gold { color: var(--c-gold); }
.title-art { width: min(340px, 84%, 42vh); aspect-ratio: 1; flex: 0 1 auto; min-height: 120px; }
.title-art canvas { width: 100%; height: 100%; display: block; }
.title-best { display: inline-flex; gap: 8px; align-items: baseline; padding: 4px 16px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-cream); font-weight: 800; font-size: 14px; }
.title-best b { font: 900 22px var(--font-num); color: var(--c-red); }
.title-actions { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.title-actions > .btn { min-width: 220px; font-size: 24px; }
.title-sub { display: flex; gap: 12px; align-items: center; }

/* ---------- モーダル・ルール ---------- */
.modal {
  position: absolute; inset: 0; z-index: 30; display: none; align-items: center; justify-content: center;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom)); background: rgba(50, 28, 16, .58);
}
.modal.is-open { display: flex; animation: screen-in var(--dur-mid) ease both; }
.modal > .card { max-height: 100%; overflow-y: auto; touch-action: pan-y; }
.rules { width: min(400px, 100%); text-align: center; }
.rules__title, .sheet__title { margin: 0 0 12px; font-size: 22px; font-weight: 900; }
.rules__list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.rules__item { display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: center; padding: 8px 10px; background: var(--c-cream); border: 3px solid var(--c-ink); border-radius: var(--radius-m); text-align: left; }
.rules__item canvas { width: 92px; height: 72px; display: block; }
.rules__item p { margin: 0; font-size: 15px; font-weight: 800; line-height: 1.5; }
.rules__item b { color: var(--c-red); }
.pause { width: min(320px, 100%); display: grid; gap: 10px; text-align: center; }

/* ---------- プレイ ---------- */
.screen--play { padding: 0; overflow: hidden; touch-action: none; }
.play-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hud {
  position: absolute; left: 0; right: 0; top: 0; z-index: 5; display: flex; align-items: center; gap: 6px;
  padding: calc(8px + var(--safe-top)) calc(8px + var(--safe-right)) 0 calc(8px + var(--safe-left)); pointer-events: none;
}
.hud > button { pointer-events: auto; flex: none; width: 40px; height: 40px; }
.hud__chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 4px 12px;
  border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-paper); box-shadow: 0 3px 0 var(--c-ink);
  font: 900 17px var(--font-num); white-space: nowrap;
}
.hud__round small { font: 800 11px var(--font-base); color: var(--c-ink-sub); }
.hud__darts { display: inline-flex; gap: 3px; }
.hud__dart { width: 9px; height: 20px; background: var(--c-red); border: 2px solid var(--c-ink); clip-path: polygon(50% 0, 72% 45%, 100% 62%, 100% 100%, 50% 84%, 0 100%, 0 62%, 28% 45%); background: var(--c-red); border: 0; }
.hud__dart.is-used { background: var(--c-line); }
.hud__score { margin-left: auto; }
.hud__score small { font: 800 11px var(--font-base); color: var(--c-ink-sub); }
.hud__score.is-up { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.18); background: var(--c-gold); } }

.panel {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; pointer-events: none;
  padding: 0 calc(6px + var(--safe-right)) calc(6px + var(--safe-bottom)) calc(6px + var(--safe-left));
  display: grid; gap: 5px;
}
.geta { height: 50px; }
.geta canvas { width: 100%; height: 100%; display: block; }
.yaku-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.yaku {
  position: relative; min-width: 0; height: 49px; padding: 3px 5px 3px; overflow: hidden;
  border: 2.5px solid var(--c-ink); border-radius: var(--radius-s); background: var(--c-paper); box-shadow: 0 2px 0 var(--c-ink);
  display: flex; flex-direction: column; justify-content: space-between;
}
.yaku__head { display: flex; align-items: baseline; justify-content: space-between; gap: 2px; white-space: nowrap; }
.yaku__name { font-size: 11px; font-weight: 900; letter-spacing: -.05em; line-height: 1.25; }
.yaku__pts { font: 900 11px/1.2 var(--font-num); color: var(--c-red-deep); }
.yaku__body { display: flex; align-items: center; gap: 1px; min-height: 22px; }
.yaku__neta { position: relative; flex: 0 1 23px; min-width: 18px; width: 23px; height: 22px; display: grid; place-items: center; filter: grayscale(1); opacity: .38; }
.yaku__neta canvas { width: 23px !important; height: 23px !important; display: block; }
.yaku__neta.is-got { filter: none; opacity: 1; }
.yaku__meter { display: flex; gap: 2px; }
.yaku__meter { flex: 0 1 auto; min-width: 0; }
.yaku__meter i { width: 9px; height: 14px; border: 2px solid var(--c-ink); border-radius: 4px; background: var(--c-line); }
.yaku__meter--7 { gap: 1px; }
.yaku__meter--7 i { width: 7px; border-width: 1.5px; border-radius: 3px; }
.yaku__meter i.is-on { background: var(--c-gold); }
.yaku__left { margin-left: auto; flex: none; padding: 0 4px; letter-spacing: -.04em; border-radius: 999px; background: var(--c-line); font-size: 11px; font-weight: 900; line-height: 17px; white-space: nowrap; }
.yaku.is-near { background: #fff3c4; border-color: var(--c-red-deep); }
.yaku.is-near .yaku__left { background: var(--c-red); color: #fff; animation: nudge 1.2s ease-in-out infinite; }
@keyframes nudge { 50% { transform: scale(1.1); } }
.yaku.is-done { background: var(--c-gold); }
.yaku.is-done .yaku__left { background: var(--c-red); color: #fff; }
.yaku.is-dead { opacity: .5; }
.yaku.is-flash { animation: bump-card .6s cubic-bezier(.2, 1.6, .4, 1); z-index: 2; }
@keyframes bump-card { 30% { transform: scale(1.2) rotate(-2deg); } }
@media (min-width: 600px) and (min-height: 700px) {
  .geta { height: 64px; }
  .yaku { height: 62px; padding: 5px 9px; }
  .yaku__name, .yaku__pts { font-size: 15px; letter-spacing: 0; }
  .yaku__neta { width: 32px; height: 28px; }
  .yaku__neta canvas { width: 31px !important; height: 31px !important; }
  .yaku__left { font-size: 14px; line-height: 22px; padding: 0 9px; }
}

.hint {
  position: absolute; left: 50%; z-index: 6; transform: translateX(-50%); bottom: 190px;
  padding: 8px 16px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-paper); box-shadow: 0 3px 0 var(--c-ink);
  font-size: 15px; font-weight: 800; white-space: nowrap; pointer-events: none;
}
.callout {
  position: absolute; left: 50%; top: 40%; z-index: 9; transform: translate(-50%, -50%); text-align: center; line-height: 1.2;
  font-size: clamp(30px, 9vw, 52px); font-weight: 900; color: var(--c-gold); white-space: nowrap; pointer-events: none;
  -webkit-text-stroke: 8px var(--c-ink); paint-order: stroke fill; animation: pop .4s cubic-bezier(.2, 1.6, .4, 1) both;
}
.callout small { display: block; font-size: .5em; -webkit-text-stroke-width: 6px; color: #fff; }
.callout.is-bad { color: #d6dde6; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(.3); } to { transform: translate(-50%, -50%) scale(1); } }

/* ---------- 役成立 ---------- */
.yaku-pop { position: absolute; inset: 0; z-index: 12; display: none; align-items: center; justify-content: center; pointer-events: none; overflow: hidden; }
.yaku-pop.is-open { display: flex; }
.yaku-pop::before {
  content: ""; position: absolute; left: 50%; top: 42%; width: 200vmax; height: 200vmax; margin: -100vmax;
  background: repeating-conic-gradient(rgba(255,208,80,.85) 0 10deg, rgba(255,243,200,.85) 10deg 20deg); animation: spin 16s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.yaku-pop__box { position: relative; margin-bottom: 16vh; text-align: center; animation: pop-box .45s cubic-bezier(.2, 1.7, .4, 1) both; }
@keyframes pop-box { from { transform: scale(.3) rotate(-6deg); } to { transform: none; } }
.yaku-pop__label { display: inline-block; padding: 4px 20px; border: 4px solid var(--c-ink); border-radius: 999px; background: var(--c-red); color: #fff; font-size: 22px; font-weight: 900; }
.yaku-pop__name { margin: 8px 0; font-size: clamp(36px, 11vw, 60px); font-weight: 900; color: #fff; -webkit-text-stroke: 10px var(--c-ink); paint-order: stroke fill; white-space: nowrap; }
.yaku-pop__neta { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; max-width: 340px; }
.yaku-pop__pts { font: 900 44px var(--font-num); color: var(--c-gold); -webkit-text-stroke: 8px var(--c-ink); paint-order: stroke fill; }

/* ---------- 結果 ---------- */
.screen--result { justify-content: safe center; gap: 16px; text-align: center; padding-top: calc(12px + var(--safe-top)); }
.result-chef { width: 104px; height: 92px; flex: none; margin-bottom: -28px; position: relative; z-index: 1; }
.result { width: min(420px, 100%); padding: 18px 16px 14px; flex: none; }
.result__rank { margin: 0; font-size: 26px; font-weight: 900; }
.result__score { font: 900 54px/1.05 var(--font-num); color: var(--c-red); }
.result__score small { font: 800 18px var(--font-base); color: var(--c-ink); }
.result__meta { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; font-size: 13px; font-weight: 800; color: var(--c-ink-sub); }
.result__new { display: inline-block; padding: 1px 10px; border: 2.5px solid var(--c-ink); border-radius: 999px; background: var(--c-gold); color: var(--c-ink); }
.result__geta { height: 64px; margin: 10px 0 8px; }
.result__geta canvas { width: 100%; height: 100%; display: block; }
.result__yaku { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.result__yaku li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 12px; border: 2.5px solid var(--c-ink); border-radius: 999px; background: var(--c-gold); font-size: 14px; font-weight: 900; }
.result__yaku li.is-empty { justify-content: center; background: var(--c-cream); border-style: dashed; color: var(--c-ink-sub); }
.result__near { margin: 8px 0 0; padding: 7px 10px; border-radius: var(--radius-s); background: #ffe6df; font-size: 14px; font-weight: 800; line-height: 1.5; }
.result__near b { color: var(--c-red); }
.result-actions { width: min(420px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: none; }
.result-actions .btn--main { grid-column: 1 / -1; }
@media (max-height: 700px) {
  .result-chef { width: 80px; height: 70px; } .result__score { font-size: 42px; } .result__rank { font-size: 21px; }
  .result__geta { height: 52px; margin: 6px 0; } .result-actions .btn--main { min-height: 48px; }
}

/* ---------- 図鑑 ---------- */
.screen--dex { justify-content: flex-start; gap: 12px; }
.dex-head { display: flex; align-items: center; gap: 12px; width: min(460px, 100%); }
.dex-head__title { flex: 1; margin: 0 44px 0 0; font-size: 24px; font-weight: 900; text-align: center; }
.dex { display: grid; gap: 9px; width: min(460px, 100%); }
.dex__item { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 14px; border: 3px solid var(--c-ink); border-radius: var(--radius-m); background: var(--c-paper); box-shadow: 0 4px 0 var(--c-ink); }
.dex__name { font-size: 17px; font-weight: 900; }
.dex__pts { text-align: right; font: 900 17px var(--font-num); color: var(--c-red); }
.dex__neta { display: flex; gap: 2px; min-height: 34px; align-items: center; }
.dex__desc { font-size: 13px; font-weight: 700; color: var(--c-ink-sub); grid-column: 1 / -1; }
.dex__stamp { align-self: center; padding: 3px 10px; border: 3px solid var(--c-red); border-radius: 8px; color: var(--c-red); white-space: nowrap; font-size: 13px; font-weight: 900; transform: rotate(-6deg); }
.dex__item:not(.is-got) { background: #f3ead9; }
.dex__item:not(.is-got) .dex__neta { filter: grayscale(1); opacity: .5; }
.dex__item:not(.is-got) .dex__stamp { border-color: var(--c-lock); color: var(--c-ink-sub); border-style: dashed; transform: none; }

/* ---------- 横向き案内・トースト ---------- */
.rotate { position: fixed; inset: 0; z-index: 100; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--c-indigo); color: #fff; font-size: 20px; font-weight: 900; }
.rotate__phone { width: 48px; height: 82px; border: 5px solid #fff; border-radius: 12px; animation: tilt 1.8s ease-in-out infinite; }
@keyframes tilt { 0%, 20% { transform: rotate(90deg); } 60%, 100% { transform: rotate(0); } }
@media (orientation: landscape) and (max-height: 500px) { .rotate { display: flex; } }
.toast { position: absolute; left: 50%; bottom: calc(24px + var(--safe-bottom)); z-index: 50; transform: translateX(-50%); padding: 10px 18px; border: 3px solid #fff; border-radius: 999px; background: var(--c-ink); color: #fff; font-weight: 800; white-space: nowrap; }

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