:root {
  color-scheme: dark;
  --forest: #07110c;
  --forest-soft: #0c2117;
  --forest-card: rgba(12, 33, 23, 0.78);
  --glass: rgba(255, 255, 255, 0.08);
  --stroke: rgba(255, 241, 212, 0.16);
  --ivory: #fff1d4;
  --muted: rgba(255, 241, 212, 0.68);
  --fox: #ff6a13;
  --gold: #ffc857;
  --danger: #ff5b5b;
  --success: #7de38d;
  --radius: 22px;
  --space: 18px;
  font-family: Poppins, ui-rounded, "SF Pro Rounded", "SF Pro Display", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ivory);
  background:
    linear-gradient(180deg, rgba(5, 12, 8, 0.25), rgba(5, 12, 8, 0.95)),
    url("../assets/images/living-room-bg.png") center / cover fixed,
    var(--forest);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  width: min(100%, 1100px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  margin: -14px -6px 10px;
  padding: 14px 6px 8px;
  background: linear-gradient(180deg, rgba(7, 17, 12, 0.92), rgba(7, 17, 12, 0.58), transparent);
  backdrop-filter: blur(14px);
}

.app-logo {
  justify-self: center;
  width: min(230px, 54vw);
  max-height: 64px;
  object-fit: contain;
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.icon-button,
.pill-button,
.primary-button,
.secondary-button,
.danger-button {
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  font-size: 28px;
  line-height: 1;
}

.pill-button {
  min-height: 42px;
  padding: 0 16px;
  font-weight: 800;
}

.pill-button.subtle {
  color: var(--gold);
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 0 20px;
  font-weight: 900;
  text-decoration: none;
}

.primary-button {
  border: 0;
  color: #1d0902;
  background: linear-gradient(135deg, var(--fox), var(--gold));
}

.secondary-button {
  color: var(--ivory);
}

.danger-button {
  border-color: rgba(255, 91, 91, 0.38);
  color: #fff;
  background: rgba(255, 91, 91, 0.18);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.42;
  filter: grayscale(0.45);
}

.screen-host {
  display: grid;
  gap: var(--space);
}

.screen {
  display: grid;
  gap: var(--space);
  animation: enter 0.28s ease both;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.hero-screen {
  min-height: calc(100dvh - 96px);
  align-content: center;
}

.hero-card,
.glass-card,
.player-row,
.choice-row,
.score-row,
.modal-card {
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03)), var(--forest-card);
  box-shadow: 0 22px 64px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(20px);
}

.hero-card {
  overflow: hidden;
  position: relative;
  display: grid;
  gap: 20px;
  padding: clamp(24px, 6vw, 52px);
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -6% -22% auto;
  width: min(56vw, 360px);
  aspect-ratio: 1;
  background: url("../assets/images/fox.png") center bottom / contain no-repeat;
  opacity: 0.9;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 680px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(44px, 10vw, 82px);
  line-height: 0.95;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(28px, 6vw, 44px);
  line-height: 1.05;
}

h3 {
  margin-bottom: 6px;
}

.lead,
.muted {
  color: var(--muted);
  line-height: 1.65;
}

.action-stack {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 14px;
}

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

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

.glass-card {
  padding: 18px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--ivory);
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid rgba(255, 241, 212, 0.16);
  border-radius: 16px;
  color: var(--ivory);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.field textarea {
  min-height: 118px;
  padding: 14px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(255, 200, 87, 0.6);
  box-shadow: 0 0 0 4px rgba(255, 200, 87, 0.12);
}

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

.stepper strong {
  text-align: center;
  font-size: 30px;
}

.list {
  display: grid;
  gap: 10px;
}

.player-row,
.choice-row,
.score-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 12px;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--ivory);
  background: linear-gradient(135deg, rgba(255, 122, 26, 0.85), rgba(255, 200, 87, 0.45));
  font-weight: 900;
}

.row-title {
  font-weight: 900;
}

.row-subtitle {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.small-button {
  min-width: 42px;
  min-height: 42px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  color: var(--ivory);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 900;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--stroke);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
}

.segmented button {
  min-height: 44px;
  border: 0;
  border-radius: 13px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.segmented button.active {
  color: #1d0902;
  background: linear-gradient(135deg, var(--fox), var(--gold));
}

.reveal-stage {
  min-height: calc(100dvh - 110px);
  align-content: center;
}

.turn-heading {
  text-align: center;
}

.turn-heading strong {
  display: block;
  font-size: clamp(38px, 10vw, 72px);
}

.secret-card {
  position: relative;
  display: grid;
  place-items: center;
  min-height: min(58dvh, 480px);
  perspective: 1100px;
}

.card-inner {
  position: relative;
  width: min(100%, 560px);
  aspect-ratio: 1.38;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.card-inner.revealed {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  border: 8px solid #552107;
  border-radius: 34px;
  backface-visibility: hidden;
  background: linear-gradient(145deg, #fff1cd, #f5c987);
  color: #111b19;
  text-align: center;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.4);
}

.card-face.back {
  transform: rotateY(180deg);
}

.fox-head {
  position: absolute;
  z-index: 2;
  top: -30%;
  width: 48%;
  max-width: 280px;
  pointer-events: none;
}

.secret-word {
  font-size: clamp(36px, 9vw, 74px);
  font-weight: 1000;
  line-height: 1.02;
}

.timer {
  text-align: center;
  font-size: clamp(58px, 16vw, 122px);
  font-weight: 1000;
  line-height: 1;
  color: var(--gold);
}

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

.choice-row {
  border-color: rgba(255, 241, 212, 0.12);
}

.choice-row.selected {
  border-color: rgba(255, 200, 87, 0.72);
  background: rgba(255, 200, 87, 0.14);
}

.winner-title {
  color: var(--gold);
  text-align: center;
  font-size: clamp(36px, 9vw, 76px);
}

.result-mascot {
  justify-self: center;
  width: min(50vw, 260px);
  filter: drop-shadow(0 26px 42px rgba(255, 122, 26, 0.22));
}

.modal {
  width: min(92vw, 520px);
  padding: 0;
  border: 0;
  color: var(--ivory);
  background: transparent;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
}

.modal-card {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.modal-title-row,
.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.toggle-row small {
  display: block;
  color: var(--muted);
}

.danger-link {
  justify-self: start;
  border: 0;
  color: var(--danger);
  background: transparent;
  font-weight: 900;
}

.empty {
  padding: 28px;
  border: 1px dashed rgba(255, 241, 212, 0.24);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.hidden {
  display: none !important;
}

@media (max-width: 780px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .hero-card::after {
    opacity: 0.34;
  }

  .secret-card {
    min-height: 420px;
  }
}

@media (display-mode: standalone) {
  .app-header {
    margin-top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
