/* NEON DIVE 電脳麻雀 - style.css */
:root {
  --cy: #00f0ff;
  --pk: #ff2bd6;
  --vi: #8a5cff;
  --gr: #39ff9a;
  --ye: #ffe14d;
  --rd: #ff3b6b;
  --bg: #04040c;
  --ink: #e9f3ff;
  --mute: #8a97c2;
  --hw: 40px;
  --hh: 54px;
  --font: 'Zen Kaku Gothic New', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', system-ui, sans-serif;
  --digi: 'Orbitron', 'Zen Kaku Gothic New', monospace;
  --big: 'Dela Gothic One', 'Zen Kaku Gothic New', sans-serif;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font-family: var(--font); user-select: none; -webkit-user-select: none; touch-action: manipulation;
  overscroll-behavior: none;
}
button { font-family: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
#scan {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}
.screen { position: fixed; inset: 0; z-index: 2; }

/* ---------- タイトル ---------- */
#title { display: flex; align-items: center; justify-content: center; overflow-y: auto; padding: calc(16px + var(--sat)) 16px calc(16px + var(--sab)); }
.title-inner { width: min(560px, 100%); text-align: center; }
.logo-sub { font-family: var(--digi); letter-spacing: .5em; font-size: 11px; color: var(--cy); opacity: .85; margin-bottom: 6px; text-shadow: 0 0 8px var(--cy); }
.logo {
  position: relative; margin: 0; font-family: var(--digi); font-weight: 900; font-size: clamp(46px, 13vw, 92px);
  letter-spacing: .06em; line-height: 1; color: #fff;
  text-shadow: 0 0 6px #fff, 0 0 18px var(--cy), 0 0 42px var(--cy), 0 0 80px var(--vi);
  animation: flicker 6s infinite;
}
.logo::before, .logo::after {
  content: attr(data-text); position: absolute; inset: 0; pointer-events: none;
}
.logo::before { color: var(--pk); transform: translate(-3px, 0); mix-blend-mode: screen; opacity: .7; animation: glitchA 3.2s infinite steps(1); }
.logo::after { color: var(--cy); transform: translate(3px, 0); mix-blend-mode: screen; opacity: .7; animation: glitchB 2.7s infinite steps(1); }
.logo-jp { font-family: var(--big); font-size: clamp(18px, 5vw, 28px); letter-spacing: .6em; margin: 10px 0 26px .6em; color: var(--pk); text-shadow: 0 0 10px var(--pk), 0 0 30px var(--pk); }
@keyframes flicker { 0%, 92%, 100% { opacity: 1 } 93% { opacity: .55 } 94% { opacity: 1 } 96% { opacity: .7 } }
@keyframes glitchA { 0%, 90%, 100% { clip-path: inset(0 0 0 0); transform: translate(-3px,0) } 91% { clip-path: inset(20% 0 55% 0); transform: translate(-9px,0) } 93% { clip-path: inset(62% 0 10% 0); transform: translate(6px,0) } }
@keyframes glitchB { 0%, 88%, 100% { clip-path: inset(0 0 0 0); transform: translate(3px,0) } 89% { clip-path: inset(40% 0 35% 0); transform: translate(10px,0) } 91% { clip-path: inset(5% 0 80% 0); transform: translate(-7px,0) } }

.menu { display: grid; gap: 14px; padding: 18px; border: 1px solid rgba(0,240,255,.35); border-radius: 18px; background: linear-gradient(180deg, rgba(10,16,40,.72), rgba(8,6,24,.82)); box-shadow: 0 0 30px rgba(0,240,255,.12), inset 0 0 40px rgba(138,92,255,.12); backdrop-filter: blur(6px); }
.opt { text-align: left; }
.opt-label { font-size: 12px; color: var(--mute); letter-spacing: .15em; margin: 0 0 6px 4px; }
.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1; min-height: 44px; padding: 8px 4px; border-radius: 10px; border: 1px solid rgba(0,240,255,.28);
  background: rgba(0,20,40,.5); font-weight: 700; font-size: 15px; position: relative; transition: all .15s;
}
.seg button small { display: block; font-size: 9px; font-weight: 500; color: var(--mute); margin-top: 2px; }
.seg button.on { border-color: var(--cy); background: linear-gradient(180deg, rgba(0,240,255,.25), rgba(138,92,255,.25)); box-shadow: 0 0 14px rgba(0,240,255,.5), inset 0 0 12px rgba(0,240,255,.3); text-shadow: 0 0 8px var(--cy); }
.seg button.locked { opacity: .5; cursor: not-allowed; }
.seg[data-key="level"] button[data-v="strongest"].on { border-color: var(--pk); box-shadow: 0 0 16px rgba(255,43,214,.6), inset 0 0 12px rgba(255,43,214,.35); background: linear-gradient(180deg, rgba(255,43,214,.3), rgba(138,92,255,.3)); text-shadow: 0 0 8px var(--pk); }

