:root {
  color-scheme: light;
  --bg: #f5fbff;
  --surface: #fffefa;
  --surface-2: #e9f7ff;
  --surface-3: #e9ffdf;
  --text: #203047;
  --muted: #5d7186;
  --line: rgba(48, 77, 98, 0.18);
  --accent: #27a9c7;
  --accent-strong: #086f8e;
  --action: #ffd84d;
  --action-2: #ff9f43;
  --ok: #37b76d;
  --danger: #ff5e7a;
  --warning: #ffcc33;
  --shadow: 0 18px 44px rgba(37, 67, 96, 0.16);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: linear-gradient(180deg, #ddf6ff 0%, #fff6c9 48%, #e9ffd8 100%);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select {
  min-height: 52px;
  font: inherit;
  font-size: 16px;
  touch-action: manipulation;
}

button {
  border: 0;
  cursor: pointer;
}

img,
video {
  max-width: 100%;
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(255, 184, 45, 0.62);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100dvh;
}

.hidden {
  display: none !important;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 4.5vw, 3.7rem);
  line-height: 1;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  letter-spacing: 0;
  overflow-wrap: anywhere;
  line-height: 1.12;
}

.setup-view {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.setup-card {
  width: min(560px, 100%);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 254, 247, 0.96);
  box-shadow: var(--shadow);
  padding: clamp(22px, 4vw, 34px);
}

.setup-card.invite-mode {
  width: min(500px, 100%);
}

.invite-join-panel {
  display: grid;
  gap: 12px;
  margin: 20px 0 8px;
  border: 1px solid rgba(255, 159, 67, 0.42);
  border-radius: 22px;
  background: #fff3bc;
  padding: 16px;
}

.invite-room-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
  line-height: 1.2;
}

.invite-room-code {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.45rem, 5vw, 2.25rem);
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1;
  overflow-wrap: anywhere;
}

.lead,
.hint,
.muted {
  color: var(--muted);
}

.lead,
.hint {
  line-height: 1.5;
}

.kicker {
  margin-bottom: 8px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.16;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.kicker.compact {
  margin-bottom: 2px;
}

.field {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 750;
}

.field input,
.field select,
.chat-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #ffffff;
  color: var(--text);
  padding: 13px 14px;
}

.small-field {
  max-width: 240px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  min-height: 52px;
  border-radius: 15px;
  padding: 12px 17px;
  font-weight: 850;
  line-height: 1.15;
  overflow-wrap: anywhere;
  text-align: center;
  white-space: normal;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.primary-btn {
  background: linear-gradient(180deg, var(--action), var(--action-2));
  color: #3f2800;
  box-shadow: 0 10px 24px rgba(255, 159, 67, 0.26);
}

.secondary-btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
}

.primary-btn:active:not(:disabled),
.secondary-btn:active:not(:disabled),
.ghost-btn:active:not(:disabled),
.category-btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

.primary-btn:hover:not(:disabled),
.primary-btn:focus-visible:not(:disabled) {
  box-shadow: 0 14px 30px rgba(255, 159, 67, 0.34);
}

.secondary-btn:hover:not(:disabled),
.secondary-btn:focus-visible:not(:disabled) {
  border-color: rgba(39, 169, 199, 0.58);
}

.small-btn {
  min-height: 44px;
  border-radius: 13px;
  padding: 9px 12px;
  font-size: 0.92rem;
}

.wide-btn {
  width: 100%;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.notice {
  margin: 0 auto 16px;
  max-width: 1500px;
  border: 1px solid rgba(39, 169, 199, 0.34);
  border-radius: 16px;
  background: #e7f8ff;
  color: var(--text);
  padding: 12px 14px;
  line-height: 1.45;
}

.notice.error {
  border-color: rgba(255, 94, 122, 0.48);
  background: #ffe8ee;
}

.notice.success {
  border-color: rgba(55, 183, 109, 0.45);
  background: #e9ffef;
}

.game-view {
  min-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) calc(92px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  max-width: 1500px;
  margin: 0 auto 14px;
}

.topbar > div,
.topbar-actions,
.game-actions,
.compact-actions,
.layout-grid > *,
.table-grid > *,
.game-status-card > *,
.panel-heading > *,
.section-heading > *,
.player-row > *,
.mini-card,
.mini-card-body,
.vehicle-card,
.vehicle-body,
.stat-item,
.category-btn {
  min-width: 0;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2.6rem);
}

