:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #202124;
  background: #f5f5f3;
  line-height: 1.5;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f5f5f3; }
button, input { font: inherit; }
button { cursor: pointer; }

.app { width: min(100% - 32px, 760px); margin: 0 auto; padding: 32px 0 48px; }
.site-header { margin-bottom: 28px; }
h1 { margin: 0 0 8px; font-size: clamp(1.8rem, 7vw, 2.5rem); line-height: 1.1; letter-spacing: -0.02em; }
.site-header p { margin: 0; color: #5f6368; }

.progress-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; padding: 16px; background: #fff; border: 1px solid #ddd; border-radius: 12px; }
.progress-summary strong, .progress-summary span { display: block; }
.progress-summary strong { font-size: 1.1rem; }
.progress-summary span { color: #6b6f73; font-size: .9rem; }

.button { border: 0; border-radius: 8px; padding: 10px 14px; font-weight: 650; }
.button-primary { color: #fff; background: #202124; }
.button-primary:hover { background: #000; }
.button-secondary { color: #202124; background: #eee; }
.button-secondary:hover { background: #e2e2e2; }

.puzzle-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.puzzle-card { width: 100%; min-height: 86px; padding: 12px; text-align: left; background: #fff; border: 1px solid #ddd; border-radius: 10px; }
.puzzle-card:not(:disabled):hover { border-color: #999; }
.puzzle-card:focus-visible, .button:focus-visible, input:focus-visible { outline: 3px solid #9bb8ff; outline-offset: 2px; }
.puzzle-card:disabled { cursor: not-allowed; opacity: .65; }
.puzzle-number { display: block; font-weight: 700; }
.puzzle-status { display: block; margin-top: 4px; font-size: .84rem; color: #666; }
.puzzle-card.completed { border-color: #9dbda4; background: #f5faf6; }
.puzzle-card.available { border-color: #aaa; }


.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.puzzle-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.puzzle-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 58px;
}

.puzzle-icon {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 58px;
  object-fit: contain;
}

.puzzle-status {
  margin-top: 0;
}

.puzzle-panel-icon {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 74px;
  margin-bottom: 10px;
}

.puzzle-icon-panel {
  max-height: 72px;
  max-width: 110px;
}

.puzzle-icon-final {
  max-height: 84px;
}

.puzzle-panel > p {
  margin-top: 0;
}

.puzzle-panel { padding: 20px; background: #fff; border: 1px solid #ddd; border-radius: 12px; }
.puzzle-panel h2 { margin: 0 0 6px; font-size: 1.35rem; }
.puzzle-panel p { margin: 0 0 16px; color: #5f6368; }
.answer-form { display: flex; gap: 10px; }
.answer-input { min-width: 0; flex: 1; padding: 12px; border: 1px solid #b8b8b8; border-radius: 8px; background: #fff; }
.feedback { min-height: 24px; margin-top: 12px !important; font-weight: 650; }
.feedback.correct { color: #176b2c; }
.feedback.incorrect { color: #a33a2b; }

.question-list { margin: 0 0 18px; padding-left: 20px; }
.question-list li { margin: 7px 0; }
.question-list .done { color: #176b2c; }

.completion-screen { margin-top: 20px; }
.completion-card { padding: 32px 20px; text-align: center; background: #fff; border: 1px solid #ddd; border-radius: 12px; }
.completion-card h2 { margin: 0 0 8px; font-size: 2rem; }
.completion-card p:last-child { margin: 0; color: #5f6368; }
.eyebrow { margin: 0 0 6px; color: #6b6f73; font-size: .8rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.hidden { display: none !important; }
footer { margin-top: 24px; text-align: center; color: #777; }

@media (max-width: 520px) {
  .app { width: min(100% - 24px, 760px); padding-top: 24px; }
  .puzzle-grid { grid-template-columns: repeat(2, 1fr); }
  .answer-form { flex-direction: column; }
  .button-primary { width: 100%; }
}

.button-link {
  display: inline-block;
  text-decoration: none;
}

.error-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.error-page .completion-card {
  width: 100%;
}

.error-page .completion-card p:last-child {
  margin-top: 20px;
}

.code-entry { flex: 1; min-width: 0; }
.code-boxes { display: flex; gap: 8px; }
.code-box {
  width: 48px;
  height: 52px;
  padding: 0;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  border: 1px solid #b8b8b8;
  border-radius: 8px;
  background: #fff;
  caret-color: transparent;
}
.code-box:focus { border-color: #202124; outline: 3px solid #9bb8ff; outline-offset: 2px; }
.code-box.has-error { border-color: #a33a2b; }

@media (max-width: 520px) {
  .code-boxes { gap: 6px; }
  .code-box { width: 44px; height: 50px; }
}
