/* Пергамент, который темнеет по мере приближения к Мордору.
   Цвета считает app.js и кладёт в переменные ниже. */

:root {
  --paper:  #e6dcc3;
  --paper2: #ddd0b1;
  --ink:    #2f2416;
  --ink-dim:#6b5b42;
  --line:   #b9a880;
  --ember:  #a83a1c;
  --gold:   #9a7b2e;
  --radius: 14px;
}

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

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 17px;
  line-height: 1.5;
  transition: background-color .8s ease, color .8s ease;
}

body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#app {
  max-width: 620px;
  margin: 0 auto;
  padding: 18px 18px 40px;
}

/* --- шапка --- */
#head { text-align: center; margin: 6px 0 14px; }
.act {
  font-size: 13px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-dim);
}
.act-sub { font-size: 15px; font-style: italic; color: var(--ink-dim); opacity: .8; }

/* --- карта --- */
#mapWrap {
  background: var(--paper2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: background-color .8s ease;
}
#map { display: block; width: 100%; height: auto; }

.route-ghost { stroke: var(--line); stroke-width: 2; stroke-dasharray: 5 6; }
.route-done  { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }

.mark-dot   { fill: var(--paper2); stroke: var(--line); stroke-width: 2; }
.mark-dot.on{ fill: var(--ink); stroke: var(--ink); }
.mark-lbl   { font-size: 13px; fill: var(--ink-dim); opacity: 0; transition: opacity .4s; }
.mark-lbl.on{ opacity: 1; fill: var(--ink); }

#tDot  { fill: var(--ember); }
#tRing { stroke: var(--ember); stroke-width: 1.5; opacity: .5; }
#traveller { transition: transform 1.2s cubic-bezier(.4,.1,.2,1); }

#eyeGlow { fill: var(--ember); opacity: .18; }
.hidden { display: none !important; }

.hill  { fill: none; stroke: var(--line); stroke-width: 1.6; stroke-linejoin: round; }
.tree  { fill: var(--line); opacity: .55; }
.water { fill: none; stroke: var(--line); stroke-width: 1.4; opacity: .7; }
.shore { fill: none; stroke: var(--line); stroke-width: 1.6; opacity: .8; }

/* --- прогресс --- */
#progress { margin: 18px 2px 4px; }
.big { font-size: 34px; line-height: 1.1; }
.big .unit { font-size: 16px; color: var(--ink-dim); }
.bar {
  height: 3px; background: var(--line); border-radius: 2px;
  margin: 12px 0 8px; overflow: hidden;
}
.bar i {
  display: block; height: 100%; width: 100%;
  background: var(--ember);
  transform: scaleX(0); transform-origin: left;
  transition: transform 1s ease;
}
.row { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-dim); gap: 10px; }

/* --- полоса «виджет отстал» --- */
.strip {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; margin: 16px 0 0; padding: 11px 14px;
  background: none; border: 1px solid var(--ember); color: var(--ink-dim);
  font-size: 13px; text-align: left;
}
.strip b { color: var(--ember); font-weight: normal; white-space: nowrap; }
.strip:active { background: var(--paper2); }

/* --- карточки --- */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 18px 0;
}
.label { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-dim); }
.next-title { font-size: 20px; margin-top: 4px; }
.next-sub { font-size: 14px; color: var(--ink-dim); }

/* --- кнопки --- */
button { font: inherit; cursor: pointer; border-radius: 10px; }
.primary {
  display: block; width: 100%; padding: 15px;
  background: var(--ink); color: var(--paper);
  border: none; font-size: 17px;
}
.primary:active { transform: scale(.99); }
.ghost {
  background: none; border: 1px solid var(--line); color: var(--ink-dim);
  padding: 10px 16px;
}

/* --- хроника --- */
#chronicle { margin-top: 30px; }
#chronicle h2 {
  font-size: 12px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-dim); font-weight: normal; margin-bottom: 10px;
}
.day {
  border-top: 1px solid var(--line);
  padding: 14px 0;
  display: grid; grid-template-columns: 54px 1fr; gap: 12px;
}
.day-n { font-size: 13px; color: var(--ink-dim); }
.day-km { font-size: 18px; }
.day-place { font-size: 14px; color: var(--ink-dim); }
.day-note { font-size: 15px; margin-top: 6px; white-space: pre-wrap; }
.day img { width: 100%; border-radius: 8px; margin-top: 10px; display: block; }
.day-scenes { margin-top: 8px; font-size: 13px; font-style: italic; color: var(--gold); }
.empty { color: var(--ink-dim); font-style: italic; }

footer { display: flex; gap: 8px; margin-top: 28px; }
footer .ghost { flex: 1; font-size: 14px; padding: 10px 6px; }
#btnDebug { flex: 0 0 42px; opacity: .35; }

/* --- модалки --- */
.modal {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(20,14,8,.55);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 12px;
}
.sheet {
  background: var(--paper);
  border-radius: 18px;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  width: 100%; max-width: 560px;
  max-height: 88vh; overflow-y: auto;
  animation: rise .28s ease;
}
@keyframes rise { from { transform: translateY(24px); opacity: 0 } }
@media (prefers-reduced-motion: reduce) {
  .sheet { animation: none }
  #traveller, .bar i { transition: none }
}
.sheet h3 { margin: 0 0 14px; font-size: 22px; font-weight: normal; }
.sheet label { display: block; font-size: 13px; color: var(--ink-dim); margin-bottom: 14px; }
.sheet input[type=text], .sheet input[type=number], .sheet textarea {
  display: block; width: 100%; margin-top: 6px; padding: 11px;
  font: inherit; color: var(--ink);
  background: var(--paper2); border: 1px solid var(--line); border-radius: 8px;
}
.sheet input[type=range] { width: 100%; margin-top: 10px; accent-color: var(--ember); }
.sheet-actions { display: flex; gap: 10px; margin-top: 6px; }
.sheet-actions .primary { flex: 2; }
.sheet-actions .ghost { flex: 1; }
.muted { color: var(--ink-dim); font-size: 14px; }
#photoPrev { width: 100%; border-radius: 8px; margin-bottom: 14px; }

/* --- сцена --- */
.scene { background: var(--paper2); }
.scene-place {
  font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold);
}
.scene h3 { font-size: 27px; margin: 6px 0 16px; }
.scene-body { white-space: pre-wrap; font-size: 17px; line-height: 1.65; margin-bottom: 22px; }