.topbar-actions,
.game-actions,
.compact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: flex-end;
}

.layout-grid {
  display: grid;
  grid-template-areas:
    "video"
    "game"
    "players"
    "chat";
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(12px, 2vw, 18px);
  max-width: 1500px;
  margin: 0 auto;
}

.video-panel {
  grid-area: video;
}

.game-panel {
  grid-area: game;
}

.players-panel {
  grid-area: players;
}

.chat-panel {
  grid-area: chat;
}

.game-panel,
.panel-block,
.game-status-card,
.card-section {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 254, 247, 0.94);
}

.panel-block,
.card-section {
  padding: clamp(13px, 2vw, 17px);
}

.panel-heading,
.section-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading .muted,
.panel-heading .muted,
#selfCardHint,
#categoryHint,
#potInfo,
#roundInfo {
  overflow-wrap: anywhere;
  line-height: 1.3;
}

.panel-heading h2,
.section-heading h2 {
  margin: 0;
}

.game-panel {
  display: grid;
  gap: clamp(12px, 2vw, 16px);
  padding: clamp(12px, 2vw, 16px);
}

.game-status-card {
  position: sticky;
  top: max(8px, env(safe-area-inset-top));
  z-index: 12;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: clamp(14px, 2vw, 19px);
  background: rgba(226, 247, 255, 0.96);
  backdrop-filter: none;
}

.game-status-card h2 {
  margin-bottom: 6px;
  font-size: clamp(1.1rem, 2.4vw, 1.65rem);
}

.coach-line {
  margin: 8px 0 0;
  color: #a25f00;
  font-size: clamp(0.95rem, 1.8vw, 1.08rem);
  font-weight: 750;
  line-height: 1.35;
}

.video-grid {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  scroll-snap-type: x proximity;
}

.remote-videos {
  display: contents;
}

.video-tile {
  position: relative;
  flex: 0 0 clamp(150px, 28vw, 240px);
  overflow: hidden;
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #dff4fb;
  scroll-snap-align: start;
}

.video-tile video {
  display: block;
  width: 100%;
  height: clamp(96px, 16vw, 140px);
  object-fit: cover;
  background: #eef9fd;
}

.video-label {
  position: absolute;
  left: 9px;
  bottom: 8px;
  border-radius: 999px;
  background: rgba(31, 49, 71, 0.78);
  color: #fff;
  padding: 5px 9px;
  font-size: 0.78rem;
  font-weight: 850;
}

.table-grid {
  display: grid;
  grid-template-columns: minmax(270px, 0.95fr) minmax(340px, 1.05fr);
  gap: clamp(12px, 2vw, 16px);
  align-items: start;
}

.vehicle-card {
  overflow: hidden;
  border: 2px solid rgba(39, 169, 199, 0.3);
  border-radius: 24px;
  background: #fffdf4;
  box-shadow: var(--shadow);
}

.vehicle-card.empty-card {
  display: grid;
  min-height: 260px;
  place-items: center;
  color: var(--muted);
  padding: 16px;
  text-align: center;
}

.vehicle-image-wrap {
  position: relative;
  background: #eef7fb;
}

.vehicle-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  object-position: center;
  background: #eef7fb;
}

