* { box-sizing: border-box; }

:root {
  --bg: #08070b;
  --panel: rgba(18, 14, 22, .88);
  --panel2: rgba(32, 20, 28, .9);
  --red: #ff3158;
  --red2: #9c102b;
  --gold: #ffb84d;
  --cyan: #37d6ff;
  --green: #42ff9e;
  --muted: rgba(255,255,255,.62);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: white;
  background:
    radial-gradient(circle at 50% 20%, rgba(255,49,88,.18), transparent 30%),
    radial-gradient(circle at 80% 80%, rgba(55,214,255,.10), transparent 25%),
    linear-gradient(135deg, #07060a, #140b12 55%, #060508);
  overflow-x: hidden;
}

.rain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  background-image:
    linear-gradient(115deg, transparent 0 48%, rgba(255,255,255,.5) 49%, transparent 51% 100%);
  background-size: 90px 90px;
  animation: rainMove 1.6s linear infinite;
  z-index: 0;
}

@keyframes rainMove {
  to { background-position: -90px 180px; }
}

.menu-shell, .game-layout, .topbar {
  position: relative;
  z-index: 1;
}

.menu-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 680px) minmax(280px, 420px);
  gap: 28px;
  align-items: center;
  justify-content: center;
  padding: 36px;
}

.brand-card, .rules-card, .side-panel, .action-panel, .dealer {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 30px 80px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(16px);
  border-radius: 24px;
}

.brand-card {
  padding: 38px;
}

.motel-sign {
  text-align: center;
  border: 2px solid var(--red);
  border-radius: 18px;
  padding: 22px;
  background: rgba(255,49,88,.08);
  box-shadow: 0 0 35px rgba(255,49,88,.35), inset 0 0 30px rgba(255,49,88,.10);
}

.motel-sign h1 {
  margin: 6px 0;
  font-size: clamp(44px, 7vw, 82px);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: white;
  text-shadow: 0 0 12px white, 0 0 28px var(--red);
}

.sign-small, .sign-sub {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: .25em;
  font-size: 12px;
  font-weight: 800;
}

.intro {
  color: var(--muted);
  line-height: 1.6;
  font-size: 17px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 24px 0;
}

label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: .12em;
}

input, select {
  width: 100%;
  margin-top: 8px;
  padding: 14px 15px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.45);
  color: white;
  outline: none;
  font-size: 15px;
}

input:focus, select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255,49,88,.14);
}

.menu-actions {
  display: flex;
  gap: 14px;
}

.btn {
  border: none;
  border-radius: 14px;
  padding: 14px 20px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: white;
  cursor: pointer;
  transition: .18s ease;
}

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

.primary {
  background: linear-gradient(135deg, var(--red), var(--red2));
  box-shadow: 0 12px 28px rgba(255,49,88,.28);
}

.ghost {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}

.danger {
  background: linear-gradient(135deg, #ffb84d, #a35a00);
  color: #221000;
}

.status-line {
  margin-top: 18px;
  color: var(--green);
  font-weight: 700;
}

.rules-card {
  padding: 28px;
}

.rules-card h2 {
  color: var(--gold);
}

.rules-card li {
  margin: 12px 0;
  color: var(--muted);
  line-height: 1.35;
}

.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: rgba(5,5,8,.85);
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.topbar strong {
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: .12em;
}

.topbar span {
  margin-left: 18px;
  color: var(--muted);
}

.small-btn {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.08);
  color: white;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(600px, 1fr) 320px;
  gap: 18px;
  padding: 18px;
  height: calc(100vh - 58px);
}

.table-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

.dealer {
  padding: 18px;
  display: flex;
  gap: 16px;
  align-items: center;
}

.dealer-face {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle, var(--red), #260711);
  font-size: 32px;
  box-shadow: 0 0 30px rgba(255,49,88,.32);
}

.dealer h2, .dealer p {
  margin: 0;
}

.dealer p {
  color: var(--muted);
  margin-top: 6px;
}

.table {
  position: relative;
  flex: 1;
  min-height: 280px;
  border-radius: 40px;
  background:
    radial-gradient(ellipse at center, rgba(255,49,88,.18), transparent 55%),
    linear-gradient(135deg, #211018, #090609);
  border: 2px solid rgba(255,255,255,.08);
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: inset 0 0 60px rgba(0,0,0,.75);
}

.table-glow {
  position: absolute;
  inset: 20px;
  border-radius: 34px;
  border: 1px solid rgba(255,49,88,.22);
  box-shadow: 0 0 50px rgba(255,49,88,.16);
}

.played-stack {
  width: 120px;
  height: 170px;
  border-radius: 16px;
  background: linear-gradient(135deg, #241018, #070609);
  border: 2px solid rgba(255,255,255,.12);
  box-shadow: 0 20px 50px rgba(0,0,0,.45);
  display: grid;
  place-items: center;
  transform: rotate(-4deg);
}

.played-stack span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.played-stack strong {
  font-size: 54px;
  color: var(--gold);
}

.claim-box {
  position: absolute;
  bottom: 24px;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(0,0,0,.45);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--muted);
}

.action-panel {
  padding: 16px;
}

#turnActions {
  display: grid;
  grid-template-columns: 220px 1fr 1fr;
  gap: 12px;
  align-items: end;
}

.wait-box {
  color: var(--muted);
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.hand {
  display: flex;
  gap: 10px;
  min-height: 150px;
  overflow-x: auto;
  padding: 10px 4px 4px;
}

.card {
  flex: 0 0 92px;
  height: 132px;
  border-radius: 14px;
  background: linear-gradient(145deg, #f8efe3, #c9b99d);
  color: #1b0b0f;
  border: 2px solid #fff6e8;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px;
  cursor: pointer;
  transition: .16s ease;
  box-shadow: 0 12px 25px rgba(0,0,0,.35);
}

.card:hover {
  transform: translateY(-8px);
}

.card.selected {
  transform: translateY(-18px);
  box-shadow: 0 0 0 3px var(--red), 0 18px 35px rgba(255,49,88,.30);
}

.card .rank {
  font-size: 28px;
  font-weight: 900;
}

.card .suit {
  font-size: 34px;
  align-self: center;
}

.card.red-card {
  color: #b80028;
}

.side-panel {
  padding: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.side-panel h3 {
  color: var(--gold);
  margin: 10px 0;
}

.player-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  margin-bottom: 8px;
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.07);
}

.player-item.active {
  border-color: var(--red);
  box-shadow: 0 0 20px rgba(255,49,88,.18);
}

.player-item.dead {
  opacity: .45;
  filter: grayscale(1);
}

.player-name {
  font-weight: 900;
}

.player-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.strikes {
  color: var(--red);
  font-weight: 900;
}

.log-box {
  flex: 1;
  overflow-y: auto;
  padding-right: 6px;
}

.log-line {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 90px);
  background: rgba(5,5,8,.95);
  border: 1px solid rgba(255,49,88,.35);
  border-radius: 14px;
  padding: 14px 18px;
  color: white;
  z-index: 20;
  transition: .24s ease;
  box-shadow: 0 20px 50px rgba(0,0,0,.5);
}

.toast.show {
  transform: translate(-50%, 0);
}

@media (max-width: 980px) {
  .menu-shell, .game-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .game-layout {
    overflow-y: auto;
  }

  #turnActions {
    grid-template-columns: 1fr;
  }

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