:root {
  --orange: #FF8A3D;
  --orange-deep: #E5651B;
  --orange-soft: #FFE3C6;
  --ink: #2E2118;
  --ink-soft: #6E5948;
  --ink-faint: #9A8069;
  --cream: #FFF7E8;
  --cream-deep: #F8E8CC;
  --paper: #FFFCF4;
  --red: #C94034;
  --red-deep: #98281F;
  --black-piece: #2F2B27;
  --line: rgba(88, 55, 28, 0.18);
  --shadow: 0 8px 22px rgba(93, 53, 18, 0.12);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #F6D8A9;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 12% 2%, rgba(255, 255, 255, 0.75), transparent 24%),
    radial-gradient(circle at 94% 18%, rgba(255, 196, 118, 0.55), transparent 30%),
    linear-gradient(160deg, #FFF4DE 0%, #FBE5C1 48%, #F6D5A3 100%);
}

button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }

.app-shell {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

.app-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.32;
  background-image: radial-gradient(rgba(126, 75, 27, 0.25) 0.7px, transparent 0.7px);
  background-size: 9px 9px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.65), transparent 62%);
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(1px);
}
.bg-orb-a {
  width: 190px;
  height: 190px;
  left: -86px;
  top: 18%;
  background: radial-gradient(circle at 60% 40%, rgba(255, 138, 61, 0.3), rgba(255, 138, 61, 0));
}
.bg-orb-b {
  width: 240px;
  height: 240px;
  right: -118px;
  bottom: 8%;
  background: radial-gradient(circle at 40% 50%, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0));
}

.game {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 520px;
  height: 100%;
  margin: 0 auto;
  padding: calc(8px + var(--safe-top)) 16px calc(8px + var(--safe-bottom));
  -webkit-user-select: none;
  user-select: none;
}

.players {
  flex: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-height: 50px;
}

.player {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.player-me { justify-content: flex-end; }

.avatar {
  position: relative;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 2px solid #3D2B1F;
  background: linear-gradient(145deg, #FFF8E8, #FFE1BB);
  box-shadow: 0 3px 0 rgba(61, 43, 31, 0.18);
  overflow: visible;
}
.avatar-opp {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 19px;
  font-weight: 800;
  color: #FFF4DE;
  border-color: #2E241D;
  background: linear-gradient(145deg, #554234, #2A211B);
}
.avatar-me {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8A3E12;
  font-weight: 900;
  font-size: 17px;
  padding: 0;
}
.avatar-me img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}
.avatar-crown {
  position: absolute;
  right: -6px;
  top: -7px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--orange);
  border: 1.5px solid #4B301C;
  color: #FFF8E8;
  box-shadow: 0 1px 0 rgba(75, 48, 28, 0.24);
}
.avatar-crown .mp-icon { width: 11px; height: 11px; }

.player-meta { min-width: 0; overflow: hidden; }
.player-meta-right { text-align: right; }
.player-line { display: flex; align-items: center; gap: 5px; min-width: 0; }
.player-line-right { justify-content: flex-end; }
.player-name {
  display: block;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 118px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.player-sub {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-faint);
  white-space: nowrap;
}
.player-sub-right { justify-content: flex-end; }
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.55; }
.side-dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid rgba(46, 33, 24, 0.5); }
.side-dot-black { background: #2F2B27; }
.side-dot-red { background: var(--red); }
.rank-badge {
  flex: none;
  padding: 2px 6px;
  border-radius: 7px;
  background: #3D2C20;
  color: #FFD9A8;
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: 0.05em;
}

.turn-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 82px;
  height: 29px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 252, 244, 0.9);
  border: 1.5px solid rgba(91, 56, 26, 0.28);
  box-shadow: 0 3px 9px rgba(103, 61, 22, 0.11);
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-soft);
  white-space: nowrap;
  justify-content: center;
}
.turn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(201, 64, 52, 0.14);
  animation: breathe 1.8s ease-in-out infinite;
}
.turn-pill.is-black .turn-dot { background: #2F2B27; box-shadow: 0 0 0 3px rgba(47, 43, 39, 0.14); }
.turn-pill.is-over .turn-dot { animation: none; opacity: 0.35; }
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.72); opacity: 0.55; }
}

.toolbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
}
.mode-tabs {
  display: flex;
  flex: 1;
  min-width: 0;
  padding: 3px;
  gap: 3px;
  border-radius: 13px;
  background: rgba(111, 69, 32, 0.09);
  border: 1px solid rgba(91, 56, 26, 0.12);
}
.mode-tab {
  flex: 1;
  min-width: 0;
  height: 31px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 6px;
  border-radius: 10px;
  color: #7B6250;
  font-size: 11.5px;
  font-weight: 700;
  transition: transform 0.12s ease, background 0.16s ease, color 0.16s ease;
}
.mode-tab .mp-icon { width: 15px; height: 15px; opacity: 0.72; }
.mode-tab.is-active {
  color: #4A2A11;
  background: #FFF9EC;
  box-shadow: 0 2px 0 rgba(78, 44, 15, 0.16), 0 1px 6px rgba(104, 61, 23, 0.09);
}
.mode-tab.is-active .mp-icon { opacity: 1; color: var(--orange-deep); }
.mode-tab:active { transform: scale(0.97); }

.side-tabs {
  display: flex;
  flex: none;
  padding: 3px;
  gap: 3px;
  border-radius: 13px;
  background: rgba(255, 249, 236, 0.72);
  border: 1px solid rgba(91, 56, 26, 0.16);
}
.side-chip {
  height: 31px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 800;
  color: #806650;
}
.side-chip.is-active {
  background: #FFE5C5;
  color: #7E3B12;
  box-shadow: inset 0 0 0 1px rgba(229, 101, 27, 0.25);
}
.side-chip:active { transform: scale(0.96); }
.chip-dot { width: 7px; height: 7px; border-radius: 50%; }
.chip-red { background: var(--red); }
.chip-black { background: #2F2B27; }

.board-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 0;
}
.board-frame {
  position: relative;
  width: auto;
  height: auto;
  width: fit-content;
  height: fit-content;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 23px;
  background: linear-gradient(150deg, rgba(255, 249, 234, 0.96), rgba(255, 230, 194, 0.92));
  border: 2px solid rgba(75, 45, 22, 0.72);
  box-shadow:
    0 7px 0 rgba(100, 55, 20, 0.2),
    0 14px 34px rgba(101, 57, 20, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  overflow: hidden;
}
.board-frame::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 17px;
  border: 1px solid rgba(115, 69, 30, 0.18);
  pointer-events: none;
}
#boardCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
  border-radius: 18px;
  cursor: pointer;
}
.board-corner {
  position: absolute;
  width: 30px;
  height: 30px;
  pointer-events: none;
  opacity: 0.55;
}
.board-corner-tl { left: 9px; top: 9px; border-left: 2px solid var(--orange-deep); border-top: 2px solid var(--orange-deep); border-radius: 9px 0 0 0; }
.board-corner-br { right: 9px; bottom: 9px; border-right: 2px solid var(--orange-deep); border-bottom: 2px solid var(--orange-deep); border-radius: 0 0 9px 0; }

.thinking {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(47, 37, 29, 0.9);
  color: #FFF3DD;
  font-size: 10.5px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(47, 37, 29, 0.25);
  backdrop-filter: blur(4px);
  pointer-events: none;
}
.thinking-dots { display: inline-flex; gap: 3px; }
.thinking-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #FFB36B;
  animation: dot 1s infinite ease-in-out;
}
.thinking-dots i:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 100% { transform: translateY(0); opacity: 0.55; } 50% { transform: translateY(-2px); opacity: 1; } }

.status-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
  padding: 0 4px;
}
.status-main {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-soft);
}
#statusText {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.status-icon {
  flex: none;
  width: 19px;
  height: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  color: var(--orange-deep);
  background: rgba(255, 138, 61, 0.14);
}
.status-icon .mp-icon { width: 13px; height: 13px; }
.status-hint {
  flex: none;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-faint);
  white-space: nowrap;
}

