@font-face {
  font-family: "Manrope";
  src: url("../fonts/Manrope-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("../fonts/Manrope-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poiret One";
  src: url("../fonts/PoiretOne-400.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Ruslan Display";
  src: url("../fonts/RuslanDisplay-400.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Playfair Display";
  src: url("../fonts/PlayfairDisplay-600.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("../fonts/CormorantGaramond-600.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Philosopher";
  src: url("../fonts/Philosopher-400.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lobster";
  src: url("../fonts/Lobster-400.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Oswald";
  src: url("../fonts/Oswald-500.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Comfortaa";
  src: url("../fonts/Comfortaa-600.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Caveat";
  src: url("../fonts/Caveat-600.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Marck Script";
  src: url("../fonts/MarckScript-400.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bone: #f3ece3;
  --muted: #b3a698;
  --line: rgba(243, 220, 190, 0.16);
  --ember: #e6a36a;
  --panel: rgba(8, 7, 6, 0.78);
  --danger: #d38a78;
}

* { box-sizing: border-box; }
/* Иначе display:flex у экранов перебивает атрибут hidden и шаги наезжают друг на друга. */
[hidden] { display: none !important; }
html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--bone);
  font-family: "Manrope", "Segoe UI", sans-serif;
  font-weight: 400;
}
body { overflow: hidden; }
button, input, select { font-family: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}

#stage {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 0;
  background: #000;
  transform: translate(-50%, -50%);
}
#stage canvas,
#stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#c-fire { z-index: 1; background: #000; }
#c-fx { z-index: 3; }
#vid-pool {
  position: fixed;
  left: -80px;
  top: 0;
  width: 8px;
  height: 8px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}
#vid-pool video {
  position: static;
  width: 8px;
  height: 8px;
  inset: auto;
}
.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 62%, transparent 58%, rgba(0, 0, 0, 0.35) 100%);
}

.pick {
  position: fixed;
  inset: 0;
  z-index: 5;
  overflow: auto;
  background: #000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px 0 32px;
}
.pick-inner {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}
.eyebrow {
  margin: 0 0 8px;
  text-align: center;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ember);
  font-size: 12px;
  font-weight: 600;
}
h1 {
  margin: 0;
  text-align: center;
  font-family: "Ruslan Display", "Poiret One", serif;
  font-size: clamp(42px, 6vw, 78px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 0.02em;
}
.lead {
  margin: 12px auto 22px;
  max-width: 38rem;
  text-align: center;
  color: var(--muted);
  font-family: "Poiret One", "Manrope", sans-serif;
  font-size: clamp(18px, 2vw, 24px);
  letter-spacing: 0.04em;
  line-height: 1.35;
}
.grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}
.card {
  display: flex;
  flex-direction: column;
  padding: 0;
  text-align: left;
  background: #070707;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(230, 163, 106, 0.75);
  box-shadow: 0 18px 40px rgba(255, 110, 30, 0.08);
}
.card canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  display: block;
  background: #000;
}
.card-copy { padding: 10px 12px 12px; }
.card-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
}
.card-note {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}
.pick-nav {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}
.text-btn, .ghost, .solid {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  padding: 10px 16px;
  font-size: 14px;
}
.text-btn { color: var(--muted); }
.text-btn:hover, .ghost:hover { border-color: var(--ember); color: var(--bone); }
.solid {
  background: #2a1a12;
  border-color: rgba(230, 163, 106, 0.45);
  color: #f6e4d2;
}
.solid:hover { background: #3a2418; }

#mark {
  position: fixed;
  z-index: 6;
  top: 18px;
  left: 20px;
  font-family: "Poiret One", serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 14px;
  color: rgba(243, 236, 227, 0.8);
  pointer-events: none;
}

#panel {
  position: fixed;
  z-index: 6;
  top: 0;
  right: 0;
  width: min(380px, 100%);
  height: 100%;
  overflow: auto;
  padding: 22px 18px 28px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
#panel h2 {
  margin: 18px 0 8px;
  font-family: "Poiret One", serif;
  font-weight: 400;
  font-size: 22px;
  letter-spacing: 0.08em;
}
.status {
  margin: 8px 0 0;
  color: var(--ember);
  font-size: 13px;
  letter-spacing: 0.03em;
  min-height: 1.2em;
}
.fps { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.phrase-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.phrase {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}
.idx { color: var(--muted); font-size: 11px; letter-spacing: 0.04em; }
.phrase input[type="text"] {
  width: 100%;
  background: #120f0c;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
}
.phrase-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #14110e;
  padding: 0;
  line-height: 1;
}
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
.add-row { display: flex; gap: 8px; margin-top: 10px; }
.add-row input {
  flex: 1;
  min-width: 0;
  background: #120f0c;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}
.empty-note { color: var(--muted); font-size: 13px; margin: 0 0 8px; }

.slider { display: block; margin: 10px 0; }
.slider-top, .check-row, .font-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.val { color: var(--muted); font-variant-numeric: tabular-nums; }
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  margin: 8px 0 0;
  background: #3a332c;
  border-radius: 99px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f0d2b0;
  border: 2px solid #1a120c;
  box-shadow: 0 0 0 1px rgba(240, 210, 176, 0.45);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f0d2b0;
  border: 2px solid #1a120c;
  cursor: pointer;
}
select, input[type="color"] {
  background: #120f0c;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
}
input[type="color"] {
  width: 42px;
  height: 28px;
  padding: 2px;
}
#font-sample {
  margin: 8px 0 0;
  font-size: 22px;
  line-height: 1.15;
  min-height: 28px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.check-row { margin-top: 8px; }
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.keys {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.legal { margin-top: 16px; color: var(--muted); font-size: 12px; }
.legal summary { cursor: pointer; }
.legal p { line-height: 1.45; }

#reveal {
  position: fixed;
  z-index: 7;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: transparent;
}
body.clean #reveal:hover, body.clean #reveal:focus-visible {
  background: rgba(0, 0, 0, 0.45);
  color: var(--bone);
  border: 1px solid var(--line);
}
#hint {
  position: fixed;
  z-index: 7;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--bone);
  font-size: 13px;
  letter-spacing: 0.04em;
}

body.clean #panel,
body.clean #mark,
body[data-step="campfire"] #panel,
body[data-step="campfire"] #mark,
body[data-step="hearth"] #panel,
body[data-step="hearth"] #mark { display: none; }

@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr 1fr; }
  #panel {
    top: auto;
    bottom: 0;
    width: 100%;
    height: min(54vh, 520px);
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
  }
  #mark { top: 12px; left: 12px; }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  h1 { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
}
