/* 忘年会ジェスチャーゲーム ― 見た目の決まりごと（C案「色の面で分かる」2026-11-25 選定）
   色はここで名前を付けたものだけを使う。ページや部品に生の色を書かない。 */

@font-face {
  font-family: "Rounded";
  src: url("/fonts/rounded-800.woff2") format("woff2");
  font-weight: 800;
  font-display: block;
}
@font-face {
  font-family: "Rounded";
  src: url("/fonts/rounded-700.woff2") format("woff2");
  font-weight: 700;
  font-display: block;
}

:root {
  /* 基本 */
  --canvas: #fbf7ef;      /* 生成りの背景 */
  --surface: #ffffff;
  --ink: #1a1a1a;         /* 墨の文字 */
  --ink-muted: #5b5650;
  --ink-on-color: #ffffff;
  --line: #ddd5c7;
  --line-strong: #1a1a1a;
  --action: #1a1a1a;      /* 主ボタン（墨の塗り） */
  --action-hover: #000000;
  --off: #d9d4cb;         /* 押せないボタン */
  --off-ink: #6b665e;

  /* レベルの色（白い文字との差 4.5:1 以上を確かめた） */
  --lv1: #1f5fd6;         /* ★ かんたん：青 5.73 */
  --lv2: #c2540a;         /* ★★ ふつう：オレンジ 4.60 */
  --lv3: #a3135f;         /* ★★★ むずかしい：赤紫 7.46 */

  /* 状態の色 */
  --alert-ink: #b42318;   /* 赤：残り10秒・取り返しのつかない操作 */
  --alert-soft: #fdecea;
  --done-ink: #1f7a3d;    /* 緑：正解の印（履歴だけ） */

  --radius: 6px;
  --font: "Rounded", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  --emoji: "Apple Color Emoji", "Noto Color Emoji", "Segoe UI Emoji", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 700;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- 共通部品 ---------- */

/* ボタンの格は3段だけ：塗り（主）／線（次）／下線の文字（その他） */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 56px; padding: 0 28px;
  border-radius: var(--radius); border: 3px solid var(--line-strong);
  font-weight: 800; font-size: 22px; text-decoration: none;
  transition: transform .08s ease;
}
.btn:active { transform: scale(.97); }
.btn-main { background: var(--action); color: var(--ink-on-color); border-color: var(--action); }
.btn-main:hover { background: var(--action-hover); }
.btn-line { background: var(--surface); color: var(--ink); }
.btn-alert { background: var(--alert-ink); color: var(--ink-on-color); border-color: var(--alert-ink); }
.btn-xl { min-height: clamp(64px, 12vh, 104px); font-size: clamp(26px, 4.4vh, 44px); padding: 0 40px; }
.btn-text {
  background: none; border: 0; padding: 8px 4px;
  font-weight: 800; font-size: 18px; color: var(--ink);
  text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 2px;
}
.btn-text.is-alert { color: var(--alert-ink); }
.btn:disabled, .lvbtn:disabled { background: var(--off); color: var(--off-ink); border-color: var(--off); cursor: not-allowed; }

.input {
  min-height: 52px; padding: 0 14px; font-size: 20px;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
}
.input:focus { outline: none; border-color: var(--line-strong); }
.select { padding-right: 36px; }

/* レベルのバッジ（色の面＋文字） */
.badge {
  display: inline-block; padding: 4px 14px; border-radius: var(--radius);
  color: var(--ink-on-color); font-weight: 800; white-space: nowrap;
}
.badge.lv-1, .lvbtn.lv-1, .card-band.lv-1 { background: var(--lv1); }
.badge.lv-2, .lvbtn.lv-2, .card-band.lv-2 { background: var(--lv2); }
.badge.lv-3, .lvbtn.lv-3, .card-band.lv-3 { background: var(--lv3); }

.muted { color: var(--ink-muted); }

