/* «Летописец» — стили. Все классы с приставкой lt-, цвета — токены сайта
   из style.css (:root), своих цветов немного: пергамент и сургуч. */

.lt-head .lead { max-width: 62ch; }
.lt-section { padding-top: clamp(20px, 4vw, 48px); }

.lt-wrap {
  display: grid; gap: 24px; align-items: start;
  grid-template-columns: minmax(0, 540px) minmax(0, 1fr);
  justify-content: center;
}
@media (max-width: 900px) { .lt-wrap { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Доска ---------- */
.lt-board {
  scroll-margin-top: calc(var(--nav-h) + 8px);
  position: relative; overflow: hidden; isolation: isolate;
  padding: 18px 18px 16px; border-radius: var(--radius);
  border: 1px solid rgba(232, 147, 76, .28);
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(107, 111, 174, .22), transparent 60%),
    radial-gradient(90% 60% at 50% 100%, rgba(232, 147, 76, .08), transparent 70%),
    linear-gradient(180deg, #1a1530, #100d1c);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), var(--shadow);
  min-height: 560px;
}
.lt-screen[hidden] { display: none !important; }

/* ---------- Шкалы ---------- */
.lt-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 4px 0 10px; }
.lt-stat { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 16px; }
.lt-stat-name { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.lt-ic { position: relative; width: 46px; height: 46px; display: block; }
.lt-ic-dim, .lt-ic-full { position: absolute; inset: 0; display: block; }
.lt-ic-dim img, .lt-ic-full img, .lt-ic-dim svg, .lt-ic-full svg { width: 100%; height: 100%; display: block; object-fit: contain; }
.lt-ic-dim { opacity: .2; filter: grayscale(1); }
/* Заливка снизу: окно высотой «уровень шкалы», картинка внутри прибита к низу. */
.lt-ic-fill {
  position: absolute; left: 0; right: 0; bottom: 0; overflow: hidden;
  height: calc(var(--lvl, .5) * 100%);
  transition: height .45s cubic-bezier(.3, .7, .3, 1);
}
.lt-ic-fill .lt-ic-full { top: auto; bottom: 0; height: 46px; }
.lt-stat.is-danger .lt-ic-full { filter: drop-shadow(0 0 6px rgba(192, 80, 58, .9)); }
.lt-stat.is-danger .lt-stat-name { color: #e98a74; }
.lt-stat.is-up .lt-ic { animation: lt-up .7s ease-out; }
.lt-stat.is-down .lt-ic { animation: lt-down .7s ease-out; }
@keyframes lt-up { 0% { filter: drop-shadow(0 0 0 transparent); } 30% { filter: drop-shadow(0 0 10px rgba(95, 212, 196, .9)); } 100% { filter: none; } }
@keyframes lt-down { 0% { filter: none; } 30% { filter: drop-shadow(0 0 10px rgba(192, 80, 58, 1)); } 100% { filter: none; } }

/* Точки предпросмотра: маленькая — немного, большая — сильно. */
.lt-dot {
  position: absolute; top: 2px; left: 50%; width: 0; height: 0; border-radius: 50%;
  background: var(--gold-2); transform: translate(-50%, 0); box-shadow: 0 0 8px rgba(240, 180, 111, .8);
  transition: width .15s, height .15s;
}
.lt-dot.is-1 { width: 7px; height: 7px; top: 4px; }
.lt-dot.is-2 { width: 13px; height: 13px; top: 1px; }

.lt-meta {
  text-align: center; font-size: .86rem; color: var(--text-2); min-height: 1.4em;
  padding: 8px 0 0; border-top: 1px solid var(--border);
}
.lt-meta b { color: var(--text); font-weight: 600; }
.lt-sep { color: var(--text-3); margin: 0 4px; }

/* ---------- Карта ---------- */
.lt-text {
  font-family: var(--font-display); font-size: clamp(1.02rem, 1.4vw, 1.14rem); line-height: 1.45;
  text-align: center; color: var(--text); min-height: 5.8em; display: flex; align-items: center; justify-content: center;
  margin: 12px 4px 10px; outline: none;
}
.lt-deck { position: relative; width: min(260px, 72%); aspect-ratio: 3 / 3.7; margin: 0 auto; touch-action: none; }
.lt-back, .lt-card { position: absolute; inset: 0; border-radius: 20px; }
.lt-back {
  transform: translate(6px, 7px) rotate(2.2deg);
  background: #1b1630 center / cover no-repeat;
  border: 1px solid rgba(240, 180, 111, .25);
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
}
.lt-back img, .lt-back svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.lt-card {
  --card-bg: #3d3552;
  cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none;
  background:
    radial-gradient(90% 70% at 50% 30%, color-mix(in srgb, var(--card-bg) 86%, #fff), var(--card-bg) 60%, color-mix(in srgb, var(--card-bg) 60%, #000) 100%);
  border: 2px solid rgba(240, 180, 111, .55);
  box-shadow: inset 0 0 0 6px rgba(0, 0, 0, .18), inset 0 0 0 7px rgba(240, 180, 111, .22), 0 22px 50px rgba(0, 0, 0, .55);
  overflow: hidden;
  transition: transform .26s cubic-bezier(.3, .7, .3, 1), opacity .26s;
}
.lt-card.is-drag { transition: none; cursor: grabbing; }
.lt-card-art { position: absolute; inset: 8% 4% 0; display: flex; align-items: flex-end; justify-content: center; pointer-events: none; }
.lt-card-art img, .lt-card-art svg { width: 100%; height: 100%; object-fit: contain; display: block; }
.lt-card-say {
  position: absolute; left: 0; right: 0; top: 0; padding: 12px 14px 22px;
  font-weight: 600; font-size: .98rem; line-height: 1.25; color: #fff4dc; opacity: 0;
  background: linear-gradient(180deg, rgba(12, 10, 19, .92), rgba(12, 10, 19, 0));
  transition: opacity .15s; pointer-events: none;
}
.lt-card-say.is-L { opacity: 1; text-align: left; }
.lt-card-say.is-R { opacity: 1; text-align: right; }
.lt-card.is-out-l { transform: translate(-140%, 40px) rotate(-24deg); opacity: 0; }
.lt-card.is-out-r { transform: translate(140%, 40px) rotate(24deg); opacity: 0; }
.lt-card.is-in { animation: lt-flip .38s cubic-bezier(.3, .7, .3, 1); }
@keyframes lt-flip { from { transform: perspective(900px) rotateY(80deg) translateX(6px); opacity: .3; } to { transform: none; opacity: 1; } }

.lt-who { position: relative; z-index: 1; text-align: center; margin: 14px 0 12px; line-height: 1.25; }
.lt-who b { display: block; font-family: var(--font-display); font-size: 1.18rem; color: var(--gold-2); font-weight: 700; }
.lt-who span { font-size: .84rem; color: var(--text-3); }

/* ---------- Кнопки решений ---------- */
.lt-choices { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lt-choice {
  display: flex; align-items: center; gap: 8px; min-height: 58px; padding: 10px 12px;
  border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--text); font-weight: 600; font-size: .92rem; line-height: 1.2; text-align: left;
  transition: background .15s, border-color .15s, transform .15s; flex-wrap: wrap;
  touch-action: manipulation;
}
.lt-choice-r { justify-content: flex-end; text-align: right; }
.lt-choice .lt-lab { flex: 1 1 60%; }
.lt-choice .lt-arr { color: var(--gold-2); font-size: 1.1rem; flex: none; }
.lt-choice .lt-num { flex: 1 0 100%; font-size: .74rem; font-weight: 500; color: var(--gold-2); order: 3; }
.lt-choice .lt-num:empty { display: none; }
.lt-choice:hover { background: rgba(255, 255, 255, .09); border-color: rgba(240, 180, 111, .45); }
.lt-choice.is-armed { border-color: var(--gold); background: rgba(232, 147, 76, .16); box-shadow: 0 0 0 3px rgba(232, 147, 76, .18); }
.lt-choice:focus-visible, .lt-tool:focus-visible, .lt-link:focus-visible, .lt-det summary:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px; }
.lt-hint[hidden] { display: none; }
.lt-hint { text-align: center; font-size: .78rem; color: var(--text-3); margin: 10px 0 0; }

.lt-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.lt-tool {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface);
  font-size: .86rem; font-weight: 600; color: var(--text);
}
.lt-tool:hover:not(:disabled) { border-color: rgba(240, 180, 111, .5); background: var(--surface-2); }
.lt-tool:disabled { opacity: .5; cursor: not-allowed; }
.lt-sage-ic {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff4dc, var(--gold-2) 40%, var(--gold) 75%);
  box-shadow: 0 0 8px rgba(240, 180, 111, .6);
}
.lt-icon { width: 44px; padding: 0; justify-content: center; }
.lt-icon::before {
  content: ""; width: 20px; height: 20px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H2v6h4l5 4V5z'/%3E%3Cpath d='M15.5 8.5a5 5 0 0 1 0 7M19 5a10 10 0 0 1 0 14'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H2v6h4l5 4V5z'/%3E%3Cpath d='M15.5 8.5a5 5 0 0 1 0 7M19 5a10 10 0 0 1 0 14'/%3E%3C/svg%3E") center / contain no-repeat;
}
.lt-icon.is-off::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H2v6h4l5 4V5z'/%3E%3Cpath d='m22 9-6 6M16 9l6 6'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H2v6h4l5 4V5z'/%3E%3Cpath d='m22 9-6 6M16 9l6 6'/%3E%3C/svg%3E");
  color: var(--text-3);
}
.lt-coins { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--gold-2); font-variant-numeric: tabular-nums; }
.lt-coin {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 35%, #ffe1a8, var(--gold-2) 45%, #b8662e 100%);
  box-shadow: inset 0 0 0 2px rgba(120, 60, 20, .35);
}

