/* Тёмная ретро-игра. Палитра с вязаного свитера: циан, кирпичный красный, зелёный, оранжевый, фиолетовый на чёрном. */
:root {
  --bg: #0b0b12; --panel: #15151f; --panel2: #1d1d2b; --line: #34344d; --text: #f2ece0; --muted: #a29eb3;
  --cyan: #2fb8c9; --red: #c8493a; --green: #6fb04c; --orange: #e08f4a; --purple: #8a5cc4; --yellow: #f4d35e;
  --px: 4px;
  --font-title: "Russo One", "Arial Black", system-ui, sans-serif;
  --font-body: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  --nav-h: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 17px; font-weight: 500; line-height: 1.45; }
body { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); }
main { max-width: 640px; margin: 0 auto; padding: 14px 16px 0; }
h1, h2, h3 { font-family: var(--font-title); font-weight: 400; line-height: 1.3; margin: 0; letter-spacing: .3px; }
h1 { font-size: 24px; } h2 { font-size: 17px; margin: 22px 0 10px; color: var(--cyan); } h3 { font-size: 17px; }
.sprite { image-rendering: pixelated; display: block; flex: none; }
.muted { color: var(--muted); } .small { font-size: 15px; }
/* суммы и числа: плотный шрифт, цифры одной ширины */
.bar-label b, .list .item > b, .num { font-family: var(--font-title); font-size: 16px; font-weight: 400; letter-spacing: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 12px; } .between { justify-content: space-between; }
.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }

