:root {
  color-scheme: dark;
  --bg: #040404;
  --panel: rgba(10, 10, 10, 0.95);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f4f4f4;
  --muted: #8f99a7;
  --accent: #3ddc97;
  --accent-soft: rgba(61, 220, 151, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: radial-gradient(circle at top, #111 0%, #090909 45%, #020202 100%);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, sans-serif;
  text-transform: lowercase;
}

.page {
  width: min(100%, 1280px);
  padding: 1.5rem;
  display: grid;
  gap: 1.5rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 1.75rem;
  padding: 1.5rem;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(20px);
  animation: fade-in 0.45s ease;
}

.game-panel {
  min-height: calc(100vh - 4rem);
  display: grid;
  gap: 1.25rem;
}

.panel-header {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.panel-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 2.8rem);
  letter-spacing: -0.05em;
}

.controls {
  display: grid;
  gap: 1.1rem;
}

label {
  font-size: 0.95rem;
  color: var(--muted);
}

input[type='range'],
select,
button {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 1rem 1rem;
  font: inherit;
}

input[type='range'] {
  accent-color: var(--accent);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.85rem;
}

button {
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(61, 220, 151, 0.18);
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  background: var(--accent-soft);
}

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

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid rgba(61, 220, 151, 0.8);
  outline-offset: 2px;
}

.board {
  display: grid;
  gap: 1rem;
}

.player-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1rem;
}

.player {
  padding: 1.1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 1.35rem;
  text-align: center;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.player.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(61, 220, 151, 0.16);
  transform: translateY(-3px);
}

.center-pile {
  min-height: 10rem;
  border-radius: 1.75rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  font-size: 1rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.center-pile.pulse {
  transform: scale(1.04);
  box-shadow: 0 0 0 1px rgba(61, 220, 151, 0.16);
}

.hand {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr));
  gap: 1rem;
}

.card {
  min-height: 8rem;
  aspect-ratio: 0.7;
  position: relative;
  perspective: 900px;
}

.card-inner {
  position: absolute;
  inset: 0;
  border-radius: 1.5rem;
  background: linear-gradient(180deg, rgba(61, 220, 151, 0.12), rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: grid;
  place-items: center;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 800;
  transform-style: preserve-3d;
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.28);
}

.card:hover .card-inner {
  transform: translateY(-0.65rem) rotateX(12deg) rotateY(8deg);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.32);
}

.card.selected .card-inner {
  transform: translateY(-0.85rem) rotateX(15deg) rotateY(-5deg);
  border-color: var(--accent);
  box-shadow: 0 30px 80px rgba(61, 220, 151, 0.24);
}

.card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  backface-visibility: hidden;
  border-radius: 1.5rem;
}

.card-front {
  background: linear-gradient(180deg, rgba(30, 30, 30, 0.92), rgba(10, 10, 10, 0.98));
}

.card-back {
  background: radial-gradient(circle at 30% 30%, rgba(61, 220, 151, 0.18), transparent 42%),
              linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  transform: rotateY(180deg);
}

.card-inner::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 1.5rem;
  background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.2), transparent 32%);
  opacity: 0.16;
  pointer-events: none;
}

.action-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.log {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  color: var(--accent);
  min-height: 1.4rem;
}

.hidden {
  display: none !important;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
