:root {
  --felt: #174331;
  --felt-dark: #071d17;
  --panel: #f4efe7;
  --ink: #17181c;
  --muted: #6a6258;
  --red: #e52d32;
  --yellow: #f4c334;
  --green: #24a05a;
  --blue: #2776cf;
  --wild: #111217;
  --danger: #e84232;
  --focus: #0f9f84;
  font-family:
    "Arial Black", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: #fff;
  background:
    radial-gradient(circle at 18% 15%, rgba(229, 45, 50, 0.28), transparent 20rem),
    radial-gradient(circle at 76% 22%, rgba(244, 195, 52, 0.18), transparent 18rem),
    linear-gradient(135deg, #08090d 0%, #1d1f26 56%, #08090d 100%);
}

button {
  border: 0;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.is-hidden {
  display: none !important;
}

.home-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.home-panel {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 460px);
  gap: 34px;
  width: min(1080px, 100%);
  min-height: min(650px, calc(100vh - 48px));
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background:
    radial-gradient(circle at 24% 30%, rgba(232, 66, 50, 0.2), transparent 18rem),
    radial-gradient(circle at 68% 25%, rgba(39, 118, 207, 0.18), transparent 18rem),
    linear-gradient(145deg, rgba(18, 54, 42, 0.96), rgba(5, 18, 15, 0.96));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
  padding: clamp(24px, 5vw, 56px);
}

.home-brand {
  display: grid;
  gap: 12px;
}

.home-brand p {
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 1rem;
}

.home-brand h1 {
  max-width: 8em;
  font-size: clamp(3rem, 9vw, 6.6rem);
  line-height: 0.95;
}

.mode-panel {
  display: grid;
  gap: 18px;
  border-radius: 8px;
  background: rgba(4, 10, 9, 0.55);
  padding: 22px;
}

.mode-panel h2 {
  color: #fff;
  font-size: 1.35rem;
}

.mode-grid {
  display: grid;
  gap: 10px;
}

.mode-card {
  display: grid;
  gap: 4px;
  min-height: 78px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 14px 16px;
  text-align: left;
}

.mode-card.is-selected {
  border-color: var(--yellow);
  background: rgba(244, 195, 52, 0.16);
}

.mode-card span,
.ai-settings span {
  color: rgba(255, 255, 255, 0.68);
}

.ai-settings {
  display: grid;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 16px;
}

.room-settings {
  display: grid;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 16px;
}

.room-row,
.room-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.room-row span,
.room-link-label {
  color: rgba(255, 255, 255, 0.68);
}

.room-row strong {
  color: var(--yellow);
  font-size: 1.7rem;
  letter-spacing: 0.08em;
}

.room-actions button {
  min-height: 40px;
  flex: 1;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 900;
}

.join-room-row {
  display: grid;
  grid-template-columns: 1fr 84px;
  gap: 8px;
}

.join-room-row button {
  min-height: 42px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 900;
}

.room-link-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 0 12px;
  font: inherit;
}

.ai-settings > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-settings strong {
  font-size: 2rem;
  color: var(--yellow);
}

.stepper {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 10px;
  align-items: center;
}

.stepper button {
  min-height: 44px;
  background: #fff;
  color: var(--ink);
  font-size: 1.4rem;
  font-weight: 900;
}

.stepper input {
  width: 100%;
  accent-color: var(--yellow);
}

.start-button {
  min-height: 56px;
  background: var(--danger);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(232, 66, 50, 0.26);
}

.lobby-return {
  display: inline-grid;
  place-items: center;
  min-height: 42px;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.2);
}

.lobby-return--home {
  min-height: 48px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: none;
}

.game-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.table-area {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 18px;
  min-width: 0;
  min-height: calc(100vh - 36px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background:
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.1), transparent 62%),
    radial-gradient(ellipse at center, var(--felt) 0%, var(--felt-dark) 76%);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.42);
  padding: 20px;
}

.top-bar,
.hand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow,
.discard-zone p,
.hand-header p,
.rule-list,
.log,
.penalty-panel span,
.penalty-panel small {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.9rem, 4vw, 4.1rem);
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.45);
}

h2 {
  color: var(--ink);
  font-size: 1.05rem;
}

.round-status {
  display: grid;
  gap: 6px;
  min-width: 160px;
  text-align: right;
}

