/* Штормовой Фонарь — стили. Переменные из /css/style.css
   (--bg, --surface, --text, --muted, --line, --accent, --accent-2,
   --accent-dark, --radius, --shadow, --font-display). */

.fn-hero {
  padding: 40px 0 8px;
  text-align: center;
}

.fn-eyebrow {
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #a12e25;
  font-weight: 700;
  margin-bottom: 10px;
}

.fn-hero h1 {
  max-width: none;
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 48px);
  color: var(--accent-dark);
  margin: 0 0 14px;
}

.fn-lead {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  max-width: 62ch;
  margin: 0 auto 20px;
}

.fn-name-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 0 auto 12px;
}

.fn-name-label {
  font-weight: 700;
  color: var(--accent-dark);
}

.fn-field {
  font: inherit;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(92, 64, 40, 0.3);
  background: var(--surface);
  min-width: 220px;
}

.fn-field:focus {
  outline: 2px solid var(--accent-2);
  outline-offset: 1px;
}

.fn-hero-note {
  font-size: 14px;
  color: var(--muted);
  max-width: 60ch;
  margin: 0 auto;
}

/* ===== Кокпит ===== */

.fn-cockpit {
  padding: 28px 0 60px;
}

.fn-cockpit-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  gap: 36px;
  align-items: start;
}

