/* ================= v52: remaining screens in the same world =================
   The win card, the hand-start banner, the per-hand settlement
   rows and the final result all join the v51 character world:
   faces + navy plates everywhere, the win total on a flame
   band, deltas in big blue / red. Presentation only — every
   number, row and label below is the one the game already
   computed. */
/* ---------- cards live in margin bands, never over the play area ----------
   Real-device feedback (v51): the left / right plates covered
   not only the side seats' tile rows but their discard ponds
   too. v52 rule: a card may sit ONLY in the margin bands the
   stage reserves above and below the canvas — the top band
   holds the three opponents (left seat at the left end, the
   far seat centre, the right seat at the right end), the
   bottom band holds your own plate. The canvas itself carries
   no card at all, so the wall, every pond, every hand row and
   every meld stays fully visible at any width. Faces grow
   inside the bands (that is the room the "bigger busts" ask
   gets); on narrow screens the band plates slim down to
   name + score so the three never collide with each other. */
#table.stage-mode { padding: 88px 6px 76px; }
#stage3d { overflow: visible; }
#stage3d canvas { border-radius: 13px; }
.char-face { width: 64px; height: 70px; }
.char-plate.pos2 { top: -82px; }
.char-plate.pos2 .char-face { width: 72px; height: 79px; }
.char-plate.pos3 { left: 0; top: -82px; }
.char-plate.pos1 { right: 0; top: -82px; }
.char-plate.pos0 { left: 0; bottom: -68px; }
.char-plate.pos0 .char-face { width: 68px; height: 75px; }
.seat-side .char-face { width: 58px; height: 64px; }