.round-status span {
  color: rgba(255, 255, 255, 0.68);
}

.direction-icon {
  position: relative;
  display: block;
  width: 156px;
  height: 44px;
  justify-self: end;
}

.direction-icon::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 22px;
  top: 50%;
  height: 8px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.82);
  transform: translateY(-50%);
}

.direction-icon::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 50%;
  width: 24px;
  height: 24px;
  border-top: 8px solid #fff;
  border-right: 8px solid #fff;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.82));
  transform: translateY(-50%) rotate(45deg);
}

.direction-icon.is-reverse {
  transform: scaleX(-1);
}

.round-status strong {
  color: #ffffff;
  font-size: 1.2rem;
}

.players-board {
  display: grid;
  gap: 10px;
}

.players-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.95rem;
}

.players-heading strong {
  color: #fff;
}

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

.player-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 58px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 12px;
}

.player-chip.is-active {
  outline: 2px solid rgba(244, 195, 52, 0.95);
  background: rgba(244, 195, 52, 0.16);
}

.player-chip.is-self {
  background: rgba(39, 118, 207, 0.18);
}

.player-name {
  display: grid;
  gap: 3px;
}

.player-name small {
  color: rgba(255, 255, 255, 0.64);
}

.count-badge {
  min-width: 44px;
  border-radius: 999px;
  background: #0c0d11;
  color: #fff;
  padding: 6px 10px;
  text-align: center;
  font-weight: 900;
}

.playfield {
  display: grid;
  grid-template-columns: minmax(150px, 0.5fr) minmax(190px, 0.7fr) minmax(170px, 0.5fr);
  grid-template-rows: auto auto;
  align-items: center;
  justify-items: center;
  gap: 26px;
  min-height: 330px;
}

.deck-zone {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: grid;
  justify-items: center;
  gap: 12px;
}

.deck-card {
  display: grid;
  width: min(100%, 156px);
  aspect-ratio: 0.67;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: #fff;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.32);
}

.deck-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.draw-status {
  align-self: start;
  justify-self: center;
  min-width: 112px;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  background: rgba(5, 6, 9, 0.72);
  color: #fff;
  padding: 7px 12px;
  text-align: center;
  font-weight: 900;
  text-shadow: 0 2px 0 #000;
}

.discard-zone {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  justify-items: center;
  gap: 12px;
}

.current-color-display {
  --current-color: var(--red);
  grid-column: 2;
  grid-row: 1;
  display: grid;
  min-width: 164px;
  gap: 4px;
  justify-items: center;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(5, 6, 9, 0.72);
  padding: 9px 14px;
  color: #fff;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
}

.current-color-display::before {
  content: "";
  width: 58px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  background: var(--current-color);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
}

.current-color-display span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
}

.current-color-display strong {
  font-size: 1.35rem;
  line-height: 1;
  text-shadow: 0 2px 0 #000;
}

.current-color-display[data-color="red"] {
  --current-color: var(--red);
}

.current-color-display[data-color="yellow"] {
  --current-color: var(--yellow);
}

.current-color-display[data-color="green"] {
  --current-color: var(--green);
}

.current-color-display[data-color="blue"] {
  --current-color: var(--blue);
}

.card {
  --card-main: var(--red);
  position: relative;
  display: grid;
  width: 96px;
  height: 146px;
  overflow: hidden;
  border: 4px solid #050609;
  border-radius: 7px;
  background: var(--card-main);
  color: #fff;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.82),
    inset 0 0 0 4px rgba(0, 0, 0, 0.76),
    0 14px 28px rgba(0, 0, 0, 0.34);
  padding: 7px;
  font-family: Impact, "Arial Black", sans-serif;
  user-select: none;
}

.card--asset {
  align-content: center;
  justify-items: center;
  border: 0;
  background: transparent;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.34);
  padding: 0;
}

.card--asset img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.flying-card {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  width: 96px;
  height: 146px;
  pointer-events: none;
  transform: translate(var(--start-x), var(--start-y)) rotate(-8deg) scale(0.86);
  filter: drop-shadow(0 18px 16px rgba(0, 0, 0, 0.55));
  animation: ai-card-flight 1200ms cubic-bezier(0.2, 0.72, 0.2, 1) forwards;
}

