/* 居酒屋パズル — ポップでカラフルなパーティー調 */
:root {
  --bg1: #1d1442;
  --bg2: #3a1a5c;
  --ink: #fff8ec;
  --muted: #c9bce6;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-line: rgba(255, 255, 255, 0.16);
  --pink: #ff4f8b;
  --yellow: #ffd23f;
  --cyan: #2ee6d6;
  --orange: #ff8a3d;
  --red: #ff4545;
  --board-bg: #120c2c;
  --cell-empty: #251c4d;
  /* 置いた人の色（皿の縁） */
  --o1: #ff4f8b;
  --o2: #20c9bb;
  --o3: #f5b700;
  --o4: #a35bff;
  --o5: #43c14f;
  --o6: #ff8a2b;
  --o7: #3f6dff;
  --o8: #8a5a2b;
  --plate: #fffaf0;
  --plate-rim: #d8cbb0;
  --cell: 28px;
  --radius: 16px;
  --font: "Hiragino Maru Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 79, 139, 0.25), transparent 40%),
    radial-gradient(circle at 85% 20%, rgba(46, 230, 214, 0.18), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(255, 210, 63, 0.15), transparent 50%),
    linear-gradient(160deg, var(--bg1), var(--bg2));
  background-attachment: fixed;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}
input { -webkit-user-select: text; user-select: text; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mt { margin-top: 1rem; }

#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; }
.screen { min-height: 100dvh; padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; }

/* ---------- ボタン ---------- */
.btn {
  font: inherit; color: var(--ink); background: var(--panel); border: 2px solid var(--panel-line);
  border-radius: 999px; padding: 10px 18px; cursor: pointer; font-weight: 700;
  transition: transform 0.08s ease, filter 0.15s ease, opacity 0.15s;
  touch-action: manipulation;
}
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn.big { display: flex; flex-direction: column; align-items: center; width: 100%; padding: 14px 18px; border: none; border-radius: var(--radius); font-size: 1.15rem; box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35); }
.btn.big:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.btn.big small { font-size: 0.8rem; font-weight: 600; opacity: 0.85; }
.btn.pink { background: var(--pink); border-color: var(--pink); color: #fff; }
.btn.yellow { background: var(--yellow); border-color: var(--yellow); color: #3a2300; }
.btn.cyan { background: var(--cyan); border-color: var(--cyan); color: #04302c; }
.btn.danger { border-color: var(--red); color: #ffb3b3; }
.btn.small { padding: 6px 14px; font-size: 0.85rem; }
.btn.link { background: none; border: none; color: var(--muted); text-decoration: underline; }
.btn.icon { width: 42px; height: 42px; padding: 0; font-size: 1.3rem; }
.btn.back { background: none; border: none; padding: 8px 4px; color: var(--muted); }

/* ---------- トップ ---------- */
.home-hero { text-align: center; padding: 24px 0 8px; }
.logo { margin: 8px 0; white-space: nowrap; font-size: clamp(2rem, 10vw, 3rem); line-height: 1.1; letter-spacing: 0.04em;
  text-shadow: 0 4px 0 var(--pink), 0 8px 18px rgba(0, 0, 0, 0.4); }
.logo-sub { display: block; font-size: 0.4em; color: var(--yellow); text-shadow: none; letter-spacing: 0.3em; margin-bottom: 6px; }
.tagline { color: var(--muted); line-height: 1.7; }
.lanterns { display: flex; justify-content: center; gap: 28px; height: 64px; }
.lanterns span { width: 34px; height: 46px; border-radius: 45%; background: radial-gradient(circle at 50% 40%, #ffcf6b, var(--orange) 45%, #c73a1c);
  box-shadow: 0 0 24px rgba(255, 138, 61, 0.7); position: relative; animation: sway 3s ease-in-out infinite; transform-origin: 50% -16px; }
.lanterns span::before { content: ""; position: absolute; left: 50%; top: -16px; width: 2px; height: 16px; background: #886; }
.lanterns span:nth-child(2) { margin-top: 14px; animation-delay: -1s; background: radial-gradient(circle at 50% 40%, #ff9ab8, var(--pink) 45%, #a8164a); box-shadow: 0 0 24px rgba(255, 79, 139, 0.7); }
.lanterns span:nth-child(3) { animation-delay: -2s; }
@keyframes sway { 50% { transform: rotate(6deg); } }
.menu { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.card-box { background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius); padding: 14px 16px; margin-top: 16px; }
#resume-box { text-align: center; }

/* ---------- フォーム ---------- */
.bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.bar h2 { margin: 0; font-size: 1.15rem; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
input[type=text], input:not([type]), .form input[name] {
  font: inherit; font-size: 1.1rem; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--panel-line);
  background: rgba(0, 0, 0, 0.25); color: var(--ink); outline: none;
}
input:focus { border-color: var(--cyan); }
input[name=code] { letter-spacing: 0.15em; text-transform: uppercase; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 0; }
.error { color: #ff9c9c; min-height: 1.2em; margin: 0; font-weight: 700; }
.tabs { display: flex; background: rgba(0, 0, 0, 0.25); border-radius: 999px; padding: 4px; margin: 6px 0 18px; }
.tab { flex: 1; font: inherit; font-weight: 700; color: var(--muted); background: none; border: none; padding: 10px; border-radius: 999px; cursor: pointer; }
.tab.active { background: var(--ink); color: var(--bg1); }
.roles { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.roles legend { font-weight: 700; margin-bottom: 6px; }
.role { flex-direction: row !important; align-items: center; gap: 10px !important; padding: 10px 12px; border: 2px solid var(--panel-line); border-radius: 12px; cursor: pointer; }
.role:has(input:checked) { border-color: var(--cyan); background: rgba(46, 230, 214, 0.1); }
.role input { width: 20px; height: 20px; accent-color: var(--cyan); }
.role span { display: flex; flex-direction: column; }
.role small { color: var(--muted); font-weight: 500; }
.name-list { margin: 0; padding-left: 1.6em; display: flex; flex-direction: column; gap: 8px; }
.name-list li { font-weight: 700; color: var(--muted); }
.name-row { display: flex; gap: 8px; align-items: center; }
.name-row input { flex: 1; min-width: 0; }
.name-row .btn { flex: none; }

/* ---------- ロビー ---------- */
.invite { text-align: center; }
.invite p { margin: 0; }
.code { font-size: 2rem; font-weight: 800; letter-spacing: 0.12em; color: var(--yellow); margin: 4px 0 8px !important; -webkit-user-select: text; user-select: text; }
.qr { background: #fff; border-radius: 12px; padding: 8px; width: 180px; height: 180px; display: block; margin: 0 auto 10px; }
.card-box h3 { margin: 0 0 8px; font-size: 1rem; }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.people li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: rgba(0, 0, 0, 0.18); border-radius: 10px; }
.people li .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.people li.muted { background: none; padding-left: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #5ee36a; flex: none; }
.dot.off { background: #777; }
.tag { font-size: 0.72rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--yellow); color: #3a2300; flex: none; }
.tag.me { background: var(--cyan); color: #04302c; }
.tag.off { background: #555; color: #ddd; }
.lobby-actions { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.lobby-actions .btn:not(.big) { align-self: stretch; }

/* ---------- ゲーム ---------- */
#s-game { padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: max(8px, env(safe-area-inset-bottom)); height: 100dvh; min-height: 0; gap: 6px; }
.game-top { flex: none; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stats { display: flex; gap: 12px; font-size: 0.9rem; color: var(--muted); }
.stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.turn-list { list-style: none; display: flex; gap: 6px; margin: 6px 0 0; padding: 2px 0 4px; overflow-x: auto; scrollbar-width: none; }
.turn-list::-webkit-scrollbar { display: none; }
.turn-list li { flex: none; display: flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: var(--panel); border: 2px solid transparent; font-size: 0.85rem; font-weight: 700; max-width: 9.5em; }
.turn-list li .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.turn-list li.current { border-color: var(--yellow); background: rgba(255, 210, 63, 0.18); }
.turn-list li.off { opacity: 0.55; }
.turn-list li .crown { color: var(--yellow); }
.turn-msg { margin: 4px 0 0; text-align: center; font-weight: 800; font-size: 1rem; min-height: 1.4em; }
.turn-msg.mine { color: var(--yellow); }

.board-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.board {
  position: relative; display: grid; grid-template-columns: repeat(10, var(--cell)); grid-template-rows: repeat(var(--rows, 15), var(--cell));
  gap: 0; padding: 4px; background: var(--wood); border-radius: 12px; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12), 0 10px 30px rgba(0, 0, 0, 0.45);
  touch-action: none;
}
.cell { width: var(--cell); height: var(--cell); padding: 1.5px; }
.cell.just::before { animation: pop 0.35s ease-out; }
@keyframes pop { 0% { transform: scale(0.4); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }

.preview { position: absolute; inset: 4px; pointer-events: none; }
.preview .pc { position: absolute; width: var(--cell); height: var(--cell); padding: 1.5px; }
.flash-row { position: absolute; left: 4px; right: 4px; height: var(--cell); background: linear-gradient(90deg, transparent, #fff, transparent); animation: flash 0.7s ease-out forwards; pointer-events: none; border-radius: 6px; }
@keyframes flash { from { opacity: 1; transform: scaleX(0.2); } 50% { opacity: 1; transform: scaleX(1); } to { opacity: 0; transform: scaleX(1); } }

.controls { flex: none; display: flex; flex-direction: column; gap: 8px; }
.tray { position: relative; height: 112px; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.22); border-radius: var(--radius); border: 2px dashed var(--panel-line); overflow: visible; }
.tray-msg { color: var(--muted); font-weight: 700; text-align: center; padding: 0 12px; }
.ctrl-buttons { display: grid; grid-template-columns: 1fr 1fr 1fr 1.3fr; gap: 6px; }
.btn.ctrl { display: flex; flex-direction: column; align-items: center; gap: 0; border-radius: 14px; padding: 6px 4px; font-size: 0.85rem; }
.btn.ctrl span { font-size: 1.3rem; line-height: 1.1; }
.spectator-bar { align-items: center; padding: 10px; background: var(--panel); border-radius: var(--radius); }
.spectator-bar p { margin: 0; }
.badge { background: var(--cyan); color: #04302c; padding: 2px 10px; border-radius: 999px; font-weight: 800; font-size: 0.85rem; }

/* 抽選カード */
.draw-card { width: 78px; height: 100px; perspective: 600px; cursor: pointer; border: none; background: none; padding: 0; }
.draw-card .inner { position: relative; width: 100%; height: 100%; transition: transform 0.55s cubic-bezier(.2, .9, .3, 1.2); transform-style: preserve-3d; }
.draw-card.flip .inner { transform: rotateY(180deg); }
.draw-card .face { position: absolute; inset: 0; border-radius: 12px; backface-visibility: hidden; display: flex; align-items: center; justify-content: center; flex-direction: column; }
.draw-card .back {
  background: repeating-linear-gradient(45deg, var(--pink) 0 8px, #ff6fa1 8px 16px); border: 3px solid #fff; box-shadow: 0 6px 0 rgba(0, 0, 0, 0.3);
  color: #fff; font-weight: 800; font-size: 0.8rem; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}
.draw-card .back::before { content: "引く"; font-size: 1.6rem; display: block; }
.draw-card .front { background: #fff8ec; border: 3px solid var(--yellow); transform: rotateY(180deg); color: #3a2300; font-weight: 800; font-size: 0.75rem; }
.draw-card.wiggle .inner { animation: wiggle 1.6s ease-in-out infinite; }
@keyframes wiggle { 0%, 70%, 100% { transform: rotate(0); } 78% { transform: rotate(-6deg); } 86% { transform: rotate(6deg); } 94% { transform: rotate(-3deg); } }
.tray-row { display: flex; align-items: center; gap: 16px; }
.food { font-size: 0.8rem; font-weight: 800; color: var(--yellow); text-align: center; }

.piece { position: relative; touch-action: none; cursor: grab; }
.piece .pc, .drag-ghost .pc, .mini-piece .pc { position: absolute; padding: 1.5px; }
.mini-piece { position: relative; flex: none; }
.mini-piece .pc { padding: 1px; }
.piece.placed { opacity: 0.3; cursor: default; }
.piece.returning { transition: transform 0.25s ease; }
.drag-ghost { position: fixed; left: 0; top: 0; pointer-events: none; z-index: 50; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.5)); }
.drag-ghost.over { opacity: 0.25; }

/* 1台モードの手番交代 */
.handoff { position: fixed; inset: 0; z-index: 60; background: rgba(29, 20, 66, 0.96); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 24px; text-align: center; font-weight: 800; font-size: 1.2rem; }
.handoff p { margin: 0; }
.handoff-name { font-size: 2.4rem; color: var(--yellow); margin: 8px 0 !important; word-break: break-all; }
.handoff .btn { max-width: 300px; margin-top: 24px; }

/* ---------- 結果 ---------- */
.result { margin: auto 0; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.result-reason { margin: 0; color: var(--muted); font-weight: 700; }
.result-title { margin: 0; font-size: 2rem; color: var(--yellow); text-shadow: 0 4px 0 var(--pink); }
.result-board { --cell: 14px; display: grid; grid-template-columns: repeat(10, var(--cell)); padding: 4px; background: var(--board-bg); border-radius: 10px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; margin: 0; }
.result-stats div { background: var(--panel); border-radius: 14px; padding: 10px 4px; }
.result-stats dt { font-size: 0.8rem; color: var(--muted); }
.result-stats dd { margin: 4px 0 0; font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.result .btn.big { max-width: 360px; }

/* ---------- シート・ダイアログ ---------- */
.sheet { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, 0.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet.center { align-items: center; padding: 16px; }
.sheet-panel { width: 100%; max-width: 560px; max-height: 88dvh; overflow-y: auto; background: #2a1c55; border-radius: 20px 20px 0 0; padding: 18px 16px max(18px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.sheet.center .sheet-panel { border-radius: 20px; max-width: 440px; }
.sheet-panel h3 { margin: 0 0 4px; }
.people .btn.small { padding: 3px 10px; font-size: 0.78rem; }
.invite-mini { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; color: var(--muted); }
.invite-mini b { color: var(--yellow); letter-spacing: 0.1em; }
#dialog-body h3 { margin: 0 0 8px; }
#dialog-body p, #dialog-body li { line-height: 1.6; }
#dialog-body ul { padding-left: 1.2em; margin: 0; }
#dialog-body .qr { margin-top: 10px; }
.dialog-buttons { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- 広告ゲート ---------- */
.ad-gate { position: fixed; inset: 0; z-index: 90; background: #000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.ad-frame { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 8px; }
.ad-label { align-self: flex-start; background: var(--yellow); color: #000; font-size: 0.75rem; font-weight: 800; padding: 2px 8px; border-radius: 4px; }
.ad-video { aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: linear-gradient(120deg, #ff4f8b, #ffd23f, #2ee6d6, #b06bff); background-size: 300% 300%; animation: adbg 4s ease infinite; display: flex; align-items: center; justify-content: center; text-align: center; font-weight: 800; color: #fff; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); font-size: 1.2rem; }
@keyframes adbg { 50% { background-position: 100% 50%; } }
.ad-bar { height: 4px; background: #333; border-radius: 2px; overflow: hidden; }
.ad-progress { height: 100%; width: 0; background: var(--yellow); }
.ad-foot { display: flex; justify-content: space-between; align-items: center; color: #bbb; font-size: 0.85rem; }

/* ---------- トースト・紙吹雪 ---------- */
.toast { position: fixed; left: 50%; top: max(16px, env(safe-area-inset-top)); transform: translate(-50%, -120%); z-index: 100; background: #fff8ec; color: #2a1c55; font-weight: 800; padding: 10px 18px; border-radius: 999px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); transition: transform 0.3s ease, visibility 0.3s; visibility: hidden; max-width: calc(100% - 32px); text-align: center; pointer-events: none; }
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.toast.big { font-size: 1.4rem; background: var(--yellow); white-space: nowrap; }
.confetti { position: fixed; top: -10px; width: 8px; height: 14px; z-index: 80; pointer-events: none; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }

/* スマホ横向きは案内を表示 */
.rotate-hint { display: none; }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .rotate-hint { display: flex; position: fixed; inset: 0; z-index: 200; background: var(--bg1); align-items: center; justify-content: center; text-align: center; font-weight: 800; font-size: 1.3rem; }
}

/* タブレット・PC: 盤面を大きく、操作を横に */
@media (min-width: 900px) and (min-height: 600px) {
  .tray.has-top { height: 210px; }
  #app { max-width: 980px; }
  #s-game { display: grid; grid-template-columns: 1fr 300px; grid-template-rows: auto minmax(0, 1fr); column-gap: 24px; }
  #s-game .board-wrap { overflow: hidden; }
  #s-game .game-top { grid-column: 1 / -1; }
  #s-game .board-wrap { grid-column: 1; grid-row: 2; }
  #s-game .controls { grid-column: 2; grid-row: 2; align-self: center; }
  .tray { height: 180px; }
  .ctrl-buttons { grid-template-columns: 1fr; }
  .btn.ctrl { flex-direction: row; justify-content: center; gap: 8px; padding: 12px; font-size: 1rem; }
  .screen:not(#s-game) { max-width: 560px; margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- 料理の設定 ---------- */
.foods-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.foods-head h3 { margin: 0 !important; }
.food-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.food-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: rgba(0, 0, 0, 0.18); border-radius: 10px; font-weight: 700; font-size: 0.9rem; min-width: 0; }
.food-list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.food-list li .none { color: var(--muted); font-weight: 500; }
.food-edit { display: flex; flex-direction: column; gap: 8px; }
.food-edit label { display: flex; align-items: center; gap: 10px; }
.food-edit .mini-wrap { width: 48px; display: flex; justify-content: center; flex: none; }
.food-edit input { flex: 1; min-width: 0; font: inherit; font-size: 1rem; padding: 9px 12px; border-radius: 10px; border: 2px solid var(--panel-line); background: rgba(0, 0, 0, 0.25); color: var(--ink); outline: none; }
.food-edit input:focus { border-color: var(--cyan); }
.food-edit-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.draw-card .food-name { margin-top: 6px; padding: 0 4px; line-height: 1.2; word-break: break-all; text-align: center; }
.foods-box .hint { margin-top: 10px; }

/* ---------- ルール設定 ---------- */
.settings-box h3 { margin: 0 0 8px; }
.setting-row { display: flex !important; flex-direction: row !important; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; font-weight: 700; }
.setting-row + .setting-row { border-top: 1px solid var(--panel-line); }
.setting-row span { display: flex; flex-direction: column; }
.setting-row small { color: var(--muted); font-weight: 500; font-size: 0.78rem; }
.setting-row select { font: inherit; font-weight: 700; padding: 8px 10px; border-radius: 10px; border: 2px solid var(--panel-line); background: rgba(0, 0, 0, 0.3); color: var(--ink); }
.setting-row select:disabled, .switch:disabled { opacity: 0.55; }
.switch { appearance: none; -webkit-appearance: none; width: 52px; height: 30px; border-radius: 999px; background: rgba(255, 255, 255, 0.18); position: relative; cursor: pointer; flex: none; transition: background 0.2s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.switch:checked { background: var(--cyan); }
.switch:checked::after { transform: translateX(22px); }

/* ---------- 除外中・選べるカード・タイマー ---------- */
.excluded { position: absolute; top: 5px; left: 8px; right: 70px; display: flex; align-items: center; gap: 5px; flex-wrap: nowrap; overflow: hidden; font-size: 0.72rem; font-weight: 800; color: #ffb3b3; }
.excluded-label { flex: none; }
.excluded-chip { position: relative; flex: none; display: flex; align-items: center; justify-content: center; padding: 2px 4px; border-radius: 6px; background: rgba(255, 69, 69, 0.18); border: 1px solid rgba(255, 120, 120, 0.5); }
.excluded-chip::after { content: ""; position: absolute; left: 2px; right: 2px; top: 50%; border-top: 1.5px solid #ff6b6b; transform: rotate(-12deg); }
.timer { position: absolute; top: 3px; right: 8px; font-size: 0.8rem; line-height: 18px; font-weight: 800; font-variant-numeric: tabular-nums; padding: 0 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); }
.timer.hurry { background: var(--orange); color: #3a1300; animation: pulse 0.5s ease-in-out infinite alternate; }
.timer.over { background: var(--red); color: #fff; }
@keyframes pulse { to { transform: scale(1.12); } }
.draw-card.special .front { background: linear-gradient(160deg, #fff6c8, #ffd23f); border-color: var(--pink); }
.draw-card .star { color: var(--pink); font-size: 1.1rem; line-height: 1; margin-bottom: 2px; }
.draw-card .food-name { white-space: pre-line; }
.choose-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; flex: 1; max-width: 260px; }
.choose-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 36px; padding: 4px 2px; border-radius: 10px; border: 2px solid var(--panel-line); background: rgba(255, 255, 255, 0.08); color: var(--ink); font: inherit; font-size: 0.62rem; font-weight: 700; cursor: pointer; }
.choose-btn span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choose-btn:not(:disabled):active { transform: scale(0.95); }
.choose-btn:disabled { opacity: 0.25; cursor: default; }
.result-board { grid-template-rows: repeat(var(--rows, 15), var(--cell)); }
.tray.has-top { padding-top: 30px; height: 142px; }

/* ---------- 料理の見た目（木のカウンター・小皿・料理の絵） ---------- */
:root {
  --wood: repeating-linear-gradient(178deg, rgba(120, 66, 22, 0.16) 0 2px, transparent 2px 11px, rgba(255, 230, 190, 0.12) 11px 13px, transparent 13px 23px), linear-gradient(160deg, #d39a5c, #b9783a);
}
.result-board { background: var(--wood); }
.cell, .pc { position: relative; }
.cell::before { content: ""; display: block; width: 100%; height: 100%; box-sizing: border-box; border-radius: 50%; border: 1.5px dashed rgba(90, 48, 14, 0.35); }
.cell[data-k]::before, .pc::before { content: ""; display: block; width: 100%; height: 100%; box-sizing: border-box; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, var(--plate) 0 58%, #efe6d4 59% 100%); border: max(2px, calc(var(--cell) * 0.09)) solid var(--plate-rim); box-shadow: 0 1px 2px rgba(60, 30, 5, 0.35); }
.cell[data-k]::after, .pc::after { content: ""; position: absolute; inset: 14%; background: center / contain no-repeat; pointer-events: none; }
.cell[data-k="8"]::before, .cell[data-k="9"]::before { background: none; border: none; box-shadow: none; }
.cell[data-k="8"]::after, .cell[data-k="9"]::after { inset: 4%; }
.cell[data-k="1"]::after, .pc[data-k="1"]::after { background-image: url(../img/food-1.svg); }
.cell[data-k="2"]::after, .pc[data-k="2"]::after { background-image: url(../img/food-2.svg); }
.cell[data-k="3"]::after, .pc[data-k="3"]::after { background-image: url(../img/food-3.svg); }
.cell[data-k="4"]::after, .pc[data-k="4"]::after { background-image: url(../img/food-4.svg); }
.cell[data-k="5"]::after, .pc[data-k="5"]::after { background-image: url(../img/food-5.svg); }
.cell[data-k="6"]::after, .pc[data-k="6"]::after { background-image: url(../img/food-6.svg); }
.cell[data-k="7"]::after, .pc[data-k="7"]::after { background-image: url(../img/food-7.svg); }
.cell[data-k="8"]::after { background-image: url(../img/food-8.svg); }
.cell[data-k="9"]::after { background-image: url(../img/food-9.svg); }
.cell[data-o="1"]::before { border-color: var(--o1); }
.cell[data-o="2"]::before { border-color: var(--o2); }
.cell[data-o="3"]::before { border-color: var(--o3); }
.cell[data-o="4"]::before { border-color: var(--o4); }
.cell[data-o="5"]::before { border-color: var(--o5); }
.cell[data-o="6"]::before { border-color: var(--o6); }
.cell[data-o="7"]::before { border-color: var(--o7); }
.cell[data-o="8"]::before { border-color: var(--o8); }
.cell.just::after { animation: pop 0.35s ease-out; }
.mini-piece .pc::before { border-width: 1px; box-shadow: none; }
.mini-piece .pc::after { inset: 4%; }
.preview .pc { opacity: 0.75; }
.preview.ng .pc::before { background: rgba(255, 69, 69, 0.55); border-color: #ff4545; }
.preview.ng .pc::after { opacity: 0.45; }
.preview.ok .pc::before { border-color: #fff; border-style: dashed; }
.choose-btn .mini-piece .pc::before, .food-list .mini-piece .pc::before { background: var(--plate); }
/* 人の色の丸（手番一覧・参加者一覧） */
.slot { width: 12px; height: 12px; border-radius: 50%; flex: none; border: 2.5px solid var(--o, #999); background: var(--plate); }
.slot[data-o="1"] { --o: var(--o1); } .slot[data-o="2"] { --o: var(--o2); } .slot[data-o="3"] { --o: var(--o3); } .slot[data-o="4"] { --o: var(--o4); }
.slot[data-o="5"] { --o: var(--o5); } .slot[data-o="6"] { --o: var(--o6); } .slot[data-o="7"] { --o: var(--o7); } .slot[data-o="8"] { --o: var(--o8); }
.food-icon { width: 34px; flex: none; display: flex; justify-content: center; align-items: center; }

/* ---------- 遊び方（図付き） ---------- */
.howto-title { margin: 0; font-weight: 800; color: var(--yellow); font-size: 1.05rem; }
.howto-figure { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; min-height: 150px; padding: 12px 8px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); }
.howto-text { margin: 0; min-height: 4.8em; line-height: 1.6; }
.howto-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.howto-dots { display: flex; gap: 5px; }
.howto-dots span { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.25); }
.howto-dots span.on { background: var(--yellow); }
.demo-board { display: grid; grid-template-columns: repeat(var(--cols), var(--cell)); padding: 4px; border-radius: 8px; background: var(--wood); }
.demo-board .cell.demo-ok::before { border: 2px dashed #fff; }
.demo-board .cell.demo-ok::after { opacity: 0.75; }
.demo-board .cell.demo-ng::before { background: rgba(255, 69, 69, 0.6); border-color: #ff4545; }
.demo-board .cell.demo-ng::after { opacity: 0.45; }
.demo-board .cell.demo-flash::before { box-shadow: 0 0 0 2px #fff8b0, 0 0 10px #fff3a0; }
.demo-arrow { font-size: 1.3rem; font-weight: 800; color: var(--yellow); }
.demo-card { width: 62px; height: 80px; cursor: default; }
.demo-card .front { font-size: 0.68rem; }
.demo-btn { pointer-events: none; min-width: 84px; }
.demo-chip { padding: 4px 6px; }
.demo-note { font-weight: 800; font-size: 0.85rem; color: var(--muted); }
.demo-choose { display: grid; grid-template-columns: repeat(4, 36px); gap: 4px; }
.demo-choose .choose-btn { min-height: 30px; cursor: default; }
.demo-board .cell.demo-ng[data-k="8"]::before { background: rgba(255, 69, 69, 0.75); border: 2px solid #ff4545; border-radius: 50%; }

/* ---------- 〆の皿・クリア ---------- */
.st-goal { color: #ffb19c; }
.st-goal b { color: #ffd65a; }
#s-result.cleared .result-title { font-size: 2.6rem; color: #ffd65a; text-shadow: 0 4px 0 #c8321e, 0 0 24px rgba(255, 214, 90, 0.6); }
.demo-clear { font-weight: 800; font-size: 1.3rem; color: #ffd65a; text-shadow: 0 3px 0 #c8321e; }

/* ---------- 招待 QR の読み取り ---------- */
.btn.cyan-outline { border-color: var(--cyan); color: var(--cyan); }
.qr-scan { position: fixed; inset: 0; z-index: 95; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px; }
.qr-scan-view { position: relative; width: min(100%, 420px); aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: #111; }
.qr-scan-view video { width: 100%; height: 100%; object-fit: cover; }
.qr-frame { position: absolute; inset: 15%; border: 3px solid var(--yellow); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35); }
.qr-scan-msg { color: #fff; font-weight: 700; text-align: center; margin: 0; min-height: 1.4em; }

/* ---------- トップの注意書き・利用規約ページ ---------- */
.home-foot { margin-top: auto; padding-top: 24px; text-align: center; font-size: 0.8rem; color: var(--muted); }
.home-foot p { margin: 6px 0; line-height: 1.6; }
.home-foot a, .doc-page a:not(.btn) { color: var(--cyan); }
.doc-page { max-width: 720px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px 40px; line-height: 1.8; -webkit-user-select: text; user-select: text; }
.doc-page h1 { font-size: 1.5rem; margin: 12px 0 4px; color: var(--yellow); }
.doc-page h2 { font-size: 1.1rem; margin: 28px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--panel-line); }
.doc-page h3 { font-size: 0.95rem; margin: 16px 0 4px; color: var(--cyan); }
.doc-page ul { padding-left: 1.3em; margin: 4px 0; }
.doc-page .doc-date { color: var(--muted); margin: 0; font-size: 0.85rem; }
.doc-page .btn { text-decoration: none; display: inline-block; }
