[hidden] {
  display: none !important;
}

:root {
  --life-bg: #0e0e0e;
  --life-panel: #151515;
  --life-panel-soft: #191919;
  --life-cream: #f4f1ea;
  --life-muted: #bdb7ae;
  --life-line: rgba(244, 241, 234, 0.16);
  --life-line-strong: rgba(244, 241, 234, 0.28);
  --life-orange: #e76f51;
  --life-red: #e05252;
  --life-green: #71a77a;
  --life-card-width: 200px;
  --life-card-crop-height: 139px;
}

.life-game-layout {
  display: grid;
  grid-template-columns: minmax(230px, 320px) minmax(0, 1fr);
  min-height: calc(100vh - 120px);
  width: 100%;
}

.life-game-main {
  min-width: 0;
  padding: 24px clamp(18px, 3vw, 48px) 52px;
  color: var(--life-cream);
  background:
    linear-gradient(rgba(231, 111, 81, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(231, 111, 81, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 85% 0%, rgba(231, 111, 81, 0.12), transparent 33%),
    var(--life-bg);
  background-size: 44px 44px, 44px 44px, auto, auto;
}

.life-game-hero,
.life-game-panel,
.life-game-round {
  width: min(1180px, 100%);
  margin-inline: auto;
}

.life-game-hero {
  margin-bottom: 12px;
}

.life-game-eyebrow,
.life-game-kicker {
  margin: 0 0 8px;
  color: var(--life-orange);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.life-game-hero h1 {
  margin: 0;
  max-width: 900px;
  font-size: clamp(2.25rem, 4.5vw, 4.2rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.life-game-intro {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--life-muted);
  font-size: clamp(1rem, 1.7vw, 1.15rem);
  line-height: 1.45;
}

.life-game-panel,
.life-game-round {
  border: 1px solid var(--life-line);
  background: rgba(18, 18, 18, 0.94);
}

.life-game-panel {
  padding: 16px 18px;
  margin-bottom: 12px;
}

.life-game-panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.life-game-panel h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2.4vw, 2rem);
}

.life-game-round-status {
  margin: 0;
  min-height: 1.5em;
  color: var(--life-muted);
  text-align: right;
}

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

.life-level-button {
  min-height: 58px;
  padding: 9px 12px;
  border: 1px solid var(--life-line-strong);
  border-radius: 0;
  background: #111;
  color: var(--life-cream);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    color 140ms ease;
}

.life-level-button strong,
.life-level-button span {
  display: block;
}

.life-level-button strong {
  margin-bottom: 4px;
  font-size: 1rem;
}

.life-level-button span {
  color: var(--life-muted);
  font-size: 0.82rem;
}

.life-level-button:hover,
.life-level-button:focus-visible {
  border-color: var(--life-orange);
  background: rgba(231, 111, 81, 0.09);
  outline: none;
  transform: translateY(-1px);
}

.life-level-button.is-active {
  border-color: var(--life-orange);
  background: var(--life-orange);
  color: #0e0e0e;
}

.life-level-button.is-active span {
  color: rgba(14, 14, 14, 0.75);
}

.life-game-round {
  min-height: 0;
  padding: 18px;
}

.life-game-content {
  display: grid;
  gap: 22px;
}

.life-clues-wrap {
  text-align: center;
}

.life-clues {
  width: min(760px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--life-line);
  background: #101010;
}

.life-clue-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 48px;
  padding: 8px 14px;
  border-right: 1px solid var(--life-line);
  border-bottom: 1px solid var(--life-line);
}

.life-clue-row:nth-child(2n) {
  border-right: 0;
}

.life-clue-row:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.life-clue-label {
  text-align: left;
  color: var(--life-muted);
}

.life-clue-label strong {
  color: var(--life-cream);
}

.life-clue-value {
  font-size: clamp(1.1rem, 2.5vw, 1.55rem);
  font-weight: 700;
  text-align: right;
}

.life-cards-wrap > .life-game-kicker {
  text-align: center;
  margin-bottom: 14px;
}

.life-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, var(--life-card-width));
  justify-content: center;
  gap: 14px;
}

.life-game-card {
  position: relative;
  width: var(--life-card-width);
  height: var(--life-card-crop-height);
  padding: 0;
  border: 2px solid var(--life-line-strong);
  border-radius: 16px;
  overflow: hidden;
  background-color: #0b0b0b;
  background-repeat: no-repeat;
  background-position: top center;
  background-size: var(--life-card-width) auto;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    opacity 140ms ease,
    filter 140ms ease;
}

