/* «Время Деньги». Layout: одна узкая сцена с игровыми карточками под липкой панелью показателей;
   стартовый экран — только заголовок и кнопка. Акцент — жёлтый ценник, на нём держится вся «смелость». */
:root {
  --ground: #E9EDF2;
  --surface: #FFFFFF;
  --surface-2: #F3F5F9;
  --ink: #1E2130;
  --ink-soft: #586075;
  --line: #D3D9E3;
  --accent: #FFD23F;
  --accent-ink: #1E2130;
  --money: #10835A;
  --loss: #D13636;
  --xp: #4054F0;
  --success-bg: #DFF4E9;
  --fail-bg: #FCE7E7;
  --info-bg: #E9ECFF;
  --note-bg: #FFF3B5;
  --note-ink: #3D3410;
  --bubble-me: #FFF1B0;
  --overlay: rgba(20, 23, 34, 0.55);
  --shadow: 0 1px 0 rgba(30, 33, 48, 0.04), 0 18px 40px -18px rgba(30, 33, 48, 0.35);
  --font-display: 'Unbounded', 'Arial Black', system-ui, sans-serif;
  --font-body: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 22px;
  --radius-sm: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --ground: #12141B;
    --surface: #1B1E29;
    --surface-2: #232736;
    --ink: #EEF0F6;
    --ink-soft: #A2A9BD;
    --line: #313649;
    --accent: #FFD23F;
    --accent-ink: #1E2130;
    --money: #45CF8C;
    --loss: #FF6E69;
    --xp: #8C99FF;
    --success-bg: #163427;
    --fail-bg: #3B1C20;
    --info-bg: #222949;
    --note-bg: #3A3315;
    --note-ink: #FFF1B0;
    --bubble-me: #3D3517;
    --overlay: rgba(0, 0, 0, 0.65);
    --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --ground: #12141B;
  --surface: #1B1E29;
  --surface-2: #232736;
  --ink: #EEF0F6;
  --ink-soft: #A2A9BD;
  --line: #313649;
  --accent: #FFD23F;
  --accent-ink: #1E2130;
  --money: #45CF8C;
  --loss: #FF6E69;
  --xp: #8C99FF;
  --success-bg: #163427;
  --fail-bg: #3B1C20;
  --info-bg: #222949;
  --note-bg: #3A3315;
  --note-ink: #FFF1B0;
  --bubble-me: #3D3517;
  --overlay: rgba(0, 0, 0, 0.65);
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

/* ---------- база ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--xp);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
}

.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.stage {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

/* ---------- кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}

.btn:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 4px 4px 0 var(--ink);
}

.btn-primary:hover {
  box-shadow: 6px 6px 0 var(--ink);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-weight: 500;
}

.btn-ghost:hover {
  color: var(--ink);
  box-shadow: none;
  transform: none;
  text-decoration: underline;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 0.92rem;
}

.link:hover {
  color: var(--ink);
}

/* ---------- стартовый экран ---------- */

.landing {
  position: relative;
  flex: 1;
  display: grid;
  justify-items: center;
  align-content: start;
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(36px, 9vh, 110px) 16px 48px;
  text-align: center;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bottom));
}

.landing__world {
  position: absolute;
  inset: 0;
}

.landing__content {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: clamp(22px, 4vh, 40px);
  pointer-events: none;
}