/* панели со ступенчатой рамкой, без скруглений */
.card {
  background: var(--panel); padding: 14px; margin: 12px 0; position: relative;
  box-shadow: 0 0 0 2px var(--line), 4px 4px 0 2px #000;
}
.card.accent-cyan { box-shadow: 0 0 0 2px var(--cyan), 4px 4px 0 2px #000; }
.card.accent-orange { box-shadow: 0 0 0 2px var(--orange), 4px 4px 0 2px #000; }
.card.accent-purple { box-shadow: 0 0 0 2px var(--purple), 4px 4px 0 2px #000; }
.card.accent-red { box-shadow: 0 0 0 2px var(--red), 4px 4px 0 2px #000; }
.card.accent-green { box-shadow: 0 0 0 2px var(--green), 4px 4px 0 2px #000; }

/* шкалы как HP/XP в игре: блоки */
.bar { display: grid; grid-template-columns: repeat(20, 1fr); gap: 2px; height: 16px; background: #000; padding: 2px; box-shadow: 0 0 0 2px var(--line); }
.bar i { background: #24243a; display: block; }
.bar i.on { background: var(--c, var(--green)); }
.bar.over i.on { background: var(--red); }
.bar-row { margin: 10px 0; }
.bar-label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 16px; margin-bottom: 6px; }
.bar-label b { font-weight: 400; }

/* кнопки: крупные (44px+), нажатие «вдавливается» */
button, .btn {
  font-family: var(--font-title); font-size: 14px; letter-spacing: .3px; line-height: 1.3; color: var(--text); background: var(--panel2);
  border: 0; padding: 12px 14px; min-height: 44px; cursor: pointer; text-transform: none;
  box-shadow: 0 0 0 2px var(--line), 3px 3px 0 2px #000;
}
button:active, .btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 2px var(--line), 1px 1px 0 2px #000; }
button.primary { background: var(--green); color: #0b0b12; box-shadow: 0 0 0 2px #0b0b12, 3px 3px 0 2px #000; }
button.danger { background: var(--red); }
button.ghost { background: transparent; box-shadow: none; color: var(--muted); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
button[disabled] { opacity: 0.5; }

input, textarea, select {
  width: 100%; font-family: var(--font-body); font-size: 17px; font-weight: 500; color: var(--text); background: #000; border: 0;
  padding: 11px 12px; min-height: 44px; box-shadow: 0 0 0 2px var(--line); border-radius: 0;
}
label { display: block; font-size: 14px; color: var(--muted); margin: 10px 0 4px; }
textarea { min-height: 110px; resize: vertical; }

/* нижняя навигация */
#nav {
  position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr);
  background: #000; border-top: 2px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5;
}
#nav button {
  box-shadow: none; background: transparent; min-height: var(--nav-h); padding: 8px 2px 6px; font-size: 11px; letter-spacing: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted);
}
#nav button.on { color: var(--text); background: var(--panel2); box-shadow: inset 0 3px 0 var(--cyan); }
#nav button:active { transform: none; }

/* вкладки внутри раздела */
.seg { display: flex; gap: 6px; margin: 8px 0 4px; flex-wrap: wrap; }
.seg button { flex: 1; font-size: 13px; padding: 10px 6px; }
.seg button.on { background: var(--cyan); color: #0b0b12; box-shadow: 0 0 0 2px #0b0b12, 3px 3px 0 2px #000; }

.pill { display: inline-block; font-size: 13px; padding: 2px 8px; background: #000; box-shadow: 0 0 0 2px var(--line); margin: 2px 4px 2px 0; }
.pill.s { color: var(--cyan); } .pill.m { color: var(--yellow); } .pill.a { color: var(--green); } .pill.r { color: var(--orange); } .pill.t { color: var(--purple); }

.list > .item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 2px dashed #26263a; }
.list > .item:last-child { border-bottom: 0; }
.chk { min-width: 44px; width: 44px; height: 44px; padding: 0; display: grid; place-items: center; }
.chk.done { background: var(--green); }
.done-text { text-decoration: line-through; color: var(--muted); }
.amount-in { color: var(--green); } .amount-out { color: var(--text); }

/* столбики недели */
.cols { display: flex; align-items: flex-end; gap: 6px; height: 96px; margin-top: 8px; }
.cols .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: 11px; color: var(--muted); }
.cols .col i { display: block; width: 100%; background: var(--c, var(--cyan)); min-height: 2px; box-shadow: inset 0 3px 0 rgba(255,255,255,.25); }

/* календарь месяца */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { font-size: 12px; color: var(--muted); text-align: center; padding: 4px 0; }
.cal button { padding: 6px 0; min-height: 48px; font-family: var(--font-body); font-size: 16px; box-shadow: 0 0 0 2px var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.cal button.empty { visibility: hidden; }
.cal button.today { box-shadow: 0 0 0 2px var(--yellow); }
.cal button.sel { background: var(--cyan); color: #0b0b12; }
.dots { display: flex; gap: 3px; height: 6px; } .dots u { width: 6px; height: 6px; background: var(--orange); display: block; } .dots u.pay { background: var(--purple); } .dots u.plan { background: var(--green); }

.goal-photo { width: 100%; aspect-ratio: 16/9; object-fit: cover; image-rendering: auto; display: block; background: #000; box-shadow: 0 0 0 2px var(--line); margin-bottom: 10px; }
.goal-photo.empty { display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.hero { display: flex; align-items: center; gap: 14px; }
.hero h1 { margin-bottom: 4px; }
.empty-state { text-align: center; padding: 20px 8px; color: var(--muted); }
.err { color: var(--red); }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 18px); transform: translateX(-50%) translateY(20px);
  background: var(--yellow); color: #0b0b12; padding: 10px 14px; font-family: var(--font-title); font-size: 14px; opacity: 0; pointer-events: none;
  max-width: 90vw; text-align: center; box-shadow: 3px 3px 0 #000; z-index: 9; transition: opacity .15s steps(3), transform .15s steps(3);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--red); color: var(--text); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (max-width: 360px) { #nav button { font-size: 10px; } body { font-size: 16px; } h1 { font-size: 21px; } }

/* окно правки записи: поднимается снизу */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.72); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet-card { background: var(--panel); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); box-shadow: 0 -2px 0 2px var(--cyan); }
.sheet-card .row > .grow { min-width: 0; }
.item > button:not(.chk) { min-width: 52px; padding: 10px 8px; font-size: 12px; }

/* черепашка-кнопка настроек */
.turtle-btn { position: relative; padding: 4px; min-height: 0; background: transparent; box-shadow: 0 0 0 2px var(--cyan), 3px 3px 0 2px #000; }

/* отметки задач и привычек: размер 44×44 как кнопки раздела «План», количество не ограничено */
.card.accent-yellow { box-shadow: 0 0 0 2px var(--yellow), 4px 4px 0 2px #000; }
.marks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mark { position: relative; width: 44px; height: 44px; min-height: 0; padding: 0; display: grid; place-items: center; background: #000; box-shadow: 0 0 0 2px var(--line), 3px 3px 0 2px #000; }
.mark.done { box-shadow: 0 0 0 2px var(--green), 3px 3px 0 2px #000; }
.mark.over { box-shadow: 0 0 0 2px var(--red), 3px 3px 0 2px #000; }
.mark.sel { box-shadow: 0 0 0 2px var(--yellow), 3px 3px 0 2px #000; }
.mark .sprite { margin: 0; }
.mark b { position: absolute; right: 3px; bottom: 0; line-height: 1.1; font-family: var(--font-title); font-weight: 400; font-size: 12px; color: var(--text); text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000; }
.mark .ok { position: absolute; right: 1px; top: 1px; }
.task-cap { margin-top: 12px; padding: 8px 10px; background: #000; box-shadow: 0 0 0 2px var(--line); display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 15px; }
.task-cap b { font-family: var(--font-title); font-weight: 400; color: var(--yellow); }
.task-cap button { min-height: 36px; padding: 6px 10px; font-size: 12px; flex: none; }
.norm { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.norm div { background: #000; padding: 8px 10px; box-shadow: 0 0 0 2px var(--line); }
.norm .num { display: block; color: var(--orange); font-size: 18px; }
.back { margin-bottom: 12px; }

/* шесть вкладок внизу */
#nav { grid-template-columns: repeat(6, 1fr); }
#nav button { font-size: 10px; }

/* метка тестовой копии */
#ribbon { position: fixed; top: 0; right: 0; z-index: 30; background: #e8559a; color: #0b0b12; font-family: var(--font-title); font-size: 12px; padding: 3px 10px; box-shadow: -2px 2px 0 #000; pointer-events: none; }

/* чат в кабинете */
.chat { display: flex; flex-direction: column; gap: 10px; padding-bottom: 150px; }
.bubble { max-width: 88%; padding: 10px 12px; background: var(--panel); box-shadow: 0 0 0 2px var(--line), 3px 3px 0 2px #000; }
.bubble.bot { align-self: flex-start; box-shadow: 0 0 0 2px var(--cyan), 3px 3px 0 2px #000; }
.bubble.me { align-self: flex-end; background: var(--panel2); box-shadow: 0 0 0 2px var(--green), 3px 3px 0 2px #000; }
.bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.typing { color: var(--muted); }
.bubble-btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.bubble-btns button { font-size: 14px; padding: 8px 10px; min-height: 40px; }
.composer { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); background: #000; border-top: 2px solid var(--line); padding: 8px 10px 10px; z-index: 6; }
.composer .chips, .composer .chat-row { max-width: 640px; margin: 0 auto; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; }
.chips button { flex: none; font-size: 13px; padding: 6px 10px; min-height: 36px; }
.chips button.on { background: var(--cyan); color: #0b0b12; }
.chat-row { display: flex; gap: 6px; align-items: stretch; }
.chat-row input { flex: 1; min-width: 0; }
.chat-row button { min-width: 48px; min-height: 48px; padding: 0 10px; }
.chat-row button.rec { background: var(--red); color: var(--text); font-size: 13px; }
