/* Тёмная тема под Kolejowa-акт (Task 5.3): фон #2E2C2B, акцент терракота
   #E07A5F, системный шрифт (TT Travels подключим позже — не трогаем сейчас). */

:root {
  --bg: #2e2c2b;
  --bg-raised: #3a3735;
  --bg-raised-2: #423e3b;
  --accent: #e07a5f;
  --accent-dim: #b85f48;
  --text: #f2ece7;
  --text-dim: #b8b0a9;
  --border: #4a453f;
  --danger: #d9534f;
  --ok: #7bb28a;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overscroll-behavior: none;
  user-select: none;
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

#scene {
  position: absolute;
  inset: 0;
}

#scene canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* ---------- gate (no Telegram, no ?dev) ---------- */

.gs-gate {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  background: var(--bg);
}

.gs-gate h1 {
  color: var(--accent);
  margin: 0;
}

.gs-gate p {
  color: var(--text-dim);
  max-width: 320px;
  line-height: 1.5;
}

/* ---------- HUD ---------- */

.gs-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 10px 8px;
  background: linear-gradient(to bottom, rgba(46, 44, 43, 0.92), rgba(46, 44, 43, 0));
  pointer-events: none;
}

.gs-hud > * {
  pointer-events: auto;
}

.gs-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.gs-hud-spacer {
  flex: 1;
}

.gs-level-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  max-width: 160px;
}

.gs-level-badge {
  background: var(--accent);
  color: #201514;
  font-weight: 800;
  font-size: 11px;
  border-radius: 999px;
  padding: 3px 7px;
  min-width: 20px;
  text-align: center;
}

.gs-xp-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.gs-xp-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.25s ease;
}

.gs-icon-btn {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
}

.gs-icon-btn:active {
  background: var(--bg-raised-2);
}

/* ---------- FTUE v2: guided-hand tutorial overlay (web/src/tutorial.ts) ----------
   Owner decision 12.07 (docs/DESIGN.md §7): explicit step-by-step guidance
   with a real input-blocking spotlight, replacing the old "no arrows" v1
   dim-only banner. Z-index 500 sits above everything, including modals (50)
   and their own backdrop, so a modal-choice step's ring/hand still show. */

.gs-tut-root {
  position: fixed;
  inset: 0;
  z-index: 500;
  pointer-events: none;
}

/* Input-blocking + dimming band. In "spotlight"/"flourish" mode up to 4 of
   these tile the screen around the target hole (or 1 full-screen band with
   no hole in "flourish" mode) — each one's own pointer-events:auto is enough
   to swallow clicks/taps without a JS handler (the browser hit-tests the
   topmost element under the pointer; nothing behind a covering div is
   reachable). The target rect itself simply has no band over it, so taps
   there fall straight through to the real game underneath. */
.gs-tut-band {
  position: fixed;
  background: rgba(20, 16, 14, 0.66);
  pointer-events: auto;
}

.gs-tut-ring {
  position: fixed;
  pointer-events: none;
  border: 2px solid var(--accent);
  border-radius: 14px;
  box-shadow: 0 0 0 4px rgba(224, 122, 95, 0.18);
  animation: gs-tut-pulse 1.1s ease-in-out infinite;
}

@keyframes gs-tut-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(224, 122, 95, 0.55);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(224, 122, 95, 0);
  }
}

.gs-tut-hand {
  position: fixed;
  pointer-events: none;
  font-size: 30px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
  animation: gs-tut-hand-nudge 0.85s ease-in-out infinite;
}

@keyframes gs-tut-hand-nudge {
  0%,
  100% {
    transform: rotate(var(--gs-tut-hand-rot, -35deg)) translate(0, 0);
  }
  50% {
    transform: rotate(var(--gs-tut-hand-rot, -35deg)) translate(-6px, -6px);
  }
}

.gs-tut-panel {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 78px);
  z-index: 501;
  pointer-events: none;
  background: var(--bg-raised-2);
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}

.gs-tut-card {
  position: fixed;
  inset: 0;
  z-index: 500;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 16, 14, 0.78);
}

.gs-tut-card-body {
  max-width: 340px;
  background: var(--bg-raised-2);
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 22px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.gs-tut-card-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
}

