:root { --teal: #0f5d57; --teal2: #0a4642; --coral: #ff6b5b; --coral2: #d94a3c; --cream: #fff6e6; --navy: #1f2a44; --sun: #ffc93c; --mint: #7fd8be;
  font-size: clamp(11px, min(2.3vh, 1.45vw) + 5px, 24px); }
@media (orientation: portrait) { :root { font-size: clamp(12px, 3.3vw, 18px); } }
[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { background: var(--teal) url(img/table.webp) center / cover; color: var(--navy); user-select: none; -webkit-user-select: none; touch-action: none;
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, "Noto Sans JP", "Noto Sans CJK JP", system-ui, sans-serif; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, rgba(255,255,255,.08), rgba(0,0,0,.32)); }
button { font-family: inherit; cursor: pointer; }
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
#top { display: flex; align-items: center; gap: .45rem; padding: .3rem .5rem; padding-top: max(.3rem, env(safe-area-inset-top)); background: var(--cream); border-bottom: .22rem solid var(--coral); position: relative; z-index: 5; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
#gName { font-size: 1.05rem; font-weight: 900; white-space: nowrap; letter-spacing: .03em; }
#hud { font-size: .8rem; font-weight: 700; color: #6b5a40; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sp { flex: 1; }
.ib { width: 2.2rem; height: 2.2rem; flex: none; border-radius: 50%; border: .14rem solid var(--navy); background: #fff; color: var(--navy); display: grid; place-items: center; padding: 0; }
.ib svg { width: 58%; height: 58%; }
.ib.off { opacity: .45; }
#bSound .x { display: none; } #bSound.off .x { display: inline; } #bSound.off .w { display: none; }
#board { position: relative; flex: 1; min-height: 0; z-index: 2; overflow: hidden; }
#bar { position: relative; z-index: 4; display: flex; align-items: center; gap: .5rem; padding: .25rem .5rem; padding-bottom: max(.25rem, env(safe-area-inset-bottom)); min-height: 2.6rem; background: rgba(8,40,37,.72); color: var(--cream); }
#msg { flex: 1; min-width: 0; font-size: .9rem; font-weight: 700; line-height: 1.25; }
#acts { display: flex; gap: .4rem; flex: none; }
#acts button { min-height: 2.1rem; padding: .2rem .8rem; border-radius: .6rem; border: 0; background: var(--sun); color: var(--navy); font-weight: 900; font-size: .9rem; box-shadow: 0 .18rem 0 #b98a12; }
#acts button:disabled { opacity: .4; }
#acts button:active { transform: translateY(2px); box-shadow: none; }
#acts button small { font-weight: 700; font-size: .75rem; margin-left: .2rem; }

/* cards */
.card { position: absolute; left: 0; top: 0; perspective: 600px; transition: transform .38s cubic-bezier(.25,.8,.3,1), width .3s, height .3s, opacity .3s; will-change: transform; }
.card .in { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .32s; transform: rotateY(180deg); }
.card.up .in { transform: rotateY(0); }
.card .f, .card .b { position: absolute; inset: 0; border-radius: .09em; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 .03em .06em rgba(0,0,0,.35); }
.card .f { background: #fffdf7; border: .025em solid #c9bda4; overflow: hidden; }
.card .b { transform: rotateY(180deg); background: #e35b4d url(img/back.webp) center / cover; border: .035em solid #fffdf7; }
.card .c { position: absolute; left: .07em; top: .04em; line-height: .95; text-align: center; font-weight: 900; font-family: "Arial Rounded MT Bold", "Hiragino Maru Gothic ProN", system-ui, sans-serif; }
.card .c i { display: block; font-style: normal; font-size: .62em; }
.card .c.r2 { left: auto; top: auto; right: .07em; bottom: .04em; transform: rotate(180deg); }
.card .m { position: absolute; left: 50%; top: 54%; transform: translate(-50%,-50%); font-size: 1.45em; line-height: 1; }
.card .pic { position: absolute; left: 22%; top: 12%; width: 70%; height: 80%; border-radius: .06em; background: center / cover; border: .02em solid #d8c9a6; }
.card.red .c, .card.red .m { color: #e0372c; }
.card.blk .c, .card.blk .m { color: #1f2a44; }
.card.jk .f { background: linear-gradient(160deg, #fff4c8, #ffd6cf); }
.card.jk .pic { left: 8%; top: 8%; width: 84%; height: 74%; border: 0; background: url(img/mascot.webp) center / contain no-repeat; }
.card.jk .jt { position: absolute; bottom: .05em; left: 0; right: 0; text-align: center; font-size: .36em; font-weight: 900; color: var(--coral2); letter-spacing: .05em; }
.card.act { cursor: pointer; }
.card.legal .f { box-shadow: 0 0 0 .05em var(--sun), 0 0 .18em .02em rgba(255,201,60,.9); }
.card.cur::after { content: ""; position: absolute; inset: -.07em; border: .06em solid #fff; border-radius: .13em; box-shadow: 0 0 0 .03em var(--coral); pointer-events: none; }
.card.dim .f { filter: brightness(.72) saturate(.6); }
.card.sel .f { box-shadow: 0 0 0 .06em var(--coral), 0 0 .2em rgba(255,107,91,.9); }
.card.gone { opacity: 0; pointer-events: none; }
.card.shake { animation: shake .3s; }
@keyframes shake { 25% { margin-left: -6px } 75% { margin-left: 6px } }
.slot { position: absolute; border-radius: 6px; border: 2px dashed rgba(255,246,230,.28); color: rgba(255,246,230,.38); display: grid; place-items: center; font-weight: 900; pointer-events: none; transition: transform .3s; }
.pilehit { position: absolute; border-radius: 8px; cursor: pointer; z-index: 400; }
.pilehit.hl { box-shadow: 0 0 0 3px var(--sun), 0 0 16px var(--sun); }
.lbl { position: absolute; color: var(--cream); font-weight: 800; font-size: .8rem; text-shadow: 0 1px 2px rgba(0,0,0,.6); white-space: nowrap; pointer-events: none; transform: translateX(-50%); }

/* seats */
.seat { position: absolute; display: flex; align-items: center; gap: .35rem; padding: .18rem .55rem .18rem .18rem; border-radius: 999px; background: rgba(255,246,230,.92); color: var(--navy); box-shadow: 0 2px 6px rgba(0,0,0,.3); transition: left .35s, top .35s, box-shadow .2s; z-index: 300; white-space: nowrap; pointer-events: none; }
.seat img { width: 2.1rem; height: 2.1rem; border-radius: 50%; border: .12rem solid var(--navy); background: #fff; object-fit: cover; }
.seat b { font-size: .85rem; display: block; line-height: 1.1; }
.seat small { font-size: .72rem; font-weight: 700; color: #6b5a40; display: block; line-height: 1.15; }
.seat.cur { box-shadow: 0 0 0 .2rem var(--sun), 0 2px 10px rgba(0,0,0,.4); }
.seat.done { opacity: .7; }
.seat .you { background: var(--coral); color: #fff; font-size: .6rem; padding: 0 .3rem; border-radius: 4px; margin-left: .2rem; vertical-align: middle; }

/* overlays */
.ov { position: fixed; inset: 0; z-index: 20; display: none; place-items: center; background: rgba(5,30,28,.6); padding: .6rem; }
.ov.show { display: grid; }
#ovStart { background: rgba(5,30,28,.35); }
.panel { background: var(--cream); border-radius: 1rem; padding: 1rem 1.2rem; width: min(26rem, 96vw); max-height: 96vh; display: flex; flex-direction: column; text-align: center;
  box-shadow: 0 .8rem 2.4rem rgba(0,0,0,.5); border: .25rem solid var(--navy); animation: pop .3s cubic-bezier(.2,1.5,.4,1); position: relative; }
@keyframes pop { from { transform: scale(.8); opacity: 0 } }
.panel h1 { margin: .1rem 0 .2rem; font-size: 1.9rem; font-weight: 900; color: var(--coral2); letter-spacing: .04em; text-shadow: 0 .12rem 0 #ffd9a0; }
.panel h2 { margin: .1rem 0 .5rem; font-size: 1.3rem; font-weight: 900; }
.panel p { margin: .2rem 0; font-size: .85rem; line-height: 1.45; }
.big { min-height: 2.8rem; padding: .3rem 1.6rem; border-radius: .8rem; border: 0; background: var(--coral); color: #fff; font-weight: 900; font-size: 1.15rem; box-shadow: 0 .25rem 0 var(--coral2); }
.big:active { transform: translateY(2px); box-shadow: 0 .08rem 0 var(--coral2); }
.sub { min-height: 2.8rem; padding: .3rem 1rem; border-radius: .8rem; border: .15rem solid var(--navy); background: #fff; color: var(--navy); font-weight: 800; font-size: .95rem; }
.foot { display: flex; gap: .6rem; justify-content: center; padding-top: .6rem; flex: none; }
.scroll { overflow: auto; min-height: 0; text-align: left; font-size: .88rem; line-height: 1.55; touch-action: pan-y; }
.scroll h3 { margin: .5rem 0 .2rem; font-size: .95rem; color: var(--coral2); }
.scroll ul { margin: .2rem 0; padding-left: 1.2rem; }
.scroll kbd { display: inline-block; min-width: 1.5em; padding: 0 .3em; border: .1rem solid var(--navy); border-bottom-width: .2rem; border-radius: .3rem; background: #fff; font-family: inherit; font-weight: 800; font-size: .8em; text-align: center; }
.rules { width: min(34rem, 96vw); }

.start { width: min(46rem, 98vw); flex-direction: row; gap: 1rem; align-items: center; padding: .8rem 1rem; }
.start .sl { flex: 0 0 38%; }
.start .sr { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .45rem; }
.mascot { width: 62%; max-width: 12rem; display: block; margin: 0 auto; filter: drop-shadow(0 .3rem .3rem rgba(0,0,0,.2)); animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-.3rem) rotate(-2deg); } }
.intro { color: #5a4a33; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.tile { position: relative; display: flex; align-items: center; gap: .5rem; text-align: left; padding: .4rem .5rem; border-radius: .8rem; border: .16rem solid var(--navy); background: #fff; color: var(--navy); min-height: 3.6rem; box-shadow: 0 .2rem 0 var(--navy); }
.tile.on { background: #fff0c2; border-color: var(--coral2); box-shadow: 0 .2rem 0 var(--coral2), 0 0 0 .14rem var(--coral); }
.tile .ic { flex: none; width: 2.3rem; height: 2.3rem; border-radius: .5rem; display: grid; place-items: center; font-size: 1.3rem; font-weight: 900; color: #fff; }
.tile b { display: block; font-size: 1rem; }
.tile small { display: block; font-size: .7rem; color: #6b5a40; font-weight: 700; line-height: 1.2; }
.tile .w { position: absolute; right: .35rem; top: .2rem; font-size: .62rem; font-weight: 800; color: var(--coral2); }
.opts { display: flex; flex-direction: column; gap: .3rem; }
.row { display: flex; align-items: center; gap: .5rem; }
.row > span { flex: 0 0 2.6rem; font-size: .8rem; font-weight: 800; text-align: right; }
.seg { flex: 1; display: flex; border: .14rem solid var(--navy); border-radius: .6rem; overflow: hidden; background: #fff; }
.seg button { flex: 1; min-height: 2rem; border: 0; background: transparent; color: var(--navy); font-weight: 800; font-size: .82rem; padding: 0 .2rem; }
.seg button + button { border-left: .1rem solid var(--navy); }
.seg button.on { background: var(--navy); color: #fff; }
.seg button:disabled { color: #b8ad98; }
.go { display: flex; gap: .5rem; }
.go .big { flex: 1; }
.keys { font-size: .7rem !important; color: #7a6a4c; margin: 0 !important; }
.cover img { width: 5rem; height: 5rem; border-radius: 50%; border: .2rem solid var(--navy); margin: 0 auto; object-fit: cover; background: #fff; }
.end ol { text-align: left; margin: .2rem auto .4rem; padding-left: 1.6rem; font-size: 1rem; font-weight: 800; line-height: 1.7; }
.end ol li.me { color: var(--coral2); }
#toast { position: fixed; z-index: 15; left: 50%; top: 42%; transform: translate(-50%,-50%) scale(.6); opacity: 0; pointer-events: none; background: var(--cream); color: var(--navy); font-size: 1.5rem; font-weight: 900;
  padding: .4rem 1.2rem; border-radius: 1rem; border: .2rem solid var(--navy); box-shadow: 0 .4rem 1rem rgba(0,0,0,.4); transition: opacity .2s, transform .25s cubic-bezier(.2,1.6,.4,1); white-space: nowrap; }
#toast.show { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.fx { position: absolute; width: 10px; height: 10px; border-radius: 2px; pointer-events: none; z-index: 900; animation: fx .9s ease-out forwards; }
@keyframes fx { to { transform: translate(var(--dx), var(--dy)) rotate(400deg); opacity: 0; } }

@media (max-height: 560px) and (orientation: landscape) {
  .start { padding: .5rem .8rem; } .panel h1 { font-size: 1.5rem; } .mascot { width: 52%; } .tile { min-height: 3rem; padding: .3rem .45rem; }
  .tile .ic { width: 2rem; height: 2rem; font-size: 1.1rem; } .seg button { min-height: 1.8rem; } .big, .sub { min-height: 2.4rem; }
}
@media (max-height: 420px) and (orientation: landscape) {
  .intro { font-size: .75rem !important; } .start .sr { gap: .3rem; } .tile small { display: none; } .tile { min-height: 2.5rem; } .mascot { width: 44%; }
  .panel { padding: .5rem .8rem; }
}
@media (orientation: portrait) {
  .start { flex-direction: column; gap: .5rem; padding: .8rem; } .start .sl { flex: none; } .mascot { width: 34%; } .panel h1 { font-size: 1.6rem; }
}
