/* みんなでポーカー — スマホ縦を基本に、PC でも同じ構成のまま広がる */
html { font-size: 16px; }
@media (min-width: 900px) { html { font-size: 17px; } }
:root {
  --bg: #0d1b2a;
  --bg2: #13263a;
  --felt: #157a4f;
  --felt2: #0d5a3a;
  --rail: #3b2414;
  --gold: #f5c84c;
  --gold2: #e2a321;
  --ink: #f4f1e8;
  --muted: #a9b6c3;
  --red: #e0414b;
  --blue: #2f7de1;
  --green: #22a05a;
  --spade: #1b2230;
  --danger: #e0414b;
  --card-w: clamp(40px, 11.5vw, 64px);
  --mine-w: clamp(58px, 17vw, 86px);
  --seat-card: clamp(22px, 6.2vw, 34px);
  --font: 'M PLUS Rounded 1c', system-ui, -apple-system, 'Hiragino Maru Gothic ProN', 'Hiragino Sans', 'Yu Gothic', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 80% at 50% 0%, #1c3550 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--ink); font-family: var(--font); font-weight: 500;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
button { font-family: inherit; cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  border: 0; border-radius: 14px; padding: .8em 1.2em; font-size: 1rem; font-weight: 800;
  background: #2b4a6b; color: var(--ink); box-shadow: 0 3px 0 #18304a;
  transition: transform .08s, filter .15s;
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #18304a; }
.btn:disabled { opacity: .45; }
.btn.big { width: 100%; font-size: 1.1rem; padding: .95em 1em; }
.btn.small { font-size: .85rem; padding: .5em .9em; }
.btn.gold { background: linear-gradient(180deg, #ffd96a, var(--gold2)); color: #3a2500; box-shadow: 0 3px 0 #a86f0b; }
.btn.ghost { background: rgba(255,255,255,.08); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.25); }
.btn.danger { background: #5a1f27; box-shadow: 0 3px 0 #33101a; }

/* ---------- タイトル ---------- */
#title { min-height: 100%; display: grid; place-items: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.titleBox { width: 100%; max-width: 400px; }
.logoCards { display: flex; justify-content: center; gap: 0; margin-bottom: 8px; height: 92px; }
.logoCards .c {
  width: 62px; height: 86px; border-radius: 9px; background: #fff; display: grid; place-items: center;
  font-style: normal; font-weight: 800; font-size: 26px; box-shadow: 0 6px 18px rgba(0,0,0,.4); position: relative;
}
.logoCards .c b { position: absolute; bottom: 8px; font-size: 22px; }
.logoCards .c.s { color: var(--spade); transform: rotate(-9deg) translateX(8px); }
.logoCards .c.h { color: var(--red); transform: rotate(8deg) translateX(-8px) translateY(4px); }
.logoCards .c { padding-bottom: 22px; }
h1 { text-align: center; font-size: clamp(1.8rem, 8vw, 2.4rem); margin: .1em 0 0; font-weight: 800; letter-spacing: .04em;
  background: linear-gradient(180deg, #fff3c4, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { text-align: center; color: var(--muted); margin: .2em 0 1.4em; font-size: .9rem; }
.field { display: block; margin: 0 0 12px; }
.field > span { display: block; font-size: .8rem; color: var(--muted); margin: 0 0 4px 2px; }
.field input, .field select {
  width: 100%; font: inherit; font-size: 1.15rem; font-weight: 800; color: var(--ink);
  background: rgba(255,255,255,.07); border: 2px solid rgba(255,255,255,.18); border-radius: 12px; padding: .65em .8em; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--gold); }
.field select { font-size: 1rem; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 12px) 55%; background-size: 6px 6px; background-repeat: no-repeat; }
.field select option { color: #000; }
#code { letter-spacing: .4em; text-align: center; font-size: 1.5rem; }
.joinBox, .createBox { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 18px; padding: 14px; }
.joinBox.focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245,200,76,.2); }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; margin: 14px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.15); }
.err { color: #ff8a92; min-height: 1.3em; text-align: center; margin: 10px 0 0; font-size: .9rem; }
.howto { margin-top: 18px; background: rgba(255,255,255,.04); border-radius: 14px; padding: 10px 14px; font-size: .9rem; line-height: 1.7; }
.howto summary { cursor: pointer; font-weight: 800; color: var(--gold); }
.howto ol { padding-left: 1.3em; margin: .6em 0; }

/* ---------- ゲーム全体 ---------- */
.rescueHint { margin: 8px 0 14px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.04); text-align: left; }
.rescueHint p { margin: 0; font-size: .78rem; line-height: 1.6; color: var(--muted); }
.rescueHint .btn { width: 100%; margin-top: 8px; font-size: .9rem; }
#homeSettlement { white-space: pre-line; font-size: .85rem; line-height: 1.6; border-left: 3px solid var(--gold); }
.rankMine { padding: 12px; border-radius: 12px; background: rgba(245,200,76,.1); }
#sheet .rankPeriods { display: flex; gap: 6px; }
.rankPeriods .btn { flex: 1; padding: 10px 6px; }
.leaderboard { table-layout: fixed; }
.leaderboard th:first-child { width: 15%; }
.leaderboard th:nth-child(2) { width: 35%; }
.leaderboard th:nth-child(3) { width: 30%; }
.leaderboard th:last-child { width: 20%; }
.rankName { max-width: 100%; padding: 0; border: 0; background: none; color: inherit; font-size: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leaderboard td { overflow-wrap: anywhere; }

#game {
  height: 100%; height: 100dvh; display: flex; flex-direction: column; max-width: 1100px; margin: 0 auto;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); position: relative; overflow: hidden;
}
#game.busy #actBtns { pointer-events: none; }
#topbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px 4px; flex: 0 0 auto; }
#handNo { flex: 1; text-align: center; font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#handNo b { color: var(--ink); font-weight: 800; margin-left: 4px; }
.chip-btn { background: rgba(255,255,255,.08); border: 0; color: var(--muted); border-radius: 999px; padding: 6px 12px; font-size: .8rem; }
.chip-btn b { color: var(--gold); font-size: 1rem; letter-spacing: .06em; margin-left: 3px; }
@media (max-width: 400px) { .chip-btn { padding: 6px 9px; font-size: .7rem; } #topbar { gap: 4px; padding-left: 8px; padding-right: 8px; } .icon-btn { width: 36px; } }
.tools { display: flex; gap: 6px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: rgba(255,255,255,.08); color: var(--ink); font-size: 1.05rem; font-weight: 800; }
.icon-btn:active { background: rgba(255,255,255,.18); }

/* ---------- テーブル ---------- */
#tableWrap { flex: 1 1 auto; min-height: 0; padding: 6px 12px 0; display: flex; }
#table { position: relative; flex: 1; min-height: 260px; }
#felt {
  position: absolute; inset: 9% 3% 7%; border-radius: 50% / 46%;
  background: radial-gradient(ellipse at 50% 40%, #1d9a63 0%, var(--felt) 45%, var(--felt2) 100%);
  box-shadow: 0 0 0 10px var(--rail), 0 0 0 12px #5a3a20, 0 18px 40px rgba(0,0,0,.55), inset 0 0 50px rgba(0,0,0,.35);
}
#felt::after { content: ''; position: absolute; inset: 9%; border-radius: inherit; border: 2px solid rgba(255,255,255,.08); }
#center { position: absolute; left: 50%; top: 47%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 4; }
#potBox { background: rgba(0,0,0,.35); border-radius: 999px; padding: 3px 14px; font-size: .85rem; transition: opacity .2s; }
#potBox.hide { opacity: 0; }
#potBox .lbl { color: #cfe8d9; }
#potBox b { color: var(--gold); font-size: 1.1rem; }
#board { display: flex; gap: clamp(3px, 1vw, 8px); }

/* ---------- カード ---------- */
.card {
  --w: var(--card-w);
  width: var(--w); height: calc(var(--w) * 1.4); border-radius: calc(var(--w) * .12);
  background: linear-gradient(180deg, #fff, #f1efe9); position: relative; display: inline-block; font-style: normal;
  box-shadow: 0 2px 5px rgba(0,0,0,.35); flex: 0 0 auto; color: var(--spade);
}
.card .r { position: absolute; left: 7%; top: 3%; font-weight: 800; font-size: calc(var(--w) * .42); line-height: 1; letter-spacing: -.06em; }
.card .s { position: absolute; left: 9%; top: 34%; font-size: calc(var(--w) * .28); line-height: 1; }
.card .big { position: absolute; right: 7%; bottom: 4%; font-size: calc(var(--w) * .55); line-height: 1; }
.card.h { color: var(--red); }
.card.d { color: var(--blue); }
.card.c { color: var(--green); }
.card.back {
  background: repeating-linear-gradient(45deg, #2a3f8f 0 4px, #22357a 4px 8px);
  box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 4px #c9a43b, 0 2px 5px rgba(0,0,0,.35);
}
.card.slot { background: rgba(0,0,0,.15); box-shadow: inset 0 0 0 2px rgba(255,255,255,.12); }
.card.deal { animation: deal .45s cubic-bezier(.2,.8,.3,1.2) both; }
@keyframes deal { from { opacity: 0; transform: translateY(-14px) rotateY(90deg) scale(.9); } to { opacity: 1; transform: none; } }
.card.core { box-shadow: 0 0 0 3px #7ef0ff, 0 0 16px 2px rgba(126,240,255,.75); transform: translateY(-3px); }
.card.win { box-shadow: 0 0 0 3px var(--gold), 0 0 20px 4px rgba(245,200,76,.85); transform: translateY(-4px); }
.card.dim { filter: grayscale(.8) brightness(.6); }
#myCards.strongStart { animation: strong-start 1s ease-out; }
@keyframes strong-start { 0%,100% { transform: none; filter: none; } 30% { transform: translateY(-7px) scale(1.07); filter: drop-shadow(0 0 10px var(--gold)); } }
@media (prefers-reduced-motion: reduce) { #myCards.strongStart { animation: none; } }

/* ---------- 席 ---------- */
#seats { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
#turnDirection { position: absolute; right: 2%; top: 1%; z-index: 4; color: var(--muted); font-size: .7rem; pointer-events: none; }
.seat { position: absolute; transform: translate(-50%, -50%); --seat-width: clamp(84px, 23vw, 128px); width: var(--seat-width); display: flex; flex-direction: column; align-items: center; pointer-events: auto; transition: opacity .25s; }
.seat .sCards { display: flex; height: calc(var(--seat-card) * 1.4); margin-bottom: -10px; z-index: 0; }
.seat .sCards .card { --w: var(--seat-card); }
.seat .sCards .card + .card { margin-left: calc(var(--seat-card) * -.35); transform: rotate(6deg); }
.seat .sCards .card:first-child { transform: rotate(-6deg); }
.seat.winner .sCards .card, .seat .sCards .card.win { --w: calc(var(--seat-card) * 1.25); }
.sBox {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 5px; width: 100%;
  background: linear-gradient(180deg, #213b56, #172b40); border-radius: 12px; padding: 4px 6px 4px 4px;
  box-shadow: 0 3px 8px rgba(0,0,0,.45), inset 0 0 0 1.5px rgba(255,255,255,.12);
}
.av { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .8rem;
  background: hsl(var(--h, 200) 60% 55%); color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.3); }
.sTxt { min-width: 0; line-height: 1.15; }
.sNm { font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sCh { font-size: .78rem; color: var(--gold); font-weight: 800; }
.sBox .tag { position: absolute; top: -8px; right: -6px; }
.sBox .tag + .tag { right: 14px; }
.tag { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 999px; font-size: .68rem; font-weight: 800; margin-left: 4px; vertical-align: middle; }
.tag.d { background: #fff; color: #222; box-shadow: 0 1px 3px rgba(0,0,0,.5); }
.tag.sb { background: #8fd3ff; color: #06314f; }
.tag.bb { background: #ffb36b; color: #4a2300; }
.tag.host { background: transparent; color: var(--gold); font-size: .85rem; }
.sAct { margin-top: 3px; font-size: .7rem; font-weight: 800; padding: 1px 8px; border-radius: 999px; background: rgba(0,0,0,.55); white-space: nowrap; }
.sAct.a-fold { color: #b9c3cc; }
.sAct.a-check { color: #b8f5cf; }
.sAct.a-call { color: #9fd5ff; }
.sAct.a-bet, .sAct.a-raise { color: #ffd27a; }
.sAct.a-allin { color: #fff; background: var(--red); }
.sAct.a-sb, .sAct.a-bb { color: #ddd; }
.sAct.a-away { color: #aaa; }
.sAct.hand { background: var(--gold); color: #3a2500; }
.seat.out { opacity: .5; }
.seat.away .sBox { filter: grayscale(1); }
.seat.turn .sBox { box-shadow: 0 0 0 3px var(--gold), 0 0 18px rgba(245,200,76,.7); animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 3px var(--gold), 0 0 4px rgba(245,200,76,.3); } }
.seat.winner .sBox { box-shadow: 0 0 0 3px var(--gold), 0 0 24px rgba(245,200,76,.9); }
.sTimer, #meTimer { width: 100%; height: 4px; background: rgba(0,0,0,.4); border-radius: 4px; overflow: hidden; margin-top: 3px; }
.sTimer i, #meTimer i { display: block; height: 100%; background: var(--gold); transition: width .25s linear; }
.sTimer i.hurry, #meTimer i.hurry { background: var(--red); }
.plus { position: absolute; top: -18px; font-weight: 800; color: var(--gold); font-size: 1.05rem; text-shadow: 0 2px 4px rgba(0,0,0,.7); animation: rise 1.2s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.betPill { position: absolute; transform: translate(-50%, -50%); z-index: 2; display: flex; align-items: center; gap: 3px;
  background: rgba(0,0,0,.5); border-radius: 999px; padding: 1px 8px 1px 3px; font-size: .78rem; font-weight: 800; color: #fff; pointer-events: none; }
.chipIco { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle, var(--gold) 0 35%, #fff 36% 45%, var(--red) 46%); box-shadow: 0 0 0 1px rgba(0,0,0,.3); }

/* ---------- 吹き出し (スタンプ) ---------- */
.stampBubble { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 6px; z-index: 9;
  background: #fff; color: #222; font-weight: 800; font-size: .85rem; padding: 6px 10px; border-radius: 14px; white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.stampBubble::after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: #fff; }
.stampBubble.pop { animation: pop .3s cubic-bezier(.2,.9,.3,1.4); }
@keyframes pop { from { transform: translateX(-50%) scale(.4); opacity: 0; } }

/* ---------- 待合 ---------- */
#lobby { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 12px; }
.lobbyCard { background: rgba(13,27,42,.92); border-radius: 20px; padding: 16px; width: min(340px, 100%); text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.5); max-height: 100%; overflow: auto; }
.bigCode { display: inline-flex; flex-direction: column; padding: 4px 18px; border-radius: 14px; }
.bigCode span { font-size: .8rem; color: var(--muted); }
.bigCode b { font-size: 2.6rem; letter-spacing: .15em; color: var(--gold); line-height: 1.1; }
#lobbyList { list-style: none; padding: 0; margin: 12px 0; text-align: left; display: grid; gap: 6px; }
#lobbyList li { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.06); padding: 6px 10px; border-radius: 10px; }
#lobbyList small { color: var(--muted); }
.note { color: var(--muted); font-size: .82rem; margin: 10px 0 0; }

/* ---------- 結果 ---------- */
#banner { position: absolute; left: 50%; top: 72%; transform: translate(-50%, -50%); z-index: 6; background: rgba(13,27,42,.93);
  border: 2px solid var(--gold); border-radius: 16px; padding: 8px 14px; min-width: min(280px, 86%); text-align: center;
  box-shadow: 0 8px 26px rgba(0,0,0,.55); animation: bannerRise .4s ease-out; }
@keyframes bannerRise { from { opacity: 0; transform: translate(-50%, calc(-50% + 14px)); } to { opacity: 1; transform: translate(-50%, -50%); } }
.bLine { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; font-size: 1rem; }
.bLine b { font-size: 1.05rem; }
.bh { background: var(--gold); color: #3a2500; padding: 0 8px; border-radius: 999px; font-weight: 800; font-size: .85rem; }
.bAmt { color: var(--gold); font-weight: 800; }
.bSub, .bNext { color: var(--muted); font-size: .78rem; }
.bQuit { margin-top: 4px; background: none; border: 0; padding: 4px 8px; color: var(--muted); font: inherit; font-size: .78rem; text-decoration: underline; cursor: pointer; }

/* ---------- 自分 ---------- */
#mePanel { position: relative; flex: 0 0 auto; display: flex; align-items: center; gap: 12px; margin: 4px 12px 0; padding: 8px 12px;
  background: linear-gradient(180deg, #1c3550, #142a40); border-radius: 18px; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.1); flex-wrap: wrap; }
#myCards { display: flex; gap: 6px; }
#myCards .card { --w: var(--mine-w); }
#meInfo { flex: 1; min-width: 0; }
#meInfo .nm { font-weight: 800; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#meInfo .chips { display: flex; align-items: center; gap: 5px; font-size: 1.15rem; margin-top: 2px; }
#meInfo .chips b { color: var(--gold); }
#meBet { font-size: .8rem; color: var(--muted); }
#handName { margin-top: 4px; min-height: 1.6em; }
#handName .hn { display: inline-block; background: rgba(126,240,255,.15); color: #aef6ff; border: 1.5px solid rgba(126,240,255,.6); padding: 1px 10px; border-radius: 999px; font-weight: 800; font-size: .9rem; }
#handName .won { color: var(--gold); font-weight: 800; font-size: 1.1rem; }
#handName .muted { color: var(--muted); font-size: .85rem; }
#mePanel.out #myCards .card { filter: grayscale(.8) brightness(.6); }
#mePanel.winner { box-shadow: 0 0 0 3px var(--gold), 0 0 24px rgba(245,200,76,.6); }
#game.myturn #mePanel { box-shadow: 0 0 0 3px var(--gold), 0 0 22px rgba(245,200,76,.5); }
/* 自分の番のタイマーは枠の下辺に重ねる (出入りで枠の高さを変えない) */
#meTimer { position: absolute; left: 14px; right: 14px; bottom: 2px; width: auto; margin: 0; }
#meBubble { left: 30%; }

/* ---------- 一行ヒントと操作 ---------- */
#coach { flex: 0 0 auto; margin: 6px 12px 0; min-height: calc(2.9em + 10px); font-size: .86rem; line-height: 1.45; color: #e6eef5; padding: 5px 10px;
  background: rgba(255,255,255,.05); border-left: 4px solid var(--gold); border-radius: 8px; display: flex; align-items: center; }
#coach.hidden { visibility: hidden; }
#coach.gone { display: none; }
#coach b { color: var(--gold); }
#coach { position: relative; padding-right: 30px; gap: 8px; }
#coach > span { flex: 1; }
.coachHint { flex: 0 0 auto; border: 1px solid var(--gold); background: none; color: var(--gold); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: .78rem; font-weight: 800; cursor: pointer; }
#coach > span { display: block; }
.coachOff { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); width: 24px; height: 24px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: .8rem; cursor: pointer; }
#actions { flex: 0 0 auto; padding: 8px 12px 10px; }
#actBtns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.act { border: 0; border-radius: 14px; padding: 10px 4px 8px; color: #fff; display: flex; flex-direction: column; align-items: center; line-height: 1.15;
  box-shadow: 0 4px 0 rgba(0,0,0,.35); transition: transform .08s, opacity .2s, box-shadow .2s; height: 62px; }
.act { justify-content: center; }
.act b { font-size: 1.05rem; font-weight: 800; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act small { font-size: .7rem; opacity: .85; margin-top: 2px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.35); }
.act.fold { background: linear-gradient(180deg, #6b7787, #4d5867); }
.act.fold.arm { background: linear-gradient(180deg, #e0414b, #a8262f); }
.act.check, .act.call { background: linear-gradient(180deg, #2f9be0, #1d6fb0); }
.act.raise { background: linear-gradient(180deg, #ffb03a, #e07b12); color: #2c1600; }
.act:disabled { opacity: .3; filter: grayscale(.4); }
.act.glow { animation: glow 1.2s ease-in-out infinite; }
@keyframes glow { 0%, 100% { box-shadow: 0 4px 0 rgba(0,0,0,.35), 0 0 0 3px #fff, 0 0 18px 4px rgba(255,255,255,.55); } 50% { box-shadow: 0 4px 0 rgba(0,0,0,.35), 0 0 0 3px rgba(255,255,255,.4), 0 0 4px rgba(255,255,255,.1); } }
#actBtns.wait .act small { opacity: .6; }
/* 「手札を見せる」などは出入りしても高さが変わらないよう、1行ぶんを常に確保する */
#extra { display: flex; gap: 8px; justify-content: center; margin-top: 8px; height: 44px; }
#extra .btn { flex: 0 1 auto; min-width: 0; height: 44px; padding-top: 0; padding-bottom: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- レイズの金額 ---------- */
#raisePanel { position: absolute; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 20; background: #1a3149; border-radius: 20px; padding: 14px;
  box-shadow: 0 -8px 30px rgba(0,0,0,.6), inset 0 0 0 2px rgba(255,176,58,.5); animation: up .2s ease-out; max-width: 520px; margin: 0 auto; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.rpHead { display: flex; justify-content: space-between; align-items: center; font-weight: 800; }
.x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,.1); color: var(--ink); font-size: 1.2rem; }
.rpAmt { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 8px 0; text-align: center; }
.rpAmt b { font-size: 2.2rem; color: #ffc46b; display: block; line-height: 1.1; }
.rpAmt small { color: var(--muted); font-size: .8rem; }
.step { width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 1.5rem; font-weight: 800; }
#rpRange { width: 100%; accent-color: #ffb03a; height: 32px; }
.rpQuick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 6px 0 12px; }
.rpQuick button { border: 0; border-radius: 10px; padding: 9px 2px; background: rgba(255,255,255,.1); color: var(--ink); font-size: .78rem; font-weight: 800; }

/* ---------- スタンプ ---------- */
#stampPanel { position: absolute; top: 54px; z-index: 22; right: 10px; z-index: 22; background: #1a3149; border-radius: 16px; padding: 8px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.6); animation: up .15s ease-out; }
#stampPanel button { border: 0; border-radius: 10px; background: rgba(255,255,255,.1); color: var(--ink); padding: 10px 12px; font-size: .9rem; font-weight: 800; text-align: left; }

/* ---------- 吹き出しガイド ---------- */
.spot { position: relative; z-index: 25 !important; animation: spot 1.1s ease-in-out infinite !important; border-radius: 14px; }
@keyframes spot { 0%, 100% { box-shadow: 0 0 0 3px #7ef0ff, 0 0 26px 6px rgba(126,240,255,.75); } 50% { box-shadow: 0 0 0 3px rgba(126,240,255,.5), 0 0 6px 2px rgba(126,240,255,.3); } }
#tip { position: fixed; z-index: 40; background: #eafcff; color: #0b2b3a; border-radius: 14px; padding: 10px 14px 10px 12px; font-size: .9rem; line-height: 1.5;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: rise .3s ease-out; cursor: pointer; }
#tip b { color: #0a6f87; }
#tip .tipBody::after { content: ' (タップで閉じる)'; color: #6b8a96; font-size: .72rem; }
.tipArrow { position: absolute; top: 100%; width: 0; height: 0; border: 8px solid transparent; border-top-color: #eafcff; margin-left: -8px; }
#tip.below .tipArrow { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: #eafcff; }

/* ---------- お知らせ ---------- */
#toast { position: fixed; left: 50%; top: calc(54px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 30; background: rgba(0,0,0,.78); color: #fff; padding: 6px 14px; border-radius: 999px; font-size: .82rem; white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }
#toast.pop { animation: rise .25s ease-out; }
#toast.warn { background: #7a1f27; }

/* ---------- シート ---------- */
#sheet { position: fixed; inset: var(--sheet-top, 0px) 0 auto; height: var(--sheet-height, 100dvh); z-index: 50; background: rgba(0,0,0,.55); display: grid; place-items: end center; }
.sheetBox { position: relative; width: min(520px, 100%); max-height: calc(var(--sheet-height, 100dvh) * .88); overflow: auto; background: #142a40; border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: up .2s ease-out; }
.nameSetup input { font-size: 16px; }
.sheetBox .x { position: absolute; top: 12px; right: 12px; }
.sheetBox h2 { margin: 0 0 8px; font-size: 1.2rem; color: var(--gold); }
.lead { color: var(--muted); font-size: .85rem; line-height: 1.6; margin: 0 0 10px; }
.lead.small { font-size: .78rem; margin-top: 10px; }
.ranks { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.ranks li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; background: rgba(255,255,255,.05); border-radius: 12px; }
.ranks li.now { background: rgba(126,240,255,.14); box-shadow: inset 0 0 0 2px #7ef0ff; }
.rk { min-width: 0; }
.rk b { display: block; font-size: .95rem; }
.rk small { color: var(--muted); font-size: .72rem; }
.nowTag { display: inline-block; font-size: .68rem; background: #7ef0ff; color: #05303a; padding: 0 6px; border-radius: 999px; font-weight: 800; }
.mini { display: flex; gap: 2px; flex: 0 0 auto; }
.mini .card { --w: 26px; }
.menu { display: grid; gap: 8px; }
.menu .btn { justify-content: space-between; }
table.score { width: 100%; border-collapse: collapse; font-size: .92rem; }
.score th { color: var(--muted); font-weight: 500; font-size: .75rem; text-align: right; padding: 4px 6px; }
.score th:first-child, .score td:first-child { text-align: left; }
.score td { padding: 8px 6px; text-align: right; border-top: 1px solid rgba(255,255,255,.08); }
.score tr.me td { color: var(--gold); }
.score td small { color: var(--muted); font-size: .7rem; }
.pos { color: #6be39a; } .neg { color: #ff8a92; }

/* ---------- 横長 (PC・タブレット横) ---------- */
@media (min-width: 760px) {
  :root { --card-w: clamp(52px, 5.4vw, 70px); --mine-w: 78px; --seat-card: 34px; }
  #felt { inset: 10% 6% 8%; }
  .seat { width: 128px; }
  .sNm { font-size: .85rem; } .sCh { font-size: .9rem; }
  .av { width: 32px; height: 32px; font-size: .95rem; }
  #mePanel { max-width: 640px; margin: 4px auto 0; width: calc(100% - 24px); }
  #coach { max-width: 640px; margin: 6px auto 0; width: calc(100% - 24px); font-size: .92rem; }
  #actions { max-width: 640px; margin: 0 auto; width: 100%; }
}
@media (max-width: 759px) {
  #tableArea { overflow-y: auto; }
  #tableWrap { min-height: auto; flex-shrink: 0; }
  #table { min-height: 360px; }
  #table[data-n="6"], #table[data-n="7"] { min-height: 420px; }
  .sBox .av { display: none; }
  .sBox { padding: 4px 7px; }
  .sNm { font-size: .72rem; }
}
/* 背の低い画面 (スマホ横・小さいPCウィンドウ) */
@media (max-height: 640px) {
  :root { --mine-w: 50px; --card-w: clamp(34px, 6vh, 52px); --seat-card: 22px; }
  .act { height: 46px; padding: 6px 4px; }
  .act small { display: none; }
  #coach { min-height: calc(2.9em + 8px); font-size: .78rem; }
  #extra, #extra .btn { height: 38px; }
}

/* ---------- PC: 自分の札と操作を横に並べて、テーブルを大きく ---------- */
@media (min-width: 900px) and (min-height: 600px) {
  :root { --card-w: 74px; --mine-w: 84px; --seat-card: 40px; }
  #game { padding-left: 16px; padding-right: 16px; }
  #tableArea { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto auto; column-gap: 14px; }
  #tableWrap { grid-column: 1 / -1; padding: 10px 40px 4px; }
  #mePanel { grid-column: 1; grid-row: 2 / 4; margin: 4px 0 14px; width: auto; max-width: none; align-self: stretch; }
  #coach { grid-column: 2; grid-row: 2; margin: 4px 0 0; width: auto; max-width: none; }
  #actions { grid-column: 2; grid-row: 3; padding: 8px 0 14px; max-width: none; }
  .seat { width: 140px; }
  .sNm { font-size: .9rem; } .sCh { font-size: .95rem; }
  #raisePanel { left: auto; right: 16px; bottom: 16px; width: 440px; }
}

.tag.cpu{color:#1ee3ff;white-space:nowrap;font-size:9px;background:#102d39}.sNm{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.sBox .tag.cpu{right:0;top:-13px}.sBox .tag.cpu + .tag{right:38px}
.tag.author{color:var(--gold);white-space:nowrap;font-size:9px;background:#352e19}
.sBox .tag.author{right:0;top:-13px}.sBox .tag.author + .tag{right:54px}.sBox .tag.author ~ .tag.host{right:76px}

/* 席→ポット→勝者のチップ。画面全体に重ね、PCの別パネルにある自分の持ち分にも届く。 */
#chipFlights{position:fixed;inset:0;pointer-events:none;z-index:12;overflow:hidden}
.flyingChip{position:absolute;width:17px;height:17px;border-radius:50%;background:radial-gradient(circle,#ffd46d 0 42%,#b87624 45% 56%,#ffe8a0 58% 67%,#ca852c 70%);border:2px dashed #fff0b7;box-shadow:0 2px 4px #0008}
.chipAmount{position:absolute;color:#fff2bc;background:#1a263deb;border:1px solid #e9bb51;border-radius:999px;padding:3px 9px;font-size:13px;white-space:nowrap;text-shadow:0 1px 3px #000;box-shadow:0 3px 10px #0005}
.chipAmount.win{color:#ffe79b;border-color:#ffe79b}.chipAmount.refund{color:#b8f5ff;border-color:#8dd5e5}

.sheetBox:has(.rankView) { height: 78dvh; max-height: 88dvh; overflow-y: scroll; scrollbar-gutter: stable; animation: none; }
.rankView { min-height: 100%; }
#rankStatus { min-height: 1.6em; }
.rankMine { min-height: 76px; }
.rankLoading { opacity: .5; pointer-events: none; }

#sessionSummaryText { white-space: pre-line; font-size: .95rem; color: var(--ink); }
.lobbyHowto { margin-top: 10px; text-align: left; font-size: .8rem; line-height: 1.6; max-height: 38vh; overflow: auto; }
.tableSettings { margin: 12px 0; background: rgba(255,255,255,.04); border-radius: 14px; padding: 10px 14px; }
.tableSettings summary { cursor: pointer; font-weight: 800; }
.tableSettings summary small { display: block; font-weight: 500; color: var(--muted); font-size: .78rem; margin-top: 2px; }
.bSkim { margin-top: 4px; color: var(--gold); font-size: .78rem; font-weight: 800; }