.actions {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 44px;
  gap: 7px;
  padding-bottom: 1px;
}
.action-btn {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 14px;
  border: 1.5px solid rgba(86, 53, 26, 0.22);
  background: linear-gradient(180deg, #FFFDF5, #FFF2DC);
  box-shadow: 0 3px 0 rgba(99, 57, 20, 0.15);
  color: #5D402B;
  font-size: 12px;
  font-weight: 800;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.action-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 rgba(99, 57, 20, 0.15); }
.action-btn:disabled { opacity: 0.4; box-shadow: none; }
.action-primary {
  color: #5A2B0D;
  border-color: #B95C1E;
  background: linear-gradient(180deg, #FFB16F, var(--orange));
  box-shadow: 0 3px 0 #B95719, 0 6px 14px rgba(229, 101, 27, 0.22);
}
.action-icon {
  width: 19px;
  height: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.action-icon .mp-icon { width: 18px; height: 18px; }
.action-icon-only { width: 44px; }

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(46, 31, 19, 0.45);
  backdrop-filter: blur(3px);
  animation: fadeIn 0.2s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 18px calc(18px + var(--safe-bottom));
  border-radius: 26px 26px 0 0;
  background:
    radial-gradient(circle at 92% 0%, rgba(255, 183, 110, 0.38), transparent 28%),
    linear-gradient(180deg, #FFFDF6, #FFF4DF);
  border: 2px solid rgba(79, 47, 20, 0.55);
  border-bottom: 0;
  box-shadow: 0 -18px 50px rgba(62, 37, 14, 0.28);
  animation: sheetUp 0.28s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}
@keyframes sheetUp { from { transform: translate(-50%, 104%); } to { transform: translate(-50%, 0); } }
.sheet-grip {
  width: 42px;
  height: 4px;
  border-radius: 99px;
  background: rgba(95, 59, 28, 0.22);
  margin: 0 auto 13px;
}
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.eyebrow {
  margin: 0 0 3px;
  color: var(--orange-deep);
  font-size: 9.5px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.18em;
}
.sheet-head h2, .result-title, .sheet-confirm h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.sheet-close {
  flex: none;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: rgba(95, 59, 28, 0.08);
  color: #6C5039;
}
.sheet-close .mp-icon { width: 18px; height: 18px; }
.sheet-close:active { transform: scale(0.94); }

.rules-list { display: flex; flex-direction: column; gap: 9px; }
.rule-item {
  display: flex;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 13px;
  background: rgba(255, 252, 243, 0.82);
  border: 1px solid rgba(111, 69, 32, 0.14);
}
.rule-no {
  flex: none;
  font-size: 10px;
  font-weight: 900;
  color: #C46B2C;
  padding-top: 1px;
  letter-spacing: 0.04em;
}
.rule-item p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.62;
  color: #6B523E;
}
.rule-item strong { color: var(--ink); font-weight: 800; }
.sheet-cta {
  width: 100%;
  height: 48px;
  margin-top: 15px;
  border-radius: 14px;
  background: linear-gradient(180deg, #FFB374, var(--orange));
  border: 1.5px solid #B55719;
  box-shadow: 0 3px 0 #B55719;
  color: #4C260B;
  font-size: 13px;
  font-weight: 900;
}
.sheet-cta:active { transform: translateY(2px); box-shadow: 0 1px 0 #B55719; }

.result-badge {
  width: 66px;
  height: 66px;
  margin: 2px auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  color: #7B3A0D;
  background: linear-gradient(150deg, #FFE1A8, #FFA94D);
  border: 2px solid #603719;
  box-shadow: 0 5px 0 rgba(96, 55, 25, 0.2), inset 0 2px 0 rgba(255, 255, 255, 0.55);
  position: relative;
  z-index: 2;
}
.result-badge .mp-icon { width: 38px; height: 38px; }
.result-badge.is-loss {
  color: #554B43;
  background: linear-gradient(150deg, #EAE1D5, #C9BCAE);
}
.result-title { text-align: center; font-size: 27px; }
.result-desc { margin: 6px 0 15px; text-align: center; color: var(--ink-faint); font-size: 12px; line-height: 1.55; }
.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(112, 68, 30, 0.07);
  border: 1px solid rgba(112, 68, 30, 0.1);
  position: relative;
  z-index: 2;
}
.result-stat { text-align: center; }
.result-label { display: block; font-size: 9.5px; color: var(--ink-faint); margin-bottom: 3px; }
.result-stat strong { display: block; font-size: 16px; line-height: 1.3; color: var(--ink); }
#resultDelta.is-plus { color: #D06A1E; }
#resultDelta.is-minus { color: #76706A; }
.result-actions { display: grid; grid-template-columns: 1fr 1.25fr; gap: 9px; margin-top: 16px; position: relative; z-index: 2; }
.result-btn {
  height: 47px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 900;
}
.result-ghost {
  border: 1.5px solid rgba(92, 58, 29, 0.26);
  background: rgba(255, 252, 244, 0.8);
  color: #6E523B;
  box-shadow: 0 3px 0 rgba(99, 57, 20, 0.12);
}
.result-main {
  border: 1.5px solid #B55719;
  background: linear-gradient(180deg, #FFB374, var(--orange));
  color: #4C260B;
  box-shadow: 0 3px 0 #B55719;
}
.result-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(99, 57, 20, 0.14); }

.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; border-radius: 24px 24px 0 0; }
.confetti i {
  position: absolute;
  top: -12px;
  width: 7px;
  height: 11px;
  border-radius: 2px;
  opacity: 0;
  animation: confettiFall 1.5s ease-in forwards;
}
@keyframes confettiFall {
  0% { transform: translateY(-10px) rotate(0); opacity: 0; }
  12% { opacity: 1; }
  100% { transform: translateY(340px) rotate(420deg); opacity: 0; }
}

.my-rank-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, #3E2B1D, #61402A);
  color: #FFF0D2;
  box-shadow: 0 4px 0 rgba(62, 43, 29, 0.2);
}
.my-rank-avatar {
  flex: none;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  background: linear-gradient(145deg, #FFD29C, #E77E2C);
  color: #51270C;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 18px;
  font-weight: 900;
  border: 1.5px solid #2E2118;
}
.my-rank-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.my-rank-info strong { font-size: 13.5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.my-rank-info span { font-size: 10.5px; color: #D9BC98; }
.my-rank-games { text-align: right; display: flex; flex-direction: column; }
.my-rank-games strong { font-size: 17px; color: #FFBE7A; }
.my-rank-games span { font-size: 9px; color: #BFA383; }

.ladder-list { margin-top: 13px; display: flex; flex-direction: column; gap: 6px; }
.ladder-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 50px;
  padding: 7px 10px;
  border-radius: 12px;
  background: rgba(255, 253, 247, 0.8);
  border: 1px solid rgba(104, 64, 29, 0.1);
}
.ladder-row.is-me { background: #FFE9CE; border-color: rgba(210, 115, 40, 0.35); }
.ladder-pos { width: 22px; text-align: center; flex: none; font-size: 12px; font-weight: 900; color: #A28A73; }
.ladder-pos.is-top { color: #C46B2C; }
.ladder-avatar {
  flex: none;
  width: 31px;
  height: 31px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F2DFC5;
  border: 1px solid rgba(88, 53, 23, 0.2);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 14px;
  font-weight: 800;
  color: #704226;
}
.ladder-info { flex: 1; min-width: 0; }
.ladder-name { display: block; font-size: 12px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.ladder-meta { display: block; margin-top: 2px; font-size: 9.5px; color: var(--ink-faint); }
.ladder-score { text-align: right; flex: none; }
.ladder-score strong { display: block; font-size: 13px; color: #8F4E1E; }
.ladder-score span { font-size: 9px; color: var(--ink-faint); }
.ladder-empty { padding: 28px 10px; text-align: center; color: var(--ink-faint); font-size: 12px; }

.sheet-confirm { padding-bottom: calc(22px + var(--safe-bottom)); text-align: center; }
.confirm-icon {
  width: 54px;
  height: 54px;
  margin: 1px auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: #FFE2C2;
  color: var(--orange-deep);
  border: 1.5px solid rgba(111, 64, 26, 0.25);
}
.confirm-icon .mp-icon { width: 28px; height: 28px; }
.sheet-confirm p { margin: 7px 8px 16px; font-size: 12px; line-height: 1.6; color: var(--ink-faint); }
.confirm-actions { display: grid; grid-template-columns: 1fr 1.15fr; gap: 9px; }

.toast {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: calc(98px + var(--safe-bottom));
  transform: translateX(-50%);
  max-width: calc(100vw - 40px);
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(48, 35, 25, 0.93);
  color: #FFF4E0;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 8px 22px rgba(48, 35, 25, 0.28);
  animation: toastIn 0.2s ease both;
  pointer-events: none;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 350px) {
  .game { padding-left: 9px; padding-right: 9px; gap: 6px; }
  .player-name { max-width: 82px; font-size: 12.5px; }
  .avatar { width: 36px; height: 36px; border-radius: 12px; }
  .turn-pill { min-width: 72px; padding: 0 7px; font-size: 10px; }
  .mode-tab { font-size: 10.5px; gap: 3px; }
  .side-chip { padding: 0 6px; font-size: 10px; }
  .action-btn { height: 45px; font-size: 11px; }
}

@media (max-height: 660px) {
  .game { gap: 5px; padding-top: calc(5px + var(--safe-top)); padding-bottom: calc(4px + var(--safe-bottom)); }
  .players { min-height: 43px; }
  .avatar { width: 35px; height: 35px; border-radius: 12px; }
  .toolbar { min-height: 33px; }
  .mode-tab, .side-chip { height: 27px; }
  .status-bar { min-height: 27px; }
  .actions { grid-template-columns: 1fr 1fr 1fr 40px; }
  .action-btn { height: 42px; }
  .action-icon-only { width: 40px; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .game { max-width: 760px; }
  .players { min-height: 39px; }
  .avatar { width: 32px; height: 32px; }
  .actions { height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
