:root {
  --bg: #f4f7f5;
  --panel: #ffffff;
  --text: #17211d;
  --muted: #64706b;
  --line: #dce5df;
  --brand: #186a5e;
  --brand-dark: #104c43;
  --accent: #d98c3a;
  --danger: #b83d4a;
  --shadow: 0 18px 48px rgba(23, 33, 29, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(24, 106, 94, 0.10), transparent 38%),
    linear-gradient(315deg, rgba(217, 140, 58, 0.12), transparent 34%),
    var(--bg);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(960px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 32px 0;
}

.panel {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.intro-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 32px;
  padding: 40px;
  align-items: center;
}

.panel-copy {
  max-width: 520px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 16px;
  font-size: clamp(2.1rem, 5vw, 4.2rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.1;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 14px;
  font-size: 1.05rem;
}

.lead {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.start-form,
.answer-form {
  display: grid;
  gap: 14px;
}

label,
legend {
  color: var(--text);
  font-weight: 750;
}

fieldset {
  margin: 6px 0 0;
  padding: 0;
  border: 0;
}

input[type="text"] {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fbfdfc;
  outline: none;
}

input[type="text"]:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(24, 106, 94, 0.14);
}

.choice-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.choice-row label {
  position: relative;
}

.choice-row input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.choice-row span {
  display: grid;
  min-height: 46px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  cursor: pointer;
}

.choice-row input:checked + span {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.primary-button,
.secondary-button,
.unknown-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.primary-button {
  color: #fff;
  background: var(--brand);
}

.primary-button:hover {
  background: var(--brand-dark);
}

.secondary-button {
  color: var(--brand-dark);
  border-color: var(--line);
  background: #fff;
}

.unknown-button {
  width: 100%;
  color: var(--brand-dark);
  border-color: rgba(217, 140, 58, 0.35);
  background: rgba(217, 140, 58, 0.12);
}

.unknown-button:hover {
  border-color: var(--accent);
  background: rgba(217, 140, 58, 0.20);
}

.secondary-link {
  color: var(--brand-dark);
  font-weight: 750;
  text-decoration: none;
}

.secondary-link:hover,
.secondary-button:hover {
  text-decoration: underline;
}

.quiz-panel {
  max-width: 720px;
  padding: 28px;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.score-pill {
  min-width: 112px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--brand-dark);
  border: 1px solid rgba(24, 106, 94, 0.25);
  background: rgba(24, 106, 94, 0.09);
  text-align: center;
  font-weight: 800;
}

.photo-frame {
  width: 100%;
  aspect-ratio: 4 / 3;
  margin-bottom: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e8efeb;
}

.photo-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.answer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 10px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.result-panel {
  max-width: 760px;
  padding: 32px;
}

.result-summary {
  margin-bottom: 26px;
}

.result-summary p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.wrong-list-wrap {
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.wrong-list {
  display: grid;
  gap: 12px;
}

.wrong-item {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.wrong-item img {
  width: 86px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  background: #e8efeb;
}

.wrong-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.wrong-item strong {
  color: var(--text);
}

.empty-state {
  margin: 0;
  padding: 16px;
  border: 1px solid rgba(24, 106, 94, 0.24);
  border-radius: 8px;
  color: var(--brand-dark);
  background: rgba(24, 106, 94, 0.08);
  font-weight: 750;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.load-error {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 16px;
  border-radius: 8px;
  color: #fff;
  background: var(--danger);
  box-shadow: var(--shadow);
}

.hidden {
  display: none;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 24px, 960px);
    padding: 18px 0;
  }

  .intro-panel {
    grid-template-columns: 1fr;
    padding: 24px;
  }

  .quiz-panel,
  .result-panel {
    padding: 20px;
  }

  .quiz-header,
  .answer-row {
    grid-template-columns: 1fr;
  }

  .quiz-header {
    display: grid;
  }

  .score-pill {
    width: 100%;
  }

  .wrong-item {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .wrong-item img {
    width: 72px;
    height: 56px;
  }
}
