:root {
  --uno-ink: #14171d;
  --uno-paper: #fffdf4;
  --uno-muted: #6d7477;
  --uno-red: #ee3f32;
  --uno-yellow: #f4c542;
  --uno-green: #27a95d;
  --uno-blue: #2879e8;
  --uno-dark: #101820;
}

* {
  box-sizing: border-box;
}

.uno-page {
  background:
    linear-gradient(125deg, rgba(238, 63, 50, 0.24), transparent 28%),
    linear-gradient(235deg, rgba(40, 121, 232, 0.24), transparent 32%),
    linear-gradient(180deg, #101820 0%, #172321 52%, #1c1a22 100%);
  color: var(--uno-ink);
  min-height: 100vh;
}

.uno-header {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 16px clamp(16px, 3vw, 34px);
}

.uno-brand,
.uno-home {
  align-items: center;
  color: #ffffff;
  display: inline-flex;
  gap: 12px;
  text-decoration: none;
}

.uno-logo {
  align-items: center;
  background: conic-gradient(from 25deg, var(--uno-red), var(--uno-yellow), var(--uno-green), var(--uno-blue), var(--uno-red));
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  color: #ffffff;
  display: inline-flex;
  font-size: 29px;
  font-weight: 1000;
  height: 50px;
  justify-content: center;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.28);
  width: 54px;
}

.uno-brand small,
.uno-scoreboard span,
.zone-label,
.player-bar span,
.opponent span {
  color: rgba(255, 255, 255, 0.68);
  display: block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.uno-brand strong {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.uno-home {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  font-weight: 900;
  min-height: 44px;
  padding: 0 16px;
}

.uno-ad {
  margin-bottom: 18px;
  margin-top: 0;
}

.uno-shell {
  display: grid;
  gap: 16px;
  margin: 0 auto;
  max-width: 1280px;
  padding: 0 clamp(14px, 3vw, 34px) 28px;
}

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

.uno-scoreboard div {
  background: rgba(255, 253, 244, 0.96);
  border: 3px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  box-shadow: 0 16px 44px rgba(4, 8, 12, 0.26);
  padding: 13px 14px;
}

.uno-scoreboard span {
  color: var(--uno-muted);
}

.uno-scoreboard strong {
  display: block;
  font-size: clamp(20px, 3vw, 31px);
  line-height: 1.05;
  margin-top: 4px;
}

.uno-table {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, #11764d 0%, #0c593d 100%);
  background-size: 42px 42px, auto;
  border: 5px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  box-shadow: 0 26px 72px rgba(1, 6, 8, 0.42);
  display: grid;
  gap: 18px;
  min-height: 650px;
  overflow: hidden;
  padding: clamp(14px, 2vw, 22px);
}

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

.opponent {
  background: rgba(8, 20, 18, 0.72);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #ffffff;
  display: grid;
  gap: 10px;
  min-height: 104px;
  padding: 12px;
}

.opponent.turn {
  border-color: var(--uno-yellow);
  box-shadow: 0 0 0 3px rgba(244, 197, 66, 0.18);
}

.opponent-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.opponent strong {
  font-size: 21px;
}

.opponent-cards {
  display: flex;
  min-height: 42px;
  overflow: hidden;
}

.mini-back {
  background: conic-gradient(from 25deg, var(--uno-red), var(--uno-yellow), var(--uno-green), var(--uno-blue), var(--uno-red));
  border: 2px solid #ffffff;
  border-radius: 6px;
  box-shadow: -7px 0 0 rgba(0, 0, 0, 0.08);
  height: 42px;
  margin-left: -7px;
  width: 28px;
}

.mini-back:first-child {
  margin-left: 0;
}

.uno-center {
  align-items: center;
  display: grid;
  gap: clamp(12px, 2vw, 28px);
  grid-template-columns: minmax(140px, 0.8fr) minmax(140px, 0.8fr) minmax(220px, 1.1fr);
  justify-items: center;
}

.discard-zone,
.draw-pile,
.message-panel {
  align-items: center;
  display: grid;
  justify-items: center;
}

.draw-pile {
  background: transparent;
  border: 0;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  gap: 9px;
  padding: 0;
}

.draw-pile:disabled {
  cursor: not-allowed;
  filter: grayscale(0.65);
  opacity: 0.7;
}

.draw-pile small {
  background: rgba(255, 255, 255, 0.94);
  border-radius: 999px;
  color: var(--uno-ink);
  font-weight: 1000;
  min-width: 52px;
  padding: 5px 11px;
}

.card-back {
  align-items: center;
  aspect-ratio: 2 / 3;
  background:
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.95) 0 24%, transparent 25%),
    conic-gradient(from 25deg, var(--uno-red), var(--uno-yellow), var(--uno-green), var(--uno-blue), var(--uno-red));
  border: 5px solid #ffffff;
  border-radius: 8px;
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.24);
  color: var(--uno-ink);
  display: flex;
  justify-content: center;
  width: clamp(96px, 11vw, 132px);
}

.card-back b {
  font-size: 25px;
  transform: rotate(-16deg);
}