.vehicle-badge {
  position: absolute;
  left: 12px;
  top: 12px;
  border-radius: 999px;
  background: #ffd84d;
  color: #3f2800;
  padding: 6px 11px;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.vehicle-body {
  padding: clamp(13px, 2vw, 16px);
}

.vehicle-title {
  margin-bottom: 3px;
  font-size: clamp(1.2rem, 2.5vw, 1.55rem);
  letter-spacing: 0;
  overflow-wrap: anywhere;
  line-height: 1.12;
}

.vehicle-subtitle {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.stat-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f6fbff;
  color: var(--text);
  padding: 10px;
  text-align: left;
}

.stat-pick-button {
  position: relative;
  display: block;
  width: 100%;
  appearance: none;
  box-shadow: none;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.stat-pick-button:hover,
.stat-pick-button:focus-visible {
  border-color: rgba(39, 169, 199, 0.62);
  background: #e2f8ff;
}

.stat-pick-button:active {
  transform: translateY(1px) scale(0.99);
}

.stat-pick-button.best-choice {
  border-color: rgba(255, 159, 67, 0.76);
  background: #fff1b8;
  box-shadow: 0 0 0 1px rgba(255, 159, 67, 0.24);
}

.stat-unavailable {
  opacity: 0.62;
}

.stat-label,
.category-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.18;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.stat-value {
  margin-top: 4px;
  font-size: clamp(1rem, 2vw, 1.18rem);
  font-weight: 950;
  line-height: 1.14;
  overflow-wrap: anywhere;
}

.image-credit {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.image-credit a {
  color: var(--accent-strong);
  text-decoration: none;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.category-btn {
  position: relative;
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f6fbff;
  color: var(--text);
  padding: 13px;
  text-align: left;
  overflow: hidden;
}

.category-btn:not(:disabled):hover,
.category-btn:not(:disabled):focus-visible {
  border-color: rgba(39, 169, 199, 0.62);
  background: #e2f8ff;
}

.category-btn.best-choice {
  border-color: rgba(255, 159, 67, 0.76);
  background: #fff1b8;
  box-shadow: 0 0 0 1px rgba(255, 159, 67, 0.24);
}

.best-choice-badge {
  justify-self: start;
  max-width: 100%;
  border-radius: 999px;
  background: #ffd84d;
  color: #5b3900;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.selected-category-card {
  border-color: rgba(39, 169, 199, 0.58);
  background: #e2f8ff;
}

.reveal-action-btn {
  border-color: rgba(55, 183, 109, 0.62);
  background: #e9ffef;
}

.category-value {
  font-size: clamp(1.06rem, 2vw, 1.28rem);
  font-weight: 950;
  line-height: 1.14;
  overflow-wrap: anywhere;
}

.category-rule,
.strength-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.strength-meter,
.card-count-meter {
  overflow: hidden;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(48, 77, 98, 0.12);
}

.strength-meter-fill,
.card-count-meter-fill {
  display: block;
  width: var(--strength, var(--count-strength, 0%));
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff5e7a, #ffd84d 46%, #37b76d);
}

.stat-strength-label {
  margin-top: 5px;
}

.players-list {
  display: grid;
  gap: 8px;
}

.player-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(96px, auto);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 10px;
  background: #fff9e7;
}

.player-row.active-player {
  border-color: rgba(255, 159, 67, 0.62);
  background: #fff1b8;
}

.player-row.self-player {
  box-shadow: inset 4px 0 0 rgba(39, 169, 199, 0.72);
}

.player-name {
  font-weight: 850;
  overflow-wrap: anywhere;
}

.player-meta {
  color: var(--muted);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.player-count {
  display: grid;
  gap: 6px;
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 900;
  text-align: right;
}

.chat-messages {
  display: grid;
  gap: 8px;
  min-height: 72px;
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
}

.chat-message {
  border-radius: 13px;
  background: #eef9ff;
  padding: 9px;
  font-size: 0.92rem;
  line-height: 1.35;
}

.chat-message strong {
  display: block;
  margin-bottom: 3px;
  color: var(--accent-strong);
  font-size: 0.78rem;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

.chat-panel.is-collapsed .chat-messages,
.chat-panel.is-collapsed .chat-form {
  display: none;
}

.has-new-chat {
  border-color: rgba(255, 159, 67, 0.82);
  color: #8a5600;
}

.table-section {
  min-height: 220px;
}

.table-cards {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 4px;
}

.mini-card {
  flex: 0 0 clamp(220px, 31vw, 310px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fffdf4;
  scroll-snap-align: start;
}

.round-winner-card {
  flex-basis: clamp(250px, 35vw, 350px);
}

.mini-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  object-position: center;
  background: #eef7fb;
}

.mini-card-body {
  padding: 11px;
}

.mini-card-result {
  margin-bottom: 8px;
  border-radius: 999px;
  background: #e7f8ff;
  color: var(--text);
  padding: 5px 8px;
  font-size: 0.75rem;
  font-weight: 900;
  text-align: center;
}

.mini-card-title {
  margin: 0 0 4px;
  font-weight: 950;
  overflow-wrap: anywhere;
  line-height: 1.18;
}

.mini-card-meta,
.mini-card-rule {
  color: var(--muted);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.mini-card-value {
  margin-top: 8px;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  font-weight: 950;
  color: var(--accent-strong);
  overflow-wrap: anywhere;
  line-height: 1.08;
}

.face-down-card {
  display: grid;
  min-height: 190px;
  place-items: center;
  flex: 0 0 clamp(210px, 30vw, 290px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(39, 169, 199, 0.16), rgba(255, 216, 77, 0.18));
  color: var(--muted);
  text-align: center;
  padding: 16px;
  scroll-snap-align: start;
}

.face-down-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.winner-border {
  border-color: rgba(55, 183, 109, 0.72);
}

.tie-border {
  border-color: rgba(255, 159, 67, 0.72);
}

.loser-border {
  border-color: rgba(255, 94, 122, 0.34);
}

.self-card-winner {
  animation: selfWinPulse 1500ms ease both;
}

.self-card-loser {
  animation: selfLossShake 980ms ease both;
}

.round-win-card {
  animation: tableWinLift 1100ms ease both;
  box-shadow: 0 0 0 1px rgba(55, 183, 109, 0.42), 0 16px 34px rgba(55, 183, 109, 0.2);
}

.round-loss-card {
  animation: tableLossDip 900ms ease both;
  filter: saturate(0.82) brightness(0.96);
}

.status-win-flash {
  animation: statusWinFlash 1200ms ease both;
}

.status-loss-flash {
  animation: statusLossFlash 1000ms ease both;
}

.round-result-toast {
  position: fixed;
  left: 50%;
  top: max(18px, env(safe-area-inset-top));
  z-index: 60;
  display: grid;
  gap: 3px;
  min-width: min(360px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 15px 18px;
  text-align: center;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  animation: resultToastIn 2400ms ease both;
}

.round-result-toast strong {
  font-size: 1.15rem;
  font-weight: 950;
}

.round-result-toast span {
  color: rgba(32, 48, 71, 0.76);
  font-size: 0.86rem;
  font-weight: 800;
}

.round-result-win {
  border-color: rgba(55, 183, 109, 0.62);
  background: #e9ffef;
  color: #17472b;
}

.round-result-loss {
  border-color: rgba(255, 94, 122, 0.58);
  background: #ffe8ee;
  color: #5f2230;
}

.round-transfer-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: clamp(8px, 2vh, 16px);
  align-items: center;
  justify-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  pointer-events: none;
  background: rgba(248, 253, 255, 0.94);
  backdrop-filter: blur(2px);
  animation: transferOverlayFade 3400ms ease both;
}

.transfer-headline {
  max-width: min(760px, 100%);
  color: var(--text);
  font-size: clamp(1.35rem, 4.4vw, 2.9rem);
  font-weight: 950;
  line-height: 1.04;
  overflow-wrap: anywhere;
  text-align: center;
  text-shadow: none;
}

.transfer-detail {
  max-width: min(680px, 100%);
  color: #a25f00;
  font-size: clamp(0.95rem, 2.3vw, 1.22rem);
  font-weight: 850;
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-align: center;
}

.transfer-stage {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, clamp(145px, 30vw, 260px)));
  justify-content: center;
  align-items: center;
  gap: clamp(14px, 4vw, 52px);
  width: min(760px, 100%);
  min-height: min(48vh, 390px);
}

.transfer-card {
  overflow: hidden;
  min-width: 0;
  border: 2px solid rgba(39, 169, 199, 0.28);
  border-radius: 20px;
  background: #fffdf4;
  box-shadow: var(--shadow);
  transform-origin: center center;
  will-change: transform, opacity, filter;
}

.transfer-card-label {
  padding: 8px 10px 7px;
  background: #fff1b8;
  color: #704900;
  font-size: clamp(0.74rem, 1.8vw, 0.9rem);
  font-weight: 900;
  line-height: 1.16;
  overflow-wrap: anywhere;
  text-align: center;
}

.transfer-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  object-position: center;
  background: #eef7fb;
}

.transfer-card-body {
  display: grid;
  gap: 3px;
  padding: 10px;
}

.transfer-card-name {
  color: var(--text);
  font-size: clamp(0.94rem, 2.2vw, 1.16rem);
  font-weight: 950;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.transfer-card-player,
.transfer-card-category {
  color: var(--muted);
  font-size: clamp(0.72rem, 1.7vw, 0.86rem);
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.transfer-card-value {
  color: var(--accent-strong);
  font-size: clamp(1.14rem, 3vw, 1.7rem);
  font-weight: 950;
  line-height: 1.02;
  overflow-wrap: anywhere;
}

.transfer-target {
  min-width: min(300px, 82vw);
  border: 1px solid rgba(255, 159, 67, 0.72);
  border-radius: 999px;
  background: #fff1b8;
  color: #704900;
  padding: 12px 18px;
  font-size: clamp(0.9rem, 2vw, 1.06rem);
  font-weight: 950;
  line-height: 1.15;
  overflow-wrap: anywhere;
  text-align: center;
  animation: transferTargetPulse 1800ms ease 780ms both;
}

.transfer-win .transfer-card-self {
  border-color: rgba(55, 183, 109, 0.78);
  animation: flyWinnerSelf 3000ms cubic-bezier(0.2, 0.82, 0.24, 1) both;
}

.transfer-win .transfer-card-other {
  animation: flyWinnerOther 3000ms cubic-bezier(0.2, 0.82, 0.24, 1) 90ms both;
}

.transfer-loss .transfer-card-lost {
  border-color: rgba(255, 94, 122, 0.78);
  animation: flyLostCard 3000ms cubic-bezier(0.2, 0.82, 0.24, 1) both;
}

.transfer-loss .transfer-card-winner {
  border-color: rgba(55, 183, 109, 0.78);
  animation: winnerReceivesCard 3000ms ease both;
}

.action-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 10px max(14px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(245, 251, 255, 0), rgba(245, 251, 255, 0.96) 24%);
}

.action-dock-btn {
  width: 100%;
  min-height: 62px;
  border-radius: 18px;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
}

.continue-attention {
  animation: nextRoundHop 1250ms ease-in-out infinite;
  box-shadow: 0 0 0 2px rgba(255, 159, 67, 0.24), 0 18px 42px rgba(255, 159, 67, 0.28);
}

@keyframes selfWinPulse {
  0% {
    transform: scale(1);
    box-shadow: var(--shadow);
  }
  24% {
    transform: scale(1.035) translateY(-5px);
    box-shadow: 0 0 0 2px rgba(55, 183, 109, 0.78), 0 24px 56px rgba(55, 183, 109, 0.22);
  }
  72% {
    transform: scale(1.025) translateY(-2px);
  }
  100% {
    transform: scale(1);
    box-shadow: var(--shadow);
  }
}

@keyframes selfLossShake {
  0% {
    transform: translateX(0);
    filter: none;
  }
  16% {
    transform: translateX(-7px) rotate(-0.8deg);
  }
  32% {
    transform: translateX(6px) rotate(0.7deg);
  }
  48% {
    transform: translateX(-4px) rotate(-0.45deg);
    filter: saturate(0.75) brightness(0.82);
  }
  100% {
    transform: translateX(0);
    filter: none;
  }
}

@keyframes tableWinLift {
  0% {
    transform: translateY(0) scale(1);
  }
  32% {
    transform: translateY(-10px) scale(1.035);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes tableLossDip {
  0% {
    transform: translateY(0);
  }
  36% {
    transform: translateY(8px) scale(0.985);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes statusWinFlash {
  0%, 100% {
    color: var(--text);
  }
  35% {
    color: var(--ok);
  }
}

@keyframes statusLossFlash {
  0%, 100% {
    color: var(--text);
  }
  35% {
    color: var(--danger);
  }
}

@keyframes resultToastIn {
  0% {
    opacity: 0;
    transform: translate(-50%, -18px) scale(0.96);
  }
  12%, 82% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -10px) scale(0.98);
  }
}

@keyframes transferOverlayFade {
  0% {
    opacity: 0;
  }
  8%, 86% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes flyWinnerSelf {
  0% {
    transform: translate(-7%, -8px) rotate(-3deg) scale(0.94);
    opacity: 0;
  }
  18% {
    transform: translate(0, 0) rotate(-2deg) scale(1);
    opacity: 1;
  }
  58% {
    transform: translate(38%, 54px) rotate(2deg) scale(0.78);
    opacity: 1;
  }
  100% {
    transform: translate(48%, 100px) rotate(0deg) scale(0.58);
    opacity: 0;
  }
}

@keyframes flyWinnerOther {
  0% {
    transform: translate(7%, -8px) rotate(3deg) scale(0.94);
    opacity: 0;
  }
  18% {
    transform: translate(0, 0) rotate(2deg) scale(1);
    opacity: 1;
  }
  58% {
    transform: translate(-38%, 54px) rotate(-2deg) scale(0.78);
    opacity: 1;
  }
  100% {
    transform: translate(-48%, 100px) rotate(0deg) scale(0.58);
    opacity: 0;
  }
}

@keyframes flyLostCard {
  0% {
    transform: translate(0, 0) rotate(-2deg) scale(1);
    opacity: 1;
    filter: none;
  }
  46% {
    transform: translate(58%, -24px) rotate(5deg) scale(0.9);
    opacity: 1;
    filter: saturate(0.9);
  }
  100% {
    transform: translate(112%, 82px) rotate(0deg) scale(0.54);
    opacity: 0;
    filter: saturate(0.72) brightness(0.82);
  }
}

@keyframes winnerReceivesCard {
  0%, 42% {
    transform: translate(0, 0) scale(1);
    box-shadow: var(--shadow);
  }
  62% {
    transform: translateY(-8px) scale(1.04);
    box-shadow: 0 0 0 2px rgba(55, 183, 109, 0.78), 0 24px 56px rgba(55, 183, 109, 0.22);
  }
  100% {
    transform: translateY(76px) scale(0.62);
    opacity: 0;
  }
}

@keyframes flyWinnerSelfMobile {
  0% {
    transform: translate(-4%, -5px) rotate(-2deg) scale(0.95);
    opacity: 0;
  }
  20% {
    transform: translate(0, 0) rotate(-1deg) scale(1);
    opacity: 1;
  }
  62% {
    transform: translate(16%, 22px) rotate(1deg) scale(0.84);
    opacity: 1;
  }
  100% {
    transform: translate(22%, 44px) rotate(0deg) scale(0.62);
    opacity: 0;
  }
}

@keyframes flyWinnerOtherMobile {
  0% {
    transform: translate(4%, -5px) rotate(2deg) scale(0.95);
    opacity: 0;
  }
  20% {
    transform: translate(0, 0) rotate(1deg) scale(1);
    opacity: 1;
  }
  62% {
    transform: translate(-16%, 22px) rotate(-1deg) scale(0.84);
    opacity: 1;
  }
  100% {
    transform: translate(-22%, 44px) rotate(0deg) scale(0.62);
    opacity: 0;
  }
}

@keyframes flyLostCardMobile {
  0% {
    transform: translate(0, 0) rotate(-1deg) scale(1);
    opacity: 1;
    filter: none;
  }
  48% {
    transform: translate(24%, -10px) rotate(3deg) scale(0.88);
    opacity: 1;
    filter: saturate(0.9);
  }
  100% {
    transform: translate(42%, 36px) rotate(0deg) scale(0.62);
    opacity: 0;
    filter: saturate(0.72) brightness(0.82);
  }
}

@keyframes winnerReceivesCardMobile {
  0%, 42% {
    transform: translate(0, 0) scale(1);
    box-shadow: var(--shadow);
  }
  62% {
    transform: translateY(-5px) scale(1.025);
    box-shadow: 0 0 0 2px rgba(55, 183, 109, 0.72), 0 18px 42px rgba(55, 183, 109, 0.22);
  }
  100% {
    transform: translateY(42px) scale(0.66);
    opacity: 0;
  }
}

@keyframes transferTargetPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: none;
  }
  42% {
    transform: scale(1.06);
    box-shadow: 0 0 0 3px rgba(255, 159, 67, 0.22), 0 18px 46px rgba(255, 159, 67, 0.22);
  }
}

@keyframes nextRoundHop {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  18% {
    transform: translateY(-7px) scale(1.03);
  }
  30% {
    transform: translateY(0) scale(1);
  }
  43% {
    transform: translateY(-3px) scale(1.015);
  }
  56% {
    transform: translateY(0) scale(1);
  }
}

@media (min-width: 1200px) {
  .game-view {
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .layout-grid {
    grid-template-areas:
      "video game"
      "players game"
      "chat game";
    grid-template-columns: 350px minmax(0, 1fr);
    align-items: start;
  }

  .video-grid,
  .remote-videos {
    display: grid;
  }

  .video-tile {
    flex-basis: auto;
    min-height: 150px;
  }

  .video-tile video {
    height: auto;
    aspect-ratio: 16 / 10;
  }

  .action-dock {
    display: none;
  }

  .category-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

@media (min-width: 860px) and (max-width: 1199px) and (orientation: landscape) {
  .layout-grid {
    grid-template-areas:
      "video video"
      "game game"
      "players chat";
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  }

  .category-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

@media (max-width: 859px) {
  .category-section.pick-on-card-mobile {
    display: none;
  }

  .topbar,
  .game-status-card,
  .panel-heading,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions,
  .game-actions,
  .compact-actions {
    justify-content: flex-start;
  }

  .table-grid {
    grid-template-columns: 1fr;
  }

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

@media (min-width: 700px) and (max-width: 859px) and (orientation: portrait) {
  .game-view {
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .topbar {
    align-items: center;
    flex-direction: row;
    margin-bottom: 10px;
  }

  .topbar h1 {
    font-size: clamp(1.35rem, 3vw, 1.85rem);
  }

  .topbar-actions,
  .game-actions,
  .compact-actions {
    justify-content: flex-end;
  }

  .panel-block,
  .card-section,
  .game-panel {
    padding: 11px;
  }

  .layout-grid,
  .game-panel,
  .table-grid {
    gap: 10px;
  }

  .panel-heading,
  .section-heading,
  .game-status-card {
    align-items: flex-start;
    flex-direction: row;
  }

  .panel-heading,
  .section-heading {
    margin-bottom: 8px;
  }

  .game-status-card {
    gap: 12px;
    padding: 12px 14px;
  }

  .game-status-card h2 {
    margin-bottom: 3px;
    font-size: clamp(1.1rem, 2.4vw, 1.35rem);
  }

  .coach-line {
    margin-top: 5px;
    font-size: 0.95rem;
  }

  .video-tile {
    flex-basis: clamp(168px, 29vw, 220px);
    min-height: 88px;
  }

  .video-tile video {
    height: 92px;
  }

  #selfCard.vehicle-card:not(.empty-card) {
    display: grid;
    grid-template-columns: minmax(210px, 42%) minmax(280px, 1fr);
  }

  #selfCard .vehicle-image-wrap {
    min-height: 100%;
  }

  #selfCard .vehicle-image {
    height: 100%;
    min-height: 250px;
    aspect-ratio: auto;
  }

  #selfCard .vehicle-body {
    display: grid;
    align-content: start;
    padding: 11px;
  }

  #selfCard .vehicle-title {
    font-size: 1.2rem;
  }

  #selfCard .vehicle-subtitle {
    margin-bottom: 8px;
  }

  #selfCard .stats-grid {
    gap: 7px;
  }

  #selfCard .stat-item {
    padding: 8px;
  }

  #selfCard .stat-value {
    font-size: 0.98rem;
  }

  #selfCard .image-credit {
    margin-top: 8px;
    font-size: 0.66rem;
  }
}