.dive {
  position: relative; display: block; width: 100%; padding: 14px 10px 12px; margin-top: 6px; border: 0; border-radius: 14px;
  background: linear-gradient(90deg, var(--pk), var(--vi) 50%, var(--cy)); color: #fff; overflow: hidden;
  box-shadow: 0 0 24px rgba(255,43,214,.55), 0 0 50px rgba(0,240,255,.25);
}
.dive span { display: block; font-family: var(--big); font-size: 21px; letter-spacing: .12em; text-shadow: 0 2px 0 rgba(0,0,0,.35); }
.dive i { display: block; font-style: normal; font-family: var(--digi); font-size: 10px; letter-spacing: .5em; opacity: .85; margin-top: 3px; }
.dive::after { content: ''; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); transform: skewX(-20deg); animation: sweep 2.6s infinite; }
.dive.small { width: auto; padding: 10px 26px; margin: 0; }
.dive.small span { font-size: 16px; }
@keyframes sweep { 0% { left: -60% } 60%, 100% { left: 130% } }
.ghost { background: transparent; border: 1px solid rgba(0,240,255,.35); border-radius: 12px; padding: 10px 14px; color: var(--cy); font-weight: 700; }
.ghost.danger { border-color: rgba(255,59,107,.5); color: #ff8fab; }
.title-foot { margin-top: 14px; font-size: 11px; color: var(--mute); letter-spacing: .05em; }

/* ---------- 召喚 ---------- */
#summon { display: flex; align-items: center; justify-content: center; z-index: 30; background: radial-gradient(circle at center, rgba(138,92,255,.25), rgba(4,4,12,.95) 60%); }
.summon-ring { position: absolute; width: 70vmin; height: 70vmin; border-radius: 50%; border: 2px solid var(--cy); box-shadow: 0 0 30px var(--cy), inset 0 0 30px var(--cy); animation: ring 1.8s ease-in forwards; }
.summon-ring.r2 { border-color: var(--pk); box-shadow: 0 0 30px var(--pk), inset 0 0 30px var(--pk); animation-delay: .25s; }
@keyframes ring { 0% { transform: scale(.1) rotate(0); opacity: 0 } 30% { opacity: 1 } 100% { transform: scale(2.2) rotate(180deg); opacity: 0 } }
.summon-text { position: relative; text-align: center; width: min(420px, 84vw); }
.st1 { font-family: var(--digi); letter-spacing: .4em; color: var(--cy); font-size: 13px; text-shadow: 0 0 10px var(--cy); }
.st2 { font-family: var(--big); font-size: 26px; margin: 10px 0 16px; text-shadow: -2px 0 var(--pk), 2px 0 var(--cy), 0 0 20px rgba(255,255,255,.5); }
.bar { height: 4px; background: rgba(255,255,255,.1); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--pk), var(--cy)); box-shadow: 0 0 12px var(--cy); animation: load 1.7s ease-in-out forwards; }
@keyframes load { to { width: 100% } }
.st3 { font-family: var(--digi); font-size: 10px; color: var(--gr); text-align: left; margin-top: 12px; min-height: 60px; line-height: 1.6; opacity: .85; }

