:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --ink: #151715;
  --muted: #626861;
  --line: #dde3df;
  --panel: #ffffff;
  --panel-strong: #eef3f0;
  --accent: #d92d3f;
  --accent-dark: #9f1828;
  --gold: #d7a928;
  --green: #147a55;
  --soft-green: #e9f4ee;
  --soft-red: #fff0f2;
  --shadow: 0 18px 46px rgba(18, 23, 19, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  min-height: 100vh;
  min-height: 100svh;
  color: var(--ink);
  background:
    linear-gradient(145deg, rgba(217, 45, 63, 0.07), transparent 38%),
    linear-gradient(320deg, rgba(20, 122, 85, 0.09), transparent 45%),
    var(--bg);
  font-family: Arial, Helvetica, sans-serif;
}

button {
  font: inherit;
}

.app {
  width: min(1040px, calc(100% - 32px));
  height: 100vh;
  height: 100svh;
  margin: 0 auto;
  display: grid;
  align-items: center;
  padding: 14px 0;
}

.screen {
  width: 100%;
  height: calc(100vh - 28px);
  height: calc(100svh - 28px);
  min-height: 0;
}

.hidden {
  display: none !important;
}

.start-screen {
  display: grid;
  place-items: center;
}

.intro,
.game-panel,
.result-screen {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.intro {
  width: min(760px, 100%);
  min-height: min(620px, 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.04;
  letter-spacing: 0;
}

h1 {
  max-width: 720px;
  margin: 0 auto;
  font-size: 4.4rem;
}

h2 {
  font-size: 2.8rem;
}

.intro-copy {
  max-width: 600px;
  margin: 22px auto 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.6;
}

.start-meta {
  width: min(560px, 100%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 28px auto 0;
}

.start-meta span {
  min-height: 64px;
  display: grid;
  place-items: center;
  padding: 10px;
  border: 1px solid rgba(18, 23, 19, 0.08);
  border-radius: 8px;
  background: rgba(238, 245, 236, 0.78);
  color: var(--muted);
  line-height: 1.25;
}

.start-meta strong {
  color: var(--ink);
}

.start-actions {
  width: min(440px, 100%);
  display: grid;
  gap: 12px;
  margin: 30px auto 0;
}

.start-actions .button {
  min-height: 56px;
}

.start-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 800;
  color: var(--ink);
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(18, 23, 19, 0.12);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}

.primary:hover {
  background: linear-gradient(135deg, #e22e40, var(--accent-dark));
}

.secondary {
  background: #eef5ec;
  border: 1px solid rgba(18, 23, 19, 0.08);
}

.ghost {
  background: transparent;
  border: 1px solid var(--line);
}

.game-screen {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "header"
    "portrait"
    "panel";
  gap: 14px;
  align-content: stretch;
}

.game-header {
  grid-area: header;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.score-pill {
  min-width: 86px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #121713;
  color: #fff;
  text-align: center;
  font-weight: 800;
}

.portrait-stage {
  grid-area: portrait;
  position: relative;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  aspect-ratio: auto;
  overflow: hidden;
  border: 10px solid #fff;
  border-radius: 8px;
  background: #111614;
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
}

.portrait-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 4 / 5;
  transform: scale(var(--zoom, 2.05));
  transform-origin: var(--focus-x, 50%) var(--focus-y, 45%);
  filter: saturate(0.95) contrast(1.04);
  transition: transform 320ms ease, filter 320ms ease;
}

.portrait-image.revealed {
  object-fit: contain;
  background: #111614;
  transform: scale(1);
  filter: none;
}

.reveal-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--gold);
  font-weight: 800;
}

.game-panel {
  grid-area: panel;
  align-self: end;
  padding: 18px;
  box-shadow: 0 12px 32px rgba(18, 23, 19, 0.08);
  display: flex;
  flex-direction: column;
}

.attempt-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  color: var(--muted);
  font-weight: 700;
}

.choices-wrap {
  display: grid;
  gap: 10px;
}

.choices-wrap p {
  margin: 0;
  font-weight: 800;
}

.choices-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.choice-button {
  width: 100%;
  min-height: 54px;
  border: 1px solid rgba(21, 23, 21, 0.1);
  border-radius: 8px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #ffffff, #f8faf8);
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  text-align: left;
  box-shadow: 0 8px 18px rgba(18, 23, 19, 0.05);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, background 160ms ease;
}

.choice-button:hover {
  border-color: rgba(217, 45, 63, 0.36);
  box-shadow: 0 12px 24px rgba(18, 23, 19, 0.1);
  transform: translateY(-1px);
}

.choice-button:disabled {
  cursor: not-allowed;
  transform: none;
}

.choice-button.correct {
  border-color: rgba(20, 122, 85, 0.42);
  background: var(--soft-green);
  color: var(--green);
}

.choice-button.wrong {
  border-color: rgba(217, 45, 63, 0.35);
  background: var(--soft-red);
  color: var(--accent-dark);
  opacity: 0.72;
}

.choice-button:focus-visible {
  outline: 3px solid rgba(217, 45, 63, 0.22);
  outline-offset: 2px;
}

.feedback {
  min-height: 26px;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.feedback.good {
  color: var(--green);
  font-weight: 800;
}

.feedback.bad {
  color: var(--accent-dark);
  font-weight: 800;
}

#next-button {
  width: 100%;
  margin-top: auto;
}

.result-screen {
  max-width: 760px;
  margin: 0 auto;
  min-height: min(620px, 100%);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.result-score {
  margin: 28px auto;
  display: grid;
  gap: 10px;
}

.result-score span {
  font-size: 7rem;
  font-weight: 900;
  line-height: 0.9;
  color: var(--accent);
}

.result-score strong {
  font-size: 2rem;
}

.share-text {
  max-width: 520px;
  margin: 0 auto 20px;
  color: var(--muted);
  line-height: 1.5;
}

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

#restart-button {
  margin-top: 16px;
}

@media (max-width: 760px) {
  .app {
    width: min(100% - 20px, 680px);
    padding: 10px 0;
  }

  .screen {
    height: calc(100vh - 20px);
    height: calc(100svh - 20px);
  }

  .intro {
    min-height: 100%;
    padding: 22px;
  }

  h1 {
    font-size: 3.1rem;
  }

  h2 {
    font-size: 2rem;
  }

  .start-meta {
    grid-template-columns: 1fr;
    margin-top: 22px;
  }

  .start-meta span {
    min-height: 48px;
  }

  .game-screen {
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 10px;
  }

  .game-header {
    align-items: center;
  }

  .portrait-stage {
    min-height: 0;
    border-width: 6px;
  }

  .attempt-row,
  .game-header {
    flex-direction: column;
  }

  .score-pill {
    align-self: stretch;
  }

  .choices-grid,
  .share-grid {
    grid-template-columns: 1fr;
  }

  .result-screen {
    min-height: 100%;
    padding: 24px;
  }

  .result-score span {
    font-size: 5rem;
  }

  .result-score strong {
    font-size: 1.5rem;
  }
}

@media (max-width: 420px) {
  .app {
    width: min(100% - 16px, 680px);
    padding: 8px 0;
  }

  .screen {
    height: calc(100vh - 16px);
    height: calc(100svh - 16px);
  }

  .intro {
    padding: 18px;
  }

  h1 {
    font-size: 2.45rem;
  }

  h2 {
    font-size: 1.7rem;
  }

  .intro-copy {
    font-size: 1rem;
  }

  .game-screen {
    gap: 8px;
  }

  .game-panel {
    padding: 12px;
  }

  .choice-button {
    min-height: 48px;
    padding: 11px 13px;
  }
}