.game-version { font-size: .8rem; margin: 0; }
.game-version--badge { color: #1e2130; background: #fffdf5; border: 1px solid #1e2130; border-radius: 100px; padding: 7px 14px; font-weight: 700; }

.landing__content .btn {
  pointer-events: auto;
}

.landing h1 {
  /* Подложка сохраняет контраст при зуме города и в ночной теме. */
  color: #1e2130;
  background: #fffdf5;
  padding: clamp(16px, 3vw, 28px);
  border: 2px solid #1e2130;
  border-radius: 24px;
  box-shadow: 0 12px 36px rgba(20, 30, 50, .2);
  text-shadow: none;
}

.landing h1 {
  font-size: clamp(1.8rem, 5.2vw, 4.2rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.03em;
  max-width: min(100%, 22ch);
  text-wrap: balance;
}

.landing h1.landing__headline {
  font-size: clamp(1rem, 4.7vw, 3.25rem);
  max-width: 100%;
  white-space: nowrap;
}

.marker {
  background: linear-gradient(transparent 56%, var(--accent) 56%, var(--accent) 92%, transparent 92%);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding: 0 0.06em;
}

.landing .btn-primary {
  font-size: 1.25rem;
  padding: 18px 56px;
  min-height: 64px;
}

/* ---------- карточки ---------- */

.card {
  --pad: clamp(18px, 4.5vw, 32px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--pad);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
  animation: card-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes card-in {
  from {
    transform: translateY(14px);
    opacity: 0.4;
  }
}

.card h2 {
  font-size: clamp(1.35rem, 4.4vw, 1.9rem);
  font-weight: 700;
}

.card h2:focus {
  outline: none;
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.prose {
  display: grid;
  gap: 12px;
  max-width: 62ch;
}

.muted {
  color: var(--ink-soft);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.chip-status {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}

/* ---------- карточка персонажа ---------- */

.hero-card {
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  column-gap: 28px;
  align-items: start;
}

.hero-card > .span {
  grid-column: 1 / -1;
}

.hero-card__head {
  display: grid;
  gap: 4px;
  text-align: center;
}

.frame {
  border: 3px solid var(--ink);
  border-radius: 20px;
  overflow: hidden;
  background: var(--surface-2);
  line-height: 0;
  max-width: 100%;
}

.frame svg {
  width: 100%;
  height: auto;
  display: block;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-weight: 600;
  font-size: 0.95rem;
}

.field input {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--line);
  background: var(--surface-2);
  font-size: 1.1rem;
  font-weight: 600;
}

.field input:focus {
  outline: none;
  border-color: var(--ink);
}

.field-hint {
  font-size: 0.86rem;
  color: var(--ink-soft);
  min-height: 1.4em;
}

.field-hint.is-ok {
  color: var(--money);
}

.field-hint.is-bad {
  color: var(--loss);
}

.summary {
  display: grid;
  gap: 0;
  margin: 0;
}

.summary__title {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-bottom: 6px;
}

.summary__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}

.summary__row dt {
  color: var(--ink-soft);
}

.summary__row dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.hero-about {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.hero-question {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
}

/* ---------- HUD ---------- */

.hud {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + var(--sync-status-height, 0px));
  z-index: 20;
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.hud__inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 10px 16px 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px 16px;
  align-items: center;
}

.who {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
}

.who__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  overflow: hidden;
  flex: none;
  line-height: 0;
}

.who__avatar {
  background: var(--accent);
}

.who__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.who__text {
  display: grid;
  min-width: 0;
}

.who__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.who__status {
  font-size: 0.8rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 6px;
}

.stat {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat .icon {
  color: var(--ink-soft);
}

.stat--money .icon {
  color: var(--money);
}

.stat--xp .icon {
  color: var(--xp);
}

.stat--rating .icon {
  color: #C99A1C;
}

.stat.is-negative .stat__value {
  color: var(--loss);
}

.stat__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.delta {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  background: var(--money);
  pointer-events: none;
  animation: delta-float 1.6s ease-out forwards;
}

.delta.is-minus {
  background: var(--loss);
}

.delta.is-xp {
  background: var(--xp);
}

@keyframes delta-float {
  0% {
    opacity: 0;
    transform: translate(-50%, -4px);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, 4px);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 14px);
  }
}

.track {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(var(--goal-count, 12), 1fr);
  gap: 4px;
}

.track span {
  height: 5px;
  border-radius: 3px;
  background: var(--line);
}

.track span.is-done {
  background: var(--money);
}

.track span.is-now {
  background: var(--accent);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.hud__tools {
  display: flex;
  gap: 6px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.icon-btn:hover {
  border-color: var(--ink);
}

/* ---------- цель и выбор ---------- */

.goal-head {
  display: grid;
  gap: 8px;
}

.goal-num {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.goal-num b {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  border: 2px solid var(--ink);
  font-weight: 800;
}

.choices {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.choice {
  width: 100%;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  text-align: left;
  line-height: 1.45;
  transition: border-color 0.12s ease, transform 0.12s ease, background 0.12s ease;
}

.choice:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
  background: var(--surface);
}

.choice__key {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--surface);
}

.choice__text {
  padding-top: 3px;
}

.choice__tag {
  display: inline-block;
  margin-left: 8px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  vertical-align: 2px;
  background: var(--line);
  color: var(--ink-soft);
}

/* ---------- NPC и диалог ---------- */

.npc {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.npc .frame {
  border-radius: 18px;
}

.npc__who {
  display: grid;
  gap: 0;
  margin-bottom: 8px;
}

.npc__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}

.npc__role {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.bubble {
  position: relative;
  padding: 12px 16px;
  border-radius: 4px 18px 18px 18px;
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  font-size: 1.05rem;
  font-weight: 500;
}

.narration {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--info-bg);
  font-weight: 500;
}

.npc-card {
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  padding: 18px;
  border-radius: 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

/* Портрет не растягивается до высоты текста: персонаж и фон держатся в одном кадре. */
.npc-card__portrait {
  position: relative;
  align-self: start;
  width: 100%;
  aspect-ratio: 8 / 9;
}

.npc-card .npc-card__portrait img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}

.npc-card h3 {
  font-size: 1.3rem;
}

/* ---------- шкала терпения ---------- */

.meter {
  display: grid;
  gap: 6px;
}

.meter__head {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.meter__cells {
  display: grid;
  grid-template-columns: repeat(var(--max), 1fr);
  gap: 5px;
}

.meter__cells span {
  height: 12px;
  border-radius: 4px;
  background: var(--line);
}

.meter__cells span.is-on {
  background: var(--money);
}

.meter[data-level='low'] .meter__cells span.is-on {
  background: var(--loss);
}

.meter[data-level='mid'] .meter__cells span.is-on {
  background: #E8A317;
}

.meter.is-hit {
  animation: shake 0.4s;
}

@keyframes shake {
  25% {
    transform: translateX(-6px);
  }
  50% {
    transform: translateX(5px);
  }
  75% {
    transform: translateX(-3px);
  }
}

/* ---------- исход ---------- */

.outcome-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 16px;
  align-items: center;
}

.outcome-head .spot,
.outcome-head .frame {
  width: 132px;
  justify-self: end;
}

.spot {
  width: 100%;
  height: auto;
}

.tone {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.82rem;
}

.tone--fail {
  background: var(--fail-bg);
  color: var(--loss);
}

.tone--success {
  background: var(--success-bg);
  color: var(--money);
}

.tone--info {
  background: var(--info-bg);
  color: var(--xp);
}

.feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.feed li {
  display: grid;
  gap: 2px;
  padding: 10px 14px;
  border-left: 4px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 12px 12px 0;
  animation: feed-in 0.35s ease both;
  animation-delay: calc(var(--i) * 0.45s);
}

.feed b {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

@keyframes feed-in {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
}

.script {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 18px 18px 4px 18px;
  background: var(--bubble-me);
  border: 1.5px solid var(--line);
  font-weight: 500;
}

.script .link {
  justify-self: end;
}

.note {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--success-bg);
  font-weight: 600;
}

.lesson {
  display: grid;
  gap: 4px;
  padding: 14px 18px;
  border-radius: 6px var(--radius-sm) var(--radius-sm) var(--radius-sm);
  background: var(--note-bg);
  color: var(--note-ink);
  max-width: 62ch;
}

.lesson b {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.effects {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.effects .chip.is-plus {
  color: var(--money);
}

.effects .chip.is-minus {
  color: var(--loss);
}

.effects .chip.is-xp {
  color: var(--xp);
}

/* ---------- мессенджер ---------- */

.phone {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 20px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  max-height: min(62vh, 560px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.phone__progress {
  display: grid;
  gap: 6px;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--money);
  border-radius: inherit;
  transition: width 0.5s ease;
}

.msg {
  display: grid;
  gap: 2px;
  max-width: 86%;
  padding: 8px 12px;
  border-radius: 4px 16px 16px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  justify-self: start;
  font-size: 0.97rem;
}

.msg b {
  font-size: 0.78rem;
  color: var(--xp);
}

.msg.is-me {
  justify-self: end;
  border-radius: 16px 4px 16px 16px;
  background: var(--bubble-me);
}

.msg.is-maybe b {
  color: #C47F00;
}

.msg.is-hit {
  border: 2px solid var(--money);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--money) 20%, transparent);
}

.msg.is-hit b {
  color: var(--money);
}

.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 92%;
}

.msg-row .msg {
  max-width: none;
  min-width: 0;
}

.msg-row.is-me {
  justify-self: end;
}

.msg__ava {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 20%;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.msg-row.is-new,
.msg.is-new,
.sys.is-new {
  animation: feed-in 0.3s ease both;
  animation-delay: calc(var(--i) * 0.55s);
}

.sys {
  justify-self: center;
  text-align: center;
  max-width: 92%;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
}

.sys.is-summary {
  border-radius: 12px;
  background: var(--info-bg);
  color: var(--ink);
  font-weight: 500;
}

.typing {
  justify-self: start;
  display: inline-flex;
  gap: 4px;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-soft);
  animation: blink 1s infinite;
}

.typing i:nth-child(2) {
  animation-delay: 0.15s;
}

.typing i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes blink {
  50% {
    opacity: 0.25;
    transform: translateY(-2px);
  }
}

/* ---------- цель выполнена / финал ---------- */

.complete {
  text-align: center;
  justify-items: center;
}

.complete .frame {
  width: 180px;
}

.status-change {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.status-change s {
  color: var(--ink-soft);
}

.status-change .chip-status {
  font-size: 0.95rem;
  padding: 6px 14px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.tile {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  text-align: left;
  min-width: 0;
}

.tile span {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.tile b {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.final-hero {
  display: grid;
  grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}

.final-hero h2 {
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  font-weight: 800;
}

.final-hero .marker {
  background: var(--accent);
  color: var(--accent-ink);
}

/* ---------- рейтинг и ачивки ---------- */

.table-wrap {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.board {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.board th,
.board td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.board th {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
}

.board td.num,
.board th.num {
  text-align: right;
}

.board tr:last-child td {
  border-bottom: 0;
}

.board tr.is-me td {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
  font-weight: 700;
}

.board .bot {
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-weight: 500;
}

.achievements {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
  gap: 8px;
}

.ach {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  line-height: 1.35;
}

.ach .icon {
  width: 34px;
  height: 34px;
  padding: 6px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
}

.ach b {
  display: block;
  font-size: 0.9rem;
}

.ach.is-locked {
  color: var(--ink-soft);
  border-style: dashed;
}

.ach.is-locked .icon {
  background: var(--line);
  color: var(--ink-soft);
}

/* ---------- модалка и тосты ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px));
  background: var(--overlay);
  animation: fade 0.2s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.modal__card {
  position: relative;
  width: 100%;
  max-width: 680px;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
}

.code {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px dashed var(--ink-soft);
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-weight: 700;
  letter-spacing: 0.08em;
  user-select: all;
}

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 60;
  display: grid;
  gap: 8px;
  width: min(440px, calc(100% - 32px));
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--ink);
  color: var(--ground);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  line-height: 1.35;
  animation: toast-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.toast .icon {
  width: 34px;
  height: 34px;
  padding: 7px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
}

.toast b {
  display: block;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
}

.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 70;
}

.offline {
  font-size: 0.8rem;
  color: var(--ink-soft);
  text-align: center;
}

/* ---------- узкие экраны ---------- */

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .hud__inner {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .stats {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stat {
    justify-content: center;
    padding: 6px 6px;
    font-size: 0.82rem;
    gap: 4px;
  }

  .hero-card,
  .npc-card,
  .final-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-card .frame,
  .npc-card .frame,
  .final-hero .frame {
    width: min(200px, 70%);
    justify-self: center;
  }

  .npc {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
  }

  .outcome-head {
    grid-template-columns: minmax(0, 1fr) 96px;
  }

  .outcome-head .spot,
  .outcome-head .frame {
    width: 96px;
  }

  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tiles--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .board .col-status {
    display: none;
  }

  .board td {
    white-space: normal;
  }

  .btn-row .btn {
    flex: 1 1 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 3D-карта пути ---------- */

:root {
  --sky-top: #bfe3ff;
  --sky-bottom: #eef7ff;
  --label-bg: rgba(255, 255, 255, 0.94);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --sky-top: #0b1230;
    --sky-bottom: #1d2a52;
    --label-bg: rgba(27, 30, 41, 0.94);
  }
}

:root[data-theme='dark'] {
  --sky-top: #0b1230;
  --sky-bottom: #1d2a52;
  --label-bg: rgba(27, 30, 41, 0.94);
}

.world {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bottom));
}

.world__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.world__labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.world-label {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--label-bg);
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.15;
  text-align: left;
  white-space: nowrap;
  pointer-events: auto;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.45);
  will-change: transform;
}

.world-label::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  width: 2px;
  height: var(--stem, 8px);
  background: var(--ink);
}

@media (max-width: 640px) {
  .world-label {
    font-size: 0.72rem;
    padding: 4px 10px 4px 4px;
  }

  .world-label em {
    display: none;
  }

  .world-label.is-now em {
    display: block;
  }
}

.world-label b {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--ink);
  font-family: var(--font-display);
  font-size: 0.75rem;
}

.world-label span {
  display: grid;
}

.world-label strong {
  font-weight: 700;
}

.world-label em {
  font-style: normal;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.world-label.is-done b {
  background: var(--accent);
  color: var(--accent-ink);
}

.world-label.is-now {
  background: var(--accent);
  color: var(--accent-ink);
  transform-origin: bottom center;
  z-index: 2;
}

.world-label.is-now em {
  color: var(--accent-ink);
  opacity: 0.75;
}

.world-label.is-now b {
  background: var(--ink);
  color: var(--accent);
}

.world-label--bali b {
  background: #ff8a5c;
  color: #fff;
}

.world-avatar {
  position: absolute;
  left: 0;
  top: 0;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: var(--accent);
  overflow: hidden;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.5);
}

.world-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* ---------- сцены: фон локации и персонаж ---------- */

:root {
  --map-fallback: url('img/map-journey-waterfix-day.webp');
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --map-fallback: url('img/map-journey-waterfix-night.webp');
  }
}

:root[data-theme='dark'] {
  --map-fallback: url('img/map-journey-waterfix-night.webp');
}

[data-world][data-city='moscow'] { --map-fallback: url('img/map-moscow-journey-waterfix-day.webp'); }
:root[data-theme='dark'] [data-world][data-city='moscow'] { --map-fallback: url('img/map-moscow-journey-waterfix-night.webp'); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) [data-world][data-city='moscow'] { --map-fallback: url('img/map-moscow-journey-waterfix-night.webp'); }
}

.scene-stage,
.world-slot--stage {
  position: relative;
  justify-self: stretch;
  margin: calc(var(--pad) * -1) calc(var(--pad) * -1) 0;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.scene-stage {
  height: clamp(230px, 56vw, 340px);
  background-color: #c9d8ea;
  background-image: var(--loc), linear-gradient(180deg, #e9d8c4, #c9b49a);
  background-size: cover;
  background-position: center;
}

.scene-stage::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 30%;
  background: linear-gradient(180deg, transparent, rgba(10, 12, 20, 0.35));
  pointer-events: none;
}

.scene-stage[data-loc='bali'] {
  background-image: var(--loc), linear-gradient(180deg, #9fe3f5, #f5dc9f);
}

.scene-stage[data-loc='office'] {
  background-image: var(--loc), linear-gradient(180deg, #dfe6f0, #a9b4c4);
}

.scene-stage[data-loc='clinic'],
.scene-stage[data-loc='vet'] {
  background-image: var(--loc), linear-gradient(180deg, #e8f6f1, #b7d8cc);
}

.scene-stage__who {
  position: absolute;
  bottom: 0;
  left: 50%;
  height: 100%;
  width: auto;
  max-width: none;
  transform: translateX(-50%);
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.35));
  animation: who-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 1;
}

@keyframes who-in {
  from {
    transform: translate(-50%, 12px);
    opacity: 0.2;
  }
}

.scene-stage__tag {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  display: grid;
  padding: 6px 12px;
  border-radius: 12px;
  background: var(--label-bg);
  border: 2px solid var(--ink);
  line-height: 1.2;
  font-size: 0.82rem;
  max-width: 60%;
}

.scene-stage__tag b {
  font-family: var(--font-display);
  font-size: 0.85rem;
}

.scene-stage__tag span {
  color: var(--ink-soft);
}

.scene-stage__tone {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.4);
}

.bubble b {
  font-family: var(--font-display);
  font-size: 0.85rem;
}

.frame--photo {
  background-color: #c9d8ea;
  background-image: var(--loc), linear-gradient(180deg, #e9d8c4, #c9b49a);
  background-size: cover;
  background-position: center;
}

.frame--photo img {
  width: 100%;
  height: auto;
  display: block;
}

.world-slot {
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bottom));
}

.world-slot--stage {
  height: clamp(230px, 58vw, 360px);
}

.world-slot--fallback {
  background: var(--map-fallback) center / contain no-repeat, linear-gradient(180deg, var(--sky-top), var(--sky-bottom));
}

.world-host {
  position: absolute;
  inset: 0;
}

.complete__hero {
  height: 150px;
  width: auto;
  margin-top: -96px;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.35));
}

.icon-btn--map {
  width: auto;
  display: inline-flex;
  gap: 6px;
  padding: 0 12px;
  font-weight: 700;
  font-size: 0.85rem;
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--ink);
}

