:root {
  color-scheme: light;
  --ink: #26352f;
  --muted: #69766f;
  --green: #245c46;
  --green-dark: #194633;
  --green-soft: #e8f1e9;
  --paper: #fffefa;
  --canvas: #f7f5ef;
  --line: #dce3d9;
  --gold: #f0c66a;
  --shadow: 0 18px 50px rgba(37, 55, 44, .08);
  font-family: ui-rounded, "Avenir Next", Avenir, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button { font: inherit; }

.site-header {
  min-height: 78px;
  padding: 0 clamp(22px, 7vw, 110px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(38, 53, 47, .08);
  background: rgba(255, 254, 250, .8);
}

.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-weight: 800; letter-spacing: -.04em; }
.brand-mark { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 12px; background: var(--green); color: white; font-size: 20px; }
.brand-name { font-size: 19px; }
.brand-name span { color: var(--green); }
.header-note { color: var(--muted); font-size: 13px; }

main { width: min(1120px, calc(100% - 40px)); margin: 54px auto 70px; }
.intro { max-width: 670px; margin: 0 auto 34px; text-align: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; margin: 0 0 13px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
h1 { margin: 0; font-size: clamp(36px, 5vw, 56px); line-height: 1.04; letter-spacing: -.055em; }
.intro p { margin: 17px 0 0; color: var(--muted); font-size: 17px; line-height: 1.65; }
.intro .solved-counter { margin-top: 13px; color: var(--green); font-size: 14px; font-weight: 650; }
.intro .generated-counter { margin-top: 5px; color: var(--muted); font-size: 14px; font-weight: 650; }
.solved-counter strong, .generated-counter strong { font-size: 17px; }
.difficulty-statistics { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.difficulty-statistics li { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 12px; }
.difficulty-statistics strong { font-size: 13px; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .8fr); gap: 22px; align-items: stretch; }
.card { border: 1px solid rgba(38, 53, 47, .08); border-radius: 22px; background: var(--paper); box-shadow: var(--shadow); }
.mural-card { padding: clamp(22px, 4vw, 42px); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.section-label { margin: 0 0 5px; color: var(--muted); font-size: 13px; font-weight: 650; }
h2 { margin: 0; font-size: 23px; letter-spacing: -.035em; }
.pill { max-width: 55%; padding: 8px 11px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 12px; font-weight: 750; text-align: center; }

.difficulty-control { max-width: 430px; margin: 26px auto 0; }
.difficulty-control label { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-bottom: 8px; color: var(--ink); font-size: 13px; font-weight: 750; }
.difficulty-control output { color: var(--green); }
.difficulty-control input { width: 100%; margin: 0; accent-color: var(--green); cursor: pointer; }
.difficulty-control input:focus-visible { outline: 3px solid rgba(36, 92, 70, .3); outline-offset: 4px; }
.difficulty-labels { display: flex; justify-content: space-between; margin-top: 3px; color: var(--muted); font-size: 11px; }

.wall-wrap { min-height: 370px; padding: 33px 8px 26px; display: flex; align-items: center; justify-content: center; }
.wall { --brick-gap: 8px; width: min(100%, 490px); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.wall-row { width: 100%; display: flex; justify-content: center; gap: var(--brick-gap); }
.brick {
  min-width: 0;
  max-width: 94px;
  height: clamp(40px, 9vw, 70px);
  flex: 1;
  display: grid;
  place-items: center;
  border: 2px solid #d8b66a;
  border-radius: 11px 11px 6px 6px;
  background: #fff3d3;
  box-shadow: inset 0 -4px rgba(221, 184, 104, .16);
}
.brick input { width: 100%; height: 100%; padding: 0 2px; border: 0; outline: 0; background: transparent; color: var(--ink); caret-color: transparent; font: inherit; font-size: clamp(11px, 4vw, 22px); font-weight: 760; text-align: center; }
.brick input::placeholder { color: #b9a779; opacity: 1; }
.brick:focus-within { outline: 3px solid rgba(36, 92, 70, .24); border-color: var(--green); }
.brick.selected { outline: 3px solid rgba(36, 92, 70, .24); border-color: var(--green); }
.brick.correct { border-color: #69a77d; background: #e9f6eb; }
.brick.incorrect { border-color: #d68572; background: #fff0eb; }

.number-pad { width: min(100%, 520px); margin: 0 auto 24px; padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: #f8f9f5; text-align: center; }
.number-pad[hidden] { display: none; }
.number-pad-hint { margin: 0 0 10px; color: var(--muted); font-size: 12px; }
.number-pad-navigation { display: flex; justify-content: center; gap: 8px; margin-bottom: 8px; }
.number-pad-digits { display: flex; justify-content: center; gap: 7px; overflow-x: auto; padding: 3px; }
.number-pad-actions { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.number-key { flex: 0 0 38px; width: 38px; height: 38px; padding: 0; border: 1px solid transparent; border-radius: 50%; color: var(--ink); font-size: 16px; font-weight: 700; cursor: pointer; }
.number-pad-digits .number-key:nth-child(5n + 1) { background: #fde2dc; }
.number-pad-digits .number-key:nth-child(5n + 2) { background: #ffedc2; }
.number-pad-digits .number-key:nth-child(5n + 3) { background: #dff1d9; }
.number-pad-digits .number-key:nth-child(5n + 4) { background: #dcecf9; }
.number-pad-digits .number-key:nth-child(5n) { background: #eee2f6; }
.number-pad-digits .number-key:hover { filter: brightness(.95); }
.number-pad-navigation .number-key, .number-pad-actions .number-key { flex: 0 0 auto; width: auto; height: auto; min-height: 34px; padding: 0 13px; border-color: var(--line); border-radius: 999px; background: white; font-size: 13px; }
.number-pad-navigation .number-key:disabled { color: #a2aaa4; background: #f0f1ed; cursor: default; }
.number-pad-navigation .number-key:hover:not(:disabled), .number-pad-actions .number-key:hover { border-color: var(--green); background: var(--green-soft); }
.number-key:focus-visible { outline: 3px solid rgba(36, 92, 70, .3); outline-offset: 2px; }
.number-pad-success-message { margin: 0 0 14px; color: var(--green); font-size: 17px; font-weight: 750; }
.number-pad-success-actions { display: flex; justify-content: center; gap: 8px; }
.number-pad-success-actions .number-key { flex: 0 0 auto; width: auto; height: auto; min-height: 38px; padding: 0 15px; border-color: var(--line); border-radius: 999px; background: white; font-size: 13px; }
.number-pad-success-actions .number-key:hover { border-color: var(--green); background: var(--green-soft); }

.feedback { min-height: 24px; margin: -7px 0 18px; color: var(--green); text-align: center; font-size: 14px; font-weight: 700; }
.feedback.error { color: #a84e3d; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.button { min-height: 47px; padding: 0 19px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); font-weight: 750; cursor: pointer; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.button:hover { transform: translateY(-1px); border-color: #b7c8ba; }
.button-primary { border-color: var(--green); background: var(--green); color: white; }
.button-primary:hover { border-color: var(--green-dark); background: var(--green-dark); }
.button:focus-visible { outline: 3px solid rgba(36, 92, 70, .3); outline-offset: 2px; }

.side-card { padding: 28px; display: flex; flex-direction: column; }
.side-icon { width: 43px; height: 43px; margin-bottom: 20px; display: grid; place-items: center; border-radius: 14px; background: #fff3d3; font-size: 21px; }
.side-card h2 { font-size: 21px; }
.side-card > p { margin: 11px 0 22px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.rule { padding: 16px; border-radius: 14px; background: #f6f7f2; }
.rule strong { display: block; margin-bottom: 5px; font-size: 13px; }
.rule p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.example { margin: auto 0 0; padding-top: 22px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.example b { color: var(--green); }

footer { padding: 20px; color: #859089; text-align: center; font-size: 12px; }
@media (max-width: 760px) {
  main { margin-top: 38px; }
  .workspace { grid-template-columns: 1fr; }
  .wall-wrap { min-height: 315px; }
  .side-card { min-height: 250px; }
  .example { margin-top: 20px; }
}
@media (max-width: 460px) {
  .site-header { min-height: 66px; padding: 0 18px; }
  .header-note { display: none; }
  main { width: min(100% - 24px, 1120px); margin-top: 32px; }
  .intro p { font-size: 15px; }
  .mural-card { padding: 20px 14px; }
  .wall { --brick-gap: 6px; gap: 6px; }
  .button { flex: 1 1 auto; padding: 0 12px; }
}
@media print {
  @page { margin: 16mm; }
  body { background: white; }
  .site-header { min-height: auto; padding: 0 0 12px; border-bottom: 1px solid #aaa; }
  .header-note, .intro, .side-card, footer, .actions, .feedback { display: none !important; }
  main { width: 100%; margin: 22px auto; }
  .workspace { display: block; }
  .mural-card { padding: 24px; border: 1px solid #aaa; box-shadow: none; }
  .card-top { justify-content: center; text-align: center; }
  .pill { display: none; }
  .wall-wrap { min-height: 390px; }
  .brick { background: white; box-shadow: none; border-color: #555; }
  .brick input { color: #111; }
}