.flying-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.swap-fly {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 110;
  width: 76px;
  height: 108px;
  pointer-events: none;
  transform: translate(var(--start-x), var(--start-y)) rotate(-8deg) scale(0.9);
  filter: drop-shadow(0 18px 16px rgba(0, 0, 0, 0.52));
  animation: swap-hand-flight 820ms cubic-bezier(0.18, 0.76, 0.2, 1) var(--delay, 0ms) forwards;
}

.swap-fly span {
  position: absolute;
  inset: 0;
  border: 3px solid #050609;
  border-radius: 7px;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.14), transparent 58%),
    #c81925;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.28);
}

.swap-fly span:nth-child(1) {
  transform: translate(-8px, 8px) rotate(-7deg);
}

.swap-fly span:nth-child(2) {
  transform: translate(0, 0) rotate(1deg);
}

.swap-fly span:nth-child(3) {
  transform: translate(8px, -8px) rotate(8deg);
}

@keyframes ai-card-flight {
  45% {
    transform: translate(var(--mid-x), var(--mid-y)) rotate(6deg) scale(1.08);
  }

  100% {
    transform: translate(var(--end-x), var(--end-y)) rotate(0deg) scale(1);
  }
}

@keyframes swap-hand-flight {
  0% {
    transform: translate(var(--start-x), var(--start-y)) rotate(-10deg) scale(0.82);
    opacity: 0;
  }

  18% {
    opacity: 1;
  }

  58% {
    transform: translate(var(--mid-x), var(--mid-y)) rotate(8deg) scale(1.02);
    opacity: 1;
  }

  100% {
    transform: translate(var(--end-x), var(--end-y)) rotate(10deg) scale(0.86);
    opacity: 0;
  }
}

.card::before {
  content: "";
  position: absolute;
  inset: 22% -30%;
  border: 3px solid #07080b;
  border-radius: 999px;
  background: var(--card-main);
  transform: rotate(-23deg);
  box-shadow:
    0 0 0 2px #f8f4e9,
    inset 0 0 0 2px rgba(255, 255, 255, 0.22);
}

.card::after {
  content: "";
  position: absolute;
  inset: 22% -36%;
  border-left: 4px solid rgba(5, 6, 9, 0.72);
  border-radius: 999px;
  transform: rotate(-23deg);
  opacity: 0.75;
  pointer-events: none;
}

.card.card--asset::before,
.card.card--asset::after {
  content: none;
}

.card > * {
  position: relative;
  z-index: 1;
}

.card-corner {
  align-self: start;
  justify-self: start;
  color: #fff;
  font-size: 1.06rem;
  line-height: 1;
  font-weight: 900;
  -webkit-text-stroke: 1.3px #07080b;
  paint-order: stroke fill;
  filter: drop-shadow(0 2px 0 #000);
}

.card-corner:empty {
  display: none;
}

.card-corner--bottom {
  align-self: end;
  justify-self: end;
  transform: rotate(180deg);
}

.card-face {
  align-self: center;
  justify-self: center;
  color: #fff;
  font-size: 3.55rem;
  line-height: 0.92;
  font-weight: 900;
  transform: rotate(-13deg);
  -webkit-text-stroke: 4.5px #08090d;
  paint-order: stroke fill;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.85));
}

.card-face--word {
  max-width: 72px;
  overflow-wrap: anywhere;
  text-align: center;
  font-size: 1.05rem;
  line-height: 0.95;
}

.card-symbol {
  display: inline-grid;
  place-items: center;
  min-width: 52px;
  min-height: 52px;
  border: 5px solid #fff;
  border-radius: 999px;
  background: #111217;
  font-size: 1.5rem;
  -webkit-text-stroke: 2px #08090d;
}

.draw-face {
  position: relative;
  align-self: center;
  justify-self: center;
  width: 54px;
  height: 62px;
  transform: rotate(-14deg);
}

.draw-tile {
  position: absolute;
  left: calc(3px + var(--tile-index) * 6px);
  top: calc(22px - var(--tile-index) * 6px);
  width: 30px;
  height: 40px;
  border: 3px solid #f8f4e9;
  border-radius: 4px;
  background: var(--red);
  box-shadow:
    0 0 0 2px #08090d,
    0 4px 0 rgba(0, 0, 0, 0.55);
}

