:root {
  --paper: #faf6ef; --ink: #2b2620; --rule: #cdbfa8; --brown: #7a5a3a;
  --matcha: #5c7838; --matcha-d: #4a6229; --shu: #b0442c; --card: #f3ead9;
  --focus: #b0442c; --ad-line: #cdbfa8; --ad-text: #7a5a3a;
  --mincho: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", "BIZ UDPMincho", serif;
  color-scheme: light;
}
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .48 0 0 0 0 .36 0 0 0 0 .23 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--ink); font-family: var(--mincho);
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; color: inherit; }

.site-title { display: none; }
.stage {
  max-width: 520px; margin: 0 auto; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; padding: 0 16px max(12px, env(safe-area-inset-bottom));
}
.bar { display: flex; align-items: center; justify-content: space-between; min-height: 52px; border-bottom: 1px solid var(--rule); flex: none; }
.cupno { font-size: 17px; letter-spacing: .05em; }
.text-btn { margin-left: auto; margin-right: 8px; min-height: 44px; padding: 0 10px; border: 0; background: transparent; color: var(--brown); font: inherit; font-size: 15px; cursor: pointer; }
.text-btn.armed { color: var(--shu); text-decoration: underline; }
.icon-btn { width: 44px; height: 44px; border: 1px solid var(--rule); background: transparent; border-radius: 8px; display: grid; place-items: center; cursor: pointer; color: var(--brown); }
.icon-btn[aria-pressed="true"] .mute, .icon-btn[aria-pressed="false"] .wave { display: none; }

.scene { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: stretch; padding-top: 12px; }
.scene.scroll { overflow-y: auto; }