/* ---------- win card: dark red, hand on top, flame total ---------- */
.card.win52 {
  background:
    radial-gradient(ellipse 130% 52% at 50% 0%, rgba(255,110,40,.28) 0%, rgba(255,110,40,0) 60%),
    linear-gradient(180deg, #4a0f0a 0%, #2a0705 58%, #1a0303 100%);
  border: 1px solid rgba(255,140,70,.4); color: #f7ead9;
}
.card.win52 h2 { color: #ffd9a0; }
.win-mid { display: flex; gap: 14px; align-items: flex-start; margin-top: 8px; }
.win-mid .yaku-rows { flex: 1 1 auto; min-width: 0; margin-top: 0; }
.card.win52 .yaku-row { border-bottom: 1px solid rgba(255,180,90,.3); }
.win-hero { display: flex; flex-direction: column; align-items: center; gap: 5px; flex: 0 0 118px; }
.win-face {
  width: 112px; height: 123px; border-radius: 12px; object-fit: cover; object-position: 50% 6%;
  background: #0b5a34; filter: drop-shadow(0 5px 10px rgba(0,0,0,.6));
  -webkit-mask-image: linear-gradient(180deg, #000 80%, transparent 99%);
  mask-image: linear-gradient(180deg, #000 80%, transparent 99%);
}
.win-hero .plate-body { min-width: 0; width: 100%; align-items: center; }
.win-hero-sub { font-size: 11.5px; font-weight: 700; color: #dcebf7; white-space: nowrap; line-height: 1.5; }
.card.win52 .win-total {
  background: linear-gradient(180deg, #ffb03a 0%, #f06400 55%, #c22e00 100%);
  border: 1px solid rgba(255,220,150,.65); border-radius: 10px;
  padding: 9px 14px 10px; align-items: center;
  box-shadow: 0 6px 22px rgba(240,100,0,.4), inset 0 1px 0 rgba(255,255,255,.5);
}
.card.win52 .win-total .wt-rank {
  color: #fff3b0; font-size: 36px;
  text-shadow: 0 2px 0 #8a3c00, 0 4px 14px rgba(90,20,0,.6);
}
.card.win52 .win-total .wt-pts {
  color: #fff; font-size: 42px;
  text-shadow: 0 2px 0 rgba(122,45,0,.85), 0 5px 18px rgba(90,20,0,.55);
}
.card.win52 .win-total .win-sub { color: #ffe3c2; }
.card.win52 .dora-line { color: #f3d9b8; }

/* ---------- v62: yakuman-class win card (役満・ダブル役満・数え役満) ----------
   The win52 flame card turns gold: a brighter gilt frame and
   glow, the huge banner across the top, the winner's face
   larger, and the total band in full gold. The yaku rows and
   the score stay on the same dark ground, so everything
   remains exactly as readable as a normal win. */
.card.win52.yakuman {
  background:
    radial-gradient(ellipse 130% 52% at 50% 0%, rgba(255,205,60,.4) 0%, rgba(255,205,60,0) 62%),
    linear-gradient(180deg, #4a3405 0%, #2a1d04 58%, #180f02 100%);
  border: 2px solid #ffd34d;
  box-shadow: 0 0 0 1px rgba(255,233,168,.75), 0 0 42px rgba(255,190,40,.5), 0 18px 50px rgba(0,0,0,.6);
}
.card.win52.yakuman h2 { color: #ffe9a8; }
.ym-banner {
  font-family: "Shippori Mincho B1", serif; font-weight: 800; text-align: center;
  font-size: clamp(44px, 11vw, 68px); line-height: 1.12; letter-spacing: .05em;
  color: #ffe9a8; margin: 2px 0 8px;
  text-shadow: 0 0 8px rgba(255,190,40,.95), 0 4px 0 #8a6a10, 0 10px 30px rgba(0,0,0,.65), 0 0 54px rgba(255,211,77,.85);
  animation: fxpop 1.1s cubic-bezier(.16,1.4,.3,1) both;
}
.card.win52.yakuman .win-face { width: 148px; height: 163px; }
.card.win52.yakuman .win-hero { flex-basis: 152px; }
.card.win52.yakuman .win-total {
  background: linear-gradient(180deg, #ffe066 0%, #ffb03a 52%, #e07b00 100%);
  border-color: #fff3b0;
  box-shadow: 0 6px 26px rgba(255,180,20,.55), inset 0 1px 0 rgba(255,255,255,.7);
}
@media (max-width: 560px) {
  .card.win52.yakuman .win-face { width: 112px; height: 123px; }
  .card.win52.yakuman .win-hero { flex-basis: 116px; }
}
/* the gold wash fired over the board at a yakuman reveal */
.ym-flash { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 50%, rgba(255,222,110,.65), rgba(255,190,40,.22) 52%, rgba(255,190,40,0) 78%); animation: fxfflash 1.4s ease-out forwards; }
@media (prefers-reduced-motion: reduce) { .ym-banner { animation: none; } .ym-flash { display: none; } }

/* ---------- v62: win-card share button ----------
   Yours only, never a CPU's. Normally a small quiet ghost
   button beside 次の局へ; a yakuman-class win makes it the
   big gold one nobody can miss. */
.win-share {
  font-size: 12.5px; font-weight: 700; color: #cdbfa8;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,220,170,.35);
  border-radius: 8px; padding: 6px 14px; min-height: 34px; cursor: pointer;
}
.win-share.big {
  font-size: 19px; font-weight: 900; color: #2a1a00;
  background: linear-gradient(180deg, #ffe066 0%, #ffb03a 55%, #f06400 100%);
  border: 1.5px solid #fff3b0; border-radius: 12px; padding: 13px 26px; min-height: 54px;
  box-shadow: 0 0 22px rgba(255,190,40,.65), 0 6px 18px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.7);
  text-shadow: 0 1px 0 rgba(255,255,255,.45);
}
.win-share.big[disabled] { opacity: .65; }

/* ---------- v65: yakuman share-image fallback panel ----------
   Shown only when the device cannot share files: the
   generated image is previewed and the player chooses —
   save the image, or fall back to the plain text share. */
.ym-share-panel {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  background: rgba(4,12,8,.78); padding: 18px;
}
.ym-share-box {
  background: linear-gradient(180deg, #2b2110 0%, #171106 100%);
  border: 1.5px solid #d8b45a; border-radius: 14px; padding: 16px;
  max-width: min(92vw, 430px); width: 100%; text-align: center;
  box-shadow: 0 18px 50px rgba(0,0,0,.6);
}
.ym-share-box img { width: min(68vw, 300px); height: auto; border-radius: 10px; border: 1px solid rgba(255,220,150,.5); display: block; margin: 0 auto 12px; }
.ym-share-box .ys-title { font-weight: 900; color: #ffe9a8; font-size: 16px; margin-bottom: 10px; }
.ym-share-box .ys-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.ym-share-box button {
  font: inherit; font-weight: 900; font-size: 14px; cursor: pointer; border-radius: 9px;
  padding: 9px 16px; min-height: 42px; border: 1px solid rgba(255,220,170,.4);
  background: rgba(255,255,255,.08); color: #eef3ec;
}
.ym-share-box button.gold {
  color: #2a1a00; background: linear-gradient(180deg, #ffe066 0%, #ffb03a 60%, #f06400 100%);
  border-color: #fff3b0;
}

/* ---------- settlement rows (per-hand score movement) ---------- */
.settle-rows { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.settle-row { display: flex; align-items: center; gap: 9px; }
.settle-row .char-face { width: 46px; height: 51px; }
.settle-row .plate-body { flex: 1 1 auto; min-width: 0; }
.st-delta {
  font-size: 24px; font-weight: 900; font-variant-numeric: tabular-nums;
  white-space: nowrap; min-width: 92px; text-align: right;
}
.st-delta.plus { color: #57b6ff; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.st-delta.minus { color: #ff6a5e; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.st-delta.zero { color: #9db4a5; }
.st-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 900; color: #ffe9a8; white-space: nowrap; }
.stick {
  display: inline-block; width: 16px; height: 5px; border-radius: 3px; background: #f5f2e4;
  position: relative; box-shadow: 0 1px 1px rgba(0,0,0,.45); flex: 0 0 auto;
}
.stick::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px;
  margin: -2px 0 0 -2px; border-radius: 50%; background: #d3382c;
}
.stick.honba::after { width: 3px; height: 3px; margin: -1.5px 0 0 -1.5px; background: #26261f; box-shadow: 4.5px 0 0 #26261f, -4.5px 0 0 #26261f; }

/* ---------- final result rows: navy plates with faces ---------- */
.final-row {
  background: linear-gradient(180deg, #2e5f8a 0%, #173d5e 45%, #0d2742 100%);
  border: 1.5px solid #6fb3d8; border-radius: 10px; border-bottom: 1.5px solid #6fb3d8;
  padding: 8px 10px; margin-bottom: 8px; color: #fff;
  box-shadow: 0 3px 10px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.3);
}
.final-row.me {
  background: linear-gradient(180deg, #2e5f8a 0%, #173d5e 45%, #0d2742 100%);
  border-color: #ffd34d; box-shadow: 0 0 0 1.5px #ffd34d, 0 0 16px rgba(255,211,77,.45);
}
.fr-face {
  width: 54px; height: 60px; border-radius: 9px; object-fit: cover; object-position: 50% 6%;
  flex: 0 0 auto; background: #0b5a34;
  -webkit-mask-image: linear-gradient(180deg, #000 80%, transparent 99%);
  mask-image: linear-gradient(180deg, #000 80%, transparent 99%);
}
.final-row .fr-rank { color: #ffd34d; font-size: 24px; min-width: 44px; }
.final-row .fr-name { color: #cfe2f2; }
.final-row .fr-score { color: #fff; white-space: nowrap; }
.final-row .fr-side { color: #cfe2f2; }
.final-row .fr-side .tot { color: #ffe9a8; white-space: nowrap; }

/* ---------- hand-start banner: four faces + plates on the felt ---------- */
#startBanner {
  background: radial-gradient(ellipse 95% 75% at 50% 42%, #7d8f4e 0%, #556434 55%, #42512a 100%);
}
.sb-stage {
  display: grid; width: min(94vw, 580px); gap: 4px 8px; align-items: center; justify-items: center;
  grid-template-columns: minmax(0,1fr) auto minmax(0,1fr);
  grid-template-areas: ". top ." "left mid right" ". bottom .";
}
.sb-seat { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.sb-seat.s2 { grid-area: top; }
.sb-seat.s3 { grid-area: left; }
.sb-seat.s1 { grid-area: right; }
.sb-seat.s0 { grid-area: bottom; }
.sb-face {
  width: 92px; height: 101px; border-radius: 12px; object-fit: cover; object-position: 50% 6%;
  background: #0b5a34; filter: drop-shadow(0 4px 8px rgba(0,0,0,.5));
  -webkit-mask-image: linear-gradient(180deg, #000 80%, transparent 99%);
  mask-image: linear-gradient(180deg, #000 80%, transparent 99%);
}
.sb-seat .plate-body { min-width: 0; }
.sb-card {
  grid-area: mid;
  background: linear-gradient(180deg, #17456e 0%, #0d2742 72%);
  border: 1.5px solid #6fb3d8; border-radius: 10px;
  padding: 12px 22px 11px; box-shadow: 0 10px 30px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.3);
}
.sb-card .sb-round {
  color: #ff9a1f; -webkit-text-stroke: 1.5px rgba(255,248,230,.9);
  text-shadow: 0 3px 0 rgba(122,45,0,.55), 0 8px 22px rgba(0,0,0,.5);
}
.sb-card .sb-honba {
  font-family: "Shippori Mincho B1", serif; font-weight: 800;
  font-size: clamp(24px, 6vw, 34px); line-height: 1.25; color: #ffd34d;
  text-shadow: 0 2px 0 rgba(122,45,0,.45), 0 6px 16px rgba(0,0,0,.5);
}
@media (max-width: 560px) {
  #table.stage-mode { padding: 60px 4px 60px; }
  .char-face { width: 46px; height: 51px; }
  .char-plate.pos2 { top: -56px; }
  .char-plate.pos2 .char-face { width: 46px; height: 51px; }
  .char-plate.pos3 { top: -56px; }
  .char-plate.pos1 { top: -56px; }
  .char-plate.pos0 { bottom: -54px; }
  .char-plate.pos0 .char-face { width: 50px; height: 55px; }
  /* the three band plates slim to name + score so they never
     touch each other across a phone-width top band */
  .char-plate.abs .plate-body { min-width: 0; padding: 2px 6px 3px; }
  .char-plate.abs .plate-rank, .char-plate.abs .plate-tag { display: none; }
  .char-plate.abs .plate-name { font-size: 12px; }
  .char-plate.abs .plate-score { font-size: 13px; }
  .char-plate.abs .wind-badge { font-size: 10px; padding: 0 4px; }
  .seat-side .char-face { width: 48px; height: 53px; }
  .sb-face { width: 66px; height: 73px; }
  .sb-card { padding: 9px 13px 8px; }
  .win-hero { flex-basis: 92px; }
  .win-face { width: 86px; height: 95px; }
  .fr-face { width: 46px; height: 51px; }
  .final-row { gap: 8px; }
  .final-row .fr-rank { min-width: 38px; font-size: 21px; }
  .final-row .fr-score { font-size: 20px; }
  .card.win52 .win-total .wt-pts { font-size: 34px; }
  .card.win52 .win-total .wt-rank { font-size: 29px; }
  .st-delta { font-size: 20px; min-width: 76px; }
}
