:root {
  --ink: #e6edf7;
  --muted: #95a9c4;
  --panel: rgba(9, 23, 44, 0.86);
  --panel-edge: rgba(120, 155, 199, 0.34);
  --felt-main: #1a4b86;
  --felt-deep: #102b56;
  --felt-glow: rgba(90, 141, 214, 0.24);
  --rim-dark: #070b13;
  --rim-gloss: #2b3442;
  --accent: #d4af37;
  --danger: #bb6262;
  --action: #7dbce4;
  --primary: #d4af37;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: "Trebuchet MS", "Verdana", sans-serif;
  background:
    radial-gradient(circle at 50% 6%, rgba(255, 255, 255, 0.12), transparent 30%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.025) 0,
      rgba(255, 255, 255, 0.025) 1px,
      transparent 1px,
      transparent 80px
    ),
    linear-gradient(180deg, #122640 0%, #0a1628 100%);
}

body {
  position: relative;
  overflow-x: hidden;
}

.aurora {
  position: fixed;
  inset: -12% -8% auto -8%;
  height: 34vh;
  background: linear-gradient(100deg, rgba(87, 130, 204, 0.24), rgba(66, 93, 150, 0.16), rgba(212, 175, 55, 0.16));
  filter: blur(18px);
  animation: aurora-wave 11s ease-in-out infinite alternate;
  pointer-events: none;
}

.snow-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.2) 1px, transparent 2px),
    radial-gradient(circle at 70% 10%, rgba(255, 255, 255, 0.16) 1px, transparent 2px),
    radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.14) 1px, transparent 2px);
  background-size: 220px 220px;
  animation: snow-drift 24s linear infinite;
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  display: grid;
  gap: 14px;
  position: relative;
  z-index: 2;
}

.topbar,
.my-panel,
.log-panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.34);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
  padding: 12px 14px;
}

.brand-block {
  display: grid;
  gap: 4px;
}

.brand-tag {
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(116, 147, 196, 0.16);
  border: 1px solid rgba(150, 187, 232, 0.34);
  color: #e6eef9;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-family: "Copperplate", "Trebuchet MS", serif;
  letter-spacing: 0.04em;
}

.subtitle {
  margin: 2px 0 0;
  color: #b2c3d9;
  font-size: 0.88rem;
}

.table-meta {
  display: grid;
  justify-items: end;
  gap: 6px;
  font-size: 0.84rem;
}

.pill {
  background: rgba(125, 159, 207, 0.22);
  border: 1px solid rgba(155, 186, 231, 0.36);
  color: #e8f1ff;
  padding: 4px 10px;
  border-radius: 999px;
}

.table-arena {
  position: relative;
  min-height: clamp(540px, 72vw, 790px);
  border-radius: 24px;
  background: radial-gradient(circle at center, rgba(22, 50, 86, 0.84) 0%, rgba(8, 20, 36, 0.9) 80%);
  border: 1px solid rgba(119, 154, 199, 0.24);
  box-shadow: inset 0 0 120px rgba(86, 128, 196, 0.08), 0 20px 55px rgba(0, 0, 0, 0.42);
  overflow: hidden;
}

.table-shell {
  position: absolute;
  inset: 13% 8% 18% 8%;
  display: grid;
  place-items: center;
}

.table-rim {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(160deg, var(--rim-gloss), var(--rim-dark) 30%, #111a21 70%, #0c1014);
  padding: 14px;
  box-shadow:
    inset 0 2px 6px rgba(255, 255, 255, 0.2),
    inset 0 -6px 18px rgba(0, 0, 0, 0.65),
    0 12px 28px rgba(0, 0, 0, 0.45);
}

.table-felt {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  background:
    radial-gradient(circle at 50% 45%, rgba(100, 188, 255, 0.32), transparent 56%),
    radial-gradient(circle at 50% 80%, rgba(8, 21, 33, 0.35), transparent 40%),
    linear-gradient(180deg, var(--felt-main) 0%, var(--felt-deep) 100%);
  border: 1px solid rgba(144, 216, 255, 0.4);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.45), inset 0 0 38px var(--felt-glow);
  padding: 18px;
}

.table-rail {
  font-size: 1rem;
  letter-spacing: 0.16em;
  color: #d8e4f8;
  text-shadow: 0 0 8px rgba(146, 180, 228, 0.44);
  animation: crest-bob 1.9s ease-in-out infinite;
}

