:root {
  color-scheme: light;
  --bg: #fff8ef;
  --card: #ffffff;
  --ink: #2a2238;
  --muted: #6f6680;
  --line: #efe5d8;
  --brand: #6d28d9;
  --brand-2: #8b5cf6;
  --brand-soft: #f1eafe;
  --amber: #f59e0b;
  --amber-soft: #fff3d6;
  --green: #16a34a;
  --green-soft: #e3f8e9;
  --red: #dc2626;
  --water: #0ea5e9;
  --water-soft: #e0f4fd;
  --c-veg: #22c55e;
  --c-prot: #f97316;
  --c-carb: #eab308;
  --c-fruit: #ec4899;
  --c-treat: #a855f7;
  --c-drink: #0ea5e9;
  --c-dish: #f97316;
  --l0: #4ade80;
  --l1: #bef264;
  --l2: #fde047;
  --l3: #fb923c;
  --l4: #f43f5e;
  --radius: 22px;
  --shadow: 0 1px 0 rgba(42, 34, 56, .04), 0 8px 24px -12px rgba(42, 34, 56, .18);
  --tabbar: 72px;
  --font: ui-rounded, 'SF Pro Rounded', 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

/* ---------- каркас ---------- */
.app {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 8px) 16px calc(var(--tabbar) + env(safe-area-inset-bottom) + 24px);
  min-height: 100dvh;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 0 12px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-badge {
  width: 40px; height: 40px; border-radius: 14px; flex: none;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; color: #fff; font-size: 22px;
  box-shadow: 0 6px 14px -6px var(--brand);
}
.brand > div:last-child { min-width: 0; }
.brand h1 { font-size: 1.05rem; font-weight: 800; }
.brand .sub { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stars-chip {
  display: flex; align-items: center; gap: 6px; flex: none;
  background: var(--amber-soft); color: #92400e; font-weight: 800;
  padding: 8px 12px; border-radius: 999px; font-size: .95rem;
}
.stars-chip .rank-emoji { font-size: 1.05rem; }

.view { display: grid; gap: 14px; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head .hint { font-size: .8rem; color: var(--muted); }
.section-title { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 4px -4px; }

/* ---------- нижняя навигация ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabbar-inner { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; }
.tab {
  display: grid; justify-items: center; gap: 2px; padding: 6px 4px; border-radius: 16px;
  font-size: .72rem; font-weight: 700; color: var(--muted);
}
.tab .ico { font-size: 1.4rem; line-height: 1; filter: grayscale(.6); opacity: .8; transition: transform .2s; }
.tab[aria-current='page'] { color: var(--brand); background: var(--brand-soft); }
.tab[aria-current='page'] .ico { filter: none; opacity: 1; transform: translateY(-1px) scale(1.08); }

/* ---------- сцена с маскотами ---------- */
.stage {
  position: relative; overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 120%, #ffe8c7 0%, transparent 60%),
    linear-gradient(180deg, #efe6ff 0%, #fff4e4 100%);
  border-radius: 28px; padding: 14px 14px 6px; border: 1px solid #eadff7;
  box-shadow: var(--shadow);
}
.bubble {
  position: relative; background: #fff; border-radius: 20px; padding: 12px 14px;
  font-size: .98rem; font-weight: 600; min-height: 64px;
  box-shadow: 0 6px 18px -10px rgba(76, 29, 149, .4);
}
.bubble .who { display: block; font-size: .74rem; font-weight: 800; color: var(--brand); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.bubble::after {
  content: ''; position: absolute; bottom: -9px; width: 18px; height: 18px; background: #fff;
  transform: rotate(45deg); border-radius: 3px; left: var(--tail, 22%);
  transition: left .3s ease;
}
.mascots { display: flex; justify-content: space-around; align-items: flex-end; margin-top: 6px; }
.mascot-btn { position: relative; display: grid; justify-items: center; gap: 0; padding: 4px; border-radius: 20px; }
.mascot-btn .name { font-size: .78rem; font-weight: 800; color: var(--muted); margin-top: -4px; }
.mascot { display: block; overflow: visible; }
.stage .mascot.medok { width: clamp(90px, 24vw, 136px); height: auto; }
.stage .mascot.pusya { width: clamp(104px, 28vw, 160px); height: auto; }
.mascot .m-body { transform-origin: 50% 90%; transform-box: fill-box; }
.mascot.mood-cheer .m-body { animation: hop 1.1s ease-in-out infinite; }
.mascot.mood-happy .m-body { animation: breathe 3.5s ease-in-out infinite; }
.mascot.mood-calm .m-body { animation: breathe 4.5s ease-in-out infinite; }
.mascot.mood-think .m-body { animation: tilt 3s ease-in-out infinite; }
.mascot .m-eyes { animation: blink 5s infinite; transform-origin: center; transform-box: fill-box; }
.mascot .m-sparkles { animation: twinkle 1.4s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
.wiggle .m-body { animation: wiggle .6s ease !important; }
@keyframes breathe { 50% { transform: scale(1.025, .985); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-8px) scale(1.02, .98); } 60% { transform: translateY(0) scale(1.03, .96); } }
@keyframes tilt { 50% { transform: rotate(-3deg); } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
@keyframes twinkle { 50% { opacity: .35; transform: scale(.85); } }
@keyframes wiggle { 20% { transform: rotate(-7deg); } 45% { transform: rotate(6deg); } 70% { transform: rotate(-3deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- быстрые действия ---------- */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.qbtn {
  display: grid; justify-items: center; align-content: center; gap: 4px;
  min-height: 92px; padding: 10px 4px; border-radius: 22px; font-weight: 800; font-size: .86rem;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform .12s ease;
}
.qbtn:active { transform: scale(.96); }
.qbtn .ico { font-size: 1.9rem; line-height: 1; }
.qbtn.meal { background: linear-gradient(160deg, #fff, #fff1e0); }
.qbtn.skin { background: linear-gradient(160deg, #fff, #f1eafe); }
.qbtn.water { background: linear-gradient(160deg, #fff, #e0f4fd); }
.qbtn.clue { background: linear-gradient(160deg, #fff, #e3f8e9); }

.skin-quick { display: flex; gap: 10px; align-items: center; }
.skin-quick .q { flex: 1; }
.pill-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 16px; border-radius: 16px; font-weight: 800; min-height: 48px;
  background: var(--brand); color: #fff; box-shadow: 0 8px 18px -10px var(--brand);
}
.pill-btn.soft { background: var(--brand-soft); color: var(--brand); box-shadow: none; }
.pill-btn.ghost { background: transparent; color: var(--brand); box-shadow: none; border: 1.5px solid #ddd0f7; }
.pill-btn.green { background: var(--green); box-shadow: 0 8px 18px -10px var(--green); }
.pill-btn.danger { background: #fee2e2; color: var(--red); box-shadow: none; }
.pill-btn.block { width: 100%; }
.pill-btn:disabled { opacity: .5; }
.link-btn { color: var(--brand); font-weight: 800; font-size: .9rem; }

/* ---------- тарелка и вода ---------- */
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.plate-wrap { display: grid; justify-items: center; gap: 8px; }
.plate-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: .78rem; font-weight: 700; }
.plate-legend span { display: flex; align-items: center; gap: 4px; opacity: .45; }
.plate-legend span.on { opacity: 1; }
.glasses { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; justify-items: center; margin: 4px 0 8px; }
.glass { width: 38px; height: 46px; position: relative; }
.glass svg { width: 100%; height: 100%; }
.water-count { text-align: center; font-weight: 800; font-size: .9rem; }
.drink-btns { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 10px 0 6px; }
.sweet-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; }
.center { text-align: center; }
.answer { margin-top: 6px; }
.answer summary { display: inline-block; cursor: pointer; font-weight: 800; color: var(--brand); padding: 4px 10px; border-radius: 999px; background: #f3edff; list-style: none; }
.answer summary::-webkit-details-marker { display: none; }
.answer[open] summary { display: none; }
.answer[open] { font-weight: 800; color: var(--brand); }
.rate { display: flex; gap: 8px; margin-top: 8px; }
.rate-btn { font-size: 1.35rem; width: 42px; height: 38px; border-radius: 12px; background: #fff; border: 1.5px solid var(--line); opacity: .75; }
.rate-btn[aria-pressed='true'] { opacity: 1; border-color: var(--brand); background: #f3edff; }
.rate-btn.pop { animation: pop .25s ease; }
@keyframes pop { 50% { transform: scale(1.18); } }
@media (prefers-reduced-motion: reduce) { .rate-btn.pop { animation: none; } }
.wtext { display: block; min-width: 0; }
.rtable { width: 100%; border-collapse: collapse; font-size: .9rem; }
.rtable th, .rtable td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.rtable .num, .rtable th:not(:first-child) { text-align: center; font-variant-numeric: tabular-nums; }
.rtable tfoot td { font-weight: 800; }
.tap-hint { text-align: center; font-size: .75rem; color: var(--muted); margin-top: 6px; }
.wisdom-item { display: flex; gap: 10px; padding: 10px 12px; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; line-height: 1.4; }
.wisdom-item .who { font-size: 1.2rem; }
.seg.place button { padding: 7px 12px; font-size: .85rem; }
.seg.place button[aria-pressed='true'] { background: var(--brand); border-color: var(--brand); }

/* ---------- лента дня ---------- */
.timeline { display: grid; gap: 8px; }
.entry {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center;
  padding: 10px; border-radius: 18px; background: #fffdf9; border: 1px solid var(--line); text-align: left; width: 100%;
}
.entry .eico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 1.35rem; background: var(--amber-soft); }
.entry.skin .eico { background: var(--brand-soft); }
.entry.factor .eico { background: var(--green-soft); }
.entry.water .eico { background: var(--water-soft); }
.entry .etitle { font-weight: 800; font-size: .95rem; }
.entry .edesc { font-size: .84rem; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.entry .etime { font-size: .8rem; font-weight: 800; color: var(--muted); }
.empty { text-align: center; padding: 18px 8px; color: var(--muted); font-size: .92rem; }
.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0, 0, 0, .08); }
.lv0 { background: var(--l0); } .lv1 { background: var(--l1); } .lv2 { background: var(--l2); } .lv3 { background: var(--l3); } .lv4 { background: var(--l4); }

/* ---------- чипсы ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px; border-radius: 999px;
  background: #fff; border: 1.5px solid var(--line); font-weight: 700; font-size: .92rem; min-height: 42px;
  transition: transform .1s ease, background .15s;
}
.chip:active { transform: scale(.95); }
.chip[aria-pressed='true'] { background: var(--brand-soft); border-color: var(--brand-2); color: var(--brand); }
.chip.small { padding: 5px 10px; min-height: 32px; font-size: .84rem; }
.chip .x { font-weight: 900; opacity: .6; margin-left: 2px; }
.chip.green { background: var(--green-soft); border-color: #bfe9cc; color: #166534; }
.chip.amber { background: var(--amber-soft); border-color: #fde3a7; color: #92400e; }

/* ---------- шторка (dialog) ---------- */
dialog.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 640px;
  max-height: calc(100dvh - env(safe-area-inset-top) - 24px);
  border-radius: 28px 28px 0 0; background: var(--bg); color: var(--ink);
  box-shadow: 0 -20px 50px -20px rgba(42, 34, 56, .45);
}
dialog.sheet[open] { display: flex; flex-direction: column; animation: up .28s cubic-bezier(.2, .9, .3, 1.1); }
dialog.sheet::backdrop { background: rgba(30, 20, 50, .38); }
@keyframes up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (min-width: 700px) {
  dialog.sheet { margin: auto; border-radius: 28px; max-height: 88dvh; }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 10px; }
.sheet-head h2 { font-size: 1.2rem; }
.sheet-close { width: 38px; height: 38px; border-radius: 50%; background: #fff; border: 1px solid var(--line); font-size: 1.1rem; font-weight: 900; color: var(--muted); }
.sheet-body { padding: 4px 18px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; -webkit-overflow-scrolling: touch; flex: 1 1 auto; min-height: 0; }
.sheet-body > * { flex-shrink: 0; }
.sheet-foot {
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); display: flex; gap: 10px;
  border-top: 1px solid var(--line); background: rgba(255, 248, 239, .96);
}
.sheet-foot .pill-btn { flex: 1; }

.field { display: grid; gap: 6px; }
.field > label, .label { font-size: .8rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.input, textarea.input {
  width: 100%; border-radius: 16px; border: 1.5px solid var(--line); background: #fff; padding: 12px 14px; min-height: 48px;
  font-size: 16px;
}
textarea.input { min-height: 72px; resize: vertical; }
.input:focus { border-color: var(--brand-2); outline: none; }
.seg { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: none; padding: 9px 14px; border-radius: 999px; background: #fff; border: 1.5px solid var(--line); font-weight: 800; font-size: .9rem; }
.seg button[aria-pressed='true'] { background: var(--ink); color: #fff; border-color: var(--ink); }

.tray { min-height: 48px; padding: 8px; border-radius: 18px; border: 1.5px dashed #e3d6c4; background: #fffdf9; }
.tray .placeholder { color: var(--muted); font-size: .9rem; padding: 6px; }
.suggest { display: grid; gap: 6px; }
.suggest button {
  text-align: left; padding: 10px 12px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: .9rem;
}
.cat-title { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: .95rem; margin-bottom: 8px; }
.cat-title i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* шкала кожи */
.zone { display: grid; gap: 8px; padding: 12px; background: #fff; border-radius: 18px; border: 1px solid var(--line); }
.zone-head { display: flex; justify-content: space-between; align-items: center; font-weight: 800; }
.zone-head .val { font-size: .84rem; color: var(--muted); }
.levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.level {
  aspect-ratio: 1; border-radius: 16px; display: grid; place-items: center; font-size: 1.5rem;
  border: 2.5px solid transparent; opacity: .55; transition: transform .1s, opacity .15s;
  max-height: 64px; width: 100%;
}
.level[aria-pressed='true'] { opacity: 1; border-color: var(--ink); transform: scale(1.06); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; background: #fff; border-radius: 16px; border: 1px solid var(--line); font-weight: 700; }
.switch { width: 52px; height: 32px; border-radius: 999px; background: #e5e0ea; position: relative; transition: background .2s; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch[aria-checked='true'] { background: var(--brand); }
.switch[aria-checked='true']::after { transform: translateX(20px); }

/* ---------- календарь ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head h2 { text-transform: capitalize; }
.cal-nav { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 900; font-size: 1.1rem; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal .wd { text-align: center; font-size: .72rem; font-weight: 800; color: var(--muted); padding-bottom: 2px; }
.day {
  aspect-ratio: 1; border-radius: 12px; display: grid; place-items: center; position: relative;
  font-weight: 800; font-size: .9rem; background: #f6f1ea; color: #8b8295;
}
.day.has { color: var(--ink); }
.day.lv0 { background: #c9f5d8; } .day.lv1 { background: #e6fab8; } .day.lv2 { background: #fdf0a2; } .day.lv3 { background: #fed1aa; } .day.lv4 { background: #fdb4c0; }
.day.meals::after { content: ''; position: absolute; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--ink); opacity: .45; }
.day.today { outline: 2px solid var(--brand); outline-offset: 1px; }
.day[aria-pressed='true'] { box-shadow: inset 0 0 0 2.5px var(--ink); }
.day.future { opacity: .35; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; font-size: .76rem; color: var(--muted); font-weight: 700; }
.legend span { display: inline-flex; gap: 4px; align-items: center; }

/* ---------- радар ---------- */
.zone-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.zone-tabs button { padding: 9px 4px; border-radius: 14px; background: #fff; border: 1.5px solid var(--line); font-weight: 800; font-size: .86rem; }
.zone-tabs button[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: #fff; }
.progress { height: 12px; border-radius: 999px; background: #efe8f9; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-2), var(--brand)); }
.suspect {
  display: grid; gap: 10px; padding: 14px; border-radius: 20px;
  background: linear-gradient(160deg, #fff, #fff0f3); border: 1px solid #fbd5dd;
}
.suspect.watch { background: linear-gradient(160deg, #fff, #fff8e6); border-color: #fbe6b5; }
.suspect-head { display: flex; align-items: center; gap: 10px; }
.suspect-head .big { font-size: 2rem; width: 48px; height: 48px; display: grid; place-items: center; background: #fff; border-radius: 16px; flex: none; }
.suspect-head .name { font-weight: 800; font-size: 1.05rem; }
.tag { display: inline-block; font-size: .7rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: #fee2e2; color: #b91c1c; text-transform: uppercase; letter-spacing: .04em; }
.tag.watch { background: #fef3c7; color: #92400e; }
.tag.fam { background: var(--brand-soft); color: var(--brand); }
.compare { display: grid; gap: 6px; font-size: .84rem; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 44px; gap: 8px; align-items: center; }
.bar { height: 12px; border-radius: 999px; background: #f2edf7; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; }
.note { font-size: .82rem; color: var(--muted); background: #fff; border-radius: 14px; padding: 8px 10px; border: 1px dashed var(--line); }
.trend { width: 100%; height: auto; display: block; }
.parent-note { font-size: .82rem; color: #57534e; background: #f5f5f4; border-radius: 16px; padding: 12px 14px; }

/* ---------- значки ---------- */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.badge { display: grid; justify-items: center; text-align: center; gap: 4px; padding: 12px 6px; border-radius: 18px; background: #fff; border: 1px solid var(--line); }
.badge .ico { font-size: 2rem; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: var(--amber-soft); }
.badge.locked .ico { filter: grayscale(1); opacity: .35; background: #f3f0f5; }
.badge .t { font-weight: 800; font-size: .82rem; line-height: 1.15; }
.badge .h { font-size: .72rem; color: var(--muted); line-height: 1.2; }
.rank-card { display: grid; gap: 8px; }
.rank-line { display: flex; align-items: center; gap: 12px; }
.rank-line .big { font-size: 2.4rem; }

/* ---------- списки настроек ---------- */
.list { display: grid; gap: 2px; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); text-align: left; width: 100%;
}
.row:last-child { border-bottom: 0; }
.row .ico { font-size: 1.4rem; width: 32px; text-align: center; flex: none; }
.row .txt { flex: 1; min-width: 0; }
.row .t, .row .d { display: block; }
.row .t { font-weight: 800; }
.row .d { font-size: .82rem; color: var(--muted); }
.row .chev { color: var(--muted); font-weight: 900; }

/* ---------- тост ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px); z-index: 60;
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 14px);
  background: var(--ink); color: #fff; padding: 12px 14px 12px 18px; border-radius: 18px; font-weight: 700;
  display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px); width: max-content;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .5);
}
.toast.show { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
.toast button { color: #c4b5fd; font-weight: 900; }

.banner { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 18px; background: var(--amber-soft); border: 1px solid #fde3a7; font-size: .88rem; font-weight: 700; color: #78350f; }
.banner .pill-btn { padding: 8px 12px; min-height: 0; font-size: .82rem; }

/* ---------- онбординг ---------- */
.onboard { display: grid; gap: 16px; text-align: center; padding-top: 16px; }
.onboard .mascots { margin: 0; }
.onboard h1 { font-size: 1.6rem; font-weight: 900; }

/* ---------- отчёт для врача ---------- */
.report { position: fixed; inset: 0; z-index: 80; background: #fff; overflow-y: auto; color: #111; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
.report-inner { max-width: 820px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 16px) 20px 40px; }
.report-tools { display: flex; gap: 10px; justify-content: flex-end; margin-bottom: 12px; position: sticky; top: 0; background: #fff; padding: 8px 0; }
.report h1 { font-size: 1.4rem; margin-bottom: 4px; }
.report h2 { font-size: 1.05rem; margin: 20px 0 8px; border-bottom: 2px solid #111; padding-bottom: 4px; }
.report table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.report th, .report td { border: 1px solid #ccc; padding: 5px 6px; vertical-align: top; text-align: left; }
.report th { background: #f3f3f3; }
.report td.num { text-align: center; width: 44px; }
.report .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.report .kpi { border: 1px solid #ccc; border-radius: 8px; padding: 8px 10px; }
.report .kpi b { display: block; font-size: 1.2rem; }
.report .disclaimer { font-size: .8rem; color: #444; margin-top: 18px; }

@media print {
  body > *:not(.report) { display: none !important; }
  .report { position: static; overflow: visible; }
  .report-tools { display: none; }
  .report-inner { padding: 0; max-width: none; }
  .report tr { break-inside: avoid; }
}

@media (min-width: 560px) {
  .quick .qbtn { min-height: 104px; }
}
@media (max-width: 370px) {
  .quick { grid-template-columns: repeat(2, 1fr); }
  .duo { grid-template-columns: 1fr; }
}

/* ---------- мини-игры ---------- */
body.game-open { overflow: hidden; }
.game-layer {
  position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.g-head { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; }
.g-close { grid-row: span 2; width: 44px; height: 44px; border-radius: 50%; background: var(--card); border: 1.5px solid var(--line); font-size: 1.1rem; font-weight: 900; }
.g-title { font-weight: 900; font-size: 1.2rem; }
.g-hint { font-size: .85rem; color: var(--muted); }
.g-lanes { flex: 1; min-height: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; }
.g-lane { display: grid; grid-template-rows: auto 1fr auto; gap: 8px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; min-height: 0; }
.g-score { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.g-score span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-score b { font-size: 1.5rem; color: var(--brand); font-variant-numeric: tabular-nums; }
.g-left { font-size: .8rem; color: var(--muted); background: var(--bg); border-radius: 999px; padding: 2px 8px; font-variant-numeric: tabular-nums; }
.g-left::after { content: ' осталось'; }
.g-sky { position: relative; overflow: hidden; border-radius: 18px; background: linear-gradient(#e0f2fe, #fff8ef 70%); min-height: 260px; }
.g-hero { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); pointer-events: none; }
.g-hero svg { display: block; }
.g-food {
  position: absolute; left: 50%; bottom: 110px; font-size: clamp(44px, 9vw, 64px); line-height: 1;
  transform: translate(-50%, calc(var(--y, 0) * -1 * min(34vh, 300px))) rotate(var(--r, 0deg));
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .15));
}
.g-food.eat { transition: transform .35s ease-in, opacity .35s; transform: translate(-50%, 40px) scale(.2); opacity: 0; }
.g-food.away { transition: transform .45s ease-out, opacity .45s; transform: translate(120%, -60px) rotate(200deg); opacity: 0; }
.g-say { position: absolute; left: 50%; top: 10px; transform: translate(-50%, -6px); max-width: 92%; padding: 8px 12px; border-radius: 14px; background: #fff; font-weight: 800; font-size: .9rem; text-align: center; box-shadow: var(--shadow); opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; }
.g-say.show { opacity: 1; transform: translate(-50%, 0); }
.g-say.good { color: var(--green); }
.g-say.soft { color: var(--brand); }
.g-say.big { font-size: 2.6rem; padding: 6px 22px; color: var(--brand); }
.g-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.g-btns button { min-height: 64px; border-radius: 18px; font-size: 1.05rem; font-weight: 900; color: #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, .12); }
.g-btns button:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, .12); }
.g-yes { background: var(--green); }
.g-no { background: #f97316; }
.g-end { margin: auto; max-width: 520px; width: 100%; display: grid; gap: 14px; justify-items: center; text-align: center; overflow-y: auto; }
.g-end h2 { margin: 0; font-size: 1.6rem; text-wrap: balance; }
.g-end-heroes { display: flex; align-items: flex-end; gap: 8px; }
.g-end-scores { display: flex; gap: 12px; }
.g-end-scores div { background: var(--card); border-radius: 16px; padding: 10px 18px; box-shadow: var(--shadow); display: grid; }
.g-end-scores b { font-size: 1.8rem; color: var(--brand); }
.g-end-note { margin: 0; color: var(--muted); }
.g-end-learn { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.g-end-cap { width: 100%; font-weight: 800; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.g-end-btns { display: flex; gap: 10px; }
.game-card { display: grid; gap: 12px; }
.game-card .gc-top { display: flex; gap: 12px; align-items: center; }
.game-card .gc-ico { font-size: 2.4rem; line-height: 1; }
.game-card h2 { margin: 0; font-size: 1.15rem; }
.game-card p { margin: 2px 0 0; }
.game-card .gc-btns { display: flex; flex-wrap: wrap; gap: 8px; }

.choice-opts { display: grid; gap: 6px; margin-top: 10px; }
.choice-opt { text-align: left; padding: 10px 12px; border-radius: 14px; background: var(--brand-soft); color: var(--ink); font-weight: 700; font-size: .92rem; line-height: 1.3; border: 1.5px solid transparent; }
.choice-opt:active { border-color: var(--brand); }
.choice-row { background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; display: grid; gap: 4px; }
.choice-row .cq { font-size: .9rem; }
.choice-row .ca { font-weight: 800; color: var(--brand); }

/* «Что для меня важно» */
.game-layer.sort { overflow-y: auto; }
.s-wrap { flex: 1; max-width: 560px; width: 100%; margin: 0 auto; display: grid; gap: 12px; align-content: start; padding-top: 4vh; }
.s-prog { margin: 0; }
.s-count { text-align: center; font-variant-numeric: tabular-nums; }
.s-stage { display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.s-hero svg { display: block; }
.s-card { flex: 1; max-width: 340px; min-height: 220px; background: var(--card); border-radius: 26px; box-shadow: var(--shadow); padding: 22px 18px; display: grid; gap: 8px; place-content: center; text-align: center; animation: s-in .25s ease-out; }
.s-e { font-size: 4rem; line-height: 1; }
.s-n { font-weight: 900; font-size: 1.5rem; text-wrap: balance; }
.s-d { color: var(--muted); font-size: 1rem; line-height: 1.35; text-wrap: balance; }
@keyframes s-in { from { transform: translateY(16px) scale(.96); opacity: 0; } }
.s-card.fly-v { transition: transform .26s ease-in, opacity .26s; transform: translate(-60%, 60%) rotate(-12deg) scale(.4); opacity: 0; }
.s-card.fly-i { transition: transform .26s ease-in, opacity .26s; transform: translate(-20%, 70%) rotate(-4deg) scale(.4); opacity: 0; }
.s-card.fly-n { transition: transform .26s ease-in, opacity .26s; transform: translate(20%, 70%) rotate(4deg) scale(.4); opacity: 0; }
.s-card.fly-u { transition: transform .26s ease-in, opacity .26s; transform: translate(60%, 60%) rotate(12deg) scale(.4); opacity: 0; }
.s-say { min-height: 1.3em; text-align: center; font-weight: 800; color: var(--brand); }
.s-decks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.s-deck { min-height: 76px; border-radius: 18px; display: grid; place-items: center; gap: 2px; font-weight: 800; font-size: .85rem; line-height: 1.15; padding: 6px 4px; background: var(--card); border: 2px solid var(--line); box-shadow: 0 3px 0 rgba(0, 0, 0, .08); }
.s-deck span { font-size: 1.7rem; }
.s-deck:active { transform: translateY(2px); }
.s-deck.d-v { border-color: #fda4af; background: #fff1f2; }
.s-deck.d-i { border-color: #93c5fd; background: #eff6ff; }
.s-deck.d-n { border-color: #e5e7eb; }
.s-deck.d-u { border-color: #fde68a; background: #fffbeb; }
.s-deck[aria-pressed="true"] { outline: 3px solid var(--brand); }
.s-foot { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.s-review { max-width: 760px; width: 100%; margin: 0 auto; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.s-col { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; border-top: 5px solid #e5e7eb; }
.s-col.d-v { border-top-color: #fb7185; }
.s-col.d-i { border-top-color: #60a5fa; }
.s-col.d-u { border-top-color: #fbbf24; }
.s-col h3 { margin: 0 0 8px; font-size: 1rem; display: flex; gap: 6px; }
.s-col h3 span { color: var(--muted); }
.s-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.s-chip { padding: 6px 10px; border-radius: 999px; background: var(--bg); font-weight: 700; font-size: .85rem; }
.s-move { position: fixed; inset: 0; background: rgba(30, 20, 50, .45); display: grid; place-items: center; padding: 16px; z-index: 5; }
.s-move-in { background: var(--card); border-radius: 24px; padding: 18px; max-width: 420px; width: 100%; display: grid; gap: 8px; text-align: center; }
.poles { display: grid; gap: 10px; margin-bottom: 6px; }
.pole { display: grid; grid-template-columns: 1fr 110px 44px; gap: 8px; align-items: center; }
.pole .pl { display: grid; }
.pbar { position: relative; height: 10px; border-radius: 6px; background: var(--bg); }
.pbar::before { content: ''; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: var(--line); }
.pbar i { position: absolute; top: 0; bottom: 0; border-radius: 6px; }
.pbar i.pos { background: var(--brand); }
.pbar i.neg { background: #fdba74; }
.pv { font-variant-numeric: tabular-nums; font-size: .85rem; text-align: right; }

/* «Лавка и кухня» */
.game-layer.kitchen { overflow-y: auto; }
.k-wrap { max-width: 620px; width: 100%; margin: 0 auto; display: grid; gap: 12px; }
.k-orders { display: grid; gap: 10px; }
.k-order { display: flex; gap: 14px; align-items: center; text-align: left; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; border: 2px solid transparent; }
.k-order:active { border-color: var(--brand); }
.k-oe { font-size: 2.8rem; line-height: 1; }
.k-ot { display: grid; gap: 3px; }
.k-ot span { color: var(--muted); font-size: .9rem; }
.k-ot .k-on { color: var(--brand); font-weight: 800; }
.k-list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.k-cap { font-weight: 800; margin-bottom: 8px; }
.k-need { display: flex; flex-wrap: wrap; gap: 6px; }
.k-ni { padding: 5px 10px; border-radius: 999px; background: var(--bg); font-weight: 700; font-size: .88rem; border: 1.5px dashed var(--line); }
.k-ni.got { background: #dcfce7; border: 1.5px solid #86efac; }
.k-ni.got::before { content: '✓ '; color: var(--green); }
.k-say { min-height: 1.4em; text-align: center; font-weight: 800; color: var(--brand); opacity: .4; }
.k-say.show { opacity: 1; }
.k-stalls { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.k-stall { display: grid; place-items: center; gap: 2px; font-size: 1.5rem; padding: 8px 2px; border-radius: 14px; background: var(--card); border: 2px solid var(--line); }
.k-stall span { font-size: .7rem; font-weight: 800; line-height: 1.1; text-align: center; }
.k-stall.on { border-color: var(--brand); background: var(--brand-soft); }
.k-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; background: linear-gradient(#fde9c8, #f8d9a8); border-radius: var(--radius); padding: 10px; }
.k-prod { display: grid; place-items: center; gap: 2px; padding: 10px 4px; border-radius: 14px; background: #fff; font-weight: 700; font-size: .8rem; box-shadow: 0 3px 0 rgba(0, 0, 0, .08); }
.k-prod span { font-size: 2.1rem; line-height: 1.1; }
.k-prod.in { opacity: .45; }
.k-pot { position: relative; display: grid; place-items: center; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.k-in { font-size: 1.6rem; letter-spacing: 4px; }
.k-pe { font-size: 4rem; }
.k-pe.bub { animation: k-bub .5s ease-out; }
@keyframes k-bub { 50% { transform: scale(1.15) rotate(-6deg); } }
.k-done { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-weight: 700; color: var(--green); }
.k-steps { display: grid; gap: 8px; }
.k-step { padding: 14px; border-radius: 16px; background: var(--card); border: 2px solid var(--line); font-weight: 800; text-align: left; box-shadow: 0 3px 0 rgba(0, 0, 0, .06); }
.shake { animation: shake .28s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.k-dish { font-size: 5rem; line-height: 1; }
.k-meaning { display: flex; gap: 10px; align-items: center; text-align: left; background: var(--card); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.k-meaning p { margin: 0; }
.k-levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.k-level { display: grid; justify-items: center; gap: 2px; padding: 10px 4px; border-radius: 16px; background: var(--card); border: 2px solid var(--line); text-align: center; }
.k-level span { font-size: 1.6rem; }
.k-level small { font-size: .72rem; color: var(--muted); line-height: 1.2; }
.k-level.on { border-color: var(--brand); background: var(--brand-soft); }
.k-prod { position: relative; }
.k-cnt { position: absolute; top: 4px; right: 6px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--brand); color: #fff; font-style: normal; font-weight: 900; font-size: .8rem; display: grid; place-items: center; }
.k-ni b { color: var(--brand); }
.k-list .pill-btn { margin-top: 4px; }

/* Робот */
.game-layer.robot { overflow-y: auto; }
.gc-robot svg { display: block; }
.rb-stage { position: relative; display: grid; place-items: center; padding: 14px 10px 10px; border-radius: 24px;
  background: radial-gradient(circle at 50% 38%, rgba(255,255,255,.9), rgba(255,255,255,0) 55%), linear-gradient(#1e3a8a, #312e81);
  background-color: #1e3a8a; overflow: hidden; }
.rb-stage::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px); background-size: 22px 22px; pointer-events: none; }
.rb-stage::after { content: ''; position: absolute; left: 18%; right: 18%; bottom: 10px; height: 18px; border-radius: 50%; background: radial-gradient(rgba(125,211,252,.55), rgba(125,211,252,0) 70%); pointer-events: none; }
.rb-stage > * { position: relative; z-index: 1; }
.rb-stage.small-stage { padding: 8px; border-radius: 20px; }
.rb-hub { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.rb-hub-info { display: grid; gap: 8px; justify-items: start; }
.rb-name { font-size: 1.4rem; font-weight: 900; }
.rb-skills { display: flex; flex-wrap: wrap; gap: 6px; }
.rb-skills.center { justify-content: center; }
.rb-skills span { padding: 4px 10px; border-radius: 999px; background: var(--brand-soft); font-weight: 800; font-size: .82rem; }
.rb-missions { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.rb-mission { display: flex; gap: 10px; align-items: center; text-align: left; background: var(--card); border-radius: 16px; padding: 10px 12px; border: 2px solid var(--line); box-shadow: 0 3px 0 rgba(0, 0, 0, .05); }
.rb-mission.done { border-color: #86efac; }
.rb-mission.locked { opacity: .5; }
.rb-mi { font-size: 1.8rem; }
.rb-mt { display: grid; gap: 2px; }
/* мастерская */
.ws-bot { transition: transform .2s; }
.ws-bot.pop { animation: ws-pop .45s ease; }
.ws-bot.dance { animation: ws-dance 1s ease-in-out infinite; }
@keyframes ws-pop { 30% { transform: scale(1.08) rotate(-4deg); } 60% { transform: scale(.97) rotate(3deg); } }
@keyframes ws-dance { 25% { transform: translateY(-8px) rotate(-5deg); } 75% { transform: translateY(-8px) rotate(5deg); } }
.ws-plate { display: flex; align-items: center; gap: 8px; margin-top: 4px; padding: 6px 8px 6px 14px; border-radius: 14px; background: linear-gradient(#e2e8f0, #94a3b8); box-shadow: inset 0 1px 0 #fff, 0 3px 0 rgba(0,0,0,.25); }
.ws-plate span { font-weight: 900; font-size: .8rem; color: #334155; text-transform: uppercase; letter-spacing: .06em; }
.ws-plate input { width: 150px; border: 0; border-radius: 10px; padding: 8px 10px; font: inherit; font-weight: 900; font-size: 1.05rem; text-align: center; background: #0f172a; color: #67e8f9; }
.ws-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ws-tab { display: grid; place-items: center; gap: 2px; padding: 8px 4px; border-radius: 14px; background: var(--card); border: 2px solid var(--line); font-weight: 800; font-size: .85rem; }
.ws-tab span { font-size: 1.5rem; }
.ws-tab.on { border-color: var(--brand); background: var(--brand-soft); }
.ws-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ws-opt { position: relative; display: grid; justify-items: center; gap: 3px; padding: 10px 8px; border-radius: 18px; background: var(--card); border: 2px solid var(--line); text-align: center; box-shadow: 0 3px 0 rgba(0,0,0,.05); }
.ws-opt.on { border-color: var(--brand); background: var(--brand-soft); }
.ws-mini { display: grid; place-items: center; width: 92px; height: 92px; border-radius: 50%; background: radial-gradient(#e0e7ff, #c7d2fe); }
.ws-opt small { font-size: .74rem; color: var(--muted); line-height: 1.25; }
.ws-check { position: absolute; top: 8px; right: 10px; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; font-style: normal; font-weight: 900; display: grid; place-items: center; }
.ws-colors { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; padding: 6px; }
.ws-color { width: 56px; height: 56px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff8, transparent 40%), var(--c); border: 4px solid #fff; box-shadow: 0 0 0 2px var(--line), 0 3px 6px rgba(0,0,0,.15); }
.ws-color.on { box-shadow: 0 0 0 4px var(--brand), 0 3px 6px rgba(0,0,0,.15); }
/* миссия */
.rb-play { max-width: 980px; width: 100%; margin: 0 auto; display: grid; gap: 12px; }
@media (min-width: 820px) { .rb-play { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; } }
.rb-left, .rb-right { display: grid; gap: 10px; }
.rb-map { --cs: min(58px, calc((100vw - 40px) / (var(--w) * 1.07 + .07))); position: relative; display: grid; grid-template-columns: repeat(var(--w), var(--cs)); grid-auto-rows: var(--cs);
  gap: calc(var(--cs) * var(--gap)); padding: calc(var(--cs) * var(--gap)); margin: 0 auto; border-radius: 16px; background: #475569; box-shadow: var(--shadow); }
@media (min-width: 820px) { .rb-map { --cs: min(64px, calc(46vw / (var(--w) * 1.07 + .07))); } }
.rb-cell { position: relative; display: grid; place-items: center; border-radius: 8px; font-size: calc(var(--cs) * .56); line-height: 1; background: #fffbeb; }
.rb-cell.t-start { background: #fef3c7; box-shadow: inset 0 0 0 3px #fbbf24; }
.rb-cell.t-wall { background: #94a3b8; }
.rb-cell.t-water { background: linear-gradient(#7dd3fc, #38bdf8); }
.rb-cell.t-mud { background: radial-gradient(circle at 30% 40%, #a16207 0 12%, transparent 13%), radial-gradient(circle at 70% 65%, #a16207 0 10%, transparent 11%), #d6a96b; }
.rb-cell.t-rock { background: #e7e5e4; }
.rb-cell.dark { background: #0f172a; }
.rb-badge { position: absolute; right: 2px; top: 1px; font-size: calc(var(--cs) * .34); font-style: normal; font-weight: 900; color: #7c3aed; }
.rb-plan { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.rb-bot { position: absolute; left: 0; top: 0; width: var(--cs); height: var(--cs); display: grid; place-items: center; transform: translate(calc(var(--x) * var(--cs)), calc(var(--y) * var(--cs))); transition: transform .38s ease; pointer-events: none; z-index: 2; }
.rb-bot svg { width: 104%; height: auto; filter: drop-shadow(0 3px 3px rgba(0,0,0,.25)); }
.rb-bot.oops svg { animation: shake .3s 2; }
.rb-bot.busy svg { animation: ws-pop .45s; }
.rb-carry { position: absolute; bottom: -4px; left: -4px; font-size: calc(var(--cs) * .3); font-style: normal; }
.rb-say { min-height: 2.6em; text-align: center; font-weight: 800; color: var(--brand); }
.rb-energy { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: #dcfce7; color: var(--green); font-size: .85rem; }
.rb-prog { display: flex; flex-wrap: wrap; gap: 8px; min-height: 64px; padding: 10px; border-radius: 16px; background: var(--card); border: 2px dashed #c4b5fd; align-items: center; }
.rb-chip { position: relative; display: inline-flex; align-items: center; gap: 3px; height: 48px; padding: 0 10px 0 8px; border-radius: 14px; background: #ede9fe; border: 2px solid #c4b5fd; font-weight: 900; }
.rb-chip i { position: absolute; top: -8px; left: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #7c3aed; color: #fff; font-size: .68rem; font-style: normal; display: grid; place-items: center; }
.rb-chip span { font-size: 1.5rem; line-height: 1; }
.rb-chip b { font-size: 1.25rem; color: #5b21b6; }
.rb-chip.act { background: #e0f2fe; border-color: #7dd3fc; }
.rb-chip.sel { border-color: #f59e0b; background: #fef3c7; }
.rb-chip.cur { background: #7c3aed; border-color: #7c3aed; color: #fff; transform: scale(1.08); }
.rb-chip.cur b { color: #fff; }
.rb-edit { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 10px; border-radius: 14px; background: #fef3c7; font-weight: 800; }
.rb-edit span { flex: 1; min-width: 140px; }
.rb-edit button { min-width: 44px; height: 40px; padding: 0 10px; border-radius: 10px; background: #fff; border: 2px solid #fcd34d; font-weight: 900; font-size: 1.1rem; }
.rb-pad { display: grid; grid-template-columns: repeat(3, minmax(0, 92px)); grid-template-areas: ". n ." "w a e" ". s ."; gap: 8px; justify-content: center; }
.rb-dir { display: grid; place-items: center; gap: 0; height: 78px; border-radius: 20px; background: var(--card); border: 2px solid #c4b5fd; font-size: 2rem; box-shadow: 0 4px 0 #c4b5fd; }
.rb-dir span { font-size: .72rem; font-weight: 800; color: var(--muted); }
.rb-dir:active { transform: translateY(3px); box-shadow: 0 1px 0 #c4b5fd; }
.rb-dir.d-N { grid-area: n; } .rb-dir.d-S { grid-area: s; } .rb-dir.d-W { grid-area: w; } .rb-dir.d-E { grid-area: e; }
.rb-dir.d-act { grid-area: a; background: #e0f2fe; border-color: #7dd3fc; box-shadow: 0 4px 0 #7dd3fc; }
.rb-ctrl { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.rb-run { background: var(--green); padding-inline: 22px; font-size: 1.1rem; }
.rb-stars { font-size: 2rem; letter-spacing: 4px; }

/* Количество в записи еды */
.tray-item { display: inline-flex; gap: 2px; }
.tray-item .chip { border-radius: 999px 0 0 999px; }
.tray-item .x-btn { border-radius: 0 999px 999px 0; padding-inline: 10px; }
.tray-item.open .chip:first-child { border-color: var(--brand); background: var(--brand-soft); }
.tray .qty { font-weight: 700; color: var(--brand); }
.tray .qty.none { font-weight: 500; color: var(--muted); }
.tray-hint { padding: 6px 4px 0; }
.qty-box { margin-top: 8px; padding: 10px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); display: grid; gap: 8px; }
.qty-pick { display: grid; gap: 6px; }
.qty-nums .chip { min-width: 40px; justify-content: center; }
.qty-foot { display: flex; gap: 8px; justify-content: flex-end; }

/* Шифровки */
.cf-from { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.cf-msg { display: flex; flex-wrap: wrap; gap: 14px 18px; justify-content: center; padding: 14px 10px; border-radius: var(--radius); background: #fff8e7; border: 2px dashed #e9c98a; }
.cf-word { display: inline-flex; gap: 4px; }
.cf-sep { align-self: end; font-weight: 800; }
.cf-cell { display: grid; grid-template-rows: 30px 38px; width: 36px; border: 0; padding: 0; background: none; }
.cf-cell i { font-style: normal; font-size: 1.25rem; display: grid; place-items: center; font-weight: 800; color: #6d28d9; }
.cf-msg.numbers .cf-cell { width: 40px; }
.cf-msg.numbers .cf-cell i { font-size: 1rem; }
.cf-cell b { display: grid; place-items: center; border-radius: 10px; background: #fff; border: 2px solid #d6c3a5; font-size: 1.25rem; color: var(--ink); }
.cf-cell.cur b { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.cf-cell.bad b { border-color: #ef4444; background: #fee2e2; }
.cf-key { background: var(--card); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); }
.cf-key p { margin: 0 0 8px; }
.cf-keys { display: flex; flex-wrap: wrap; gap: 6px; }
.cf-keys span { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 10px; background: #f5f0ff; font-weight: 800; }
.cf-keys i { font-style: normal; font-size: 1.15rem; }
.cf-abc { display: grid; grid-template-columns: repeat(16, 1fr); gap: 2px; }
.cf-abc span { display: grid; justify-items: center; font-weight: 800; font-size: .9rem; padding: 3px 0; border-radius: 6px; background: #f5f0ff; }
.cf-abc small { font-size: .62rem; color: #7c3aed; line-height: 1; }
.cf-kbd { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.cf-kbd button { min-height: 44px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); font-size: 1.1rem; font-weight: 800; color: var(--ink); }
.cf-kbd button:active { background: var(--brand-soft); }
.cf-kbd .wide { grid-column: span 8; }
.cf-done { font-size: 1.3rem; font-weight: 800; margin: 0; color: #6d28d9; }

/* Логика сыщика */
.lg-clues { background: var(--card); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); }
.lg-clues ol { margin: 0; padding-left: 22px; display: grid; gap: 4px; }
.lg-clues button { border: 0; background: none; padding: 4px 0; text-align: left; font: inherit; color: var(--ink); }
.lg-clues button.done { text-decoration: line-through; color: var(--muted); }
.lg-grid-wrap { overflow-x: auto; }
.lg-grid { border-collapse: collapse; margin: 0 auto; }
.lg-grid th, .lg-grid td { padding: 0; text-align: center; }
.lg-cat { font-size: .78rem; font-weight: 800; color: var(--muted); padding-bottom: 2px; }
.lg-val { font-size: 1.2rem; height: 34px; }
.lg-grid .first { border-left: 3px solid #475569; }
.lg-who { text-align: left; padding-right: 6px; font-size: 1.3rem; white-space: nowrap; }
.lg-who span { font-size: .8rem; font-weight: 700; margin-left: 2px; }
.lg-cell { width: 34px; height: 34px; border: 1.5px solid #94a3b8; background: #fff; font-size: 1.1rem; font-weight: 900; padding: 0; margin: 1px; border-radius: 6px; }
.lg-cell.x { color: #94a3b8; background: #f1f5f9; }
.lg-cell.o { color: #fff; background: #16a34a; border-color: #16a34a; }
.lg-cell.bad { background: #ef4444; border-color: #ef4444; }
.lg-answer { display: grid; gap: 6px; width: 100%; }
.lg-answer div { display: flex; justify-content: space-between; background: var(--card); padding: 8px 12px; border-radius: 12px; box-shadow: var(--shadow); font-size: 1.1rem; }
.lg-clues ol { list-style: none; padding-left: 0; }
.lg-clues button { display: flex; gap: 6px; align-items: baseline; }
.lg-clues button b { min-width: 1.4em; text-align: right; }
@media (max-width: 480px) {
  .lg-who span { display: none; }
  .lg-cell { width: 28px; height: 30px; margin: 1px 0; }
  .lg-val { font-size: 1.05rem; }
}
