/* ブロック陣取り */
:root {
  --blue: #2f6fd6; --yellow: #f2b705; --red: #e0453a; --green: #2e9e57;
  --gold1: #fff1a8; --gold2: #f0c24a; --gold3: #b9831c; --gold4: #6e4708;
  --ink: #1b1b1b;
  --font: "BIZ UDPGothic", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: #1a0d05;
  color: #fff;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
}
button { font-family: inherit; cursor: pointer; color: inherit; }
[data-icon] svg { width: 100%; height: 100%; display: block; }

.screen { position: fixed; top: 0; left: 0; right: 0; height: 100%; height: 100dvh; display: none; } /* 実際に見えている高さ（iPhoneの下のツールバーにかぶらない） */
.screen.active { display: flex; }

/* ───────── トップ ───────── */
#top {
  flex-direction: column; align-items: center;
  overflow-y: auto; overflow-x: hidden;
  background: radial-gradient(ellipse at 50% 28%, #fff7c9 0%, #ffd04a 26%, #ff9a1f 58%, #e2561a 85%, #a8300d 100%);
  padding: max(10px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
.burst {
  position: absolute; inset: -30%; pointer-events: none;
  background: repeating-conic-gradient(from 0deg at 50% 38%, rgba(255,255,255,.18) 0deg 6deg, rgba(255,255,255,0) 6deg 15deg);
  animation: spin 80s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.floaters { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.floaters svg { position: absolute; opacity: .55; filter: drop-shadow(0 6px 8px rgba(80,20,0,.35)); animation: bob 6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-12px) rotate(var(--r2, 6deg)); } }

.topbar {
  position: relative; z-index: 2; width: 100%; max-width: 760px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.iconbar { display: flex; gap: 6px; background: rgba(40,20,5,.55); padding: 5px 8px; border-radius: 40px; }
.ibtn {
  width: 58px; height: 58px; border-radius: 50%; border: 2px solid var(--gold2);
  background: radial-gradient(circle at 50% 35%, #6b6b6b, #262626 70%);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.25), 0 2px 4px rgba(0,0,0,.4);
}
.ibtn span { width: 24px; height: 24px; }
.ibtn small { font-size: 10px; font-weight: 700; }
.recpill {
  background: rgba(30,15,5,.75); border-radius: 8px; padding: 8px 12px;
  display: flex; gap: 10px; align-items: baseline; font-weight: 700;
}
.recpill span { font-size: 13px; color: #ffd98a; }
.recpill b { font-size: 18px; }

.logo { position: relative; z-index: 2; margin: 14px 0 6px; text-align: center; line-height: 1; }
.logo-blocks { display: flex; justify-content: center; gap: 6px; }
.logo-blocks i {
  font-style: normal; font-weight: 700; color: #fff;
  width: clamp(58px, 16vw, 96px); height: clamp(58px, 16vw, 96px);
  font-size: clamp(40px, 11vw, 68px);
  display: grid; place-items: center;
  border: 3px solid var(--ink);
  box-shadow: inset 6px 6px 0 rgba(255,255,255,.38), inset -6px -6px 0 rgba(0,0,0,.22), 0 6px 0 rgba(60,20,0,.45);
  text-shadow: 0 3px 0 rgba(0,0,0,.35);
  animation: drop .6s cubic-bezier(.3,1.6,.5,1) both;
}
.logo-blocks i:nth-child(2) { animation-delay: .08s; transform: rotate(-3deg); }
.logo-blocks i:nth-child(3) { animation-delay: .16s; }
.logo-blocks i:nth-child(4) { animation-delay: .24s; }
@keyframes drop { from { transform: translateY(-80px) scale(.6); opacity: 0; } }
.b-blue { background: var(--blue); } .b-yellow { background: var(--yellow); }
.b-red { background: var(--red); } .b-green { background: var(--green); }
.logo-main {
  display: block; margin-top: 6px;
  font-size: clamp(64px, 19vw, 132px); font-weight: 700; letter-spacing: .04em; color: var(--ink);
  text-shadow:
    4px 0 0 #fff, -4px 0 0 #fff, 0 4px 0 #fff, 0 -4px 0 #fff,
    3px 3px 0 #fff, -3px -3px 0 #fff, 3px -3px 0 #fff, -3px 3px 0 #fff,
    0 9px 0 rgba(90,30,0,.45);
}
.logo-tag {
  display: inline-block; margin-top: 8px; padding: 5px 14px;
  font-size: clamp(13px, 3.4vw, 17px); font-weight: 700;
  background: var(--ink); color: #ffe08a; border-radius: 4px; transform: skewX(-8deg);
}

.banner {
  position: relative; z-index: 2; width: 100%; max-width: 620px; margin: 14px 0 10px;
  display: flex; align-items: center; gap: 6px;
}
.banner-arrow { background: none; border: 0; font-size: 44px; line-height: 1; color: #fff; text-shadow: 0 2px 3px rgba(0,0,0,.5); padding: 0 4px; }
.banner-body {
  flex: 1; min-height: 74px; border: 3px solid var(--gold2); border-radius: 6px;
  background: linear-gradient(100deg, #3a0d05, #8a1f0a 55%, #3a0d05);
  display: flex; align-items: center; gap: 12px; padding: 8px 14px; overflow: hidden;
  box-shadow: 0 4px 10px rgba(0,0,0,.35);
}
.banner-body svg { flex: none; width: 54px; height: 54px; }
.banner-body .bt { font-size: clamp(16px, 4.2vw, 22px); font-weight: 700; color: #ffe37a; text-shadow: 0 2px 0 #000; }
.banner-body .bs { font-size: 13px; color: #fff; margin-top: 3px; }
.banner-body.in { animation: slidein .35s ease both; }
@keyframes slidein { from { opacity: 0; transform: translateX(24px); } }

.goldpanel {
  position: relative; z-index: 2; width: calc(100% + 32px); max-width: 760px;
  margin: 6px -16px 0; padding: 18px 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.18), rgba(0,0,0,.08)),
    linear-gradient(115deg, #c88a1c, #f7d873 30%, #d9a335 52%, #f5d46a 75%, #b97a14);
  border-top: 4px solid var(--gold4); border-bottom: 4px solid var(--gold4);
  box-shadow: inset 0 0 0 3px rgba(255,240,180,.6), 0 8px 18px rgba(0,0,0,.35);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.bigbtn {
  position: relative; width: min(100%, 520px); height: 130px;
  border: 4px solid #f7e7b0; border-radius: 12px;
  background: radial-gradient(ellipse at 50% 20%, #7a1a12, #3a0805 70%);
  box-shadow: 0 0 0 3px var(--gold4), 0 6px 0 #2a0402, 0 10px 16px rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; gap: 18px;
}
.bigbtn-icon { width: 72px; height: 72px; color: #ffe08a; }
.bigbtn-text { font-size: 64px; font-weight: 700; color: #ffe08a; text-shadow: 0 4px 0 #000; letter-spacing: .1em; }
.bigbtn-sub { position: absolute; bottom: 8px; font-size: 12px; color: #fff; opacity: .85; }
.bigbtn.locked .bigbtn-icon, .bigbtn.locked .bigbtn-text { color: #8b8b8b; }
.bigbtn .lock { position: absolute; left: 14px; top: 10px; width: 46px; height: 46px; display: none; }
.bigbtn.locked .lock { display: block; }
.bigbtn .lock svg { width: 100%; height: 100%; }
.subbtns { display: flex; gap: 10px; width: min(100%, 520px); }
.redbtn {
  flex: 1; height: 58px; border-radius: 8px;
  border: 3px solid #2a0402;
  background: linear-gradient(180deg, #ff6a55, #d8261a 45%, #a3130b);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.45), 0 4px 0 #4a0904;
  font-size: clamp(16px, 4.6vw, 22px); font-weight: 700; text-shadow: 0 2px 0 rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.redbtn span { width: 24px; height: 24px; flex: none; }
.redbtn:active, .bigbtn:active, .ibtn:active { transform: translateY(2px); }

.sizes { position: relative; z-index: 2; display: flex; gap: 14px; justify-content: center; margin: 20px 0 8px; flex-wrap: wrap; }
.sizebtn {
  position: relative; width: 98px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: 0; padding: 0;
}
.sizebtn .medal {
  width: 86px; height: 86px; border-radius: 50%; padding: 13px;
  background: radial-gradient(circle at 50% 35%, #5a3a1a, #2a1505 70%);
  border: 3px solid var(--gold3);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.2), 0 4px 6px rgba(0,0,0,.4);
}
.sizebtn .medal svg { width: 100%; height: 100%; }
.sizebtn b { font-size: 14px; text-shadow: 0 2px 2px rgba(0,0,0,.6); }
.sizebtn small { font-size: 11px; color: #fff3c4; text-shadow: 0 1px 2px rgba(0,0,0,.7); }
.sizebtn[aria-checked="true"] .medal {
  border-color: #fff6c0;
  background: radial-gradient(circle at 50% 35%, #ffd35a, #e08a10 70%);
  box-shadow: 0 0 0 3px var(--gold4), 0 0 18px 4px rgba(255,240,150,.9);
}
.ribbon {
  position: absolute; top: -6px; right: -4px; z-index: 1;
  background: #d8261a; color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 7px; border-radius: 10px; border: 2px solid #fff;
}
@media (max-width: 430px) {
  .redbtn span { display: none; }
  .redbtn { font-size: 17px; white-space: nowrap; }
  .sizes { gap: 8px; }
  .sizebtn { width: 104px; }
  .sizebtn small { font-size: 10px; white-space: nowrap; }
}
.foot { position: relative; z-index: 2; font-size: 11px; margin: 12px 0 0; }
.foot-link { background: rgba(40,15,0,.45); border: 1px solid rgba(255,230,160,.6); border-radius: 20px; padding: 6px 14px; font-size: 13px; font-weight: 700; color: #fff3c4; }

/* ───────── VS ───────── */
#vs {
  flex-direction: column; justify-content: center; overflow: hidden;
  background: radial-gradient(ellipse at 50% 50%, #3a2a1a, #050302 75%);
}
.vs-lines {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(-12deg, rgba(255,255,255,.05) 0 2px, transparent 2px 22px);
  animation: lines .5s linear infinite;
}
@keyframes lines { to { background-position: 60px 0; } }
.vs-bands { position: relative; display: flex; flex-direction: column; gap: 10vh; width: 100%; }
.vs-bands.four { gap: 2vh; }
.band {
  position: relative; height: 26vh; max-height: 220px; display: flex; align-items: center;
  overflow: hidden;
}
.vs-bands.four .band { height: 18vh; }
.band .bg {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--c1), var(--c2) 60%, var(--c1));
  border-top: 4px solid rgba(255,255,255,.75); border-bottom: 4px solid rgba(0,0,0,.4);
}
.band .bg::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.12) 0 2px, transparent 2px 7px);
}
.band.from-right .bg { clip-path: polygon(6% 0, 100% 0, 100% 100%, 0 100%); }
.band.from-left .bg { clip-path: polygon(0 0, 100% 0, 94% 100%, 0 100%); }
.band .av { position: relative; height: 100%; aspect-ratio: 1; flex: none; padding: 1.5%; margin: 0 2.5vw; }
.band .av svg { width: 100%; height: 100%; filter: drop-shadow(0 6px 6px rgba(0,0,0,.45)); }
.band .info { position: relative; flex: 1; padding: 0 5%; min-width: 0; }
.band.from-right { flex-direction: row-reverse; }
.band .nm { font-size: clamp(22px, 6vw, 46px); font-weight: 700; text-shadow: 0 3px 0 rgba(0,0,0,.5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.band .ttl { font-size: clamp(13px, 3vw, 20px); font-weight: 700; color: #fff7c9; margin: 4px 0 6px; text-shadow: 0 2px 0 rgba(0,0,0,.5); }
.band .rec { display: flex; gap: 16px; align-items: baseline; font-weight: 700; text-shadow: 0 2px 0 rgba(0,0,0,.5); }
.band .rec b { font-size: clamp(22px, 5.5vw, 40px); }
.band .rec span { font-size: clamp(13px, 3vw, 18px); opacity: .9; }
.band.from-right { animation: inR .45s cubic-bezier(.2,.9,.3,1.1) both; }
.band.from-left { animation: inL .45s cubic-bezier(.2,.9,.3,1.1) both; }
@keyframes inR { from { transform: translateX(110%); } }
@keyframes inL { from { transform: translateX(-110%); } }
.vs-mark {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: clamp(90px, 26vw, 200px); font-weight: 700; font-style: italic; letter-spacing: -.04em;
  background: linear-gradient(180deg, #fff7a0, #ffc400 45%, #ff6a00 80%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 5px #6a1d00;
  filter: drop-shadow(0 6px 0 rgba(0,0,0,.6));
  opacity: 0;
}
#vs.go .vs-mark { animation: vsin .5s .55s cubic-bezier(.2,1.8,.4,1) both; }
@keyframes vsin { from { opacity: 0; transform: translate(-50%, -50%) scale(3); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.vs-start {
  position: absolute; left: 0; right: 0; bottom: 6vh; text-align: center;
  font-size: clamp(28px, 7vw, 54px); font-weight: 700; color: #fff; text-shadow: 0 0 18px #ffb000, 0 3px 0 #000;
  opacity: 0;
}
#vs.go .vs-start { animation: fadeup .4s 1.7s both; }
@keyframes fadeup { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; } }

/* ───────── 対局 ───────── */
#game {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  flex-direction: row; gap: 10px;
}
.game-bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(circle at 15% 20%, rgba(255,170,60,.45), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(255,90,30,.4), transparent 45%),
    linear-gradient(160deg, #6b2a0a, #3a1405 50%, #220b03);
}
.g-main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 8px 0 8px 8px; }
.g-side { width: clamp(270px, 30vw, 360px); display: flex; flex-direction: column; gap: 8px; padding: 8px 8px 8px 0; min-height: 0; }

.pbar {
  display: flex; align-items: stretch; gap: 8px; padding: 6px;
  background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,.35));
  border: 2px solid rgba(240,194,74,.55); border-radius: 10px;
}
.pchips { flex: 1; display: flex; gap: 6px; min-width: 0; }
.pchip {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 4px; border-radius: 8px;
  background: rgba(255,255,255,.07); border: 2px solid transparent;
  transition: background .2s, border-color .2s, box-shadow .2s;
}
.pchip.active { border-color: #ffe27a; background: rgba(255,226,122,.18); box-shadow: 0 0 14px rgba(255,210,80,.55); }
.pchip.out { opacity: .45; }
.pchip .av { width: 46px; height: 46px; flex: none; }
.pchip .av svg { width: 100%; height: 100%; }
.pchip .pi { min-width: 0; flex: 1; }
.pchip .pn { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pchip .ps { font-size: 11px; color: #ffe9b0; white-space: nowrap; }
.pchip .pt { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.pchip .pt.low { color: #ff6d5a; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .45; } }
.pchip .streak { font-size: 15px; font-weight: 700; color: #ffd84a; text-shadow: 0 2px 0 #000; white-space: nowrap; }
.bar-btns { display: flex; gap: 6px; }
.tbtn {
  min-width: 64px; border-radius: 8px; border: 2px solid rgba(0,0,0,.6);
  font-size: 17px; font-weight: 700; text-shadow: 0 2px 0 rgba(0,0,0,.5);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.35);
  position: relative; padding: 0 8px;
}
.tbtn.resign { background: linear-gradient(180deg, #4d7fd8, #1f4fa8); }
.tbtn.helpme { background: linear-gradient(180deg, #ffb13b, #e76a00); }
.tbtn.menu { background: linear-gradient(180deg, #5b5b5b, #2c2c2c); min-width: 48px; }
.tbtn.menu span { display: block; width: 24px; height: 24px; margin: auto; }
.tbtn:disabled { opacity: .4; }
.hint-left {
  position: absolute; top: -8px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; color: #c25000; font-size: 12px; display: grid; place-items: center; text-shadow: none;
}

.board-wrap { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; padding: 8px 0; overflow: hidden; }
.board-frame {
  position: relative; padding: 8px; border-radius: 6px;
  background: linear-gradient(135deg, #8a4b1a, #5a2c0c);
  box-shadow: inset 0 0 0 2px #e7b45b, 0 10px 24px rgba(0,0,0,.55);
}
#board { display: block; touch-action: none; border-radius: 2px; }
.toast {
  position: absolute; left: 50%; top: 14px; transform: translate(-50%, -10px);
  background: rgba(20,10,0,.88); border: 2px solid #ffd45a; color: #fff;
  padding: 8px 16px; border-radius: 30px; font-weight: 700; font-size: 15px;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; white-space: nowrap; z-index: 3;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.ctrl {
  background: rgba(0,0,0,.45); border: 2px solid rgba(240,194,74,.55); border-radius: 10px; padding: 8px;
  display: grid; grid-template-columns: 96px 1fr; grid-template-rows: auto auto; gap: 6px 8px; align-items: center;
}
.preview {
  grid-row: span 2; width: 96px; height: 96px; border-radius: 8px;
  background: rgba(255,255,255,.08); display: grid; place-items: center;
}
.preview svg { max-width: 84px; max-height: 84px; }
.preview .ph { font-size: 11px; text-align: center; color: #ccc; padding: 4px; }
.ctrl-btns { display: flex; gap: 6px; }
.cbtn {
  flex: 1; height: 54px; border-radius: 8px; border: 2px solid rgba(0,0,0,.5);
  background: linear-gradient(180deg, #6e6e6e, #3a3a3a);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.3);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 13px; font-weight: 700;
}
.cbtn span { width: 22px; height: 22px; }
.cbtn.place { background: linear-gradient(180deg, #4cc46c, #1d8a3d); }
.cbtn.place.ng { background: linear-gradient(180deg, #7a7a7a, #4a4a4a); }
.cbtn:disabled { opacity: .4; }
.cbtn:active:not(:disabled) { transform: translateY(2px); }
.status { margin: 0; font-size: 13px; font-weight: 700; line-height: 1.4; min-height: 2.8em; color: #ffe9b0; }
.status.ok { color: #8dffad; }
.status.ng { color: #ff9f8f; }

.tray {
  flex: 1; min-height: 0; overflow-y: auto;
  background: rgba(0,0,0,.35); border: 2px solid rgba(240,194,74,.35); border-radius: 10px; padding: 8px;
  display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start;
}
.tray.wait { opacity: .55; }
.pc {
  width: 68px; height: 68px; border-radius: 8px; border: 2px solid transparent;
  background: rgba(255,255,255,.07); display: grid; place-items: center; padding: 2px;
}
.pc svg { max-width: 60px; max-height: 60px; }
.pc.sel { border-color: #ffe27a; background: rgba(255,226,122,.25); box-shadow: 0 0 12px rgba(255,210,80,.6); }
.pc.cant { opacity: .3; }
.pc:active:not(:disabled) { transform: scale(.94); }

/* 縦長の画面（タブレット縦・スマホ）：盤の下に操作を並べる */
@media (orientation: portrait) {
  #game { flex-direction: column; gap: 0; }
  .g-main { padding: 6px 6px 0; flex: 1; min-height: 0; } /* 盤が大きくなりすぎて、下のコマ置き場を押し出さないように */
  .g-side { width: auto; padding: 6px; flex: none; }
  .ctrl { grid-template-columns: 74px 1fr; padding: 6px; }
  .preview { width: 74px; height: 74px; }
  .preview svg { max-width: 64px; max-height: 64px; }
  /* コマ置き場は2段に並べて、入りきらないぶんは横に指でずらす（段が途中で切れない） */
  .tray {
    flex: none; display: grid; grid-auto-flow: column;
    grid-template-rows: repeat(2, 58px); grid-auto-columns: 58px;
    overflow-x: auto; overflow-y: hidden; padding: 6px; gap: 5px;
    -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  }
  .pc { width: 58px; height: 58px; }
  .pc svg { max-width: 50px; max-height: 50px; }
}
/* スマホの縦向き：帯と操作を少しコンパクトにして、盤を大きく */
@media (orientation: portrait) and (max-width: 520px) {
  .tray { grid-template-rows: repeat(2, 48px); grid-auto-columns: 48px; padding: 5px; gap: 4px; }
  .pc { width: 48px; height: 48px; border-radius: 6px; }
  .pc svg { max-width: 40px; max-height: 40px; }
  .pbar { padding: 3px; gap: 5px; }
  .pchip { padding: 2px 6px 2px 2px; }
  .pchip .av { width: 34px; height: 34px; }
  .pchip .pn { font-size: 12px; }
  .pchip .ps { font-size: 10px; }
  .pchip .pt { font-size: 17px; }
  .pchip .streak { font-size: 12px; }
  .tbtn { min-width: 48px; font-size: 13px; padding: 0 6px; }
  .board-wrap { padding: 4px 0; }
  .board-frame { padding: 5px; }
  .g-side { padding: 4px 6px 6px; gap: 5px; }
  .ctrl { grid-template-columns: 56px 1fr; padding: 5px; gap: 4px 6px; }
  .preview { width: 56px; height: 56px; }
  .preview svg { max-width: 48px; max-height: 48px; }
  .cbtn { height: 44px; font-size: 12px; }
  .cbtn span { width: 18px; height: 18px; }
  .status { font-size: 12px; min-height: 1.4em; line-height: 1.3; }
}
@media (max-width: 520px) {
  .pchip .av { width: 36px; height: 36px; }
  .pchip .pt { font-size: 20px; }
  .tbtn { min-width: 52px; font-size: 14px; }
  .ibtn { width: 50px; height: 50px; }
  .bigbtn { height: 110px; }
  .bigbtn-text { font-size: 50px; }
  .bigbtn-icon { width: 54px; height: 54px; }
}

/* ───────── オンライン ───────── */
.pchip.away { opacity: .7; }
.pchip.away .av { filter: grayscale(.8); }
.note { font-size: 13px !important; color: #6a5030; line-height: 1.6; }
.err { min-height: 1.4em; color: #c0261a; font-weight: 700; font-size: 14px !important; }
.wait-lead { text-align: center; font-weight: 700; margin: 0; }
.code-big { display: flex; justify-content: center; gap: 10px; margin: 10px 0 4px; }
.code-big span, .slots span {
  width: 64px; height: 78px; display: grid; place-items: center;
  font-size: 48px; font-weight: 700; color: #fff; border-radius: 10px;
  background: linear-gradient(180deg, #3a3a3a, #111); border: 3px solid var(--gold3);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.25);
}
.slots { display: flex; justify-content: center; gap: 10px; margin: 6px 0 12px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 320px; margin: 0 auto; }
.keypad button {
  height: 58px; border-radius: 10px; border: 2px solid #c8a76a; background: #fff;
  font-size: 26px; font-weight: 700; color: #3a2a10; box-shadow: 0 3px 0 #c8a76a;
}
.keypad button:active { transform: translateY(2px); box-shadow: 0 1px 0 #c8a76a; }
.keypad .kdel { font-size: 17px; }
.keypad .kgo { background: linear-gradient(180deg, #ff6a55, #d8261a); color: #fff; border-color: #7a0f06; font-size: 20px; box-shadow: 0 3px 0 #7a0f06; }
.keypad .kgo:disabled { opacity: .4; }
.wait-seat span:last-child { margin-left: auto; font-weight: 700; color: #8a6a3a; }
.wait-seat.in span:last-child { color: #1d8a3d; }
.rematch-info { text-align: center; font-weight: 700; font-size: 14px; color: #6a5030; }
.seg button small { font-weight: 400; font-size: 12px; }

/* ───────── 窓 ───────── */
.overlay {
  position: fixed; inset: 0; z-index: 20; background: rgba(10,4,0,.6);
  display: grid; place-items: center; padding: 16px;
}
.overlay[hidden] { display: none; }
.sheet {
  width: min(100%, 520px); max-height: calc(100% - 20px); overflow-y: auto;
  background: linear-gradient(180deg, #fff9e8, #fbe9c2); color: #2a1a08;
  border: 4px solid var(--gold3); border-radius: 14px;
  box-shadow: 0 0 0 3px #5a3a08, 0 20px 40px rgba(0,0,0,.5);
  padding: 18px 18px 16px; animation: pop .25s cubic-bezier(.2,1.4,.4,1) both;
}
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.sheet h2 {
  margin: -18px -18px 14px; padding: 12px 18px; font-size: 20px; color: #fff;
  background: linear-gradient(180deg, #d8261a, #9a1209); border-radius: 10px 10px 0 0;
  text-shadow: 0 2px 0 rgba(0,0,0,.4);
}
.sheet h3 { font-size: 15px; margin: 14px 0 6px; }
.sheet p, .sheet li { font-size: 15px; line-height: 1.7; }
.sheet ol { padding-left: 1.3em; margin: 6px 0; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  flex: 1; min-width: 84px; min-height: 46px; border-radius: 8px; border: 2px solid #c8a76a;
  background: #fff; font-size: 15px; font-weight: 700; color: #4a3010; padding: 4px 6px;
}
.seg button[aria-pressed="true"] { background: #ffe07a; border-color: #b9831c; box-shadow: inset 0 0 0 2px #b9831c; }
.prow { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.prow .av { width: 44px; height: 44px; flex: none; }
.prow .av svg { width: 100%; height: 100%; }
.prow .seg { flex: 1; }
.sheet-btns { display: flex; gap: 10px; margin-top: 18px; }
.sheet-btns button {
  flex: 1; min-height: 54px; border-radius: 10px; font-size: 17px; font-weight: 700;
  border: 3px solid #2a0402; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.45);
  background: linear-gradient(180deg, #ff6a55, #d8261a 45%, #a3130b);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.4), 0 3px 0 #4a0904;
}
.sheet-btns button.sub { background: linear-gradient(180deg, #8a8a8a, #555); border-color: #222; box-shadow: inset 0 2px 0 rgba(255,255,255,.3), 0 3px 0 #222; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed #d9bf8a; font-size: 15px; }
.toggle .seg { flex: none; }
.toggle .seg button { min-width: 64px; }
.rules-fig { display: flex; gap: 14px; justify-content: center; margin: 8px 0; }
.rules-fig figure { margin: 0; text-align: center; font-size: 13px; font-weight: 700; }
.rules-fig svg { width: 110px; height: 110px; display: block; background: #f2c27c; border: 2px solid #5b3410; }

.result-head { text-align: center; font-size: 46px; font-weight: 700; margin: 4px 0 10px; }
.result-head.win { color: #d8261a; text-shadow: 0 3px 0 #ffd84a; }
.result-head.lose { color: #3a5aa8; }
.result-head.draw { color: #6a5a2a; }
.rank { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; margin: 6px 0; background: rgba(255,255,255,.6); }
.rank .no { width: 40px; font-size: 22px; font-weight: 700; text-align: center; }
.rank .av { width: 44px; height: 44px; flex: none; }
.rank .av svg { width: 100%; height: 100%; }
.rank .nm { flex: 1; font-weight: 700; }
.rank .nm small { display: block; font-weight: 400; font-size: 12px; color: #6a5030; }
.rank .sc { font-size: 24px; font-weight: 700; }
.rank.first { background: linear-gradient(90deg, #fff1a8, #ffd45a); }

@media (prefers-reduced-motion: reduce) {
  .burst, .floaters svg, .vs-lines { animation: none; }
}
