/* Тренажёр состава числа: крупные окошки и клавиатура под палец. */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  --bg1: #f3f0e4;
  --bg2: #e7e0c8;
  --ink: #3a3320;
  --card: #fffdf5;
  --frame: #5a8835;
  --roof: #c8d8a4;
  --roof-ink: #2f5320;
  --line: #a8bc80;
  --accent: #4a6b2a;
  --accent-bg: #c8d8a4;
  --ok: #3f8a2e;
  --bad: #c0392b;

  margin: 0; min-height: 100vh; padding: 18px 12px 40px;
  background: linear-gradient(180deg, var(--bg1) 0%, var(--bg2) 100%);
  font-family: Georgia, 'Times New Roman', serif; color: var(--ink);
}

.wrap { max-width: 640px; margin: 0 auto; }
h1 { font-size: 28px; margin: 4px 0 8px; text-align: center; color: var(--accent); }
h2 { font-size: 23px; margin: 4px 0 8px; text-align: center; color: var(--accent); }

.lead { text-align: center; font-size: 15px; line-height: 1.5; margin: 0 auto 16px; max-width: 560px; opacity: .9; }
.lead.small { font-size: 13.5px; margin-top: 22px; }
.lead a { color: var(--frame); }

.screen {
  background: var(--card); border: 1.5px solid #b8862c; border-radius: 16px;
  padding: 20px 18px 24px; box-shadow: 0 10px 30px rgba(0,0,0,.12);
}

/* ---------- меню ---------- */
.menu-grid { display: grid; gap: 12px; margin: 16px 0 20px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.big-btn {
  font-family: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 16px 14px; border-radius: 14px; border: 1.5px solid var(--frame);
  background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(0,0,0,.02)); color: var(--ink);
}
.big-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.big-btn b { font-size: 16px; }
.big-btn small { font-size: 12.5px; opacity: .8; text-align: center; }
.big-emoji { font-size: 34px; line-height: 1; text-align: center; }

.opts { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.opt-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.opt-label { font-size: 14px; opacity: .75; }
.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 6px 13px; border-radius: 999px; border: 1.4px solid var(--line); font-size: 14px; }
.chip input:checked + span { background: var(--accent-bg); border-color: var(--accent); font-weight: 700; }
.stats { margin-top: 18px; text-align: center; font-size: 13.5px; opacity: .85; min-height: 20px; }

/* ---------- тренажёр ---------- */
.play-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.progress { font-size: 14px; opacity: .8; }
.status { text-align: center; font-size: 17px; font-weight: 700; min-height: 26px; margin: 10px 0; }
.status.ok { color: var(--ok); }
.status.bad { color: var(--bad); }

.house-holder { display: flex; justify-content: center; }
.house { width: min(320px, 86vw); }

.roof {
  height: 74px; position: relative; display: flex; align-items: flex-end; justify-content: center;
}
.roof::before {
  content: ""; position: absolute; inset: 0; background: var(--roof);
  clip-path: polygon(50% 0, 100% 100%, 0 100%); border-bottom: 2px solid var(--frame);
}
.roof span { position: relative; z-index: 2; font-size: 34px; font-weight: 700; color: var(--roof-ink); padding-bottom: 4px; }

.floors { border: 2px solid var(--frame); border-top: none; }
.floor { display: flex; align-items: stretch; border-top: 1.4px solid var(--line); min-height: 56px; }
.floor:first-child { border-top: none; }
.floor.done { background: rgba(200, 216, 164, .35); }

.win {
  flex: 1 1 0; display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; background: rgba(255,255,255,.75);
}
.win + .win { border-left: 1.4px solid var(--line); }
.win.blank { color: #b8a86c; cursor: pointer; }
.win.active { background: #fff6d8; box-shadow: inset 0 0 0 3px var(--accent); }
.win.filled { color: var(--ok); }
.win.wrong { animation: shake .32s; background: #f6d7d2; color: var(--bad); }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
.sub-line {
  flex: 0 0 40%; display: flex; align-items: center; justify-content: center; gap: 4px;
  border-left: 1.4px dashed #b8a86c; font-size: 17px; color: #6a5a35;
}

/* ---------- клавиатура ---------- */
.keypad { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 18px auto 0; max-width: 420px; }
.key {
  font-family: inherit; cursor: pointer; width: 54px; height: 54px; border-radius: 12px;
  border: 1.6px solid var(--frame); background: #fffdf5; color: var(--ink);
  font-size: 22px; font-weight: 700;
}
.key:hover { background: var(--accent-bg); }
.key:disabled { opacity: .35; cursor: not-allowed; }

/* ---------- кнопки ---------- */
.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.btn {
  font-family: inherit; font-size: 15px; cursor: pointer; padding: 10px 18px; border-radius: 10px;
  border: 1.5px solid var(--frame); background: rgba(255,255,255,.5); color: var(--ink);
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent-bg); border-color: var(--accent); font-weight: 700; }
.btn.ghost { border-style: dashed; opacity: .85; }
.btn.small { font-size: 13px; padding: 6px 12px; }

@media (max-width: 480px) {
  h1 { font-size: 23px; }
  .screen { padding: 14px 10px 18px; }
  .key { width: 48px; height: 48px; font-size: 20px; }
  .roof { height: 62px; }
  .roof span { font-size: 28px; }
  .floor { min-height: 50px; }
  .win { font-size: 22px; }
}