/* ---------- 画面の枠 ---------- */
#app { height: 100%; }
.screen {
  min-height: 100%; height: 100dvh;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* 上の帯（チーム・時間・得点）。お題の画面ではレベルの色になる */
.bar {
  display: flex; align-items: center; gap: clamp(12px, 3vw, 40px);
  padding: 10px clamp(16px, 3vw, 32px);
  background: var(--action); color: var(--ink-on-color);
  font-weight: 800; font-size: clamp(20px, 3.4vh, 30px);
}
.odai.lv-1 .bar { background: var(--lv1); }
.odai.lv-2 .bar { background: var(--lv2); }
.odai.lv-3 .bar { background: var(--lv3); }
.bar .btn-text { color: var(--ink-on-color); }
.bar-host { margin-left: auto; }
.bar-timer { font-variant-numeric: tabular-nums; min-width: 3.2em; }
.bar-timer.is-warn {
  background: var(--surface); color: var(--alert-ink);
  padding: 0 10px; border-radius: var(--radius);
  animation: pulse 1s ease-in-out infinite;
}
.bar-score { position: relative; }
.bump {
  position: absolute; left: 100%; top: -6px; margin-left: 6px;
  font-size: .8em; animation: bump .5s ease-out both;
}
.odai .badge { background: var(--surface); color: var(--ink); }

@keyframes pulse { 50% { transform: scale(1.08); } }
@keyframes bump { 0% { transform: translateY(8px) scale(.6); opacity: 0; } 50% { transform: translateY(-6px) scale(1.15); opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.screen { animation: fadein .2s ease-out; }

/* ---------- ⓪ はじめる ---------- */
.setup { align-items: center; justify-content: center; gap: 24px; padding: 24px 16px; height: auto; min-height: 100dvh; }
.setup-title { margin: 0; font-size: clamp(30px, 5vw, 52px); font-weight: 800; text-align: center; }
.setup-form {
  width: min(760px, 100%); display: grid; gap: 18px;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: clamp(18px, 3vw, 32px);
}
.field { display: grid; gap: 8px; }
.field-label { font-size: 18px; color: var(--ink-muted); }
.team-names { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.checks { display: flex; flex-wrap: wrap; gap: 10px; }
.check {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 16px; border-radius: var(--radius);
  border: 3px solid var(--line); background: var(--surface); font-size: 20px; cursor: pointer;
}
.check input { width: 24px; height: 24px; accent-color: var(--action); }
.check.lv-1:has(input:checked) { border-color: var(--lv1); color: var(--lv1); }
.check.lv-2:has(input:checked) { border-color: var(--lv2); color: var(--lv2); }
.check.lv-3:has(input:checked) { border-color: var(--lv3); color: var(--lv3); }
.setup-foot { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; justify-content: center; font-size: 18px; }

/* ---------- ① チーム交代 ---------- */
.turn { align-items: center; justify-content: center; gap: clamp(16px, 4vh, 40px); padding: 24px 16px; text-align: center; }
.turn-round { margin: 0; font-size: 22px; color: var(--ink-muted); }
.turn-title { margin: 0; font-size: clamp(34px, 8vh, 80px); font-weight: 800; line-height: 1.2; }
.turn-team { white-space: nowrap; }
.turn-foot { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; justify-content: center; }
.scoreline { display: flex; flex-wrap: wrap; gap: 8px 20px; list-style: none; margin: 0; padding: 0; font-size: 22px; }
.scoreline li { display: flex; gap: 8px; padding: 4px 10px; border-bottom: 3px solid transparent; }
.scoreline li.is-now { border-bottom-color: var(--line-strong); }
.scoreline b { font-weight: 800; }

/* ---------- ② レベルを選ぶ ---------- */
.lvgrid {
  flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(10px, 1.6vw, 20px);
  padding: clamp(14px, 3vh, 32px) clamp(14px, 3vw, 32px) 0;
}
.lvbtn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3em;
  border: 3px solid transparent; border-radius: var(--radius);
  color: var(--ink-on-color); font-weight: 800; font-size: clamp(22px, 5.2vh, 50px); line-height: 1.15;
  transition: transform .08s ease;
}
.lvbtn:active { transform: scale(.97); }
.lvbtn.lv-0 { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.lvbtn-stars { font-size: 1.3em; letter-spacing: .05em; }
.lvbtn-name { font-size: 1.05em; }
.lvbtn-left { font-size: .72em; opacity: .95; }
.level-foot { display: flex; justify-content: flex-end; padding: clamp(12px, 2.5vh, 24px) clamp(14px, 3vw, 32px); }

/* ---------- ③ お題 ---------- */
.odai-body {
  flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 8px 16px; text-align: center;
}
.odai-emoji { font-family: var(--emoji); font-size: clamp(64px, 20vh, 190px); line-height: 1.1; }
.odai-text { margin: 0; font-weight: 800; line-height: 1.1; letter-spacing: .02em; word-break: keep-all; overflow-wrap: anywhere; }
.odai-text.s4  { font-size: min(26vh, 19vw); }
.odai-text.s6  { font-size: min(21vh, 14vw); }
.odai-text.s8  { font-size: min(17vh, 11vw); }
.odai-text.s10 { font-size: min(14vh, 8.6vw); }
.odai-yomi { margin: .4em 0 0; font-size: clamp(20px, 4vh, 36px); color: var(--ink-muted); }
.odai-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: clamp(12px, 2vw, 24px); padding: 0 clamp(14px, 3vw, 32px) clamp(14px, 3vh, 28px); }

/* ---------- ④ 司会用 ---------- */
.host { height: auto; min-height: 100dvh; padding: 0 0 24px; }
.host-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px clamp(16px, 3vw, 32px); background: var(--action); color: var(--ink-on-color);
}
.host-head h1 { margin: 0; font-size: 28px; font-weight: 800; }
.host-head .btn-main { background: var(--surface); color: var(--ink); border-color: var(--surface); min-height: 48px; font-size: 20px; }
.host-now { margin: 16px clamp(16px, 3vw, 32px) 0; padding: 12px 16px; border-left: 8px solid var(--line-strong); background: var(--surface); }
.host-now p { margin: 0; }
.host-now-label { font-size: 16px; color: var(--ink-muted); }
.host-now-odai { font-size: 30px; font-weight: 800; }
.host-hantei { font-size: 22px; margin-top: 4px !important; }
.host-teams {
  list-style: none; margin: 16px 0 0; padding: 0 clamp(16px, 3vw, 32px);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px;
}
.host-team { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); }
.host-team-head { display: flex; justify-content: space-between; padding: 10px 14px; border-bottom: 2px solid var(--line); font-size: 22px; }
.host-team-head b { font-weight: 800; }
.host-hist { list-style: none; margin: 0; padding: 6px 14px 10px; font-size: 18px; }
.host-hist li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.host-hist li:last-child { border-bottom: 0; }
.host-hist .r-ok span:last-child { color: var(--done-ink); }
.host-hist .r-pass span:last-child, .host-hist .r-timeup span:last-child { color: var(--ink-muted); }
.host-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 20px clamp(16px, 3vw, 32px) 0; font-size: 18px; }