/* ---------- Начало ---------- */
.lt-screen { animation: lt-fade .3s ease-out; }
@keyframes lt-fade { from { opacity: 0; } to { opacity: 1; } }
#ltStart { text-align: center; padding: 8px 4px 4px; }
.lt-start-art { width: 150px; height: 150px; margin: 6px auto 4px; border-radius: 50%; overflow: hidden; background: radial-gradient(circle at 50% 40%, #3d3552, #1a1530); border: 2px solid rgba(240, 180, 111, .45); }
.lt-start-art img, .lt-start-art svg { width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; }
.lt-h { font-family: var(--font-display); font-size: clamp(1.5rem, 2.4vw, 1.9rem); color: var(--text); margin: 10px 0 8px; outline: none; }
.lt-start-text { color: var(--text-2); max-width: 44ch; margin: 0 auto 16px; font-size: .98rem; line-height: 1.6; }
.lt-start-btns { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 8px; }
.lt-link { background: none; border: 0; color: var(--text-3); font-size: .86rem; text-decoration: underline; text-underline-offset: 3px; padding: 10px; min-height: 44px; }
.lt-link:hover { color: var(--text-2); }
.lt-record { font-size: .82rem; color: var(--text-3); margin-top: 10px; }

/* ---------- Конец ---------- */
#ltEnd { text-align: center; }
.lt-end-art { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; border: 1px solid rgba(240, 180, 111, .3); background: #120e1c; }
.lt-end-art > svg, .lt-end-art > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lt-end-portrait { position: absolute; left: 50%; bottom: 0; width: 46%; height: 88%; transform: translateX(-50%); }
.lt-end-portrait img, .lt-end-portrait svg { width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; }
.lt-end-kicker { margin-top: 14px; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-2); font-weight: 600; }
.lt-end-text { color: var(--text-2); line-height: 1.6; max-width: 48ch; margin: 0 auto; }
.lt-end-sum { font-size: .86rem; color: var(--gold-2); margin-top: 10px; }

/* Летопись — светлый пергамент: единственное светлое пятно на тёмной странице,
   и так и задумано — это то, что игрок уносит с собой. */
.lt-scroll {
  position: relative; text-align: left; margin: 18px 0 16px; padding: 22px 20px 30px;
  border-radius: 6px; color: #2e2418;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 255, 255, .35), transparent 60%),
    linear-gradient(180deg, #efe2c4, #e4d2ab);
  box-shadow: inset 0 0 40px rgba(120, 80, 30, .25), 0 12px 30px rgba(0, 0, 0, .4);
  font-family: var(--font-display);
}
.lt-scroll::before, .lt-scroll::after {
  content: ""; position: absolute; left: -6px; right: -6px; height: 12px; border-radius: 6px;
  background: linear-gradient(180deg, #c9a56a, #9a7440);
}
.lt-scroll::before { top: -6px; }
.lt-scroll::after { bottom: -6px; }
.lt-scroll h3 { font-size: 1.1rem; font-weight: 700; color: #6e1e16; text-align: center; margin-bottom: 12px; line-height: 1.3; }
.lt-scroll p { font-size: 1rem; line-height: 1.6; margin: 0 0 10px; }
.lt-scroll p:first-child::first-letter { float: left; font-size: 2.9em; line-height: .9; padding: 4px 6px 0 0; color: #8a2a1e; font-weight: 800; }
.lt-seal { position: absolute; right: 14px; bottom: 2px; width: 64px; height: 64px; }
.lt-seal img, .lt-seal svg { width: 100%; height: 100%; }
.lt-end-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 22px; }
.lt-copied { min-height: 1.4em; font-size: .86rem; color: var(--teal); margin-top: 8px; }
.lt-app { font-size: .9rem; color: var(--text-2); max-width: 46ch; margin: 6px auto 0; line-height: 1.55; }
.lt-app a { color: var(--gold-2); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Боковая панель ---------- */
.lt-side { display: flex; flex-direction: column; gap: 16px; }
.lt-panel {
  padding: 18px; border-radius: var(--radius); border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(26, 22, 40, .82), rgba(15, 13, 25, .88));
}
.lt-panel-h { font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); font-weight: 600; font-family: var(--font-body); margin-bottom: 12px; }
.lt-live, .lt-dyn-list { list-style: none; margin: 0; padding: 0; }
.lt-live { display: flex; flex-direction: column; gap: 10px; }
.lt-live li { font-family: var(--font-display); font-size: .98rem; line-height: 1.45; color: var(--text); padding-left: 14px; border-left: 2px solid rgba(240, 180, 111, .35); }
.lt-live li.is-new { animation: lt-ink 1.2s ease-out; }
@keyframes lt-ink { from { color: var(--gold-2); border-left-color: var(--gold-2); } to { color: var(--text); } }
.lt-live-when { display: block; font-family: var(--font-body); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.lt-live-empty { font-size: .9rem; color: var(--text-3); }
.lt-live-empty[hidden] { display: none; }
.lt-dyn-list { display: flex; flex-direction: column; gap: 8px; }
.lt-dyn-list[hidden] { display: none; }
.lt-dyn-list li { display: flex; justify-content: space-between; gap: 12px; font-size: .9rem; padding: 8px 0; border-bottom: 1px solid var(--border); }
.lt-dyn-list li:last-child { border-bottom: 0; }
.lt-dyn-list b { font-weight: 600; color: var(--text); }
.lt-dyn-list span { color: var(--text-3); text-align: right; }
.lt-dyn-list li.is-now b { color: var(--gold-2); }
#ltStartDyn { text-align: left; max-width: 360px; margin: 0 auto 14px; }
#ltDyn:empty::after { content: "Династия только начинается."; color: var(--text-3); font-size: .9rem; }

.lt-koshel { display: flex; justify-content: flex-start; }
@media (max-width: 900px) { .lt-side { order: 2; } }

/* ---------- Всплывашка ---------- */
.lt-toast {
  position: absolute; left: 50%; top: 92px; z-index: 5; transform: translate(-50%, -8px);
  padding: 9px 16px; border-radius: 999px; font-size: .84rem; font-weight: 600; white-space: nowrap; max-width: calc(100% - 24px);
  overflow: hidden; text-overflow: ellipsis;
  color: #1a1206; background: linear-gradient(135deg, var(--gold-2), var(--gold));
  box-shadow: 0 10px 30px rgba(232, 147, 76, .35); opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.lt-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Правила ---------- */
.lt-rules { display: grid; gap: 10px; margin-top: 28px; max-width: 820px; }
.lt-det { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.lt-det[open] { border-color: var(--border-strong); }
.lt-det summary { list-style: none; cursor: pointer; padding: 16px 20px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; }
.lt-det summary::-webkit-details-marker { display: none; }
.lt-det summary::after { content: "+"; font-size: 1.3rem; color: var(--gold-2); line-height: 1; }
.lt-det[open] summary::after { content: "−"; }
.lt-det-body { padding: 0 20px 16px; color: var(--text-2); display: grid; gap: 10px; line-height: 1.6; }
.lt-det-body b { color: var(--text); }
.lt-rules kbd { font: 600 12px/1 var(--font-body); padding: 3px 7px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); }
.lt-noscript { padding: 20px; text-align: center; color: var(--text-2); }

/* ---------- Телефон ---------- */
@media (max-width: 640px) {
  .lt-head { padding-top: 76px; padding-bottom: 12px; }
  .lt-head .lead { font-size: .96rem; }
  .lt-section .container { width: calc(100% - 24px); }
  .lt-board { padding: 12px 10px 12px; min-height: 0; border-radius: var(--radius-sm); }
  .lt-ic { width: 40px; height: 40px; }
  .lt-ic-fill .lt-ic-full { height: 40px; }
  .lt-stat-name { font-size: .64rem; letter-spacing: .04em; }
  .lt-text { min-height: 6.4em; font-size: 1rem; margin: 8px 2px; }
  .lt-deck { width: min(214px, 60%); }
  .lt-who { margin: 10px 0; }
  .lt-choice { font-size: .88rem; min-height: 56px; padding: 8px 10px; }
  .lt-tool { padding: 0 12px; font-size: .82rem; }
  .lt-scroll { padding: 18px 14px 28px; }
  .lt-scroll p { font-size: .96rem; }
  .lt-toast { top: 76px; }
  .lt-wide { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .lt-card, .lt-ic-fill, .lt-dot, .lt-toast { transition: none; }
  .lt-card.is-in, .lt-screen, .lt-live li.is-new, .lt-stat.is-up .lt-ic, .lt-stat.is-down .lt-ic { animation: none; }
}
