/* Офлайн и родители: карта дня (письмо, Сова, Кот, «Пых спит»), экраны после приключения, вход для взрослых
   и родительская зона — «тетрадь в клетку». Классы карты здесь, потому что их рисует main.js этого исполнителя. */

/* ---------- карта: что сегодня ---------- */
.today-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); gap: 18px; }
.today-list > :first-child { grid-column: 1 / -1; }
.today {
  grid-template-columns: auto 1fr; grid-template-areas: "hero label" "hero title";
  column-gap: 20px; row-gap: 2px; align-items: center; position: relative;
}
.today-hero { grid-area: hero; width: 84px; height: 84px; display: grid; place-items: center; background: #fff6ea; border: 2px solid rgba(31, 43, 61, .18); }
.today-hero .hero-body { display: block; width: 64px; height: 64px; background: var(--hero, var(--c-pyh)); }
.today-label { grid-area: label; align-self: end; }
.today-title { grid-area: title; align-self: start; }
.today-list > .today:not(:first-child) { min-height: 108px; padding: 16px 18px; }
.today-list > .today:not(:first-child) .today-title { font-size: 25px; }
.today-list > .today:not(:first-child) .today-hero { width: 70px; height: 70px; }
.today-list > .today:not(:first-child) .today-hero .hero-body { width: 52px; height: 52px; }

/* письмо от родителя: конверт «авиа» — полосатая кромка читается как письмо и без букв */
.today.is-letter {
  background: #fffaf0; color: var(--c-ink); border: 9px solid transparent;
  border-image: repeating-linear-gradient(-45deg, #d9574a 0 14px, #fffaf0 14px 22px, #2e6f9e 22px 36px, #fffaf0 36px 44px) 9;
  box-shadow: 0 6px 0 rgba(31, 43, 61, .35);
}
.today.is-letter:active { box-shadow: 0 2px 0 rgba(31, 43, 61, .35); }
.today.is-letter .today-label { font-weight: 700; color: #b2412f; opacity: 1; }
.today-env { background: none; border: 0; color: var(--c-ink); transform: rotate(-6deg); }
.today-env svg { width: 76px; height: 57px; }

.today.is-review { background: var(--c-sova); box-shadow: 0 6px 0 #6b4826; }
.today.is-review:active { box-shadow: 0 2px 0 #6b4826; }
.today.is-kot { background: var(--c-kot); color: var(--c-ink); box-shadow: 0 6px 0 #a8731f; }
.today.is-kot:active { box-shadow: 0 2px 0 #a8731f; }
.today.is-kot .today-hero .hero-body { border-radius: 30% 30% 46% 46% / 22% 22% 60% 60%; } /* уши-углы: «кошачий» силуэт */

/* Пых спит до завтра */
.sleep-card {
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: "pyh title" "pyh label"; column-gap: 24px; align-items: center;
  padding: 26px 30px; min-height: 150px; color: #eef3fa; position: relative; overflow: hidden;
  background: #24324a radial-gradient(circle at 92% 22%, #f6e3b8 0 26px, transparent 27px);
  box-shadow: 0 6px 0 #141d2c;
}
.sleep-card::after { content: ""; position: absolute; right: calc(8% - 14px); top: calc(22% - 30px); width: 50px; height: 50px; border-radius: 50%; background: #24324a; } /* месяц */
.sleep-card .today-title { grid-area: title; font-family: var(--f-title); font-size: 34px; line-height: 1.1; align-self: end; }
.sleep-card .today-label { grid-area: label; font-size: 17px; opacity: .85; align-self: start; max-width: 560px; }
.sleep-pyh { grid-area: pyh; position: relative; width: 96px; height: 96px; }
.sleep-pyh .hero-body { display: block; width: 84px; height: 72px; margin-top: 22px; background: var(--c-pyh); border-radius: 50% 50% 44% 44% / 62% 62% 38% 38%; }
.hero-body.is-asleep .hero-eye { height: 4%; top: 40%; border-radius: 2px; }
.hero-body.is-asleep .hero-mouth { width: 12%; left: 44%; }
.sleep-z { position: absolute; right: -16px; top: -6px; font-family: var(--f-title); font-size: 22px; color: #f6e3b8; animation: drift 3s ease-in-out infinite; }
.sleep-z i { font-style: normal; font-size: 17px; position: relative; top: 10px; margin-left: 2px; }
.sleep-z b { font-weight: 400; font-size: 13px; position: relative; top: 18px; margin-left: 2px; }
@keyframes drift { 50% { transform: translate(4px, -6px); opacity: .7; } }
.map.is-sleeping .zone-advs .adv { opacity: .45; cursor: default; }
.map-notice { margin: 0; padding: 14px 18px; background: #fff; border: 2px solid var(--c-oops); font-size: 17px; }

/* кнопка входа для взрослых: удержание заполняет её слева направо за 2 секунды */
.parent-gate { position: relative; overflow: hidden; touch-action: none; -webkit-touch-callout: none; min-height: 44px; white-space: nowrap; flex-shrink: 0; }
.parent-gate::before { content: ""; position: absolute; inset: 0; width: 0; background: rgba(46, 111, 158, .22); }
.parent-gate.is-holding::before { width: 100%; transition: width 2s linear; }

/* ---------- экраны после приключения ---------- */
.stage-bg.zone-letter { background-color: #fbf1df; }
.stage-bg.zone-night { background-color: #2b3a55; }
.letter-voice { display: grid; justify-items: center; gap: 22px; }
.letter-voice .today-hero { grid-area: auto; width: auto; height: auto; }
.letter-voice .today-env svg { width: 180px; height: 135px; }
.letter-play { width: 112px; height: 112px; border: 0; background: var(--c-pyh); color: #fff; box-shadow: 0 6px 0 #c4621d; display: grid; place-items: center; }
.letter-play svg { width: 56px; height: 56px; margin-left: 6px; }
.letter-play:active { transform: translateY(4px); box-shadow: 0 2px 0 #c4621d; }
.letter-play.is-playing { animation: bob .5s infinite alternate ease-in-out; }
.tired { position: relative; width: 140px; height: 120px; }
.tired .sleep-z { font-size: 54px; right: 0; top: 0; }
.tired .sleep-z i { font-size: 40px; top: 24px; } .tired .sleep-z b { font-size: 28px; top: 44px; }

/* ---------- вход для взрослых ---------- */
.gate, .parent {
  min-height: 100%; background-color: #fbfaf5;
  background-image: linear-gradient(rgba(46, 111, 158, .1) 1px, transparent 1px), linear-gradient(90deg, rgba(46, 111, 158, .1) 1px, transparent 1px);
  background-size: 24px 24px; user-select: text; -webkit-user-select: text;
}
.gate { display: grid; place-items: center; padding: 24px 16px; }
.gate-card { width: min(440px, 100%); background: #fff; border: 2px solid var(--c-ink); box-shadow: 6px 6px 0 var(--c-ink); padding: 26px 28px 24px; display: grid; gap: 12px; }
.gate-card h1 { margin: 0; font-family: var(--f-title); font-weight: 400; font-size: 30px; }
.gate-card p { margin: 0; }
.gate-q { font-family: var(--f-title); font-size: 46px; line-height: 1.1; }
.gate-input { font: inherit; font-size: 34px; font-weight: 700; width: 140px; min-height: 64px; padding: 4px 14px; border: 2px solid var(--c-ink); border-radius: 0; background: #fff; color: var(--c-ink); }
.gate-input:focus { outline: 3px solid var(--c-pyh); outline-offset: 2px; }
.gate-err { color: #b2412f; font-weight: 700; }
.gate-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.gate-actions button, .gate .gate-back { min-height: 52px; padding: 0 20px; border: 1.5px solid var(--c-ink); background: #fff; }

/* ---------- родительская зона: тетрадь в клетку с полями ---------- */
.parent { max-width: none; margin: 0; padding: 0; display: block; }
.p-sheet {
  max-width: 940px; margin: 0 auto; position: relative; display: grid; gap: 18px; align-content: start; min-height: 100vh; min-height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 48px 76px;
}
.p-sheet::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50px; width: 2px; background: rgba(217, 87, 74, .5); } /* красное поле */
.p-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.p-head h1 { font-family: var(--f-title); font-weight: 400; font-size: 34px; margin: 0; }
.parent button { min-height: 48px; padding: 0 16px; border: 1.5px solid var(--c-ink); background: #fff; color: var(--c-ink); border-radius: 0; }
.parent button:disabled { opacity: .5; cursor: default; }
.parent button:active:not(:disabled) { transform: translateY(2px); }
.parent h2 { font-family: var(--f-title); font-weight: 400; font-size: 26px; margin: 0 0 6px; }
.parent h3 { font-size: 17px; margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--c-muted); }
.parent p { line-height: 1.45; }

.p-tabs { display: flex; flex-wrap: wrap; border-bottom: 2px solid var(--c-ink); }
.parent .p-tabs button { border: 2px solid var(--c-ink); border-bottom: 0; margin: 0 -2px -2px 0; background: #e9f0f5; min-height: 52px; padding: 0 18px; font-weight: 700; }
.parent .p-tabs button[aria-selected="true"] { background: #fff; padding-bottom: 2px; position: relative; z-index: 1; box-shadow: inset 0 4px 0 var(--c-pyh); }
.p-count { display: inline-block; min-width: 24px; padding: 0 6px; margin-left: 4px; background: var(--c-pyh); color: #fff; font-size: 14px; line-height: 24px; text-align: center; }

.p-body { display: grid; gap: 12px; align-content: start; }
.p-body > h2:first-child, .p-body > .p-flash + h2 { margin-top: 6px; }
.p-hide { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.p-lead { font-size: 19px; margin: 0; max-width: 680px; }
.p-muted { color: var(--c-muted); font-size: 15px; }
.p-card { background: #fff; border: 1.5px solid var(--c-ink); box-shadow: 4px 4px 0 var(--c-ink); padding: 16px 20px; }
.p-card > :first-child { margin-top: 0; }
.p-card > :last-child { margin-bottom: 0; }
.p-card p { margin: 0 0 8px; }
.p-flash { margin: 0; padding: 12px 16px; background: #e3f3e8; border-left: 6px solid var(--c-ok); font-weight: 700; }
.p-err { margin: 0; color: #b2412f; font-weight: 700; }
.p-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.p-primary { background: var(--c-pyh) !important; color: #fff !important; border-color: #b85a17 !important; box-shadow: 0 4px 0 #b85a17; font-weight: 700; }
.p-danger { background: var(--c-oops) !important; color: #fff !important; border-color: #9e3227 !important; font-weight: 700; }
.p-danger-line { border-color: var(--c-oops) !important; color: #b2412f !important; font-weight: 700; }

/* отчёт */
.p-report { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 22px; align-items: start; }
.p-num { margin: 4px 0 10px !important; font-size: 18px; }
.p-num b { font-family: var(--f-title); font-weight: 400; font-size: 52px; line-height: .9; margin-right: 4px; vertical-align: -4px; }
.p-num span { color: var(--c-muted); }
.p-list { margin: 0 0 8px; padding-left: 22px; display: grid; gap: 6px; line-height: 1.4; }
.p-dinner { background: #fffaf0; transform: rotate(-.4deg); } /* листок на холодильник */
.p-dinner ol { counter-reset: q; list-style: none; padding: 0; }
.p-dinner li { counter-increment: q; padding-left: 34px; position: relative; }
.p-dinner li::before { content: counter(q); position: absolute; left: 0; top: -2px; font-family: var(--f-title); font-size: 24px; color: var(--c-pyh); }

/* выбор: цель, лимит, от кого */
.p-opts { display: flex; flex-wrap: wrap; gap: 10px; }
.parent .p-opt { font-weight: 500; }
.parent .p-opt[aria-pressed="true"] { background: var(--c-ink); color: #fff; font-weight: 700; }
.parent .p-opt[aria-pressed="true"]::before { content: "✓ "; }
.p-result { margin: 10px 0 0; padding: 12px 16px; background: #fff; border: 1.5px dashed var(--c-ink); font-size: 18px; }

/* письмо */
.p-letter { display: grid; gap: 16px; max-width: 680px; }
.p-field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.p-field > span, .p-field legend { font-weight: 700; padding: 0; }
.p-field small { font-weight: 500; color: var(--c-muted); }
.parent select, .parent textarea, .parent input[type="text"], .parent input:not([type]) {
  font: inherit; color: var(--c-ink); background: #fff; border: 1.5px solid var(--c-ink); border-radius: 0; min-height: 50px; padding: 8px 12px; width: 100%; max-width: 100%;
}
.parent textarea { resize: vertical; min-height: 76px; line-height: 1.4; }
.parent input[name="fromOwn"] { max-width: 320px; }
.p-radio { position: relative; }
.p-radio input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.p-radio span { display: grid; place-items: center; min-height: 48px; padding: 0 18px; border: 1.5px solid var(--c-ink); background: #fff; }
.p-radio input:checked + span { background: var(--c-ink); color: #fff; font-weight: 700; }
.p-radio input:focus-visible + span { outline: 3px solid var(--c-pyh); outline-offset: 2px; }
.p-rec audio { height: 44px; max-width: 100%; }
.p-rec.is-recording .p-rec-stop { background: var(--c-oops); color: #fff; border-color: #9e3227; }
.p-rec.is-recording .p-rec-stop::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; background: #fff; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.p-rec-status { font-weight: 700; min-height: 1.2em; }
.p-letter > .p-primary { justify-self: start; min-height: 56px; padding: 0 26px; }
.p-letters, .offline-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.p-letters li { display: grid; grid-template-columns: 1fr auto auto; gap: 8px 14px; align-items: center; padding: 12px 14px; background: #fff; border: 1.5px solid var(--c-line); }
.p-letters li.is-done { background: rgba(255, 255, 255, .6); }
.p-note { display: block; margin-top: 2px; }
.p-state { font-size: 15px; color: var(--c-muted); }
.p-letters li:not(.is-done) .p-state { color: var(--c-ok); font-weight: 700; }
.p-tag { display: inline-block; font-size: 13px; padding: 0 6px; border: 1px solid var(--c-ink); vertical-align: 2px; }

/* без экрана */
.offline-list li { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; padding: 14px 18px; border: 1.5px solid var(--c-ink); }
.offline-list li p { margin: 6px 0 0; }
.p-done { color: var(--c-muted); }

/* время и данные */
.p-alert { border-color: #24324a; background: #eef1f7; }
.p-wipe { border-color: var(--c-oops); box-shadow: 4px 4px 0 var(--c-oops); }
.p-confirm { padding: 14px 16px; margin-bottom: 10px; background: #fdecea; border: 2px solid var(--c-oops); }
.p-confirm p { margin: 0 0 10px; }
.p-asr-status { margin: 8px 0 0 !important; min-height: 1.2em; }

@media (max-width: 700px) {
  .today-list { gap: 14px; }
  .today { column-gap: 14px; padding: 18px; }
  .today .today-title { font-size: 26px; }
  .today-hero { width: 66px; height: 66px; } .today-hero .hero-body { width: 50px; height: 50px; }
  .today-list > .today:not(:first-child) .today-hero { width: 60px; height: 60px; }
  .today-list > .today:not(:first-child) .today-hero .hero-body { width: 44px; height: 44px; }
  .today-env svg { width: 60px; height: 45px; }
  .sleep-card { grid-template-columns: 1fr; grid-template-areas: "pyh" "title" "label"; row-gap: 8px; padding: 22px; }
  .sleep-card .today-title { font-size: 28px; }
  .p-sheet { padding-left: 34px; padding-right: 16px; gap: 14px; }
  .p-sheet::before { left: 18px; }
  .p-head h1 { font-size: 28px; }
  .p-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 0; gap: 0; }
  .parent .p-tabs button { border-bottom: 2px solid var(--c-ink); margin: 0 -2px -2px 0; padding: 0 6px; font-size: 16px; }
  .parent .p-tabs button[aria-selected="true"] { padding-bottom: 0; }
  .p-report { grid-template-columns: 1fr; }
  .p-card { padding: 14px 16px; box-shadow: 3px 3px 0 var(--c-ink); }
  .p-letters li { grid-template-columns: 1fr auto; }
  .p-letters li > div { grid-column: 1 / -1; }
  .offline-list li { grid-template-columns: 1fr; }
  .offline-list li button { justify-self: start; }
  .gate-q { font-size: 40px; }
}
.p-plan { margin: 0 0 14px; padding: 10px 14px; border: 1.5px dashed var(--c-line, rgba(34,48,74,.25)); font-size: 15px; line-height: 1.45; }