.draw-tile--red {
  background: var(--red);
}

.draw-tile--yellow {
  background: var(--yellow);
}

.draw-tile--green {
  background: var(--green);
}

.draw-tile--blue {
  background: var(--blue);
}

.wild-face {
  position: relative;
  align-self: center;
  justify-self: center;
  width: 58px;
  height: 58px;
  overflow: hidden;
  border: 4px solid #08090d;
  border-radius: 999px;
  background: #fff;
  transform: rotate(-14deg);
  box-shadow:
    0 0 0 4px #f4efe2,
    0 5px 0 rgba(0, 0, 0, 0.48);
}

.wild-slice {
  position: absolute;
  width: 50%;
  height: 50%;
}

.wild-slice--red {
  top: 0;
  left: 0;
  background: var(--red);
}

.wild-slice--yellow {
  top: 0;
  right: 0;
  background: var(--yellow);
}

.wild-slice--green {
  right: 0;
  bottom: 0;
  background: var(--green);
}

.wild-slice--blue {
  bottom: 0;
  left: 0;
  background: var(--blue);
}

.card--large {
  width: 132px;
  height: 198px;
  border-width: 6px;
}

.card--large .card-face {
  font-size: 4.35rem;
}

.card--large .draw-face {
  width: 82px;
  height: 88px;
}

.card--large .draw-tile {
  left: calc(8px + var(--tile-index) * 8px);
  top: calc(30px - var(--tile-index) * 8px);
  width: 43px;
  height: 56px;
  border-width: 4px;
}

.card--large .wild-face {
  width: 74px;
  height: 74px;
}