.fn-lantern-col {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.fn-lantern-frame {
  width: 100%;
  max-width: 340px;
  border-radius: 26px;
  padding: 10px;
  background: linear-gradient(145deg, #3a2a1a, #1c130c);
  box-shadow: 0 18px 40px rgba(20, 12, 5, 0.45), inset 0 0 0 2px rgba(200, 55, 45, 0.35);
}

.fn-lantern-svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
}

.fn-wave--back { fill: #12304a; opacity: 0.9; }
.fn-wave--front { fill: #0b2236; }

.fn-brass { fill: #8a6a3a; }
.fn-brass-line { stroke: #8a6a3a; stroke-width: 1.6; }
.fn-brass-frame { stroke: #a67f45; stroke-width: 2.4; }

.fn-ring {
  fill: none;
  stroke: #5a4a36;
  stroke-width: 3.2;
  transition: stroke 0.8s ease;
}

.fn-ring--inner { stroke-width: 2.6; }

.is-gimbal .fn-ring { stroke: #d6a64e; }

.fn-pane {
  fill: #2a2733;
  fill-opacity: 0.6;
  transition: fill 1s ease, fill-opacity 1s ease;
}

.fn-pane.is-lit { fill-opacity: 0.5; }
.fn-pane[data-pane="0"].is-lit { fill: #9b7b3c; }
.fn-pane[data-pane="1"].is-lit { fill: #2f8fa8; }
.fn-pane[data-pane="2"].is-lit { fill: #e0762a; }
.fn-pane[data-pane="3"].is-lit { fill: #cfe2ee; }

.fn-glyph {
  fill: #6b6475;
  opacity: 0.35;
  transition: opacity 1s ease, fill 1s ease;
}

.fn-glyph--line {
  fill: none;
  stroke: #6b6475;
  stroke-width: 1.4;
  stroke-linecap: round;
}

.fn-glyph.is-lit { opacity: 1; fill: #fff6e0; }
.fn-glyph--line.is-lit { fill: none; stroke: #fff6e0; }

.fn-crown-arc {
  fill: none;
  stroke: #5a4a36;
  stroke-width: 4;
  transition: stroke 1s ease;
}

.fn-crown-head { fill: #5a4a36; transition: fill 1s ease; }

#fnCrown.is-lit .fn-crown-arc--dragon { stroke: #e9b52f; }
#fnCrown.is-lit .fn-crown-arc--tiger { stroke: #c8372d; }
#fnCrown.is-lit .fn-crown-head--dragon { fill: #f2c94c; }
#fnCrown.is-lit .fn-crown-head--tiger { fill: #d9533f; }
#fnCrown.is-lit { filter: drop-shadow(0 0 3px rgba(242, 201, 76, 0.8)); }

#fnFlame { opacity: 0; transition: opacity 1.2s ease; }
#fnFlame.is-lit { opacity: 1; filter: drop-shadow(0 0 5px rgba(255, 200, 80, 0.9)); }

#fnCrystal { fill: #5c1f1a; transition: fill 1s ease; }
#fnCrystal.is-lit { fill: #e0463a; filter: drop-shadow(0 0 4px rgba(224, 70, 58, 0.9)); }

#fnFlower {
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0);
  opacity: 0;
  transition: transform 2.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 2s ease;
}

#fnFlower.is-open {
  transform: scale(1);
  opacity: 0.92;
  filter: drop-shadow(0 0 6px rgba(255, 220, 120, 0.9));
}

.fn-lantern-caption {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  min-height: 2.8em;
  margin: 0;
  max-width: 32ch;
}

.fn-parts {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 4px;
  font-size: 14px;
  color: var(--muted);
  width: 100%;
  max-width: 320px;
}

.fn-parts li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fn-part-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #b9a78f;
  flex: none;
}

.fn-parts li.is-lit { color: var(--accent-dark); font-weight: 700; }
.fn-parts li.is-lit .fn-part-dot { background: #c8372d; border-color: #c8372d; box-shadow: 0 0 6px rgba(200, 55, 45, 0.6); }

.fn-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.fn-tab {
  font: inherit;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(92, 64, 40, 0.25);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.fn-tab span {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(92, 64, 40, 0.12);
  font-size: 11px;
  font-weight: 700;
}

.fn-tab[disabled] { opacity: 0.4; cursor: not-allowed; }
.fn-tab.is-active { border-color: #c8372d; color: #a12e25; font-weight: 700; }
.fn-tab.is-done span { background: #c8372d; color: #fff; }

/* ===== Консоль ===== */

.fn-console {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 28px 30px 24px;
  min-width: 0;
}

.fn-station-eyebrow {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #a12e25;
  font-weight: 700;
  margin: 0 0 6px;
}

.fn-station h2 {
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 30px);
  color: var(--accent-dark);
  margin: 0 0 12px;
}

.fn-station-text {
  line-height: 1.6;
  margin: 0 0 12px;
}

.fn-cues {
  margin: 0 0 16px;
  padding-left: 20px;
  line-height: 1.55;
}

.fn-cues li { margin-bottom: 6px; }

.fn-step {
  font-size: 17px;
  color: var(--accent);
  margin: 22px 0 6px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.fn-step-hint {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 12px;
  line-height: 1.5;
}

/* ===== Пейсер дыхания ===== */

.fn-pacer {
  background: linear-gradient(160deg, #1b2236, #12172a);
  color: #f3eadb;
  border-radius: 18px;
  padding: 18px;
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 18px;
  align-items: center;
}

.fn-pacer-visual {
  position: relative;
  width: 150px;
  height: 150px;
  display: grid;
  place-items: center;
}

.fn-ball-ring {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 1px dashed rgba(243, 234, 219, 0.25);
}

.fn-ball {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  transform: scale(0.25);
  background: radial-gradient(circle at 40% 35%, #fff4cc, #f2b705 55%, #b8661c);
  box-shadow: 0 0 24px rgba(242, 183, 5, 0.55);
}

.fn-pacer[data-mode="red"] .fn-ball {
  background: radial-gradient(circle at 40% 35%, #ffd8c8, #e0463a 55%, #8a1f17);
  box-shadow: 0 0 24px rgba(224, 70, 58, 0.55);
}

.fn-pacer[data-mode="elements"] .fn-ball {
  background: radial-gradient(circle at 40% 35%, #e6f6fb, #2f8fa8 55%, #1a4d63);
  box-shadow: 0 0 24px rgba(47, 143, 168, 0.55);
}

.fn-channel {
  position: absolute;
  inset: 0;
  display: none;
}

.fn-pacer.has-channel .fn-ball,
.fn-pacer.has-channel .fn-ball-ring { display: none; }
.fn-pacer.has-channel .fn-channel { display: block; }

.fn-channel-track {
  position: absolute;
  left: 50%;
  top: 14px;
  bottom: 14px;
  width: 6px;
  margin-left: -3px;
  border-radius: 3px;
  background: linear-gradient(to top, rgba(47, 143, 168, 0.6), rgba(243, 234, 219, 0.25));
}

.fn-channel-label {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: rgba(243, 234, 219, 0.7);
}

.fn-channel-label--top { top: -4px; }
.fn-channel-label--bottom { bottom: -4px; }

.fn-orb {
  position: absolute;
  left: 50%;
  width: 26px;
  height: 26px;
  margin-left: -13px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff4cc, #f2b705 60%, #b8661c);
  box-shadow: 0 0 16px rgba(242, 183, 5, 0.8);
}

.fn-pacer[data-mode="red"] .fn-orb {
  background: radial-gradient(circle at 40% 35%, #ffd8c8, #e0463a 60%, #8a1f17);
  box-shadow: 0 0 16px rgba(224, 70, 58, 0.8);
}

.fn-pacer-set {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f2c94c;
  margin: 0 0 4px;
  font-weight: 700;
}

.fn-pacer[data-mode="red"] .fn-pacer-set { color: #ff8a7a; }

.fn-pacer-phase {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0 0 4px;
  min-height: 1.3em;
}

.fn-pacer-text {
  font-size: 14px;
  color: rgba(243, 234, 219, 0.8);
  margin: 0 0 12px;
  min-height: 2.8em;
  line-height: 1.45;
}

.fn-pacer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.fn-hold {
  font: inherit;
  font-weight: 700;
  padding: 12px 18px;
  border-radius: 14px;
  border: 2px solid rgba(243, 234, 219, 0.4);
  background: rgba(243, 234, 219, 0.08);
  color: #f3eadb;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  min-width: 170px;
}

.fn-hold.is-pressed {
  background: #f2b705;
  border-color: #f2b705;
  color: #1c1612;
}

.fn-pacer[data-mode="red"] .fn-hold.is-pressed {
  background: #e0463a;
  border-color: #e0463a;
  color: #fff;
}

.fn-hold[disabled] { opacity: 0.4; cursor: default; }

.fn-pacer-go {
  font: inherit;
  padding: 10px 16px;
  border-radius: 14px;
  border: 0;
  background: #f3eadb;
  color: #1c1612;
  font-weight: 700;
  cursor: pointer;
}

.fn-meter {
  margin-top: 12px;
  height: 8px;
  border-radius: 4px;
  background: rgba(243, 234, 219, 0.15);
  overflow: hidden;
}

.fn-meter-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #c8372d, #f2b705);
  transition: width 0.3s ease;
}

.fn-pacer-stats {
  font-size: 13px;
  color: rgba(243, 234, 219, 0.75);
  margin: 6px 0 0;
}

.fn-pacer-msg {
  font-size: 14px;
  margin: 8px 0 0;
  color: #f2c94c;
}

.fn-pacer-msg.is-bad { color: #ff8a7a; }

/* ===== Таймер ===== */

.fn-timer {
  background: linear-gradient(160deg, #1b2236, #12172a);
  color: #f3eadb;
  border-radius: 18px;
  padding: 18px 20px;
}

.fn-timer-label {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0 0 6px;
}

.fn-timer-text {
  font-size: 14px;
  color: rgba(243, 234, 219, 0.82);
  margin: 0 0 12px;
  line-height: 1.5;
  min-height: 2.8em;
}

.fn-timer-bar {
  height: 8px;
  border-radius: 4px;
  background: rgba(243, 234, 219, 0.15);
  overflow: hidden;
  margin-bottom: 12px;
}

.fn-timer-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #f2b705, #c8372d);
}

/* ===== Тест ===== */

.fn-q {
  margin: 0 0 16px;
}

.fn-q-text {
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1.45;
}

.fn-q-options {
  display: grid;
  gap: 6px;
}

.fn-opt {
  font: inherit;
  text-align: left;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid rgba(92, 64, 40, 0.22);
  background: #fff;
  cursor: pointer;
  line-height: 1.4;
}

.fn-opt:hover:not([disabled]) { border-color: var(--accent-2); }
.fn-opt[disabled] { cursor: default; color: var(--text); opacity: 1; }
.fn-opt.is-right { border-color: #2f5d3a; background: #e8f2ea; }
.fn-opt.is-wrong { border-color: #a12e25; background: #f8e6e3; }

.fn-q-why {
  font-size: 14px;
  color: var(--muted);
  margin: 6px 0 0;
}

/* ===== Сортировка Дракон / Тигр ===== */

.fn-sort-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}

.fn-sort-trait { flex: 1 1 220px; }

.fn-sort-btns { display: flex; gap: 6px; }

.fn-sort-btn {
  font: inherit;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(92, 64, 40, 0.25);
  background: #fff;
  cursor: pointer;
}

.fn-sort-btn[data-who="dragon"]::before { content: "🐉 "; }
.fn-sort-btn[data-who="tiger"]::before { content: "🐅 "; }
.fn-sort-btn[disabled] { cursor: default; color: var(--text); opacity: 1; }
.fn-sort-btn.is-right { border-color: #2f5d3a; background: #e8f2ea; }
.fn-sort-btn.is-wrong { border-color: #a12e25; background: #f8e6e3; }

/* ===== Итоги ===== */

.fn-station-done {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fbeee9;
  border: 1px solid rgba(200, 55, 45, 0.3);
}

.fn-station-done p { margin: 0 0 10px; }

.fn-result {
  margin-top: 20px;
  padding: 20px;
  border-radius: 18px;
  background: #fffaf3;
  border: 2px solid #c8372d;
}

.fn-result h3 {
  font-family: var(--font-display);
  color: var(--accent-dark);
  margin: 0 0 10px;
}

.fn-result table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 14px;
  font-size: 15px;
}

.fn-result td {
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
}

.fn-result td:last-child { text-align: right; font-weight: 700; }

.fn-verdict { font-size: 18px; font-weight: 700; margin: 0 0 12px; }
.fn-verdict.is-pass { color: #2f5d3a; }
.fn-verdict.is-fail { color: #a12e25; }

.fn-result-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.fn-reset-row {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: right;
}

/* ===== Финал ===== */

#fnApp [hidden],
.fn-finale[hidden] {
  display: none !important;
}


.fn-finale {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: radial-gradient(circle at 50% 45%, rgba(60, 30, 10, 0.92), rgba(10, 8, 15, 0.96));
  display: grid;
  place-items: center;
  padding: 20px;
}

.fn-finale-inner {
  text-align: center;
  max-width: 420px;
}

.fn-finale-flower {
  width: min(70vw, 300px);
  height: auto;
  filter: drop-shadow(0 0 24px rgba(255, 210, 110, 0.75));
}

.fn-finale-petals {
  transform-origin: 100px 100px;
  animation: fn-bloom 3s cubic-bezier(0.2, 0.8, 0.2, 1) both, fn-spin 24s linear 3s infinite;
}

@keyframes fn-bloom {
  from { transform: scale(0.05) rotate(-90deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes fn-spin {
  to { transform: rotate(360deg); }
}

.fn-finale-text {
  color: #fff3d6;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.4;
  margin: 18px 0;
}

/* ===== Адаптив ===== */

@media (max-width: 860px) {
  .fn-cockpit-grid { grid-template-columns: 1fr; }
  .fn-lantern-col { position: static; }
  .fn-lantern-frame { max-width: 280px; }
  .fn-console { padding: 22px 18px; }
}

@media (max-width: 520px) {
  .fn-pacer { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .fn-pacer-controls { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .fn-finale-petals { animation: none; }
  #fnFlower { transition: none; }
}