.gs-tut-card-text {
  font-size: 14px;
  line-height: 1.5;
}

.gs-tut-popup {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  z-index: 501;
  pointer-events: none;
  background: var(--bg-raised-2);
  border: 1px solid var(--accent);
  border-radius: 18px;
  padding: 18px 22px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: gs-tut-pop-in 0.25s ease-out;
}

@keyframes gs-tut-pop-in {
  from {
    transform: translate(-50%, -50%) scale(0.7);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

[data-ftue-highlight] {
  position: relative;
}

/* ---------- Goals chip (post-FTUE, content/goals.ts) ---------- */

.gs-goal-chip {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 58px;
  z-index: 19;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}

.gs-goal-chip.hidden {
  display: none;
}

.gs-goal-chip-icon {
  font-size: 16px;
}

.gs-goal-chip-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.gs-goal-chip-text {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gs-goal-chip-bar {
  height: 5px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}

.gs-goal-chip-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.25s ease;
}

/* ---------- tab bar ---------- */

.gs-tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  gap: 4px;
  padding: 6px 6px calc(env(safe-area-inset-bottom, 0px) + 6px);
  background: linear-gradient(to top, rgba(46, 44, 43, 0.96), rgba(46, 44, 43, 0.75));
  border-top: 1px solid var(--border);
}

.gs-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 11px;
  padding: 8px 2px 6px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.gs-tab-emoji {
  font-size: 18px;
}

.gs-tab.active {
  color: var(--accent);
  background: var(--bg-raised);
}

/* ---------- modal ---------- */

.gs-modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.gs-modal-backdrop.hidden {
  display: none;
}

.gs-modal {
  width: 100%;
  max-width: 480px;
  max-height: 78vh;
  background: var(--bg-raised);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  border: 1px solid var(--border);
  border-bottom: none;
  padding: 14px 14px calc(env(safe-area-inset-bottom, 0px) + 14px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gs-modal-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
}

.gs-modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.gs-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
}

.gs-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Item icon (Task 6.4 §5): real assets/sprites/item_<id>.png in place of the
   emoji/color-dot placeholders across warehouse, supply/recipe modals and
   journal contract cards. Falls back to .gs-swatch (color dot) on <img>
   error — see itemIcon() in ui.ts. */
.gs-item-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex-shrink: 0;
  background: var(--bg-raised);
  border-radius: 6px;
  padding: 2px;
}

.gs-item-icon-sm {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
  vertical-align: -3px;
  margin-right: 3px;
}

.gs-contract-services {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
}

.gs-row-title {
  font-weight: 600;
  font-size: 13px;
}

.gs-row-sub {
  font-size: 11px;
  color: var(--text-dim);
}

.gs-row-main {
  flex: 1;
  min-width: 0;
}

.gs-btn {
  background: var(--accent);
  color: #201514;
  border: none;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.gs-btn:active {
  background: var(--accent-dim);
}

.gs-btn:disabled {
  background: var(--border);
  color: var(--text-dim);
  cursor: default;
}

.gs-btn-secondary {
  background: var(--bg-raised-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.gs-contract-pair {
  display: flex;
  gap: 8px;
}

.gs-contract-card {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gs-progressbar {
  height: 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.gs-progressbar-fill {
  height: 100%;
  background: var(--ok);
}

.gs-week-days {
  display: flex;
  gap: 4px;
}

.gs-week-day {
  flex: 1;
  height: 22px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-dim);
}

.gs-week-day.done {
  background: var(--ok);
  color: #16281c;
  border-color: var(--ok);
}

.gs-week-day.today {
  border-color: var(--accent);
  color: var(--accent);
}

.gs-color-swatches {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 6px 0 2px;
}

.gs-color-swatch-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  cursor: pointer;
}

.gs-empty {
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  padding: 18px 0;
}

/* ---------- toasts ---------- */

.gs-toast-root {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 54px);
  left: 0;
  right: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.gs-toast {
  background: var(--bg-raised-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  animation: gs-toast-in 0.2s ease-out, gs-toast-out 0.3s ease-in 2.2s forwards;
}

@keyframes gs-toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes gs-toast-out {
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

/* ---------- photo mode ---------- */

.gs-photo-preview {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.gs-photo-actions {
  display: flex;
  gap: 8px;
}