.modal--map {
  padding: 12px;
}

.modal__card--map {
  max-width: 1200px;
  height: min(92vh, 960px);
  height: min(92dvh, 960px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
}

.map-head {
  display: grid;
  gap: 4px;
  padding-right: 48px;
}

.world-slot--map {
  position: relative;
  border-radius: 16px;
  min-height: 0;
  border: 1px solid var(--line);
  overflow: hidden;
}

@media (max-width: 640px) {
  .icon-btn--map span {
    display: none;
  }

  .icon-btn--map {
    padding: 0;
    width: 40px;
    justify-content: center;
  }

  .modal--map {
    padding: 0;
  }

  .modal__card--map {
    height: 100%;
    border-radius: 0;
  }

  /* На маленькой карте герой уже показан фишкой. Второй портрет перекрывал её кнопки. */
  .complete__hero {
    display: none;
  }
}

/* ---------- управление картой ---------- */

.world__canvas {
  cursor: grab;
}

.world__canvas.is-dragging {
  cursor: grabbing;
}

.world__controls {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  display: flex;
  gap: 5px;
}

.world-ctl {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  border: 2px solid var(--ink);
  background: var(--label-bg);
  color: var(--ink);
  box-shadow: 0 4px 12px -6px rgba(0, 0, 0, 0.45);
}

@media (max-width: 640px), (pointer: coarse) {
  .world__controls { right: 8px; bottom: 8px; gap: 6px; max-width: calc(100% - 16px); }
  .world-ctl { width: 44px; height: 44px; flex: 0 0 44px; }
}

@media (max-width: 640px) {
  /* В компактной карте остаются масштаб и переход к полному управлению. */
  .world-slot--stage .world[data-mode='focus'] .world-label:not(.is-now) { display: none; }
  .world-slot--stage .world[data-mode='focus'] .world-ctl--left,
  .world-slot--stage .world[data-mode='focus'] .world-ctl--right,
  .world-slot--stage .world[data-mode='focus'] .world-ctl--center { display: none; }
}

.world-ctl svg {
  width: 18px;
  height: 18px;
}

.world-ctl:hover {
  background: var(--accent);
  color: var(--accent-ink);
}

.world-ctl--expand {
  background: var(--accent);
  color: var(--accent-ink);
}

.world[data-mode='landing'] .world__controls,
.world[data-mode='landing'] .world__hint,
.world[data-mode='map'] .world-ctl--expand {
  display: none;
}

.world__hint {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 3;
  max-width: calc(100% - 20px);
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--label-bg);
  border: 1px solid var(--line);
  font-size: 0.75rem;
  line-height: 1.3;
  pointer-events: none;
  transition: opacity 0.4s ease;
  animation: hint-out 0.6s ease 7s forwards;
}