.pot-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.pot-label {
  color: #c2eaff;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.pot-value {
  color: var(--accent);
  font-size: clamp(1.35rem, 3.2vw, 2rem);
  font-weight: 700;
  text-shadow: 0 0 12px rgba(255, 220, 120, 0.45);
}

.board-cards,
.hole-cards {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card {
  width: 56px;
  height: 78px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  background: linear-gradient(145deg, #f6fcff, #d0e8f4);
  color: #0d3144;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.12rem;
  animation: card-pop 0.28s ease;
  box-shadow: 0 10px 16px rgba(0, 0, 0, 0.28);
}

.card.back {
  background:
    repeating-linear-gradient(45deg, #07507e 0, #07507e 9px, #0d669c 9px, #0d669c 18px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.08));
  color: #dcf6ff;
}

.card.red {
  color: #af2e2e;
}

.winners {
  display: flex;
  justify-content: center;
  gap: 7px;
  flex-wrap: wrap;
}

.winner-pill {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  color: #fff0cf;
  background: rgba(255, 214, 114, 0.16);
  border: 1px solid rgba(255, 228, 156, 0.42);
}

.seat-ring {
  position: absolute;
  inset: 0;
}

.seat {
  position: absolute;
  left: var(--seat-x, 50%);
  top: var(--seat-y, 50%);
  transform: translate(-50%, -50%);
  width: clamp(106px, 12vw, 162px);
  min-height: clamp(86px, 9vw, 126px);
  padding: 8px;
  display: grid;
  gap: 4px;
  justify-items: center;
  text-align: center;
  background: rgba(4, 33, 52, 0.88);
  border: 1px solid rgba(132, 211, 246, 0.4);
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.seat.me {
  border-color: rgba(255, 226, 146, 0.88);
  box-shadow: 0 0 0 1px rgba(255, 239, 186, 0.35), 0 8px 20px rgba(0, 0, 0, 0.45);
}

.seat.acting {
  animation: acting-pulse 1.1s ease-in-out infinite;
}

.seat.folded {
  opacity: 0.58;
}

.seat-title {
  font-size: 0.62rem;
  color: #9fd4e8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.seat-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  border: 1px solid rgba(203, 242, 255, 0.45);
  background: radial-gradient(circle at 30% 20%, #d9f7ff, #73b3cd 70%, #3e6a7f);
}

.seat-avatar.has-photo {
  background: #0d3b52;
  padding: 0;
  overflow: hidden;
}

.seat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.seat-avatar.empty {
  opacity: 0.7;
}

.seat-name {
  color: #ebf9ff;
  font-size: clamp(0.7rem, 1.2vw, 0.88rem);
  font-weight: 600;
  line-height: 1.15;
}

.seat-chip {
  color: #bfe9fb;
  font-size: 0.72rem;
}

.seat .hole-cards {
  gap: 4px;
}

.seat .card {
  width: 21px;
  height: 30px;
  font-size: 0.6rem;
  border-radius: 5px;
  box-shadow: none;
}

.seat button {
  width: 100%;
  border: none;
  border-radius: 7px;
  padding: 5px 8px;
  color: #072a38;
  background: linear-gradient(145deg, #6bd6ca, #3ead9f);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.my-panel,
.log-panel {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.my-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.identity {
  display: grid;
  gap: 2px;
}

.chip-stack {
  color: #c8f2dd;
  font-size: 0.84rem;
}

.actions-inline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.teach-panel {
  border: 1px solid rgba(176, 230, 250, 0.38);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(85, 166, 210, 0.18), rgba(120, 221, 187, 0.12)),
    rgba(7, 38, 55, 0.72);
  padding: 10px 12px;
  display: grid;
  gap: 6px;
}

.teach-lang-switch {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.teach-lang {
  min-width: 44px;
  padding: 6px 10px;
  font-size: 0.74rem;
}

.teach-lang.active {
  box-shadow: 0 0 0 1px rgba(193, 241, 255, 0.45) inset;
  filter: brightness(1.08);
}

.teach-mode-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.teach-tab.active {
  box-shadow: 0 0 0 1px rgba(193, 241, 255, 0.45) inset;
  filter: brightness(1.08);
}

.teach-title {
  color: #e9fbff;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.teach-text {
  color: #cde9f4;
  font-size: 0.79rem;
  line-height: 1.35;
  white-space: pre-line;
}

.teach-card-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.teach-card-counter {
  color: #d2ecf7;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
}

.live-guide-panel {
  border: 1px solid rgba(155, 227, 248, 0.34);
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(132, 220, 255, 0.16), rgba(120, 233, 182, 0.1)),
    rgba(7, 37, 53, 0.74);
  padding: 10px 12px;
  display: grid;
  gap: 6px;
}

.live-guide-title {
  color: #e8fbff;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.live-guide-text {
  color: #cce9f5;
  font-size: 0.8rem;
  line-height: 1.35;
}

.label {
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.action-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, auto));
  align-items: center;
  gap: 8px;
}

.action-hint {
  border: 1px dashed rgba(169, 224, 247, 0.34);
  border-radius: 10px;
  background: rgba(8, 38, 54, 0.52);
  color: #bfe0ee;
  font-size: 0.8rem;
  line-height: 1.35;
  padding: 9px 11px;
}

.raise-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
  min-width: 220px;
}

.raise-box span {
  grid-column: 1 / -1;
  color: #badff0;
  font-size: 0.8rem;
}

button {
  border: none;
  border-radius: 10px;
  padding: 9px 12px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease;
}

button:hover:enabled {
  transform: translateY(-1px);
  filter: brightness(1.07);
}

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

button.primary {
  background: linear-gradient(145deg, var(--primary), #d8a93d);
  color: #392500;
}

button.ghost {
  border: 1px solid rgba(180, 219, 239, 0.38);
  background: rgba(183, 217, 236, 0.12);
  color: var(--ink);
}

button.action {
  background: linear-gradient(145deg, #9ee5f7, var(--action));
  color: #052f44;
}

button.danger {
  background: linear-gradient(145deg, #ef9a9a, var(--danger));
  color: #341212;
}

.log-list {
  max-height: 180px;
  overflow: auto;
  display: grid;
  gap: 6px;
}

.log-item {
  font-size: 0.8rem;
  color: #daf3fe;
  background: rgba(109, 190, 232, 0.12);
  border-radius: 8px;
  padding: 6px 8px;
}

@keyframes aurora-wave {
  from {
    transform: translateX(-2%) translateY(-4%) scale(1);
  }
  to {
    transform: translateX(4%) translateY(4%) scale(1.08);
  }
}

@keyframes snow-drift {
  from {
    transform: translateY(-8px);
  }
  to {
    transform: translateY(10px);
  }
}

@keyframes card-pop {
  from {
    transform: translateY(8px) scale(0.94);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes acting-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 237, 174, 0.12), 0 8px 20px rgba(0, 0, 0, 0.45);
  }
  50% {
    box-shadow: 0 0 0 2px rgba(255, 237, 174, 0.42), 0 8px 20px rgba(0, 0, 0, 0.45);
  }
}

@keyframes crest-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

@media (max-width: 960px) {
  .table-shell {
    inset: 17% 5% 20% 5%;
  }

  .seat {
    width: clamp(96px, 21vw, 136px);
    min-height: 84px;
    padding: 7px;
  }

  .seat .card {
    width: 19px;
    height: 27px;
  }

  .action-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .raise-box {
    grid-column: 1 / -1;
    min-width: 0;
  }
}

@media (max-width: 680px) {
  .topbar {
    padding: 10px;
  }

  .subtitle {
    font-size: 0.8rem;
  }

  .table-arena {
    min-height: 620px;
  }

  .table-shell {
    inset: 22% 4% 24% 4%;
  }

  .table-rim {
    padding: 10px;
  }

  .table-felt {
    padding: 12px;
    gap: 9px;
  }

  .board-cards {
    gap: 6px;
  }

  .card {
    width: 46px;
    height: 64px;
    font-size: 0.95rem;
  }

  .seat {
    width: 92px;
    min-height: 76px;
    padding: 6px;
    border-radius: 10px;
  }

  .seat-title {
    font-size: 0.54rem;
  }

  .seat-avatar {
    width: 24px;
    height: 24px;
    font-size: 0.72rem;
  }

  .seat-name {
    font-size: 0.62rem;
  }

  .seat-chip {
    font-size: 0.58rem;
  }

  .seat button {
    padding: 3px 4px;
    font-size: 0.62rem;
  }

  .seat .card {
    width: 15px;
    height: 21px;
    font-size: 0.48rem;
  }
}