@media (max-width: 560px) {
  .category-grid,
  .stats-grid,
  .chat-form {
    grid-template-columns: 1fr;
  }

  .player-row {
    grid-template-columns: 1fr;
  }

  .player-count {
    text-align: left;
  }

  .table-section {
    min-height: 0;
  }

  .table-cards {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    overflow-x: visible;
    padding-bottom: 0;
    scroll-snap-type: none;
  }

  .mini-card,
  .round-winner-card,
  .face-down-card {
    flex-basis: auto;
    width: 100%;
    scroll-snap-align: none;
  }

  .mini-card {
    display: grid;
    grid-template-columns: minmax(94px, 36%) minmax(0, 1fr);
    border-radius: 16px;
  }

  .mini-card img {
    height: 100%;
    min-height: 128px;
    aspect-ratio: auto;
    object-fit: contain;
  }

  .mini-card-body {
    display: grid;
    align-content: center;
    gap: 3px;
    padding: 9px;
  }

  .mini-card-result {
    margin-bottom: 3px;
    border-radius: 10px;
    padding: 4px 6px;
    font-size: 0.66rem;
    line-height: 1.12;
  }

  .mini-card-title {
    margin-bottom: 2px;
    font-size: 0.92rem;
    line-height: 1.12;
  }

  .mini-card-meta,
  .mini-card-rule {
    font-size: 0.74rem;
    line-height: 1.18;
  }

  .mini-card-value {
    margin-top: 4px;
    font-size: clamp(1rem, 5vw, 1.28rem);
    line-height: 1.05;
  }

  .face-down-card {
    min-height: 132px;
    padding: 13px;
  }

  .round-result-toast {
    top: max(10px, env(safe-area-inset-top));
    width: calc(100vw - 20px);
    min-width: 0;
    border-radius: 15px;
    padding: 12px 14px;
  }

  .round-transfer-overlay {
    grid-template-rows: auto auto auto auto;
    align-content: center;
    gap: 7px;
    overflow: hidden;
    padding:
      max(10px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }

  .transfer-headline {
    max-width: 96vw;
    font-size: clamp(1.05rem, 6vw, 1.38rem);
    line-height: 1.08;
  }

  .transfer-detail {
    max-width: 94vw;
    font-size: 0.82rem;
    line-height: 1.18;
  }

  .transfer-stage {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: 8px;
    width: min(380px, 100%);
    min-height: min(38dvh, 240px);
  }

  .transfer-card {
    border-width: 1px;
    border-radius: 14px;
    box-shadow: var(--shadow);
  }

  .transfer-card-label {
    padding: 6px 7px 5px;
    font-size: 0.66rem;
  }

  .transfer-card img {
    max-height: min(22dvh, 96px);
  }

  .transfer-card-body {
    gap: 2px;
    padding: 7px;
  }

  .transfer-card-name {
    display: -webkit-box;
    overflow: hidden;
    font-size: clamp(0.76rem, 3.4vw, 0.92rem);
    line-height: 1.05;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .transfer-card-player,
  .transfer-card-category {
    overflow: hidden;
    font-size: 0.66rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .transfer-card-value {
    font-size: clamp(0.95rem, 4.6vw, 1.2rem);
  }

  .transfer-target {
    width: min(290px, 86vw);
    min-width: 0;
    padding: 9px 12px;
    font-size: 0.84rem;
  }

  .transfer-win .transfer-card-self {
    animation-name: flyWinnerSelfMobile;
  }

  .transfer-win .transfer-card-other {
    animation-name: flyWinnerOtherMobile;
  }

  .transfer-loss .transfer-card-lost {
    animation-name: flyLostCardMobile;
  }

  .transfer-loss .transfer-card-winner {
    animation-name: winnerReceivesCardMobile;
  }
}

@media (max-width: 380px) {
  .mini-card {
    grid-template-columns: minmax(82px, 34%) minmax(0, 1fr);
  }

  .mini-card img {
    min-height: 112px;
  }

  .mini-card-body {
    padding: 8px;
  }

  .transfer-stage {
    gap: 6px;
    min-height: min(34dvh, 216px);
  }

  .transfer-card-label {
    font-size: 0.62rem;
  }

  .transfer-card img {
    max-height: min(19dvh, 82px);
  }

  .transfer-card-body {
    padding: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }

  .self-card-winner,
  .self-card-loser,
  .round-win-card,
  .round-loss-card,
  .status-win-flash,
  .status-loss-flash,
  .round-result-toast,
  .round-transfer-overlay,
  .transfer-card,
  .transfer-target,
  .continue-attention {
    animation-duration: 1ms;
    animation-iteration-count: 1;
  }
}