.world__hint.is-gone {
  opacity: 0;
}

@keyframes hint-out {
  to {
    opacity: 0;
  }
}

/* Версия 2.0: ачивки доступны с первого хода. */
.icon-btn--achievements { position: relative; }
.achievement-count { min-width: 18px; padding: 1px 4px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .68rem; font-weight: 800; }
.toast { pointer-events: auto; grid-template-columns: 34px minmax(0, 1fr) 24px; }
.toast--achievement { border: 2px solid var(--accent); }
.toast__close { border: 0; padding: 2px; background: transparent; color: inherit; cursor: pointer; font-size: 1.25rem; line-height: 1; }

/* Выбор внешности героя: восемь своих мультяшных персонажей. */
.avatar-picker { border: 0; margin: 0; padding: 0; min-width: 0; }
.avatar-picker legend { font-weight: 700; margin-bottom: 12px; }
.gender-picker { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.avatar-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.avatar-option { display: grid; align-content: start; justify-items: center; gap: 7px; border: 2px solid var(--line); border-radius: 16px; padding: 10px; background: var(--surface-2); color: var(--ink); text-align: center; cursor: pointer; }
.avatar-option img { width: min(96px, 100%); height: auto; aspect-ratio: 1; object-fit: contain; }
.avatar-option span { font-size: .75rem; line-height: 1.3; color: var(--ink-soft); }
.avatar-option.is-selected { border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent); }
.avatar-option:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
@media (max-width: 540px) { .avatar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- звук ---------- */
.landing__audio {
  position: absolute;
  z-index: 5;
  top: max(18px, env(safe-area-inset-top, 0px));
  right: max(18px, env(safe-area-inset-right, 0px));
  min-height: 44px;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.landing__audio [data-audio-open-icon] { display: flex; }
.audio-settings { max-width: 520px; display: grid; gap: 24px; }
.audio-settings__head { display: grid; gap: 10px; padding-right: 38px; }
.audio-settings__head .eyebrow { font-size: 0.65rem; }
.audio-setting { display: grid; gap: 10px; }
.audio-setting__label { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-weight: 700; }
.audio-setting__label output { min-width: 3.5em; text-align: right; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.audio-setting input[type='range'] { width: 100%; min-height: 32px; margin: 0; accent-color: var(--xp); cursor: pointer; }
.audio-setting p { font-size: 0.86rem; }
.light-toggle { min-width: 164px; min-height: 44px; justify-content: center; gap: 10px; padding: 9px 12px; }
.light-toggle__track { display: inline-flex; align-items: center; width: 34px; height: 20px; flex: 0 0 34px; border-radius: 12px; padding: 3px; background: var(--line); }
.light-toggle__track::after { content: ''; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); }
.light-toggle[aria-checked='true'] .light-toggle__track { background: var(--accent); }
.light-toggle[aria-checked='true'] .light-toggle__track::after { transform: translateX(14px); }
.audio-settings__status { min-height: 2.8em; font-size: 0.86rem; }
.audio-settings [data-sound-label] { justify-content: center; }
@media (max-width: 480px) {
  .landing__audio { top: max(12px, env(safe-area-inset-top, 0px)); right: 12px; }
  .audio-settings { gap: 20px; }
  .audio-settings .btn-row { flex-direction: column; align-items: stretch; }
}

/* ---------- финансовые показатели ---------- */
.hud__inner { grid-template-columns: minmax(0, 1fr) auto; }
.stats { grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat--money, .stat--earned, .stat--income, .stat--expenses { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 6px; }
.stat--money .stat__label, .stat--earned .stat__label, .stat--income .stat__label, .stat--expenses .stat__label { position: static; width: auto; height: auto; overflow: visible; clip: auto; grid-column: 1 / -1; font-size: 0.7rem; font-weight: 500; color: var(--ink-soft); white-space: normal; }
.stat--money .stat__value, .stat--earned .stat__value, .stat--income .stat__value, .stat--expenses .stat__value { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.stat--earned .icon, .stat--income .icon { color: var(--money); }
.legacy-notice { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--note-bg); color: var(--note-ink); font-size: 0.85rem; line-height: 1.45; }
.hud__legacy { grid-column: 1 / -1; padding: 8px 10px; font-size: 0.74rem; }
.budget-note { font-size: 0.84rem; line-height: 1.45; }
.tile.is-negative b { color: var(--loss); }
.summary__row dt, .summary__row dd { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .hud__inner { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .who { grid-column: 1 / -1; }
  .hud__tools { grid-column: 1 / -1; grid-row: 2; justify-content: flex-end; }
  .stats { grid-row: 3; }
  .stat--money, .stat--earned, .stat--income, .stat--expenses { padding: 6px; font-size: clamp(0.74rem, 3.2vw, 0.9rem); gap: 3px; }
  .stat--money .icon, .stat--earned .icon, .stat--income .icon, .stat--expenses .icon { width: 15px; height: 15px; }
  .stat--money .stat__label, .stat--earned .stat__label, .stat--income .stat__label, .stat--expenses .stat__label { font-size: 0.65rem; }
  .tiles--finance .tile { padding: 10px; }
  .tiles--finance .tile b { font-size: 1rem; }
}

/* Мобильная панель и итог цели: крупные зоны касания без лишних переносов. */
@media (max-width: 640px) {
  .hud__inner { padding: 8px 12px 6px; row-gap: 6px; }
  .hud__tools { gap: 4px; }
  .hud__tools .icon-btn { width: 44px; height: 44px; flex: 0 0 44px; }
  .stat--money .stat__label, .stat--earned .stat__label, .stat--income .stat__label, .stat--expenses .stat__label {
    min-width: 0; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .complete .status-change {
    display: grid; grid-template-columns: minmax(0, 1fr);
    gap: 6px; align-items: center; width: 100%;
  }
  .complete .status-change > span:first-child { grid-column: 1 / -1; font-size: .85rem; }
  .complete .status-change s { min-width: 0; font-size: .75rem; white-space: normal; overflow-wrap: break-word; }
  .complete .status-change > [aria-hidden="true"] { justify-self: center; transform: rotate(90deg); }
  .complete .status-change .chip { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: break-word; font-size: .78rem; border-radius: 16px; justify-content: center; text-align: center; }
}

@media (pointer: coarse) {
  .hud__tools .icon-btn { min-width: 44px; min-height: 44px; }
  .hud__tools .icon-btn--map { width: 44px; padding: 0; justify-content: center; }
  .hud__tools .icon-btn--map span { display: none; }
}
@media (pointer: coarse) and (max-height: 480px) {
  .hud { position: static; }
}

/* Квартира: тёплый вечер, отдельное пространство от рабочих сцен. */
.landing__back {position:absolute;z-index:5;top:18px;left:20px;display:flex;align-items:center;gap:8px;color:var(--ink);background:var(--surface);padding:10px 16px;border:1px solid var(--line);border-radius:100px;font-weight:700;text-decoration:none}
.home {--home-ink:#f6eddc;--home-soft:#c6bcae;--home-panel:#242a30;--home-line:#44484a;--home-warm:#f7cf82;max-width:1120px;margin:0 auto;padding:20px 28px 32px;color:var(--home-ink)}
body:has(.home),body:has(.arcade) {background:#171d24}
.home button {font-family:var(--font-body)}
.home-nav {display:flex;justify-content:space-between;align-items:center;gap:14px;font-size:14px}
.home-nav>span,.home-nav>div {display:flex;align-items:center;gap:12px}
.home-nav>span {color:var(--home-soft)}
.home-nav .icon,.home-hotspot .icon,.home-zones .icon,.home-trophy .icon,.home-keepsake .icon {width:20px;height:20px}
.home-link {border:0;background:none;color:var(--home-warm);padding:9px 0;cursor:pointer;text-align:left;text-decoration:none;font-weight:600;line-height:1.4}
.home-link:hover {color:#ffe8bd;text-decoration:underline;text-underline-offset:4px}
.home-audio {display:grid;place-items:center;width:42px;height:42px;border-radius:50%;border:1px solid var(--home-line);background:var(--home-panel);color:var(--home-ink);cursor:pointer}
.home-welcome {display:flex;justify-content:space-between;align-items:center;gap:20px;margin:24px 0 22px}
.home-kicker {display:block;color:var(--home-soft);font-size:11px;letter-spacing:.12em;text-transform:uppercase;font-weight:600;margin-bottom:9px}
.home-welcome h1 {font-size:clamp(30px,4.8vw,54px);letter-spacing:-.045em;color:var(--home-ink)}
.home-welcome p {margin:9px 0 0;color:var(--home-soft);font-size:16px}
.home-person {display:flex;align-items:center;gap:12px;background:none;color:inherit;border:0;text-align:left;cursor:pointer;min-width:0}
.home-person img {border:2px solid var(--home-warm);border-radius:50%;width:60px;height:60px}
.home-person b {display:block;max-width:200px;overflow:hidden;text-overflow:ellipsis}
.home-person small {display:block;color:var(--home-soft);font-size:12px}
.home-room {position:relative;overflow:hidden;border-radius:24px;border:1px solid #6d5a3a;box-shadow:0 20px 64px -30px #0009;background:#172b41;isolation:isolate}
.home-room>img {width:100%;height:auto;display:block;aspect-ratio:1672/941;object-fit:cover}
.home-room::after {content:'';position:absolute;inset:70% 0 0;background:linear-gradient(transparent,#10151bc2);pointer-events:none;z-index:0}
.home-hotspot {position:absolute;z-index:1;display:flex;align-items:center;gap:7px;transform:translate(-50%,-50%);background:#182431e8;color:#fff4dc;border:1px solid #f5d69a9c;border-radius:100px;box-shadow:0 4px 18px #0007;min-height:44px;padding:8px 13px;cursor:pointer;font-size:13px;font-weight:700;transition:background .2s,box-shadow .2s}
.home-hotspot::before {content:'';position:absolute;inset:-5px;border:1px solid #ffe2a94d;border-radius:inherit;pointer-events:none}
.home-hotspot:hover,.home-hotspot:focus-visible {background:#4e3d27;box-shadow:0 0 24px #ffe5a365}
.home-hotspot--trophies {left:16%;top:18%}
.home-hotspot--laptop {left:19%;top:53%}
.home-room--1 .home-hotspot--laptop {left:14%;top:50%}
.home-hotspot--tea {left:54%;top:76%}
.home-hotspot--arcade {left:89%;top:56%}
.home-hotspot--cat {left:76%;top:64%}
.home-cat-response {position:absolute;z-index:1;left:76%;top:48%;transform:translate(-50%,-50%);font-size:clamp(16px,3vw,32px);letter-spacing:.15em;color:#ffe0a3;text-shadow:0 2px 8px #000b;opacity:0;pointer-events:none}
.home-room.is-petting .home-cat-response {opacity:1;animation:home-cat-hearts 2.8s ease-out both}
.home-room.is-petting .home-hotspot--cat {background:#604536;border-color:#ffdea2}
.home-stage-label {display:flex;flex-wrap:wrap;justify-content:space-between;gap:5px 16px;margin:12px 2px 0;color:var(--home-soft);font-size:12px;line-height:1.5}
.home-stage-label>span {color:var(--home-warm);font-size:11px}
@keyframes home-cat-hearts {0%{opacity:0;transform:translate(-50%,-10%)}15%,75%{opacity:1}100%{opacity:0;transform:translate(-50%,-110%)}}
.home-room__caption {position:absolute;z-index:1;bottom:16px;left:24px;color:#fff3da;font-size:12px;text-shadow:0 1px 4px #000}
.home-zones {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:16px 0 24px}
.home-zones--starter {grid-template-columns:repeat(3,minmax(0,1fr))}
.home-zones>button {border:1px solid var(--home-line);border-radius:16px;background:var(--home-panel);color:var(--home-ink);text-align:left;padding:16px 18px;cursor:pointer;transition:border-color .2s,background .2s}
.home-zones>button:hover,.home-zones>button.is-selected {border-color:var(--home-warm);background:#313334}
.home-zones>button>span {display:flex;align-items:center;gap:7px;color:var(--home-soft);font-size:13px}
.home-zones b {display:block;font-size:22px;line-height:1.3;margin:9px 0 5px;letter-spacing:-.03em;color:var(--home-warm)}
.home-zones small {display:block;font-size:11px;color:var(--home-soft)}
.home-panel {border:1px solid var(--home-line);border-radius:22px;background:var(--home-panel);padding:30px}
.home-panel h2 {font-size:clamp(22px,3vw,30px);letter-spacing:-.025em;line-height:1.3;color:var(--home-ink)}
.home-panel p {color:var(--home-soft);font-size:15px}
.home-panel p b {color:var(--home-ink)}
.home-panel__head {display:flex;justify-content:space-between;gap:18px;align-items:center}
.home-percent {font-size:34px;color:var(--home-warm);letter-spacing:-.06em}
.home-progress,.home-rest__track {overflow:hidden;height:6px;border-radius:100px;background:#131c25;margin:18px 0}
.home-progress>span,.home-rest__track>span {display:block;height:100%;background:var(--home-warm);border-radius:inherit}
.home-goals {list-style:none;padding:0;margin:24px 0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 20px}
.home-goals li {display:flex;align-items:center;gap:12px;border-bottom:1px solid #44484a80;padding:12px 0;min-width:0}
.home-goal-number {flex:0 0 34px;height:34px;display:grid;place-items:center;border-radius:50%;background:#303943;color:var(--home-soft);font-size:13px;font-weight:700}
.home-goals b {display:block;font-size:13px;line-height:1.4}
.home-goals small {display:block;color:var(--home-soft);font-size:11px}
.home-goals .is-done .home-goal-number {background:#2d4e44;color:#b1e0bb}
.home-goals .is-current .home-goal-number {background:var(--home-warm);color:#302416}
.home-goals .home-link {margin-left:auto;font-size:11px}
.home-finances {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:20px 0}
.home-finances>div {background:#1b232c;border-radius:12px;padding:15px}
.home-finances span {display:block;color:var(--home-soft);font-size:11px}
.home-finances b {font-size:17px;display:block;margin-top:6px}
.home-overview {display:grid;grid-template-columns:1.5fr 1fr;gap:36px}
.home-keepsake {border-left:1px solid var(--home-line);padding-left:30px}
.home-keepsake p {display:flex;align-items:center;gap:8px}
.home-keepsake .icon {flex-shrink:0;color:var(--home-warm)}
.home-button {border:1px solid var(--home-line);border-radius:12px;background:#1b232c;color:var(--home-ink);padding:13px 19px;font-size:14px;font-weight:700;cursor:pointer}
.home-button--warm {background:var(--home-warm);color:#302416;border-color:var(--home-warm)}
.home-button--warm:hover {background:#ffe0a3}
.home-trophies {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:22px}
.home-trophy {display:flex;gap:14px;background:#1b232c;border:1px solid #363e47;border-radius:14px;padding:18px;color:#bdc4cc}
.home-trophy.is-earned {border-color:#776443;background:#332f27;color:var(--home-ink)}
.home-trophy__medal {flex:0 0 36px;height:36px;border-radius:50%;display:grid;place-items:center;background:#303943;color:#9ea9b6}
.home-trophy.is-earned .home-trophy__medal {color:#302416;background:var(--home-warm)}
.home-trophy b {font-size:14px;line-height:1.35;display:block}
.home-trophy p {font-size:12px;margin:6px 0 8px}
.home-trophy small {font-size:10px;color:var(--home-soft)}
.home-rest__ritual {display:flex;align-items:center;justify-content:center;gap:52px;padding:32px 12px}
.home-rest__ritual>div:last-child {width:300px;max-width:100%}
.home-breath {display:grid;place-items:center;flex:0 0 160px;width:160px;height:160px;border-radius:50%;background:radial-gradient(circle,#f6cf8650,#f6cf8610);border:1px solid #f7cf825c;box-shadow:0 0 0 12px #f7cf8206,0 0 0 24px #f7cf8204;transition:transform 4s ease-in-out,box-shadow 4s ease-in-out}
.home-breath>span {font-size:48px}
.home-breath[data-phase='inhale'] {transform:scale(1.12);box-shadow:0 0 0 14px #f7cf8212,0 0 0 30px #f7cf8208}
.home-breath[data-phase='exhale'] {transform:scale(.92)}
.home-rest .home-rest__instruction {font-size:18px;color:var(--home-ink);line-height:1.5}
.home-rest .home-rest__time {font-size:13px}
.home-rest__track>span {width:0}
.home-rest .home-note {text-align:center;font-size:12px;border-top:1px solid var(--home-line);padding-top:18px}
.home-footer {font-size:11px;color:#8f9aa6;text-align:center;padding-top:26px}
.home button:focus-visible {outline:3px solid #ffe0a3;outline-offset:4px}
.home [hidden] {display:none !important}
@media(max-width:700px) {
  .home {padding:14px 16px 25px}
  .home-nav {font-size:12px;gap:8px}.home-nav__landing {font-size:11px}.home-nav>div {gap:10px}.home-nav>span {display:none}
  .home-welcome {margin:22px 0 18px;gap:8px}.home-kicker {font-size:9px;letter-spacing:.08em}
  .home-welcome p {font-size:13px}.home-person {gap:7px}.home-person img {width:44px;height:44px}.home-person b {max-width:98px;font-size:12px}.home-person small {max-width:98px;font-size:9px}
  .home-room {border-radius:18px}.home-room__caption {bottom:9px;left:12px;font-size:9px}
  .home-hotspot {font-size:10px;padding:7px 9px;gap:4px;min-height:40px}.home-hotspot .icon {width:14px;height:14px}
  .home-room--1 .home-hotspot--laptop {left:17%}
  .home-hotspot--trophies {left:16%;top:20%}.home-hotspot--arcade {left:85%;top:56%}
  .home-hotspot--cat {left:76%;top:76%;min-width:40px;justify-content:center}.home-hotspot--cat [data-home-cat-label] {display:none}
  .home-stage-label {font-size:10px}.home-stage-label>span {font-size:10px}
  .home-zones {grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin:12px 0 18px}
  .home-zones>button {padding:13px 15px;border-radius:13px}.home-zones b {font-size:20px;margin:6px 0 3px}.home-zones>button>span {font-size:12px}.home-zones small {font-size:10px}
  .home-panel {padding:22px 19px;border-radius:18px}.home-panel p {font-size:13px}.home-panel h2 {font-size:21px}
  .home-overview {grid-template-columns:1fr;gap:25px}.home-keepsake {border-left:0;border-top:1px solid var(--home-line);padding:20px 0 0}
  .home-goals,.home-trophies {grid-template-columns:1fr}.home-finances {grid-template-columns:repeat(2,minmax(0,1fr))}
  .home-rest__ritual {flex-direction:column;gap:24px;padding:25px 0}.home-breath {width:130px;height:130px;flex-basis:130px}
  .home-rest__ritual>div:last-child {text-align:center}.home-rest__ritual .home-link {display:block;margin:6px auto}
  .landing__back {left:14px;top:14px;padding:9px 12px;font-size:12px}
}
@media(prefers-reduced-motion:reduce) {.home-breath,.home-hotspot,.home-zones>button {transition:none}.home-breath[data-phase] {transform:none}.home-room.is-petting .home-cat-response {animation:none}}

/* Автономный домашний автомат: все правила ограничены .arcade. */
.arcade {
  width: min(100%, 680px);
  min-width: 0;
  margin: 0 auto;
  padding: 18px clamp(10px, 3vw, 28px) 32px;
  color: #e9f2f0;
  box-sizing: border-box;
}
.arcade *, .arcade *::before, .arcade *::after { box-sizing: border-box; }
.arcade-room__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.arcade .arcade-room__exit {
  background: #25323a;
  border: 1px solid #537274;
  border-radius: 12px;
  color: #effaf7;
  padding: 11px 15px;
  min-height: 44px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.arcade-room__free { color: #b3d3c7; font-size: 12px; text-align: right; }
.arcade-cabinet {
  position: relative;
  max-width: 540px;
  margin: 0 auto;
  padding: clamp(12px, 3vw, 24px);
  border: 1px solid #6b685e;
  border-radius: 28px 28px 20px 20px;
  background: linear-gradient(145deg, #3c4140, #272e34 52%, #303836);
  box-shadow: 0 18px 44px #050c1780, 0 0 0 5px #242b2c, inset 0 1px #aba89355;
}
.arcade-cabinet::before {
  content: "";
  position: absolute;
  top: 20px;
  left: 7px;
  bottom: 20px;
  width: 3px;
  border-radius: 5px;
  background: #79d8c5;
  box-shadow: 0 0 14px #79d8c570;
  pointer-events: none;
}
.arcade-cabinet__header {
  border: 1px solid #788174;
  border-radius: 15px;
  padding: 15px 10px 14px;
  margin-bottom: 14px;
  background: linear-gradient(115deg, #243538, #29303d);
  text-align: center;
}
.arcade-cabinet__eyebrow {
  display: block;
  color: #bed3c7;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.arcade .arcade-cabinet h1 {
  margin: 7px 0 6px;
  color: #f3d59e;
  font-size: clamp(22px, 5.2vw, 33px);
  line-height: 1.12;
  letter-spacing: -.035em;
  text-shadow: 0 0 17px #efc8842b;
}
.arcade-cabinet__header p { margin: 0; color: #c7d6d3; font-size: 12px; line-height: 1.5; }
.arcade-hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 0;
  margin: 0 0 12px;
}
.arcade-hud > div { padding: 8px 3px; background: #1c292e; border: 1px solid #445a5d; border-radius: 9px; text-align: center; }
.arcade-hud dt { color: #adc6c3; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.arcade-hud dd { margin: 3px 0 0; color: #d8f4e9; font-size: clamp(16px, 4vw, 23px); font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.1; overflow-wrap: anywhere; }
.arcade-screen {
  position: relative;
  overflow: hidden;
  border: 3px solid #101b23;
  border-radius: 16px;
  box-shadow: 0 0 0 1px #608079, 0 0 20px #6bd2bd16, inset 0 0 24px #000;
  background: #101b35;
}
.arcade-canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.arcade-screen__corner { position: absolute; top: 10px; right: 11px; color: #83aaa7; font-size: 9px; letter-spacing: .18em; pointer-events: none; }
.arcade-status {
  min-height: 46px;
  padding: 11px 3px 8px;
  color: #cce1d9;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}
.arcade-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 13px; }
.arcade .arcade-actions button {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid #6e8f8b;
  border-radius: 11px;
  background: #364e50;
  color: #f0f6ee;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  box-shadow: inset 0 1px #a9d3c72c, 0 3px #131e2480;
}
.arcade .arcade-actions [data-arcade-start] { background: #82d8be; color: #173f3a; border-color: #adf3d7; }
.arcade .arcade-actions button:disabled { color: #8da19f; border-color: #475a5c; background: #2b383e; cursor: default; box-shadow: none; }
.arcade-controls {
  display: grid;
  grid-template-columns: minmax(48px, 1fr) minmax(95px, 1.8fr) minmax(48px, 1fr);
  gap: 12px;
  padding: 15px 15px 18px;
  border: 1px solid #8e735b;
  border-radius: 13px;
  background: repeating-linear-gradient(4deg, #615044 0, #615044 8px, #655448 9px, #655448 17px);
  box-shadow: inset 0 2px 5px #1c211d75;
}
.arcade .arcade-controls button {
  min-width: 0;
  min-height: 56px;
  padding: 8px;
  border: 2px solid #8ccbc1;
  border-radius: 16px;
  background: radial-gradient(ellipse at 40% 25%, #567b7d, #2e4d58);
  box-shadow: inset 0 2px #d2fff13b, 0 5px #172f39;
  color: #e8fff5;
  font: inherit;
  font-size: 25px;
  font-weight: 750;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.arcade .arcade-controls__fire {
  color: #ffebca;
  background: radial-gradient(ellipse at 40% 25%, #91675f, #674951);
  border-color: #e6b29a;
  box-shadow: inset 0 2px #ffd3b73b, 0 5px #442d3b;
  font-size: 20px;
}
.arcade .arcade-controls button:active { transform: translateY(3px); box-shadow: inset 0 2px 6px #17302b70, 0 2px #172f39; }
.arcade .arcade-controls button:disabled { opacity: .55; cursor: default; }
.arcade .arcade-instructions { margin: 13px 0 0; color: #bdcec8; font-size: 11px; line-height: 1.65; text-align: center; }
.arcade-cabinet__footer { margin-top: 15px; padding-top: 12px; border-top: 1px solid #52665f; color: #a9beb5; font-size: 10px; text-align: center; }
.arcade-cabinet__footer span { color: #ecd39d; margin-right: 5px; }
.arcade-room__note { margin: 20px auto 0; max-width: 450px; color: #a9beb5; font-size: 11px; line-height: 1.5; text-align: center; }
.arcade button:focus-visible, .arcade-canvas:focus-visible { outline: 3px solid #ffdb94; outline-offset: 4px; }
.arcade [hidden] { display: none !important; }
@media (max-width: 400px) {
  .arcade { padding-right: 9px; padding-left: 9px; }
  .arcade-room__top { gap: 8px; }
  .arcade .arcade-room__exit { padding: 10px; font-size: 12px; }
  .arcade-cabinet { padding: 12px; border-radius: 22px; }
  .arcade-controls { gap: 9px; padding: 12px 10px 15px; }
  .arcade .arcade-controls button { min-height: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  .arcade *, .arcade *::before, .arcade *::after { transition: none !important; animation: none !important; }
  .arcade .arcade-controls button:active { transform: none; }
}

/* Короткие подсказки: UI-настройка, не часть игрового прогресса. */
.avatar-help { margin: 8px 0 14px; font-size: .85rem; line-height: 1.5; }
.guide-card > h2 { padding-right: 32px; }
.guide-card > .eyebrow { display: block; padding-right: 40px; margin-bottom: 8px; }
.guide-list { display: grid; gap: 16px; list-style: none; padding: 0; margin: 24px 0; }
.guide-list li { display: grid; grid-template-columns: 40px minmax(0,1fr); gap: 12px; align-items: start; }
.guide-icon { display: grid; place-items: center; width: 40px; height: 40px; background: var(--surface-2); border-radius: 12px; }
.guide-icon svg { width: 24px; height: 24px; }
.guide-list p { margin: 4px 0 0; color: var(--ink-soft); font-size: .88rem; line-height: 1.5; }
.guide-card .btn, .guide-card .modal__close { min-width: 44px; min-height: 44px; }
@media(max-width:640px) { .guide-list { gap: 14px; margin: 18px 0; } .guide-list li { gap: 10px; } }

/* Операции забега и регулярные расходы. */
.who__day { color: var(--ink-soft); font-size: .75rem; line-height: 1.3; }
.stat--expenses .icon { color: var(--loss); }
.stat--expenses .stat__label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
.journal-card > h2, .budget-card > h2 { padding-right: 36px; }
.journal-opening { padding: 12px; background: var(--surface-2); border-radius: 10px; font-size: .85rem; }
.journal-list { display: grid; gap: 14px; padding: 0; margin: 20px 0 0; list-style: none; }
.journal-entry { padding: 16px; border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.journal-label { font-size: .95rem; overflow-wrap: anywhere; margin: 8px 0 12px; }
.journal-deltas { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.journal-deltas li { display: flex; gap: 12px; justify-content: space-between; font-size: .85rem; }
.journal-deltas b { white-space: nowrap; }
.journal-deltas .is-loss { color: var(--loss); } .journal-deltas .is-gain { color: var(--money); }
.journal-balance { font-size: .85rem; margin: 12px 0 0; }
.journal-months { margin-top: 12px; font-size: .85rem; }
.journal-months summary { min-height: 44px; cursor: pointer; display: flex; align-items: center; }
.journal-months ul { padding: 0; list-style: none; display: grid; gap: 10px; }
.journal-months li { display: grid; gap: 4px; padding: 10px; background: var(--surface-2); border-radius: 10px; }
@media(max-width:640px) {
  .stat--expenses { min-width: 0; min-height: 44px; }
  .stat--expenses .stat__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .journal-entry { padding: 12px; }
  .journal-deltas li { font-size: .8rem; }
}

/* Уведомления об операции не перекрывают её подробный разбор. */
.is-reading-ledger .toasts { visibility: hidden; pointer-events: none; }

.final-replay { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 16px 0 24px; }
.final-replay .btn { min-height: 44px; }
.final-replay p { flex: 1 1 260px; margin: 0; font-size: .85rem; }
.rank-title { display: block; margin-top: 4px; color: var(--ink-soft); font-size: .72rem; font-weight: 500; white-space: normal; }
.ach__locked { display: block; margin-top: 6px; color: var(--ink-soft); font-size: .7rem; }

/* 4.0: следующий шаг и связь с авторами. */
.landing__content { gap: clamp(14px, 2.5vh, 26px); max-width: 100%; }
.landing__authors { min-height: 44px; padding: 10px 20px; border-radius: 100px; background: #fffdf5; color: #1e2130; font-size: .9rem; }
.practicum-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 20px; align-items: center; padding: clamp(16px, 3vw, 24px); margin-bottom: 12px; border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: 16px; background: var(--surface-2); }
.practicum-card h3 { margin: 0 0 8px; font-size: clamp(1.1rem, 2.8vw, 1.35rem); }
.practicum-card p { margin: 0; line-height: 1.5; }
.practicum-card .btn { min-height: 52px; }
.practicum-hint { grid-column: 1 / -1; font-size: .82rem; }
.authors-card > h2 { padding-right: 40px; }
.authors-card > p { line-height: 1.6; margin: 0; }
.authors-card > h3 { font-size: 1rem; margin: 4px 0 0; }
.creator-links { display: grid; gap: 12px; }
.creator-link { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 60px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--ink); text-decoration: none; }
.creator-link:hover { border-color: var(--ink); }
.creator-link strong { overflow-wrap: anywhere; }
.creator-link > span { color: var(--ink-soft); font-size: .8rem; }
@media (max-width: 640px) {
  .practicum-card { grid-template-columns: minmax(0, 1fr); }
  .practicum-card .btn { width: 100%; }
}
@media (max-width: 400px) { .creator-link > span { display: none; } }
.authors-card .modal__close { min-width: 44px; min-height: 44px; }

/* The laptop goal shows actual savings separately from its monthly forecast. */
.laptop-progress { min-width: 0; margin: 20px 0; padding: clamp(12px, 3vw, 18px); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.laptop-progress h3 { margin: 0 0 14px; font-size: 1rem; line-height: 1.5; overflow-wrap: anywhere; }
.laptop-progress__bar { display: block; width: 100%; max-width: 100%; height: 10px; margin: 0 0 15px; appearance: none; border: 0; border-radius: 10px; overflow: hidden; background: var(--line); accent-color: var(--money); }
.laptop-progress__bar::-webkit-progress-bar { border-radius: 10px; background: var(--line); }
.laptop-progress__bar::-webkit-progress-value { border-radius: 10px; background: var(--money); }
.laptop-progress__bar::-moz-progress-bar { border-radius: 10px; background: var(--money); }
.laptop-progress dl { display: grid; gap: 9px; margin: 0; }
.laptop-progress__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 10px; font-size: .88rem; line-height: 1.5; }
.laptop-progress__row dt { min-width: 0; overflow-wrap: anywhere; color: var(--ink-soft); }
.laptop-progress__row dd { min-width: 0; max-width: 100%; margin: 0; overflow-wrap: anywhere; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.laptop-progress__row .is-negative { color: var(--loss); }
.laptop-progress__hint { margin: 13px 0 0; color: var(--ink-soft); font-size: .82rem; line-height: 1.55; overflow-wrap: anywhere; }
.laptop-progress__hint.is-ready { color: var(--money); font-weight: 700; }
.laptop-progress__period { margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--line); }
.laptop-progress__period h4 { margin: 0; font-size: .9rem; line-height: 1.5; overflow-wrap: anywhere; }
.laptop-progress__days { margin: 5px 0 13px; font-size: .82rem; line-height: 1.5; color: var(--ink-soft); }
/* Status stays outside re-rendered game screens so an outage remains visible. */
.sync-status{position:sticky;top:env(safe-area-inset-top,0px);z-index:90;display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:8px;padding:8px 12px;background:#e4f4ed;color:#164f3a;font-size:13px;line-height:1.4;overflow-wrap:anywhere}
.sync-status[hidden]{display:none}.sync-status.is-warning{background:#fff0bd;color:#503b07}.sync-status .btn{padding:6px 10px;font-size:12px;min-height:34px}