.card--number::before {
  inset: 17% -35%;
  border: 4px solid #06070a;
  background:
    linear-gradient(130deg, rgba(255, 255, 255, 0.2), transparent 42%),
    var(--card-main);
  box-shadow:
    0 0 0 2px #f7f1df,
    inset 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.card--number::after {
  inset: 17% -40%;
  border-left: 5px solid rgba(6, 7, 10, 0.74);
}

.card--penalty::before {
  inset: 28% -40%;
  background: #f4efe2;
  box-shadow:
    0 0 0 3px #06070a,
    inset 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.card--penalty::after {
  inset: 28% -44%;
  border-left-color: rgba(255, 255, 255, 0.5);
}

.card--red {
  --card-main: var(--red);
}

.card--yellow {
  --card-main: var(--yellow);
}

.card--green {
  --card-main: var(--green);
}

.card--blue {
  --card-main: var(--blue);
}

.card--wild {
  --card-main: var(--wild);
  background:
    radial-gradient(circle at 22% 24%, #f4c334 0 2px, transparent 3px),
    radial-gradient(circle at 72% 16%, var(--blue) 0 2px, transparent 3px),
    radial-gradient(circle at 18% 78%, var(--red) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 78%, var(--green) 0 2px, transparent 3px),
    linear-gradient(145deg, #1a1b22 0%, #07080b 72%),
    #111217;
}

.card--wild::before {
  background: #f4efe2;
  box-shadow:
    0 0 0 3px #08090d,
    inset 0 0 0 2px rgba(0, 0, 0, 0.12);
}

.card--wild::after {
  border-left-color: rgba(255, 255, 255, 0.28);
}

.card--wild .card-face {
  color: #fff;
}

.card--yellow .card-face,
.card--yellow .card-corner {
  color: #fff;
}

.penalty-panel {
  grid-column: 3;
  grid-row: 1 / span 2;
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 150px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
  padding: 18px;
}

.penalty-panel strong {
  color: #fff;
  font-size: 4rem;
  line-height: 1;
  text-shadow: 0 4px 0 #000;
}

.hand-zone {
  min-width: 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 14px;
}

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

.actions button,
.test-actions button {
  min-height: 40px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  font-weight: 900;
}

#challengeButton {
  background: var(--danger);
  color: #fff;
}

#menuButton {
  background: #12141a;
  color: #fff;
}

.hand-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 24px 2px 4px;
  scrollbar-width: none;
}

.hand-scroll::-webkit-scrollbar {
  display: none;
}

.hand {
  display: flex;
  gap: 10px;
  min-height: 180px;
  width: fit-content;
  min-width: 100%;
}

.hand-slider {
  display: block;
  width: 100%;
  margin-top: 10px;
  accent-color: var(--yellow);
}

.hand-slider:disabled {
  opacity: 0.3;
}

.hand .card {
  flex: 0 0 auto;
  transition:
    transform 160ms ease,
    filter 160ms ease;
}

.hand .card.is-selected {
  transform: translateY(-16px) rotate(-2deg);
}

.hand .card.is-selected {
  filter: drop-shadow(0 14px 12px rgba(0, 0, 0, 0.42)) brightness(1.08);
}

.hand .card.is-unplayable {
  opacity: 0.52;
}

.hand .card.is-unplayable.is-selected {
  opacity: 0.72;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: calc(100vh - 36px);
  color: var(--ink);
}

.side-panel section {
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.rule-list {
  display: grid;
  gap: 9px;
  margin-top: 12px;
  padding-left: 20px;
  color: var(--ink);
  line-height: 1.5;
}

.log {
  display: grid;
  gap: 9px;
  max-height: 280px;
  overflow-y: auto;
  margin-top: 12px;
  color: var(--ink);
}

.log-entry {
  border-left: 4px solid var(--danger);
  background: rgba(232, 66, 50, 0.1);
  padding: 8px 10px;
}

.comm-panel {
  display: grid;
  gap: 10px;
}

.comm-status {
  border-radius: 8px;
  background: rgba(23, 24, 28, 0.08);
  color: var(--muted);
  padding: 8px 10px;
  font-size: 0.86rem;
  font-weight: 800;
}

.chat-messages {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 180px;
  max-height: 240px;
  overflow-y: auto;
  border-radius: 8px;
  background: rgba(23, 24, 28, 0.08);
  padding: 10px;
}

.chat-message {
  display: grid;
  gap: 2px;
  border-left: 4px solid var(--blue);
  background: rgba(39, 118, 207, 0.1);
  padding: 8px 10px;
}

.chat-message.is-self {
  border-left-color: var(--yellow);
  background: rgba(244, 195, 52, 0.15);
}

.chat-message strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.chat-message span {
  color: var(--ink);
  line-height: 1.35;
  word-break: break-word;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr 76px;
  gap: 8px;
}

.chat-form input {
  min-height: 42px;
  border: 1px solid rgba(23, 24, 28, 0.18);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
}

.chat-form button,
.voice-buttons button {
  min-height: 42px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.voice-controls {
  display: grid;
  gap: 8px;
}

.voice-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.test-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.62);
  padding: 20px;
}

.modal-panel {
  display: grid;
  gap: 14px;
  width: min(440px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #f4efe7;
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  padding: 20px;
}

.modal-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.swap-options {
  display: grid;
  gap: 10px;
}

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

.color-option {
  min-height: 58px;
  border: 3px solid #111217;
  color: #fff;
  font-weight: 900;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
}

.color-option--red {
  background: var(--red);
}

.color-option--yellow {
  background: var(--yellow);
}

.color-option--green {
  background: var(--green);
}

.color-option--blue {
  background: var(--blue);
}

.swap-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  background: #17181c;
  color: #fff;
  padding: 0 14px;
}

.swap-option strong {
  color: var(--yellow);
}

.result-panel {
  justify-items: stretch;
  text-align: center;
}

.result-panel h2 {
  color: var(--ink);
  font-size: 1.8rem;
}

.play-again-button {
  min-height: 52px;
  background: var(--danger);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(232, 66, 50, 0.24);
}

@media (max-width: 980px) {
  .home-panel {
    grid-template-columns: 1fr;
    align-content: center;
  }

  .home-brand h1 {
    max-width: none;
  }

  .game-shell {
    grid-template-columns: 1fr;
  }

  .table-area,
  .side-panel {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .game-shell {
    padding: 10px;
  }

  .table-area {
    padding: 14px;
  }

  .top-bar,
  .hand-header {
    align-items: stretch;
    flex-direction: column;
  }

  .round-status {
    text-align: left;
  }

  .opponents,
  .playfield {
    grid-template-columns: 1fr;
  }

  .playfield {
    grid-template-rows: auto;
    min-height: auto;
  }

  .deck-zone,
  .current-color-display,
  .discard-zone,
  .penalty-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .actions {
    justify-content: stretch;
  }

  .actions button {
    flex: 1 1 92px;
  }
}
