/* Sushi Go styles. Colours come from the neon theme in static/neon.css. */
/* ── Card styles ─────────────────────────────────────────────────── */
.sg-card {
  width: 90px; min-height: 120px; border-radius: 10px; border: 2px solid;
  padding: 6px 4px; text-align: center;
  transition: transform .15s, box-shadow .15s; user-select: none;
  cursor: pointer; display: inline-flex; flex-direction: column;
  align-items: center; justify-content: center; flex-shrink: 0;
  overflow: hidden; font-family: 'Fredoka One', cursive;
}
.sg-card:hover { transform: translateY(-5px); box-shadow: 0 5px 14px rgba(0,0,0,.22); }
.sg-card.selected { transform: translateY(-12px); box-shadow: 0 8px 20px rgba(0,0,0,.32); outline: 3px solid #0d6efd; }
.sg-card.second-select { outline: 3px solid #198754; }
.sg-card.disabled-card { opacity: .45; cursor: default; pointer-events: none; }
.sg-table-card { width: 60px; min-height: 80px; cursor: default; font-size: .8rem; }
.sg-table-card:hover { transform: none; box-shadow: none; }
.sg-emoji { font-size: 2.4rem; line-height: 1.1; }
.sg-table-card .sg-emoji { font-size: 1.3rem; }
.sg-name { font-size: .75rem; font-weight: 700; margin-top: 2px; line-height: 1.2; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #1a1a1a; }
.sg-hint { font-size: .6rem; font-style: italic; color: #444; margin-top: 1px; line-height: 1.2; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-pips { font-size: .55rem; letter-spacing: -1px; color: #555; }

/* ── Results tables (round end / game over) ──────────────────────── */
/* Bootstrap's default table colours assume a light page; set them for the dark neon theme. */
.sg-results {
  --bs-table-color: var(--text-main, #d8d8f0);
  --bs-table-bg: transparent;
  --bs-table-border-color: rgba(0,245,255,.18);
  --bs-table-striped-bg: rgba(255,255,255,.03);
  color: var(--text-main, #d8d8f0);
}
.sg-results thead th { color: var(--neon-cyan, #00f5ff); font-family: monospace; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.sg-results tbody tr.sg-me-row > * {
  --bs-table-bg: rgba(255,45,120,.2);
  --bs-table-color: #fff;
  color: #fff;
  background-color: rgba(255,45,120,.2);
  box-shadow: none;
}
.sg-results tbody tr.sg-me-row > td:first-child { border-left: 3px solid var(--neon-pink, #ff2d78); }
.sg-results tbody tr.sg-winner-row td:first-child { font-weight: 700; }

/* ── Section labels ──────────────────────────────────────────────── */
.sg-section-label { color: var(--neon-cyan, #00f5ff); font-family: monospace; font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; text-shadow: 0 0 6px rgba(0,245,255,.4); margin-bottom: 6px; }

/* ── Game panels ─────────────────────────────────────────────────── */
.sg-panel { background: var(--bg-surface, #0c0c1a); border: 1px solid var(--border-dim, #1c1c38); border-radius: 8px; padding: 8px; min-height: 70px; }
.sg-panel-hand { background: rgba(0,245,255,0.03); border-color: rgba(0,245,255,0.15); }

/* ── Game header bar ─────────────────────────────────────────────── */
.sg-game-header { background: linear-gradient(90deg, #0a0a18, #120d24, #0a0a18); border: 1px solid rgba(255,45,120,0.3); box-shadow: 0 0 20px rgba(255,45,120,0.08); }

/* ── Views ──────────────────────────────────────────────────────── */
.sg-view { min-height: 60vh; }

/* ── Pulse animation for second-card selection ───────────────────── */
@keyframes pulse-border {
  0%,100% { box-shadow: 0 0 0 0 rgba(25,135,84,.4); }
  50%      { box-shadow: 0 0 0 6px rgba(25,135,84,0); }
}
.chopstick-pick { animation: pulse-border 1.2s ease infinite; }

/* ── The table ───────────────────────────────────────────────────── */
.sg-table-wrap { margin-bottom: 14px; }
.felt {
  position: relative; width: 100%; height: 540px; max-width: 1100px; margin: 0 auto;
  border-radius: 50% / 46%; border: 12px solid #4a2f1b;
  background: radial-gradient(ellipse at 50% 45%, #23805a 0%, #17573e 55%, #0e3a2a 100%);
  box-shadow: inset 0 0 60px rgba(0,0,0,.55), 0 0 0 2px rgba(0,245,255,.18), 0 10px 30px rgba(0,0,0,.5);
}
.felt-center {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  text-align: center; color: rgba(255,255,255,.8); font-family: monospace; width: 34%; pointer-events: none;
}
.felt-center .pass-arrow { font-size: 2rem; opacity: .35; line-height: 1; }
.felt-center .pass-label { font-size: .65rem; letter-spacing: .12em; text-transform: uppercase; opacity: .55; }
#last-turn { font-size: .72rem; margin-top: 6px; line-height: 1.5; color: #d8ffe9; }
#last-turn b { color: #fff; }
.seat {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px; width: max-content; max-width: 46%;
}
.seat.plate-below { flex-direction: column-reverse; }
.seat-plate {
  display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px;
  background: rgba(8,10,24,.82); border: 1px solid rgba(0,245,255,.3); color: #e8eaf6;
  font-size: .8rem; white-space: nowrap; transition: box-shadow .2s, border-color .2s;
}
.seat.me .seat-plate { border-color: var(--neon-pink, #ff2d78); box-shadow: 0 0 12px rgba(255,45,120,.4); }
.seat.picked .seat-plate { border-color: #5dff9a; box-shadow: 0 0 12px rgba(93,255,154,.5); }
.seat-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #ff2d78, #00f5ff);
  color: #0a0a18; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: .85rem;
}
.seat-name { font-weight: 700; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.seat-stats { color: #b9c4ff; font-family: monospace; font-size: .72rem; }
.seat-backs { display: flex; margin-left: 4px; }
.card-back {
  width: 12px; height: 17px; border-radius: 2px; border: 1px solid #ffd0e0; margin-left: -6px;
  background: repeating-linear-gradient(45deg, #ff2d78, #ff2d78 2px, #c4155a 2px, #c4155a 4px);
}
.seat-cards { display: flex; flex-wrap: wrap; justify-content: center; min-height: 62px; padding: 0 12px; }
.seat-cards .sg-card { margin-left: -14px; }
.seat.me .seat-cards .sg-card { margin-left: -8px; }
.seat-cards .sg-card:first-child { margin-left: 0; }
.seat-cards .sg-card:hover { z-index: 5; transform: translateY(-6px) scale(1.12); }
.seat.me .seat-cards { min-height: 78px; }
.seat-empty { color: rgba(255,255,255,.4); font-size: .72rem; align-self: center; font-family: monospace; }
.sg-mini { width: 46px; min-height: 62px; border-radius: 7px; padding: 3px 2px; cursor: default; }
.sg-mini .sg-emoji { font-size: 1.35rem; }
.sg-mini .sg-name { font-size: .5rem; margin-top: 0; }
.sg-mini .sg-pips { font-size: .45rem; }
.seat.me .sg-mini { width: 56px; min-height: 76px; }
.seat.me .sg-mini .sg-emoji { font-size: 1.7rem; }
.seat.me .sg-mini .sg-name { font-size: .58rem; }
@keyframes deal-in {
  0%   { opacity: 0; transform: translateY(-40px) rotateY(90deg) scale(.8); }
  100% { opacity: 1; transform: none; }
}
.sg-card.just-played { animation: deal-in .5s ease-out both; box-shadow: 0 0 14px rgba(255,255,120,.9); }

@media (max-width: 820px) {
  .felt { height: auto; border-radius: 28px; border-width: 8px; padding: 12px 6px; display: flex; flex-direction: column; gap: 14px; }
  .felt-center { position: static; transform: none; width: auto; order: -1; }
  .seat { position: static !important; transform: none; max-width: 100%; width: auto; }
  .seat .seat-cards { justify-content: flex-start; }
  .seat.plate-below { flex-direction: column-reverse; }
  .seat.me { order: 99; }
}

/* ── Fit the game on one screen (no page scroll while playing) ───── */
body.sg-playing { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
body.sg-playing > .navbar { flex: 0 0 auto; }
body.sg-playing main { flex: 1 1 auto; min-height: 0; padding: 6px 12px !important; display: flex; flex-direction: column; }
body.sg-playing #intro-alert { display: none; }
body.sg-playing #view-game { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
body.sg-playing .sg-game-header { margin-bottom: 0 !important; padding-top: 4px !important; padding-bottom: 4px !important; flex: 0 0 auto; }
body.sg-playing .sg-table-wrap { flex: 1 1 auto; min-height: 0; margin: 0; }
body.sg-playing .felt { height: 100%; }
body.sg-playing #hand-area { flex: 0 0 auto; }
body.sg-playing #my-hand { flex-wrap: nowrap; min-height: 0; padding: 6px 8px 6px; gap: 6px !important; }
body.sg-playing #my-hand .sg-card {
  flex: 0 1 84px; min-width: 40px; width: auto; min-height: 0; height: clamp(84px, 14vh, 112px);
  padding: 4px 2px;
}
body.sg-playing #my-hand .sg-card:hover { transform: translateY(-4px); }
body.sg-playing #my-hand .sg-card.selected { transform: translateY(-8px); }
body.sg-playing #my-hand .sg-hint { display: none; }
body.sg-playing #my-hand .sg-emoji { font-size: clamp(1.4rem, 4.2vh, 2rem); }
body.sg-playing #my-hand .sg-name { font-size: .68rem; }
@media (max-height: 780px) {
  .sg-mini { width: 38px; min-height: 52px; }
  .sg-mini .sg-emoji { font-size: 1.1rem; }
  .seat.me .sg-mini { width: 46px; min-height: 62px; }
  .seat.me .sg-mini .sg-emoji { font-size: 1.35rem; }
  .seat-cards { min-height: 52px; }
  .seat.me .seat-cards { min-height: 62px; }
  .seat-cards .sg-card { margin-left: -12px; }
}
@media (max-width: 820px) {
  /* Seats become a list; scroll inside the table area, never the page. */
  body.sg-playing .felt { overflow-y: auto; }
}
