:root {
  --cream: #fbf6ea;
  --card: #fffdf7;
  --line: #e7dcc4;
  --ink: #1d2433;
  --muted: #6f6a5f;
  --yellow: #f6c337;
  --yellow-d: #d9a215;
  --green: #2f9a55;
  --red: #d9443f;
  --blue: #3566c9;
  --shadow: 0 6px 18px rgba(40, 30, 10, .16);
  --r: 18px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 16px/1.35 Nunito, system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.grow { flex: 1; min-width: 0; }

#game { height: 100dvh; display: flex; flex-direction: column; }
#view { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }

/* ================= HUD ================= */
.hud {
  position: absolute; inset: 0 0 auto 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 10px;
  padding: 12px 14px;
  pointer-events: none;
  z-index: 5;
}
.hud > * { pointer-events: auto; }
.card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 10px 14px;
}
.hud-left { display: flex; flex-direction: column; gap: 10px; max-width: 320px; }
.profile { display: flex; gap: 10px; align-items: center; padding: 8px 14px 8px 8px; }
.avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: #dff1ee; border: 3px solid #fff; box-shadow: 0 2px 6px #0002;
  display: grid; place-items: center; font-size: 26px;
}
.p-title { font-weight: 800; font-size: .95rem; margin-bottom: 6px; }
.bar { height: 9px; border-radius: 99px; background: #ece5d6; overflow: hidden; }
.bar .fill { height: 100%; background: var(--yellow); border-radius: 99px; transition: width .4s; }

.order { padding: 10px 14px; }
.o-head { display: flex; gap: 10px; align-items: center; }
.o-head .box { font-size: 30px; }
.o-title { font-weight: 800; }
.o-line { font-size: .88rem; color: var(--muted); }
.o-line b { color: var(--ink); }
.steps { display: flex; gap: 4px; margin-top: 8px; }
.steps span {
  flex: 1; text-align: center; font-size: .68rem; font-weight: 700; color: #a49d8f;
  padding-top: 6px; border-top: 4px solid #ece5d6;
}
.steps span.done { border-color: var(--green); color: var(--green); }
.steps span.cur { border-color: var(--yellow); color: var(--ink); }
.o-tip { margin-top: 6px; font-size: .8rem; color: var(--muted); }

.shift { text-align: center; padding: 8px 18px 10px; }
.s-title { font-weight: 800; font-size: .92rem; }
.dots { display: flex; gap: 10px; justify-content: center; margin-top: 6px; }
.dots span { width: 12px; height: 12px; border-radius: 50%; background: #e2dacb; }
.dots span.done { background: var(--yellow); }
.dots span.cur { background: #fff; box-shadow: 0 0 0 3px var(--yellow); }

.hud-right { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.pill {
  background: var(--card); border-radius: 99px; box-shadow: var(--shadow);
  padding: 8px 14px; font-weight: 800; white-space: nowrap;
}
.pill.low { color: var(--red); }
.icon-btn {
  width: 42px; height: 42px; border-radius: 14px; border: 0;
  background: var(--card); box-shadow: var(--shadow); cursor: pointer; font-size: 18px;
}
.icon-btn.off { opacity: .55; }

/* стрелки на перекрёстке */
#arrows { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.arrow {
  position: absolute; transform: translate(-50%, -50%);
  width: 64px; height: 64px; border-radius: 50%;
  border: 0; background: #fff; box-shadow: 0 6px 16px #0003;
  font-size: 30px; font-weight: 900; cursor: pointer; pointer-events: auto;
  animation: popIn .25s ease-out;
}
.arrow:hover { background: #fff6d6; transform: translate(-50%, -50%) scale(1.08); }
@keyframes popIn { from { transform: translate(-50%, -50%) scale(.4); opacity: 0; } }

/* уведомления */
#toasts {
  position: absolute; left: 50%; top: 86px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 6px; align-items: center;
  z-index: 6; pointer-events: none; width: min(92%, 460px);
}
.toast {
  background: var(--ink); color: #fff; border-radius: 12px;
  padding: 8px 14px; font-weight: 700; font-size: .9rem; text-align: center;
  box-shadow: var(--shadow);
  animation: toastIn .25s ease-out;
  transition: opacity .4s, transform .4s;
}
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

.flycoin {
  position: fixed; z-index: 50; font-size: 22px; pointer-events: none;
  transition: transform .65s cubic-bezier(.5, -0.3, .6, 1);
}

/* ================= НИЖНЯЯ ПАНЕЛЬ ================= */
.panel {
  flex: none;
  background: var(--cream);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(40, 30, 10, .1);
  padding: 16px 22px calc(16px + env(safe-area-inset-bottom));
  min-height: 150px;
  position: relative; z-index: 6;
}
.nav-panel { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.talk-panel { display: flex; flex-direction: column; gap: 10px; max-width: 760px; margin: 0 auto; }
.riding { font-weight: 800; font-size: 1.1rem; padding: 30px 0; }

.voice { display: flex; gap: 16px; align-items: center; flex: 1; min-width: 260px; }
.speak {
  flex: none; width: 64px; height: 64px; border-radius: 50%;
  border: 0; background: #ede6d6; cursor: pointer; font-size: 26px;
  box-shadow: inset 0 -3px 0 #0001;
}
.speak:hover { background: #e4dac4; }
.speak.small { width: 38px; height: 38px; font-size: 17px; vertical-align: middle; margin-left: 6px; }
.who {
  flex: none; width: 64px; height: 64px; border-radius: 50%;
  background: #f4e3cf; display: grid; place-items: center; font-size: 36px;
  border: 3px solid #fff; box-shadow: 0 2px 8px #0002;
}
.vlabel { font-size: .82rem; color: var(--muted); font-weight: 700; }
.vline { font-size: clamp(1.25rem, 3.2vw, 2rem); font-weight: 900; line-height: 1.2; letter-spacing: -.01em; }
.vline.masked { filter: blur(9px); cursor: pointer; user-select: none; }
.link { background: none; border: 0; padding: 0; color: var(--blue); text-decoration: underline; cursor: pointer; font-weight: 700; font-size: .9rem; margin-top: 4px; }
.link .cost { color: var(--muted); text-decoration: none; font-weight: 500; font-size: .8rem; }
.vtr { font-size: .95rem; color: var(--muted); margin-top: 4px; }

.dirs { display: flex; gap: 10px; }
.dir {
  min-width: 150px; padding: 18px 20px; border-radius: 16px;
  background: #fff; border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line);
  font-size: 1.15rem; font-weight: 900; cursor: pointer;
}
.dir span { font-size: 1.4rem; }
.dir:hover { border-color: var(--yellow); background: #fffaf0; }
.dir:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.hint { font-size: .85rem; color: var(--muted); font-weight: 700; text-align: center; border-left: 1px solid var(--line); padding-left: 16px; }
.hint.big { font-size: 1rem; color: var(--ink); }

.talk-q { font-weight: 900; font-size: 1.1rem; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.card-opt, .answer {
  position: relative;
  background: #fff; border: 2px solid var(--line); border-radius: 14px;
  cursor: pointer; box-shadow: 0 3px 0 var(--line);
}
.card-opt { padding: 18px 8px; }
.card-opt .ic { font-size: 30px; letter-spacing: 2px; line-height: 1.3; }
.answers { display: flex; flex-direction: column; gap: 8px; }
.answer { text-align: left; padding: 12px 16px 12px 40px; font-weight: 700; font-size: 1.05rem; }
.card-opt:hover:not(:disabled), .answer:hover:not(:disabled) { border-color: var(--yellow); }
.answer.sel { border-color: var(--ink); background: #eef3ff; }
.right { border-color: var(--green) !important; background: #e5f6ea !important; }
.wrong { border-color: var(--red) !important; background: #fde9e7 !important; opacity: .7; }
.k {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  font-size: .7rem; font-weight: 800; color: #a49d8f;
  border: 1px solid var(--line); border-radius: 5px; padding: 0 5px;
}
.card-opt .k { top: 12px; transform: none; }

.btn {
  border: 0; border-radius: 14px; padding: 12px 20px; cursor: pointer;
  background: #fff; box-shadow: 0 3px 0 var(--line), 0 0 0 2px var(--line) inset;
  font-weight: 800;
}
.btn:hover:not(:disabled) { background: #fffaf0; }
.btn.primary { background: var(--yellow); box-shadow: 0 4px 0 var(--yellow-d); }
.btn.primary:hover:not(:disabled) { background: #f8cd52; }
.btn:active:not(:disabled) { transform: translateY(2px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.big { font-size: 1.15rem; padding: 16px 28px; width: 100%; }
.btn.ghost { background: transparent; box-shadow: none; color: var(--muted); text-decoration: underline; }
.k-in { font-size: .75rem; opacity: .6; margin-left: 4px; }
#reply { align-self: stretch; padding: 14px; font-size: 1.05rem; }

.result-panel { display: flex; align-items: center; gap: 20px; justify-content: center; flex-wrap: wrap; padding: 10px 0; }
.stars { font-size: 34px; }
.stars .dim { filter: grayscale(1); opacity: .3; }
.r-title { font-weight: 900; font-size: 1.4rem; }

/* ================= БАЗА ================= */
#overlay {
  position: absolute; inset: 0; z-index: 8;
  display: grid; place-items: center;
  background: rgba(251, 246, 234, .35);
  backdrop-filter: blur(2px);
  padding: 16px;
  overflow-y: auto;
}
.hub {
  background: var(--card); border-radius: 26px; box-shadow: 0 20px 50px rgba(40, 30, 10, .25);
  padding: 26px; width: min(420px, 100%); text-align: center;
  display: flex; flex-direction: column; gap: 12px;
}
.hub.wide { width: min(760px, 100%); text-align: left; }
.hub h1 { margin: 0; font-size: 2rem; font-weight: 900; }
.hub h2 { margin: 0; font-weight: 900; }
.hub p { margin: 0; }
.hub-logo { font-size: 56px; line-height: 1; }
.hub-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0; }
.hub-stats div { background: #f6f0e2; border-radius: 14px; padding: 10px 4px; }
.hub-stats b { display: block; font-size: 1.4rem; font-weight: 900; }
.hub-stats span { font-size: .78rem; color: var(--muted); }
.hub-row { display: flex; gap: 10px; }
.hub-row .btn { flex: 1; }

.ups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.up { background: #f8f3e7; border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.up.locked { opacity: .65; }
.up-ico { font-size: 34px; }
.up-name { font-weight: 900; }
.lvl { display: flex; gap: 5px; margin: 4px 0; }
.lvl span { flex: 1; height: 7px; border-radius: 9px; background: #e2dacb; }
.lvl span.on { background: var(--yellow); }
.up .btn { margin-top: auto; }

.book { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: 45vh; overflow-y: auto; }
.book li { background: #f8f3e7; border-radius: 10px; padding: 8px 12px; font-weight: 700; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: 8px; vertical-align: -2px; border: 1px solid #0003; }

/* ================= МОБИЛЬНЫЕ ================= */
@media (max-width: 760px) {
  .hud { grid-template-columns: 1fr auto; padding: 8px; gap: 6px; }
  .shift { grid-column: 1 / -1; grid-row: 2; justify-self: center; padding: 6px 14px; }
  .hud-left { max-width: 230px; gap: 6px; }
  .profile { padding: 6px 10px 6px 6px; }
  .avatar { width: 36px; height: 36px; font-size: 20px; }
  .steps, .o-tip { display: none; }
  .o-head .box { font-size: 22px; }
  .card { padding: 8px 10px; }
  .icon-btn { width: 34px; height: 34px; font-size: 15px; border-radius: 10px; }
  .pill { padding: 6px 10px; font-size: .85rem; }
  .hud-right { max-width: 150px; }
  #toasts { top: auto; bottom: 12px; }
  .panel { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
  .nav-panel { gap: 10px; }
  .voice { min-width: 0; flex-basis: 100%; gap: 10px; }
  .speak, .who { width: 48px; height: 48px; font-size: 22px; }
  .who { font-size: 28px; }
  .dirs { width: 100%; }
  .dir { min-width: 0; flex: 1; padding: 14px 6px; font-size: 1rem; }
  .hint { display: none; }
  .hint.big { display: block; border: 0; padding: 0; width: 100%; }
  .cards { gap: 6px; }
  .card-opt .ic { font-size: 22px; }
  .k { display: none; }
  .answer { padding: 10px 12px; font-size: .98rem; }
  .ups { grid-template-columns: 1fr; }
  .arrow { width: 52px; height: 52px; font-size: 24px; }
}


/* Generated assets retain emoji fallbacks until each PNG has loaded. */
.game-asset { position: relative; display: inline-grid; place-items: center; width: 1em; height: 1em; flex: none; vertical-align: middle; }
.game-asset img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; }
.game-asset.asset-loaded img { opacity: 1; }
.game-asset.asset-loaded .asset-fallback { visibility: hidden; }
.portrait-asset { width: 100%; height: 100%; overflow: hidden; border-radius: 50%; }
.who { overflow: hidden; }
.item-asset { width: 38px; height: 38px; font-size: 30px; }
.item-group { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 2px; }
.card-opt .ic { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.inline-asset { width: 26px; height: 26px; }
@media (max-width: 540px) { .item-asset { width: 27px; height: 27px; font-size: 25px; } .card-opt .ic { gap: 4px; } }

/* ================= ГАРДЕРОБ ================= */
.skins { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.skin { background: #f8f3e7; border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 6px; border: 2px solid transparent; }
.skin.worn { border-color: var(--yellow); background: #fff8e4; }
.skin.locked .skin-look { filter: grayscale(.85); opacity: .7; }
.skin-look { position: relative; height: 120px; border-radius: 12px; display: grid; place-items: center; }
.skin-prev { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.skin-face {
  position: absolute; right: 8px; bottom: 8px;
  width: 44px; height: 44px; border-radius: 50%;
  background: #fff; border: 3px solid #fff; box-shadow: 0 2px 6px #0002;
  display: grid; place-items: center; font-size: 22px; overflow: hidden;
}
.skin-face .game-asset { font-size: 22px; }
.skin .btn { margin-top: auto; }
.skin-worn { margin-top: auto; font-weight: 800; color: var(--green); text-align: center; padding: 10px; }
.skin-lock { margin-top: auto; font-size: .85rem; font-weight: 700; color: var(--muted); }
.r-note { font-weight: 800; margin-top: 4px; }
.avatar { overflow: hidden; }
.avatar .game-asset { font-size: 26px; }
@media (max-width: 760px) {
  .skins { grid-template-columns: 1fr 1fr; }
  .skin-look { height: 96px; }
  .hub-row { flex-wrap: wrap; }
}

/* ================= СЛОВА: знакомство и словарь ================= */
.unit-asset { width: 1em; height: 1em; font-size: 28px; }
.unit-asset.big, .unit-icon.big { font-size: 84px; }
.unit-asset.tiny, .unit-icon.tiny { font-size: 20px; }
.unit-num { font-weight: 900; color: var(--ink); }
.unit-num.big { font-size: 64px; display: grid; place-items: center; width: 100px; height: 100px; border-radius: 22px; background: #fff; box-shadow: 0 3px 0 var(--line); }
.unit-num.tiny { font-size: .85rem; min-width: 22px; text-align: center; background: #fff; border-radius: 6px; padding: 0 4px; }
.unit-color { display: inline-block; border-radius: 50%; border: 2px solid #0002; vertical-align: middle; }
.unit-color.big { width: 96px; height: 96px; }
.unit-color.tiny { width: 18px; height: 18px; }

.intro-panel { display: flex; align-items: center; gap: 22px; max-width: 760px; margin: 0 auto; animation: pop .25s ease-out; }
.intro-pic { flex: none; width: 120px; height: 120px; border-radius: 26px; background: #fff3d1; display: grid; place-items: center; box-shadow: inset 0 0 0 3px #f6c33755; }
.intro-text { flex: 1; min-width: 0; }
.intro-badge { display: inline-block; background: var(--yellow); border-radius: 99px; padding: 2px 10px; font-weight: 900; font-size: .78rem; margin-bottom: 4px; }
.intro-word { font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 900; line-height: 1.1; }
.intro-ru { font-size: 1.15rem; font-weight: 700; color: var(--muted); margin: 2px 0 4px; }

.r-words { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .9rem; }
.wchip { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px 3px 6px; font-weight: 700; }

.book { max-height: 52vh; }
.wsec { background: #f8f3e7; border-radius: 14px; padding: 8px 10px; }
.wsec summary { cursor: pointer; font-weight: 900; padding: 4px 2px; }
.wrow {
  width: 100%; display: grid; grid-template-columns: 26px 1fr 1fr auto auto; align-items: center; gap: 10px;
  background: #fff; border: 0; border-radius: 10px; padding: 7px 10px; margin-top: 6px; cursor: pointer; text-align: left;
}
.wsec.cat-phrase .wrow, .wsec.cat-counter .wrow { grid-template-columns: 1fr 1fr auto auto; }
.wrow:hover { background: #fffaf0; }
.w-en { font-weight: 800; }
.w-ru { color: var(--muted); }
.w-st { font-size: .8rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.w-box { font-size: .7rem; letter-spacing: 1px; color: #d9a215; white-space: nowrap; }
.wrow.known .w-st { color: var(--green); }

@media (max-width: 760px) {
  .intro-panel { gap: 12px; flex-wrap: wrap; }
  .intro-pic { width: 84px; height: 84px; }
  .unit-asset.big, .unit-icon.big { font-size: 58px; }
  .unit-num.big { width: 70px; height: 70px; font-size: 44px; }
  .unit-color.big { width: 64px; height: 64px; }
  .intro-panel .btn { width: 100%; }
  .wrow { grid-template-columns: 22px 1fr auto; }
  .wrow .w-ru { grid-column: 2; grid-row: 2; }
  .wrow .w-box { display: none; }
}

/* карточка правила: схема «где нужный дом» */
.intro-pic.rule { width: auto; min-width: 150px; padding: 10px 14px; background: #eef4ff; box-shadow: inset 0 0 0 3px #3566c933; }
.diagram { display: flex; align-items: center; gap: 6px; }
.diagram.col { flex-direction: column; gap: 4px; }
.dg { width: 46px; height: 46px; border-radius: 10px; background: #fff; display: grid; place-items: center; font-size: 26px; box-shadow: 0 2px 0 #0001; }
.dg .unit-asset { font-size: 34px; }
.dg.target { box-shadow: 0 0 0 3px var(--yellow), 0 2px 0 #0001; background: #fff8e1; }
.dg-road { width: 70px; height: 12px; border-radius: 4px; background: repeating-linear-gradient(90deg, #767b87 0 10px, #e9e3d0 10px 16px, #767b87 16px 26px); }
.intro-ex { font-weight: 700; margin: 2px 0 4px; }
@media (max-width: 760px) { .dg { width: 38px; height: 38px; font-size: 22px; } .intro-pic.rule { min-width: 0; } }

/* ================= СБОРКА ОТВЕТА ИЗ СЛОВ ================= */
.build {
  min-height: 56px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  border: 2px dashed var(--line); border-radius: 14px; padding: 8px; background: #fff;
}
.build.right { border-style: solid; border-color: var(--green); background: #e5f6ea; }
.build.wrong { border-style: solid; border-color: var(--red); background: #fde9e7; animation: shakeX .35s; }
@keyframes shakeX { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.tile {
  position: relative; padding: 10px 14px 9px; border-radius: 12px; cursor: pointer;
  background: #fff; border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line);
  font-weight: 800; font-size: 1.05rem;
}
.tiles .tile { padding-left: 24px; }
.tile .k { top: 6px; left: 5px; transform: none; font-size: .6rem; padding: 0 3px; }
.tile:hover:not(:disabled) { border-color: var(--yellow); }
.tile:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.tiles .tile:disabled { visibility: hidden; }
.tile.on { background: #eef3ff; border-color: #b9c8ec; box-shadow: 0 3px 0 #b9c8ec; }
.tile.on.right { background: #e5f6ea; border-color: var(--green); box-shadow: 0 3px 0 #9fd6b3; }
.build-row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.build-row #reply { min-width: 160px; }
@media (max-width: 760px) {
  .tile { padding: 8px 10px; font-size: .95rem; }
  .tiles .tile { padding-left: 10px; }
  .build-row .btn { flex: 1; }
}

/* ================= ОТЧЁТ ДИСПЕТЧЕРУ ================= */
.review-ask { display: flex; align-items: center; gap: 16px; }
.unit-asset.mid, .unit-icon.mid { font-size: 52px; }
.unit-num.mid { font-size: 38px; display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 16px; background: #fff; box-shadow: 0 3px 0 var(--line); }
.unit-color.mid { width: 56px; height: 56px; }
.card-opt .ic .unit-color, .card-opt .ic .unit-num { margin: 0 auto; }
.feedback {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: 12px; font-weight: 700;
  animation: pop .2s ease-out;
}
.feedback.right { background: #e5f6ea; color: #1d6b3d; }
.feedback.wrong { background: #fde9e7; color: #9b2a24; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.type-form { display: flex; gap: 8px; }
.type-form input {
  flex: 1; min-width: 0; font: inherit; font-size: 1.2rem; font-weight: 700;
  padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: #fff; color: var(--ink);
}
.type-form input:focus { outline: none; border-color: var(--yellow); }
@media (max-width: 760px) { .unit-asset.mid, .unit-icon.mid { font-size: 40px; } }
.card-opt .unit-num { box-shadow: none; background: none; }

/* стрелки поворота — компактнее, чтобы не закрывать здания у перекрёстка */
.arrow { width: 50px; height: 50px; font-size: 24px; background: rgba(255, 255, 255, .92); }
@media (max-width: 760px) { .arrow { width: 42px; height: 42px; font-size: 20px; } }

/* ================= ВЫДЕЛЕНИЕ КЛЮЧЕВЫХ СЛОВ ================= */
mark.kw { background: #ffe27a; color: inherit; border-radius: 6px; padding: 0 4px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.rule-line { font-size: .95rem; margin-top: 2px; }

/* схема правила: наша сторона улицы, дорога, другая сторона */
.diagram { flex-direction: column; gap: 4px; }
.dg-row { display: flex; gap: 6px; justify-content: center; }
.dg-road { width: 100%; min-width: 150px; }
.dg { position: relative; }
.dg.dim { opacity: .35; }
.dg.ref { box-shadow: 0 0 0 2px #3566c9, 0 2px 0 #0001; }
.dg.target i { position: absolute; top: -8px; right: -6px; font-style: normal; font-size: 14px; color: #d9a215; }
.intro-pic.rule { height: auto; padding: 12px 14px; }

/* название здания у курсора */
#maptip {
  position: absolute; z-index: 7; pointer-events: none;
  transform: translate(-50%, calc(-100% - 14px));
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow);
  padding: 6px 12px; font-size: .92rem; white-space: nowrap;
}
#maptip b { font-weight: 900; }

/* выбор длины смены */
.len-pick { display: flex; gap: 6px; background: #f6f0e2; border-radius: 14px; padding: 4px; }
.len {
  flex: 1; border: 0; border-radius: 10px; padding: 9px 6px; cursor: pointer;
  background: transparent; font-weight: 800; font-size: .9rem; color: var(--muted);
}
.len.on { background: #fff; color: var(--ink); box-shadow: 0 2px 6px #0001; }
.len.locked { display: grid; place-items: center; cursor: default; opacity: .55; font-size: .8rem; }
.end-early {
  margin-top: 6px; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-weight: 700; font-size: .75rem; text-decoration: underline;
}

/* ================= ДОСКА ЗАКАЗОВ ================= */
.offers { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.offer {
  position: relative; display: flex; flex-direction: column; gap: 5px; align-items: flex-start; text-align: left;
  background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 14px 14px 12px;
  box-shadow: 0 3px 0 var(--line); cursor: pointer;
}
.offer:hover { border-color: var(--yellow); }
.offer .k { left: auto; right: 10px; top: 12px; transform: none; }
.o-stars { font-weight: 900; color: #d9a215; }
.o-stars .dim { color: #e2dacb; }
.o-shop { font-weight: 800; display: flex; align-items: center; gap: 6px; }
.o-pay { font-weight: 900; font-size: 1.15rem; }
.o-notes { display: flex; flex-wrap: wrap; gap: 4px; }
.o-notes i { font-style: normal; font-size: .75rem; font-weight: 700; background: #f6f0e2; border-radius: 99px; padding: 2px 8px; }
.offer.tier-hard { border-color: #e9c46a; background: #fffaf0; }
#refresh { align-self: flex-start; }

/* разговор у прилавка */
.wait-bar { display: flex; align-items: center; gap: 10px; font-size: .85rem; font-weight: 700; color: var(--muted); }
.wait-bar .bar { flex: 1; max-width: 260px; }
.wait-bar .fill { transition: width 1.2s ease; width: 0; }
.task { background: #eef4ff; border-radius: 12px; padding: 8px 12px; font-size: 1.05rem; }

/* ================= ПЕРЕПИСКА ================= */
.phone { background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 10px 12px; }
.ph-head { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.ph-head .game-asset, .ph-head > span:first-child { width: 32px; height: 32px; font-size: 22px; border-radius: 50%; overflow: hidden; }
.ph-msgs { display: flex; flex-direction: column; gap: 6px; padding: 10px 0 4px; }
.bubble { max-width: 80%; padding: 8px 12px; border-radius: 16px; font-weight: 700; animation: pop .2s ease-out; }
.bubble.in { align-self: flex-start; background: #eef1f6; border-bottom-left-radius: 4px; }
.bubble.out { align-self: flex-end; background: #dff3e6; border-bottom-right-radius: 4px; }
#t-auto.off { opacity: .45; }

/* срочные заказы */
.o-notes i.urgent { background: #ffe9c2; color: #8a5300; }
.o-timer { margin-top: 6px; font-weight: 900; font-size: .85rem; color: #8a5300; background: #fff1d6; border-radius: 8px; padding: 3px 8px; display: inline-block; }
.o-timer.low { background: #ffe0d6; color: #a03a1c; }
.o-timer.late { background: #fde9e7; color: var(--red); }

/* оплата */
.pay-opt { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pay-opt b { font-size: 1.1rem; }
.o-pay-chip { margin-top: 6px; display: inline-block; font-weight: 800; font-size: .8rem; background: #e5f6ea; color: #1d6b3d; border-radius: 8px; padding: 3px 8px; }

/* пока нет заказов */
.result-panel.quiet .bar.search { margin-top: 8px; width: 220px; overflow: hidden; }
.result-panel.quiet .bar.search .fill { width: 35%; animation: search 1.4s ease-in-out infinite alternate; }
@keyframes search { from { transform: translateX(-100%); } to { transform: translateX(280%); } }
.quiet-acts { display: flex; flex-direction: column; gap: 8px; }

/* ================= РАЙОНЫ ================= */
.district-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: #f6f0e2; border: 0; border-radius: 14px; padding: 8px 12px; cursor: pointer;
}
.district-btn:hover { background: #efe6d2; }
.d-ico { font-size: 26px; }
.d-ico.big { font-size: 38px; }
.districts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.district { background: #f8f3e7; border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 8px; border: 2px solid transparent; }
.district.here { border-color: var(--yellow); background: #fff8e4; }
.district.locked .d-head { opacity: .75; }
.d-head { display: flex; gap: 10px; align-items: flex-start; }
.reqs { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 700; }
.reqs li { color: var(--muted); }
.reqs li.ok { color: var(--green); }
.district .btn { margin-top: auto; }
@media (max-width: 760px) { .districts { grid-template-columns: 1fr; } }

/* ================= ДЕЛОВОЙ ЦЕНТР ================= */
.unit-num sup { font-size: .45em; margin-left: 1px; }
.unit-clock {
  display: inline-grid; place-items: center; font-weight: 900; letter-spacing: .03em;
  font-family: ui-monospace, Menlo, monospace; background: #1d2433; color: #7dffb0;
  border-radius: 12px; padding: 4px 12px;
}
.unit-clock.big { font-size: 44px; padding: 14px 18px; }
.unit-clock.mid { font-size: 30px; }
.unit-clock.tiny { font-size: .8rem; padding: 1px 6px; border-radius: 6px; }
.lift { display: grid; grid-template-columns: repeat(6, 56px); gap: 8px; background: #d9dde3; border-radius: 16px; padding: 12px; width: max-content; }
.lift-btn {
  width: 56px; height: 56px; border-radius: 50%; border: 3px solid #aab2bd; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #fff, #e3e7ec); font: inherit; font-weight: 900; font-size: 1.2rem;
}
.lift-btn:hover:not(:disabled) { border-color: var(--yellow); }
.lift-btn.right { border-color: var(--green); background: #e5f6ea; box-shadow: 0 0 12px #2f9a5588; }
.lift-btn.wrong { border-color: var(--red); background: #fde9e7; opacity: .6; }
@media (max-width: 760px) { .lift { grid-template-columns: repeat(4, 48px); } .lift-btn { width: 48px; height: 48px; } }
.intro-pic.wide { width: auto; min-width: 120px; padding: 0 14px; }
.intro-pic.wide .unit-clock.big { font-size: 38px; }

/* ================= МОДАЛЬНЫЕ ОКНА ================= */
#modal {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center; padding: 16px;
  background: rgba(29, 36, 51, .38); backdrop-filter: blur(2px);
  animation: fadeIn .2s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal-card {
  background: var(--card); border-radius: 26px; box-shadow: 0 24px 60px rgba(20, 15, 5, .35);
  width: min(440px, 100%); padding: 26px 24px 22px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  animation: popUp .28s cubic-bezier(.2, 1.4, .4, 1);
}
.modal-card.wide { width: min(560px, 100%); }
@keyframes popUp { from { transform: translateY(20px) scale(.92); opacity: 0; } }
.m-icon { font-size: 64px; line-height: 1; width: 104px; height: 104px; display: grid; place-items: center; border-radius: 28px; background: #fff3d1; }
.m-title { margin: 2px 0 0; font-size: 1.7rem; font-weight: 900; }
.m-text { margin: 0; color: var(--muted); font-size: 1rem; }
.m-lines { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.m-lines div { display: flex; justify-content: space-between; background: #f6f0e2; border-radius: 12px; padding: 9px 14px; font-weight: 700; }
.m-lines .late { background: #fde9e7; color: var(--red); }
.m-notes { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.m-row { display: flex; gap: 10px; width: 100%; }
.m-row .btn { flex: 1; }
.modal-card .btn.big { width: 100%; }
.stars.big { font-size: 44px; }

/* ================= ТЕЛЕФОН: МЕССЕНДЖЕР ================= */
.modal-card.phone-card { width: min(380px, 100%); padding: 0; background: transparent; box-shadow: none; }
.phone-card .phone {
  width: 100%; height: min(680px, 86vh); display: flex; flex-direction: column;
  background: #f4f1ea; border: 10px solid #1d2433; border-radius: 42px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(20, 15, 5, .45); text-align: left;
}
.ph-bar { display: flex; justify-content: space-between; padding: 6px 20px 2px; font-size: .75rem; font-weight: 800; background: #fff; }
.phone-card .ph-head { display: flex; align-items: center; gap: 10px; padding: 8px 14px 10px; background: #fff; border-bottom: 1px solid var(--line); }
.ph-ava { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; font-size: 26px; flex: none; background: #f4e3cf; }
.ph-ava .game-asset { width: 40px; height: 40px; font-size: 26px; }
.ph-status { font-size: .75rem; color: var(--green); font-weight: 700; }
.phone-card .ph-msgs { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 8px; }
.phone-card .bubble { max-width: 85%; font-size: .95rem; box-shadow: 0 1px 1px #0001; }
.phone-card .bubble.in { background: #fff; }
.phone-card .bubble.out { background: #d8f5c8; }
.ticks { margin-left: 6px; font-size: .7rem; color: #3b9c5c; }
.ph-tr { align-self: flex-start; font-size: .8rem; }
.ph-task { align-self: center; text-align: center; background: #eef4ff; border-radius: 12px; padding: 8px 12px; font-weight: 800; font-size: .9rem; }
.bubble.typing { display: flex; gap: 4px; padding: 12px 14px; }
.bubble.typing i { width: 7px; height: 7px; border-radius: 50%; background: #a9a39a; animation: blink 1s infinite; }
.bubble.typing i:nth-child(2) { animation-delay: .15s; }
.bubble.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 50% { opacity: .25; transform: translateY(-2px); } }
.ph-kb { background: #e7e3da; padding: 10px; border-top: 1px solid var(--line); max-height: 48%; overflow-y: auto; }
.ph-kb .talk-panel { gap: 6px; }
.ph-kb .talk-q { font-size: .8rem; color: var(--muted); }
.ph-kb .answer { font-size: .9rem; padding: 9px 12px 9px 34px; border-radius: 18px; }
.ph-kb #reply, .ph-kb .build-row .btn { padding: 9px; font-size: .9rem; }
.ph-kb .build { min-height: 44px; padding: 6px; }
.ph-kb .tile { padding: 7px 10px 6px; font-size: .9rem; }
.ph-kb .tiles .tile { padding-left: 20px; }
.ph-kb .build-row { justify-content: space-between; }

/* ================= ТОРГОВАЯ УЛИЦА: ПОЛКА ================= */
.errand-note { background: #fff8e4; border-radius: 12px; padding: 8px 12px; font-weight: 700; }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.sh-item {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: #fff; border: 2px solid var(--line); border-radius: 14px; box-shadow: 0 3px 0 var(--line);
  padding: 10px 8px; cursor: pointer; font-size: .9rem;
}
.sh-item:hover { border-color: var(--yellow); }
.sh-pic { font-size: 30px; position: relative; }
.sh-pic i { position: absolute; right: -16px; bottom: -4px; font-size: 18px; font-style: normal; }
.sh-price { font-weight: 900; color: #8a5300; }
.sh-n { position: absolute; top: 6px; right: 8px; background: var(--green); color: #fff; border-radius: 99px; min-width: 22px; height: 22px; display: grid; place-items: center; font-weight: 900; font-size: .8rem; }
.basket { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-weight: 700; }
.basket .wchip { cursor: pointer; }

/* «Не слышно? Показать слово» в вопросах на слух */
#nohear { display: block; margin-top: 4px; }
#nohear.pulse { animation: nohear 1s ease-in-out 3; color: var(--red); }
@keyframes nohear { 50% { transform: scale(1.06); } }
.hear-word { display: block; margin-top: 4px; }
