:root {
  --bg: #050505;
  --text: #f4f4f4;
  --muted: #8a8a8a;
  --red: #e03131;
  --yellow: #f1c40f;
  --green: #2f9e44;
  --blue: #1c7ed6;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  overflow: hidden;
}

.uno-app {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  padding: 12px 18px 14px;
  gap: 10px;
}

.uno-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.back-link,
.uno-top h1,
.text-btn {
  font-size: 26px;
  font-weight: 600;
}

.back-link,
.text-btn {
  color: #fff;
  text-decoration: none;
  background: transparent;
  padding: 7px 14px;
  border: 2px solid #fff;
  border-radius: 999px;
  white-space: nowrap;
}

.back-link:active,
.text-btn:active,
.action-btn:active {
  background: #fff;
  color: #000;
}

.cpus {
  display: flex;
  gap: 16px;
}

.cpu {
  flex: 1;
  min-width: 0;
  border: 2px solid #333;
  border-radius: 18px;
  padding: 10px 12px;
}

.cpu.done {
  opacity: 0.42;
}

.cpu-name {
  font-size: 22px;
  font-weight: 600;
}

.cpu-count {
  color: var(--muted);
  font-size: 18px;
  margin-top: 2px;
}

.cpu-backs {
  display: flex;
  margin-top: 8px;
  min-height: 54px;
}

.cpu-backs .mini {
  width: 34px;
  height: 48px;
  margin-right: -18px;
  border-radius: 6px;
  background: linear-gradient(160deg, #222, #111);
  border: 2px solid #fff;
}

.table {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.pile {
  display: flex;
  gap: 18px;
  align-items: center;
}

.card {
  width: 92px;
  height: 132px;
  border-radius: 12px;
  border: 3px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 800;
  color: #fff;
  flex: 0 0 auto;
  position: relative;
}

.card.back {
  background: radial-gradient(circle at 30% 30%, #444, #111);
  color: #fff;
  font-size: 22px;
}

.card.red { background: var(--red); }
.card.yellow { background: var(--yellow); color: #111; }
.card.green { background: var(--green); }
.card.blue { background: var(--blue); }
.card.wild {
  background: conic-gradient(var(--red), var(--yellow), var(--green), var(--blue), var(--red));
  color: #fff;
  text-shadow: 0 1px 4px #000;
}

.card.legal {
  box-shadow: 0 0 0 4px #fff;
  transform: translateY(-8px);
}

.card.dim {
  opacity: 0.38;
}

.pile-card {
  width: 108px;
  height: 154px;
  font-size: 40px;
}

.color-line,
.status {
  font-size: 22px;
  text-align: center;
}

.color-line.red { color: var(--red); }
.color-line.yellow { color: var(--yellow); }
.color-line.green { color: var(--green); }
.color-line.blue { color: var(--blue); }

.status {
  color: var(--muted);
  min-height: 28px;
}

.hand {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 10px 4px 8px;
  min-height: 160px;
  align-items: flex-end;
}

.uno-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.action-btn {
  min-width: 180px;
  min-height: 64px;
  border: 3px solid #fff;
  border-radius: 18px;
  background: transparent;
  color: #fff;
  font-size: 28px;
  font-weight: 700;
}

.action-btn:disabled {
  opacity: 0.35;
}

.mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

.mask:not([hidden]) {
  display: flex;
}

.mask-card {
  background: #111;
  border: 3px solid #fff;
  border-radius: 24px;
  padding: 28px 24px;
  min-width: min(520px, 90vw);
  text-align: center;
}

.mask-card p {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 18px;
}

.color-picks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.color-pick {
  min-height: 80px;
  border: 0;
  border-radius: 16px;
  color: #fff;
  font-size: 30px;
  font-weight: 800;
}

.color-pick.red { background: var(--red); }
.color-pick.yellow { background: var(--yellow); color: #111; }
.color-pick.green { background: var(--green); }
.color-pick.blue { background: var(--blue); }

.you-active .hand {
  outline: 2px solid #fff;
  outline-offset: 4px;
  border-radius: 16px;
}

@media (max-height: 700px) {
  .card { width: 72px; height: 104px; font-size: 26px; }
  .pile-card { width: 84px; height: 120px; font-size: 30px; }
  .action-btn { min-height: 52px; font-size: 22px; }
  .hand { min-height: 128px; }
}