/* 札 */
.ticket {
  align-self: center; background: var(--card); border-left: 6px solid var(--matcha);
  padding: 8px 24px 10px; text-align: center; min-width: 62%;
  box-shadow: 0 1px 0 rgba(122, 90, 58, .25);
}
.ticket h1, .ticket h2 { margin: 0; font-size: 28px; letter-spacing: .08em; font-weight: 600; }
.ticket p { margin: 2px 0 0; font-size: 14px; color: var(--brown); }
.ticket .big { font-size: 40px; line-height: 1.15; margin: 0; color: var(--ink); font-weight: 600; letter-spacing: .04em; }
.ticket .sub::before, .ticket .sub::after { content: ""; display: inline-block; width: 1.6em; border-top: 1px solid var(--brown); vertical-align: middle; margin: 0 .5em; }
.flip { animation: flip .45s ease-out both; transform-origin: top center; }
@keyframes flip { from { transform: perspective(600px) rotateX(-80deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* 器 */
.vessel-wrap { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: center; touch-action: none; user-select: none; -webkit-user-select: none; }
.vessel-wrap svg { width: 100%; height: 100%; max-height: 480px; display: block; overflow: hidden; }
svg text { font-family: var(--mincho); }
.ring { transform-box: fill-box; transform-origin: center; animation: ring 1.1s ease-out 1 both; }
@keyframes ring { from { transform: scale(.2); opacity: .9; } to { transform: scale(1.6); opacity: 0; } }
.drop { animation: drop .7s ease-in 1 both; }
@keyframes drop { from { transform: translateY(0); opacity: 1; } to { transform: translateY(60px); opacity: 0; } }

.turn { text-align: center; font-size: 22px; min-height: 34px; padding: 4px 0; border-top: 1px solid var(--rule); flex: none; }
.turn .ok { color: var(--matcha-d); }
.turn .ng { color: var(--shu); }
.answers { list-style: none; margin: 0; padding: 6px 4px; display: grid; grid-template-columns: 1fr; gap: 2px 12px; border-top: 1px solid var(--rule); flex: none; font-size: 15px; }
.answers.many { grid-template-columns: 1fr 1fr; font-size: 14px; }
.answers.solo { text-align: center; font-size: 17px; }
.answers li { display: flex; gap: .6em; align-items: baseline; white-space: nowrap; overflow: hidden; }
.answers .who { font-weight: 600; flex: none; min-width: 2.2em; max-width: 7em; overflow: hidden; text-overflow: ellipsis; }
.answers.many .who { max-width: 4.6em; }
.answers .over { color: var(--shu); }
.answers .win { color: var(--matcha-d); font-weight: 600; }

/* ボタン */
.btn { border: 0; border-radius: 10px; font-size: 20px; padding: 10px 16px; cursor: pointer; letter-spacing: .06em; }
.btn.primary { background: var(--matcha); color: #fff; }
.btn.primary:active { background: var(--matcha-d); }
.btn.ghost { background: transparent; border: 1px solid var(--brown); color: var(--brown); }
.btn:disabled { opacity: .45; cursor: default; }
.pour { width: 100%; min-height: 64px; font-size: 24px; flex: none; margin-top: 6px; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pour.pressing { background: var(--matcha-d); transform: translateY(1px); }
.home-btns, .row-btns { display: flex; gap: 12px; flex: none; }
.home-btns .btn, .row-btns .btn { flex: 1; min-height: 60px; }
.foot { display: flex; justify-content: space-between; font-size: 13px; color: var(--brown); margin: 10px 2px 0; flex: none; }
.foot a { color: var(--brown); }

/* 名前 */
.names-card { align-self: stretch; text-align: left; border-left-width: 6px; padding: 12px 16px; margin-bottom: 16px; }
.names-card h2 { text-align: center; font-size: 22px; margin-bottom: 8px; }
.names-card ol { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.names-card li { display: flex; gap: 8px; align-items: center; }
.names-card label { width: 3.6em; font-size: 14px; color: var(--brown); }
.names-card input { flex: 1; min-width: 0; font: inherit; font-size: 18px; padding: 6px 10px; border: 1px solid var(--rule); border-radius: 6px; background: #fffdf8; color: var(--ink); }
.names-card .del { width: 44px; border: 1px solid var(--rule); background: transparent; border-radius: 6px; cursor: pointer; color: var(--brown); font-size: 18px; }
.names-card .ghost { width: 100%; font-size: 16px; }
#names .row-btns { margin-top: auto; }

/* 友だちと(招待) */
.home-btns { flex-wrap: wrap; }
.home-btns .btn.wide { flex-basis: 100%; }
.note { margin: 4px 0 10px; font-size: 14px; color: var(--brown); text-align: center; }
.names-card .field { width: auto; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 12px; font-size: 14px; color: var(--brown); }
.field input { font: inherit; font-size: 18px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 6px; background: #fffdf8; color: var(--ink); }
#online-form .btn { width: 100%; margin-top: 8px; }
.test-box { margin-top: 14px; padding-top: 8px; border-top: 1px dashed var(--rule); }
.test-box select { font: inherit; min-width: 64px; border: 1px solid var(--rule); border-radius: 6px; background: #fffdf8; }
.names-card .seats, .seats { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seats li { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 10px; border: 1px solid var(--rule); border-radius: 8px; background: #fffdf8; font-size: 16px; overflow: hidden; }
.seats li.empty { color: var(--rule); border-style: dashed; background: transparent; }
.seats li.me { border-color: var(--matcha); }
.seats li.in { animation: rise .4s ease-out both; }
.seats .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seats small { color: var(--brown); font-size: 12px; }
#lobby .btn.ghost { width: 100%; margin-top: 6px; font-size: 16px; }
#lobby .row-btns { margin-top: auto; }
#online .row-btns { margin-top: auto; }
.conn { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); margin: 0; padding: 6px 12px; background: var(--shu); color: #fff; border-radius: 6px; font-size: 14px; z-index: 5; }
.toast { position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); margin: 0; padding: 10px 16px; background: var(--ink); color: #fff; border-radius: 8px; font-size: 15px; z-index: 5; max-width: calc(100% - 32px); text-align: center; white-space: nowrap; }

/* 結果 */
.ranking { list-style: none; margin: 16px 0 8px; padding: 0; display: grid; gap: 6px; }
.ranking li { display: grid; grid-template-columns: 3em 1fr auto auto; gap: 10px; align-items: baseline; padding: 10px 12px; background: #fffdf8; border: 1px solid var(--rule); border-radius: 8px; font-size: 17px; animation: rise .4s ease-out both; }
.ranking li.first { border-color: var(--matcha); border-width: 2px; }
.ranking .rk { font-size: 20px; font-weight: 600; }
.ranking .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking .sm { font-size: 14px; color: var(--brown); }
.ranking .over { color: var(--shu); }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.total { text-align: center; font-size: 22px; margin: 4px 0 14px; }
.total .best { color: var(--matcha-d); font-size: 16px; margin-left: .5em; }
#result .row-btns { margin-top: 8px; }

/* パソコン幅: 左に大きな器、右に札・番・答え・ボタン(2026-11-24 対話: 520px の細い列だけで左右が空き、左上の題が札と二重だった) */
@media (min-width: 900px) {
  .stage { max-width: 1080px; padding: 0 40px 24px; }
  #home:not([hidden]), #play:not([hidden]) {
    display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(340px, 1fr); column-gap: 56px; padding-top: 24px;
  }
  #home:not([hidden]) { grid-template-rows: 1fr auto auto auto 1fr; grid-template-areas: "v ." "v k" "v b" "v f" "v ."; }
  #play:not([hidden]) { grid-template-rows: 1fr auto auto auto auto 1fr; grid-template-areas: "v ." "v k" "v n" "v a" "v b" "v ."; }
  #home .ticket, #play .ticket { grid-area: k; align-self: stretch; margin-bottom: 20px; }
  #home .vessel-wrap, #play .vessel-wrap { grid-area: v; }
  .vessel-wrap svg { max-height: none; }
  #home .home-btns { grid-area: b; }
  #home .foot { grid-area: f; }
  #play .turn { grid-area: n; }
  #play .answers { grid-area: a; font-size: 17px; gap: 6px 16px; padding: 10px 4px; }
  #play .pour { grid-area: b; margin-top: 16px; min-height: 76px; }
  #play .ticket { padding: 18px 24px 20px; }
  .ticket .big { font-size: 60px; }
  .ticket h1 { font-size: 36px; }
  #home .ticket { padding: 22px 24px; }
  #names, #result, #online, #lobby { width: 100%; max-width: 560px; margin: 0 auto; }
}
@media (max-height: 640px) {
  .ticket .big { font-size: 32px; }
  .pour { min-height: 54px; }
}

/* プライバシー */
.doc { height: auto; }
.article { max-width: 680px; margin: 0 auto; padding: 24px 16px 48px; line-height: 1.8; }
.article a { color: var(--brown); }