.life-game-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 72%, rgba(0, 0, 0, 0.12));
  pointer-events: none;
}

.life-game-card:hover,
.life-game-card:focus-visible {
  border-color: var(--life-orange);
  outline: none;
  transform: translateY(-3px);
}

.life-game-card.is-wrong {
  border-color: var(--life-red);
  filter: saturate(0.55) brightness(0.72);
  cursor: default;
}

.life-game-card.is-wrong::before {
  content: "×";
  position: absolute;
  z-index: 2;
  top: 8px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: var(--life-red);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
}

.life-game-card.is-correct {
  border-color: var(--life-green);
  cursor: default;
}

.life-game-card:disabled {
  pointer-events: none;
}

.life-game-error {
  padding: 18px;
  border: 1px solid rgba(224, 82, 82, 0.55);
  background: rgba(224, 82, 82, 0.08);
  color: #ffd4d4;
}

.life-win-modal[hidden] {
  display: none;
}

.life-win-modal {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 10px;
}

.life-win-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.84);
  backdrop-filter: blur(6px);
}

.life-win-dialog {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100vw - 20px));
  max-height: calc(100dvh - 20px);
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto;
  gap: 22px;
  align-items: center;
  padding: 18px 20px;
  border: 1px solid var(--life-line-strong);
  background:
    linear-gradient(135deg, rgba(231, 111, 81, 0.1), transparent 40%),
    #111;
  color: var(--life-cream);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.life-win-copy {
  align-self: center;
}

.life-win-copy h2 {
  margin: 0 0 8px;
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  line-height: 0.95;
}

.life-win-name {
  margin: 0 0 14px;
  color: var(--life-muted);
  font-size: 1rem;
}

.life-win-score {
  margin: 0 0 24px;
  color: var(--life-orange);
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  font-weight: 700;
  line-height: 1;
}

.life-win-card {
  width: min(
    250px,
    calc((100dvh - 72px) * 0.71875)
  );
  max-height: calc(100dvh - 72px);
  aspect-ratio: 736 / 1024;
  justify-self: center;
  border-radius: 18px;
  background-color: #090909;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.life-win-close {
  min-width: 120px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--life-orange);
  border-radius: 0;
  background: var(--life-orange);
  color: #0e0e0e;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.life-win-close:hover,
.life-win-close:focus-visible {
  background: var(--life-cream);
  border-color: var(--life-cream);
  outline: none;
}

body.life-modal-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .life-game-layout {
    display: block;
  }

  .life-game-main {
    padding-top: 28px;
  }

  .life-game-panel-head {
    align-items: start;
    flex-direction: column;
  }

  .life-game-round-status {
    text-align: left;
  }
}

@media (max-width: 980px) {
  .life-cards-grid {
    grid-template-columns: repeat(2, var(--life-card-width));
  }
}

@media (max-width: 760px) {
  .life-game-levels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .life-clues {
    grid-template-columns: 1fr;
  }

  .life-clue-row,
  .life-clue-row:nth-child(2n),
  .life-clue-row:nth-last-child(-n + 2) {
    border-right: 0;
    border-bottom: 1px solid var(--life-line);
  }

  .life-clue-row:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 620px) {
  .life-cards-grid {
    grid-template-columns: var(--life-card-width);
  }

  :root {
    --life-card-width: 200px;
    --life-card-crop-height: 139px;
  }

  .life-game-main {
    padding-inline: 14px;
    padding-bottom: 48px;
  }

  .life-level-button {
    min-height: 78px;
    padding: 10px;
  }

  .life-game-round {
    padding-inline: 12px;
  }

  .life-clue-row {
    gap: 12px;
    padding-inline: 14px;
  }

  .life-win-dialog {
    width: min(430px, calc(100vw - 16px));
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
    text-align: center;
    overflow: auto;
  }

  .life-win-card {
    width: min(190px, calc((100dvh - 230px) * 0.71875));
    max-height: calc(100dvh - 230px);
    order: -1;
  }

  .life-win-score {
    margin-bottom: 14px;
  }

  .life-win-close {
    width: 100%;
  }
}

@media (max-width: 390px) {
  .life-game-levels {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .life-level-button,
  .life-game-card {
    transition: none;
  }
}