/* 確認の小窓 */
.confirm { border: 3px solid var(--line-strong); border-radius: var(--radius); padding: 24px; max-width: min(520px, 92vw); background: var(--surface); color: var(--ink); }
.confirm::backdrop { background: rgb(0 0 0 / .45); }
.confirm-text { margin: 0 0 20px; font-size: 20px; line-height: 1.6; }
.confirm-actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- スマホ（縦）---------- */
@media (max-width: 700px) {
  .lvgrid { grid-template-columns: 1fr 1fr; }
  .lvbtn { font-size: 22px; }
  .lvbtn-name { font-size: .9em; }
  .setup-title { font-size: 26px; }
  .setup .btn-xl { font-size: 24px; }
  .turn-title { font-size: 34px; }
  .bar { font-size: 18px; gap: 10px; flex-wrap: wrap; }
  .odai-text.s4  { font-size: 22vw; }
  .odai-text.s6  { font-size: 15vw; }
  .odai-text.s8  { font-size: 11.5vw; }
  .odai-text.s10 { font-size: 9.2vw; }
  .odai-emoji { font-size: 22vw; }
  .odai-actions { grid-template-columns: 1fr 1.3fr; }
  .btn-xl { padding: 0 16px; }
}

/* 動きを減らす設定がオンなら、はねる・脈打つを止める */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