/* ---------- 盤面 ---------- */
#game { overflow: hidden; }
#board-wrap { position: absolute; inset: 0; }
#board { position: absolute; width: 1100px; height: 1100px; transform-origin: 0 0; }
.grid-floor {
  position: absolute; inset: 30px; border-radius: 60px;
  background:
    radial-gradient(circle at center, rgba(138,92,255,.22), transparent 62%),
    linear-gradient(rgba(0,240,255,.09) 2px, transparent 2px) 0 0/55px 55px,
    linear-gradient(90deg, rgba(0,240,255,.09) 2px, transparent 2px) 0 0/55px 55px;
  border: 2px solid rgba(0,240,255,.25);
  box-shadow: 0 0 60px rgba(0,240,255,.12), inset 0 0 120px rgba(255,43,214,.10);
}
#layers { position: absolute; inset: 0; z-index: 1; }
.layer { position: absolute; inset: 0; transform-origin: 550px 550px; pointer-events: none; }
.layer[data-r="1"] { transform: rotate(-90deg); }
.layer[data-r="2"] { transform: rotate(180deg); }
.layer[data-r="3"] { transform: rotate(90deg); }

#center {
  position: absolute; left: 400px; top: 400px; width: 300px; height: 300px; border-radius: 26px;
  background: linear-gradient(160deg, rgba(14,20,48,.92), rgba(6,6,22,.95));
  border: 2px solid rgba(0,240,255,.55);
  box-shadow: 0 0 28px rgba(0,240,255,.35), inset 0 0 40px rgba(138,92,255,.25);
  text-align: center; z-index: 0;
}
.c-round { position: absolute; left: 0; right: 0; top: 76px; font-family: var(--big); font-size: 38px; line-height: 1; color: #fff; text-shadow: 0 0 10px var(--cy), 0 0 24px var(--cy); }
.c-sub { position: absolute; left: 0; right: 0; top: 120px; font-size: 17px; color: var(--mute); display: flex; justify-content: center; gap: 16px; font-weight: 700; }
.c-dora-label { position: absolute; left: 0; right: 0; top: 146px; font-family: var(--digi); font-size: 11px; letter-spacing: .4em; color: var(--ye); text-shadow: 0 0 8px var(--ye); }
.c-dora { position: absolute; left: 0; right: 0; top: 162px; display: flex; justify-content: center; gap: 3px; --tw: 30px; --th: 40px; }
.c-left { position: absolute; left: 0; right: 0; top: 208px; font-size: 16px; color: var(--mute); font-weight: 700; }
.c-left b { font-family: var(--digi); color: var(--gr); font-size: 20px; text-shadow: 0 0 8px var(--gr); }

.seatinfo { position: absolute; left: 400px; top: 640px; width: 300px; height: 58px; display: flex; align-items: center; justify-content: center; gap: 10px; z-index: 2; }
.seatinfo .wind { font-family: var(--big); font-size: 26px; width: 40px; height: 40px; line-height: 40px; border-radius: 10px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.2); }
.seatinfo .wind.dealer { color: #160a22; background: var(--ye); border-color: var(--ye); box-shadow: 0 0 14px var(--ye); }
.seatinfo .score { font-family: var(--digi); font-weight: 700; font-size: 27px; letter-spacing: .02em; color: #fff; text-shadow: 0 0 10px rgba(0,240,255,.8); min-width: 110px; text-align: left; }
.seatinfo .score.neg { color: #ff8fab; text-shadow: 0 0 10px rgba(255,59,107,.8); }
.stick { position: absolute; left: 95px; top: -10px; width: 110px; height: 10px; border-radius: 5px; background: #f4f7ff; box-shadow: 0 0 10px #fff, 0 0 20px var(--cy); }
.stick::after { content: ''; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--rd); }
.turnbar { position: absolute; left: 430px; top: 693px; width: 240px; height: 5px; border-radius: 4px; background: transparent; z-index: 2; }
.turnbar.on { background: var(--cy); box-shadow: 0 0 10px var(--cy), 0 0 24px var(--cy); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .45 } }

.river { position: absolute; left: 400px; top: 712px; width: 330px; display: flex; flex-wrap: wrap; align-items: flex-end; align-content: flex-start; --tw: 52px; --th: 70px; }
.river .rowbreak { flex-basis: 100%; height: 0; }
.river .tile { margin: 0 1px 1px 0; }
.opp-strip { position: absolute; left: 96px; right: 96px; top: 1018px; height: 64px; display: flex; align-items: flex-end; gap: 10px; }
.opp-strip .nameplate { flex: 0 0 auto; }
.opp-hand { display: flex; gap: 1px; --tw: 34px; --th: 46px; }
.opp-hand .gap { width: 8px; }
.opp-melds { margin-left: auto; display: flex; gap: 8px; align-items: flex-end; --tw: 38px; --th: 51px; }
.nameplate { padding: 4px 12px; border-radius: 10px; background: rgba(8,10,30,.8); border: 1px solid rgba(255,43,214,.5); box-shadow: 0 0 10px rgba(255,43,214,.3); text-align: left; min-width: 96px; }
.nameplate .nm { font-weight: 700; font-size: 26px; line-height: 1.1; color: #fff; white-space: nowrap; font-family: var(--digi); }
.nameplate .lv { font-size: 15px; color: var(--pk); font-weight: 700; white-space: nowrap; }
.layer[data-r="2"] .nameplate, .layer[data-r="2"] .seatinfo { transform: rotate(180deg); }
.nameplate.riichi { border-color: var(--cy); box-shadow: 0 0 14px var(--cy); }

/* ---------- 牌 ---------- */
.tile {
  position: relative; flex: 0 0 auto; width: var(--tw); height: var(--th); border-radius: 14% / 10.5%;
  background: linear-gradient(165deg, #222d55 0%, #10173a 50%, #090d22 100%);
  box-shadow: inset 0 0 0 1px rgba(150,235,255,.45), inset 0 -3px 0 rgba(0,0,0,.4), 0 0 5px rgba(40,232,255,.2);
}
.tile svg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.tile.aka { box-shadow: inset 0 0 0 1.6px rgba(255,212,90,.95), inset 0 -3px 0 rgba(0,0,0,.4), 0 0 9px rgba(255,79,160,.55); }
.tile.back {
  background:
    linear-gradient(rgba(255,43,214,.28) 1px, transparent 1px) 0 0/7px 7px,
    linear-gradient(90deg, rgba(255,43,214,.28) 1px, transparent 1px) 0 0/7px 7px,
    linear-gradient(160deg, #3a1066, #16052c);
  box-shadow: inset 0 0 0 1px rgba(255,120,230,.6), 0 0 5px rgba(255,43,214,.3);
}
.tile.side { width: var(--th); height: var(--tw); }
.tile.side svg { width: var(--tw); height: var(--th); left: calc((var(--th) - var(--tw)) / 2); top: calc((var(--tw) - var(--th)) / 2); transform: rotate(90deg); }
.tile.last { box-shadow: inset 0 0 0 2px var(--ye), 0 0 14px var(--ye); animation: dropIn .28s ease-out; }
.tile.tsumogiri { filter: brightness(.78); }
.tile.dim { opacity: .3; filter: grayscale(.6); }
.tile.hl { box-shadow: inset 0 0 0 2px var(--pk), 0 0 16px var(--pk); }
@keyframes dropIn { 0% { transform: scale(1.5); filter: brightness(2.2); } 100% { transform: scale(1); } }
.meld { display: flex; align-items: flex-end; gap: 1px; }
.meld .stack { display: flex; flex-direction: column; gap: 1px; }

/* ---------- HUD・手牌 ---------- */
#hud { position: absolute; top: calc(6px + var(--sat)); left: calc(6px + var(--sal)); right: calc(6px + var(--sar)); display: flex; align-items: flex-start; gap: 8px; z-index: 10; pointer-events: none; }
.hud-btn { pointer-events: auto; width: 42px; height: 42px; border-radius: 12px; border: 1px solid rgba(0,240,255,.45); background: rgba(6,10,28,.75); color: var(--cy); display: grid; place-items: center; box-shadow: 0 0 12px rgba(0,240,255,.25); }
.hud-btn svg { width: 24px; height: 24px; }
#hint { pointer-events: none; margin-left: auto; max-width: min(70vw, 460px); padding: 6px 10px; border-radius: 10px; background: rgba(6,10,28,.82); border: 1px solid rgba(255,43,214,.55); box-shadow: 0 0 14px rgba(255,43,214,.3); font-size: 12.5px; line-height: 1.45; }
#hint b { color: var(--pk); font-family: var(--digi); font-size: 10px; letter-spacing: .15em; margin-right: 6px; }
#hint .mini { display: inline-block; vertical-align: middle; --tw: 18px; --th: 24px; margin: 0 2px; }

#handbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 8; padding: 6px calc(6px + var(--sar)) calc(8px + var(--sab)) calc(6px + var(--sal));
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: linear-gradient(180deg, transparent, rgba(4,4,14,.85) 35%);
}
#hand { display: flex; align-items: flex-end; justify-content: center; --tw: var(--hw); --th: var(--hh); min-height: calc(var(--hh) * 1.25); padding-top: calc(var(--hh) * .25); }
#hand .tile { margin: 0 1px; transition: transform .12s ease-out; cursor: pointer; }
#hand .tile.drawn { margin-left: calc(var(--hw) * .38); }
#hand .tile.sel { transform: translateY(-24%); box-shadow: inset 0 0 0 2px var(--cy), 0 0 18px var(--cy), 0 0 34px rgba(0,240,255,.5); }
#hand .tile.rec::after { content: 'AI'; position: absolute; left: 50%; top: -15px; transform: translateX(-50%); font-family: var(--digi); font-size: 9px; font-weight: 900; color: #160a22; background: var(--pk); padding: 1px 4px; border-radius: 4px; box-shadow: 0 0 8px var(--pk); }
#hand .tile.rec { box-shadow: inset 0 0 0 2px var(--pk), 0 0 14px var(--pk); }
#hand .tile.sel.rec { box-shadow: inset 0 0 0 2px var(--cy), 0 0 18px var(--cy), 0 0 30px var(--pk); }
#hand .tile.newdraw { animation: drawIn .3s ease-out; }
@keyframes drawIn { 0% { transform: translateY(-60%); opacity: 0; filter: brightness(2); } 100% { transform: none; opacity: 1; } }
#mymelds { display: flex; gap: 6px; align-self: flex-end; --tw: calc(var(--hw) * .72); --th: calc(var(--hh) * .72); min-height: 0; }
#mymelds:empty { display: none; }
.sortbtn { margin-left: calc(var(--hw) * .3); align-self: center; font-size: 11px; padding: 6px 7px; border-radius: 8px; border: 1px solid rgba(0,240,255,.4); background: rgba(6,10,28,.8); color: var(--cy); font-weight: 700; }

#actions { position: absolute; right: calc(10px + var(--sar)); z-index: 12; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; max-width: 92vw; }
.act {
  min-width: 74px; height: 50px; padding: 0 14px; border-radius: 14px; border: 2px solid var(--c, var(--cy));
  background: linear-gradient(180deg, rgba(10,14,40,.92), rgba(20,8,40,.92)); color: #fff;
  font-family: var(--big); font-size: 21px; letter-spacing: .05em;
  box-shadow: 0 0 16px var(--c, var(--cy)), inset 0 0 16px rgba(255,255,255,.06); text-shadow: 0 0 10px var(--c, var(--cy));
  animation: actIn .2s ease-out; position: relative;
}
.act.ron, .act.tsumo { --c: var(--rd); font-size: 24px; min-width: 92px; }
.act.riichi { --c: var(--cy); }
.act.pon, .act.chi, .act.kan { --c: var(--gr); }
.act.skip { --c: #7a86b5; font-family: var(--font); font-weight: 700; font-size: 16px; }
.act.active { background: var(--c); color: #0a0a18; text-shadow: none; }
.act.recd::after { content: 'AI推奨'; position: absolute; top: -10px; right: -6px; font-family: var(--font); font-size: 9.5px; font-weight: 700; background: var(--pk); color: #fff; padding: 1px 5px; border-radius: 6px; box-shadow: 0 0 8px var(--pk); text-shadow: none; letter-spacing: 0; }
@keyframes actIn { 0% { transform: scale(.6); opacity: 0 } 100% { transform: none; opacity: 1 } }
#subchoice { position: absolute; z-index: 13; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; padding: 10px; border-radius: 14px; background: rgba(6,8,26,.92); border: 1px solid var(--gr); box-shadow: 0 0 18px rgba(57,255,154,.4); --tw: 30px; --th: 40px; }
#subchoice button { background: transparent; border: 1px solid rgba(57,255,154,.5); border-radius: 10px; padding: 6px; display: flex; gap: 2px; }
#subchoice button:active { background: rgba(57,255,154,.2); }

/* ---------- 演出 ---------- */
#fx { position: absolute; inset: 0; pointer-events: none; z-index: 20; overflow: hidden; }
.callout {
  position: absolute; transform: translate(-50%, -50%); font-family: var(--big); white-space: nowrap; color: #fff;
  font-size: clamp(44px, 11vw, 110px); line-height: 1;
  text-shadow: -4px 0 var(--pk), 4px 0 var(--cy), 0 0 30px rgba(0,240,255,.9), 0 0 60px rgba(255,43,214,.6);
  animation: callIn 1.1s cubic-bezier(.2,.9,.2,1) forwards;
}
.callout.small { font-size: clamp(32px, 7.5vw, 70px); }
.callout.red { text-shadow: -4px 0 var(--ye), 4px 0 var(--rd), 0 0 30px rgba(255,59,107,.95), 0 0 70px rgba(255,59,107,.7); }
.callout.green { text-shadow: -3px 0 var(--cy), 3px 0 var(--gr), 0 0 26px rgba(57,255,154,.9); }
@keyframes callIn {
  0% { transform: translate(-50%, -50%) scale(2.6); opacity: 0; filter: blur(10px); }
  18% { transform: translate(-50%, -50%) scale(.92); opacity: 1; filter: blur(0); }
  24% { transform: translate(-52%, -50%) scale(1); }
  28% { transform: translate(-48%, -50%) scale(1); }
  32% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.2); filter: blur(4px); }
}
.laser { position: absolute; left: -10%; right: -10%; height: 3px; background: linear-gradient(90deg, transparent, var(--cy), #fff, var(--pk), transparent); box-shadow: 0 0 20px var(--cy), 0 0 40px var(--pk); animation: laser .9s ease-out forwards; }
@keyframes laser { 0% { transform: scaleX(0); opacity: 1 } 40% { transform: scaleX(1); opacity: 1 } 100% { transform: scaleX(1); opacity: 0 } }
.flash { position: absolute; inset: 0; background: #fff; animation: flash .7s ease-out forwards; mix-blend-mode: screen; }
.flash.red { background: radial-gradient(circle, rgba(255,255,255,.95), rgba(255,59,107,.6) 50%, transparent 80%); }
@keyframes flash { 0% { opacity: .95 } 100% { opacity: 0 } }
.shock { position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; border: 4px solid var(--cy); box-shadow: 0 0 30px var(--cy), inset 0 0 30px var(--pk); animation: shock 1s ease-out forwards; }
@keyframes shock { 0% { transform: scale(.2); opacity: 1 } 100% { transform: scale(30); opacity: 0 } }
.banner { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; padding: 22px 0; background: linear-gradient(90deg, transparent, rgba(8,8,30,.9) 20%, rgba(8,8,30,.9) 80%, transparent); border-top: 1px solid var(--cy); border-bottom: 1px solid var(--pk); box-shadow: 0 0 30px rgba(0,240,255,.3); animation: bannerIn 1.5s ease forwards; }
.banner .b1 { font-family: var(--big); font-size: clamp(40px, 10vw, 84px); line-height: 1.05; color: #fff; text-shadow: -3px 0 var(--pk), 3px 0 var(--cy), 0 0 26px var(--cy); letter-spacing: .1em; }
.banner .b2 { font-family: var(--digi); font-size: 12px; letter-spacing: .4em; color: var(--cy); margin-top: 6px; }
.banner .b3 { font-size: 14px; color: var(--ye); margin-top: 6px; font-weight: 700; }
@keyframes bannerIn { 0% { clip-path: inset(50% 0 50% 0); opacity: 0 } 15% { clip-path: inset(0 0 0 0); opacity: 1 } 80% { clip-path: inset(0 0 0 0); opacity: 1 } 100% { clip-path: inset(50% 0 50% 0); opacity: 0 } }
.shake { animation: shake .4s; }
@keyframes shake { 20% { transform: translate(-6px, 3px) } 40% { transform: translate(5px, -4px) } 60% { transform: translate(-4px, 2px) } 80% { transform: translate(3px, -1px) } }
.ptext { position: absolute; transform: translate(-50%, -50%); font-family: var(--digi); font-weight: 900; font-size: 26px; animation: floatUp 1.6s ease-out forwards; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, -20%) } 20% { opacity: 1 } 100% { opacity: 0; transform: translate(-50%, -160%) } }

/* ---------- パネル・モーダル ---------- */
.panel, #modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(2,2,10,.62); backdrop-filter: blur(4px); padding: calc(10px + var(--sat)) 10px calc(10px + var(--sab)); }
.panel-inner, .modal-inner {
  width: min(560px, 100%); max-height: 100%; overflow-y: auto; border-radius: 20px; padding: 18px;
  background: linear-gradient(170deg, rgba(14,18,46,.96), rgba(10,4,26,.97));
  border: 1px solid rgba(0,240,255,.5); box-shadow: 0 0 40px rgba(0,240,255,.25), inset 0 0 50px rgba(138,92,255,.15);
  animation: modalIn .3s ease-out;
}
@keyframes modalIn { 0% { transform: scale(.9) translateY(20px); opacity: 0 } 100% { transform: none; opacity: 1 } }
.panel-title { font-family: var(--digi); font-weight: 900; letter-spacing: .3em; color: var(--cy); text-shadow: 0 0 10px var(--cy); margin-bottom: 12px; }
.panel-title small { display: block; font-family: var(--font); letter-spacing: 0; font-weight: 500; font-size: 12px; color: var(--mute); text-shadow: none; margin-top: 4px; }
.srow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 4px; border-bottom: 1px solid rgba(255,255,255,.07); }
.srow .sl { font-weight: 700; font-size: 15px; }
.srow .sd { font-size: 11.5px; color: var(--mute); margin-top: 2px; }
.sw { flex: 0 0 auto; width: 54px; height: 30px; border-radius: 16px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); position: relative; transition: all .2s; }
.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #9aa6cf; transition: all .2s; }
.sw.on { background: rgba(0,240,255,.3); border-color: var(--cy); box-shadow: 0 0 12px rgba(0,240,255,.5); }
.sw.on::after { left: 27px; background: #fff; box-shadow: 0 0 10px var(--cy); }
.minis { display: flex; gap: 4px; flex: 0 0 auto; }
.minis button { padding: 6px 10px; border-radius: 9px; border: 1px solid rgba(0,240,255,.3); background: rgba(0,20,40,.5); font-size: 13px; font-weight: 700; }
.minis button.on { border-color: var(--cy); background: rgba(0,240,255,.25); box-shadow: 0 0 10px rgba(0,240,255,.4); }
.panel-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

.m-head { text-align: center; margin-bottom: 10px; }
.m-kind { font-family: var(--big); font-size: 46px; line-height: 1.05; text-shadow: -3px 0 var(--pk), 3px 0 var(--cy), 0 0 24px var(--cy); }
.m-kind.red { text-shadow: -3px 0 var(--ye), 3px 0 var(--rd), 0 0 24px var(--rd); }
.m-who { font-size: 15px; color: var(--mute); margin-top: 4px; }
.m-who b { color: #fff; }
.m-hand { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 1px; margin: 12px 0; --tw: min(34px, 6.3vw); --th: min(46px, 8.5vw); }
.m-hand .sp { width: 8px; }
.m-hand .tile.win { box-shadow: inset 0 0 0 2px var(--ye), 0 0 14px var(--ye); margin-left: 8px; }
.m-ind { display: flex; justify-content: center; gap: 16px; font-size: 12px; color: var(--mute); margin-bottom: 10px; flex-wrap: wrap; }
.m-ind > div { display: flex; align-items: center; gap: 6px; --tw: 24px; --th: 32px; }
.m-ind .tl { display: flex; gap: 2px; }
.yaku-list { display: grid; gap: 4px; margin: 8px auto; max-width: 360px; }
.yaku-row { display: flex; justify-content: space-between; padding: 5px 12px; border-radius: 8px; background: rgba(255,255,255,.04); border-left: 3px solid var(--cy); font-weight: 700; font-size: 16px; opacity: 0; animation: yakuIn .35s ease-out forwards; }
.yaku-row .h { font-family: var(--digi); color: var(--cy); }
.yaku-row.ym { border-left-color: var(--ye); }
.yaku-row.ym .h { color: var(--ye); }
@keyframes yakuIn { 0% { opacity: 0; transform: translateX(-20px) } 100% { opacity: 1; transform: none } }
.m-total { text-align: center; margin: 14px 0 6px; }
.m-fu { color: var(--mute); font-weight: 700; }
.m-label { font-family: var(--big); font-size: 34px; color: var(--ye); text-shadow: 0 0 16px var(--ye), 0 0 34px var(--pk); animation: labelPop .6s ease-out; }
@keyframes labelPop { 0% { transform: scale(2.4); opacity: 0 } 60% { transform: scale(.95); opacity: 1 } 100% { transform: none } }
.m-points { font-family: var(--digi); font-weight: 900; font-size: 40px; color: #fff; text-shadow: 0 0 14px var(--cy); }
.m-points small { font-family: var(--font); font-size: 15px; color: var(--mute); margin-left: 6px; }
.deltas { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 12px 0; }
.drow { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 10px; border-radius: 10px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); font-size: 13px; gap: 6px; }
.drow .n { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drow .s { font-family: var(--digi); font-size: 13px; }
.drow .d { font-family: var(--digi); font-size: 12px; }
.drow .d.p { color: var(--gr); } .drow .d.m { color: #ff8fab; }
.drow.me { border-color: rgba(0,240,255,.5); }
.m-btns { display: flex; justify-content: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.tenpai-list { display: grid; gap: 8px; margin: 10px 0; }
.tp-row { padding: 8px; border-radius: 10px; background: rgba(255,255,255,.04); }
.tp-row .tp-h { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 4px; }
.tp-row .tp-h .y { color: var(--gr); } .tp-row .tp-h .n { color: var(--mute); }
.tp-row .m-hand { margin: 4px 0 0; justify-content: flex-start; --tw: min(26px, 5.2vw); --th: min(35px, 7vw); }

.result-title { font-family: var(--digi); font-weight: 900; font-size: 26px; letter-spacing: .25em; text-align: center; color: #fff; text-shadow: 0 0 10px var(--cy), 0 0 30px var(--vi); }
.result-sub { text-align: center; font-size: 12px; color: var(--mute); margin: 4px 0 14px; }
.rank-row { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; margin-bottom: 8px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1); opacity: 0; animation: yakuIn .4s ease-out forwards; }
.rank-row .rk { font-family: var(--digi); font-weight: 900; font-size: 26px; text-align: center; }
.rank-row .nm { font-weight: 700; font-size: 16px; }
.rank-row .nm small { display: block; font-size: 11px; color: var(--mute); font-weight: 500; }
.rank-row .rt { text-align: right; }
.rank-row .sc { font-size: 11.5px; color: var(--mute); text-align: right; white-space: nowrap; margin-top: 2px; }
.rank-row .pt { font-family: var(--digi); font-weight: 900; font-size: 22px; min-width: 84px; text-align: right; }
.rank-row .pt.p { color: var(--gr); text-shadow: 0 0 10px rgba(57,255,154,.6); } .rank-row .pt.m { color: #ff8fab; }
.rank-row.top { border-color: var(--ye); background: linear-gradient(90deg, rgba(255,225,77,.18), rgba(255,43,214,.12)); box-shadow: 0 0 22px rgba(255,225,77,.35); }
.rank-row.top .rk { color: var(--ye); text-shadow: 0 0 12px var(--ye); }
.rank-row.me .nm { color: var(--cy); }
.rules-body { font-size: 13.5px; line-height: 1.8; color: #cdd7f5; }
.rules-body h4 { margin: 12px 0 4px; color: var(--cy); font-size: 14px; }
.rules-body ul { margin: 0; padding-left: 18px; }

@media (orientation: landscape) and (max-height: 560px) {
  #handbar { flex-direction: row; justify-content: center; align-items: flex-end; gap: 10px; background: linear-gradient(180deg, transparent, rgba(4,4,14,.75) 50%); padding-top: 2px; }
  #mymelds { order: 2; align-self: flex-end; }
  #hint { font-size: 11.5px; }
  .act { height: 44px; min-width: 64px; font-size: 18px; }
}
.layer[data-r="2"] .stick { top: auto; bottom: -10px; }