.message-panel {
  align-self: stretch;
  background: rgba(255, 253, 244, 0.96);
  border: 3px solid rgba(255, 255, 255, 0.65);
  border-radius: 8px;
  color: var(--uno-ink);
  justify-items: start;
  max-width: 340px;
  padding: 16px;
}

.message-panel strong {
  font-size: 24px;
}

.message-panel p {
  color: var(--uno-muted);
  font-weight: 800;
  line-height: 1.42;
  margin: 6px 0 0;
}

.uno-card {
  align-items: center;
  aspect-ratio: 2 / 3;
  border: 4px solid #ffffff;
  border-radius: 8px;
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.24);
  color: #ffffff;
  display: grid;
  font: inherit;
  justify-items: center;
  min-width: 74px;
  overflow: hidden;
  padding: 10px;
  position: relative;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.28);
}

.uno-card::before {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  content: "";
  height: 54%;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-18deg);
  width: 82%;
}

.uno-card strong {
  color: var(--card-face, #111111);
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1;
  position: relative;
  z-index: 1;
}

.uno-card small {
  color: var(--card-face, #111111);
  font-size: 13px;
  font-weight: 1000;
  margin-top: -8px;
  position: relative;
  text-transform: uppercase;
  z-index: 1;
}

.uno-card.big {
  width: clamp(112px, 14vw, 164px);
}

.card-corner {
  font-size: 18px;
  font-weight: 1000;
  left: 9px;
  position: absolute;
  top: 7px;
  z-index: 1;
}

.card-corner.bottom {
  bottom: 7px;
  left: auto;
  right: 9px;
  top: auto;
  transform: rotate(180deg);
}

.card-red {
  background: var(--uno-red);
  --card-face: var(--uno-red);
}

.card-yellow {
  background: var(--uno-yellow);
  --card-face: #9b6510;
}

.card-green {
  background: var(--uno-green);
  --card-face: var(--uno-green);
}

.card-blue {
  background: var(--uno-blue);
  --card-face: var(--uno-blue);
}

.card-wild {
  background: conic-gradient(from 28deg, var(--uno-red), var(--uno-yellow), var(--uno-green), var(--uno-blue), var(--uno-red));
  --card-face: #111111;
}

.player-area {
  align-self: end;
  display: grid;
  gap: 12px;
}

.player-bar {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.player-bar strong {
  color: #ffffff;
  display: block;
  font-size: 25px;
}

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

.uno-action {
  background: var(--uno-yellow);
  border: 0;
  border-radius: 8px;
  color: #172017;
  cursor: pointer;
  font: inherit;
  font-weight: 1000;
  min-height: 42px;
  padding: 0 14px;
}

.uno-action.secondary {
  background: rgba(255, 255, 255, 0.94);
}

.uno-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.player-hand {
  align-items: end;
  display: flex;
  gap: 8px;
  min-height: 178px;
  overflow-x: auto;
  padding: 12px 6px 8px;
}

.player-hand .uno-card {
  border: 0;
  cursor: pointer;
  flex: 0 0 clamp(78px, 10vw, 108px);
  min-height: 118px;
  transition: transform 140ms ease, filter 140ms ease;
}

.player-hand .uno-card.playable {
  box-shadow: 0 0 0 4px rgba(244, 197, 66, 0.62), 0 18px 28px rgba(0, 0, 0, 0.26);
  transform: translateY(-10px);
}

.player-hand .uno-card:not(.playable) {
  filter: saturate(0.65) brightness(0.82);
}

.player-hand .uno-card:disabled {
  cursor: not-allowed;
}

.color-modal {
  align-items: center;
  background: rgba(4, 8, 12, 0.68);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 20;
}

.color-modal.hidden {
  display: none;
}

.color-dialog {
  background: var(--uno-paper);
  border: 4px solid #ffffff;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  max-width: 420px;
  padding: 18px;
  width: 100%;
}

.color-dialog h2 {
  font-size: 32px;
  margin: 0 0 14px;
}

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

.color-choice {
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 18px;
  font-weight: 1000;
  min-height: 72px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}

.color-choice.yellow {
  color: #392a06;
  text-shadow: none;
}

.uno-footer {
  max-width: 1280px;
}

@media (max-width: 860px) {
  .uno-scoreboard,
  .opponents-row,
  .uno-center {
    grid-template-columns: 1fr;
  }

  .uno-table {
    min-height: 760px;
  }

  .opponents-row {
    grid-template-columns: repeat(3, minmax(145px, 1fr));
    overflow-x: auto;
  }

  .uno-center {
    gap: 18px;
  }

  .message-panel {
    max-width: none;
    width: 100%;
  }

  .player-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .player-actions {
    justify-content: stretch;
  }

  .player-actions .uno-action {
    flex: 1 1 120px;
  }
}

@media (max-width: 560px) {
  .uno-header {
    align-items: stretch;
    flex-direction: column;
  }

  .uno-home {
    justify-content: center;
  }

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

  .uno-scoreboard strong {
    font-size: 20px;
  }

  .player-hand .uno-card {
    flex-basis: 76px;
  }
}
