
:root {
  --bg: #091018;
  --bg-soft: #111c27;
  --wood: #6e4325;
  --gold: #d6a85c;
  --gold-soft: #f3d49b;
  --ember: #ff8a3d;
  --cream: #f5ead4;
  --muted: #b9b3a7;
  --line: rgba(214, 168, 92, .25);
  --shadow: 0 24px 80px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--cream);
  background:
    radial-gradient(circle at 15% 0%, rgba(34, 70, 89, .35), transparent 34rem),
    var(--bg);
  font-family: Georgia, "Times New Roman", serif;
  min-height: 100vh;
  overflow-x: hidden;
}

body::selection { background: var(--gold); color: #15100b; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
img { display: block; max-width: 100%; }

#fireflies {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
  opacity: .8;
}

.site-header {
  position: fixed;
  z-index: 50;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px clamp(18px, 4vw, 64px);
  border-bottom: 1px solid transparent;
  transition: .3s ease;
}

.site-header.scrolled {
  background: rgba(7, 13, 20, .82);
  backdrop-filter: blur(16px);
  border-color: var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--cream);
  text-decoration: none;
  letter-spacing: .04em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 45px;
  aspect-ratio: 1;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold-soft);
  background: rgba(14, 22, 29, .72);
  box-shadow: inset 0 0 20px rgba(214, 168, 92, .18);
  font-size: 1.35rem;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 1rem; }
.brand small { margin-top: 2px; color: var(--muted); font-size: .72rem; }

.main-nav { display: flex; gap: 10px; }
.main-nav a {
  color: rgba(245, 234, 212, .8);
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 999px;
  transition: .2s ease;
}
.main-nav a:hover, .main-nav a.active {
  color: #fff4dc;
  background: rgba(214, 168, 92, .13);
}

.menu-toggle {
  display: none;
  border: 0;
  background: transparent;
  padding: 8px;
}
.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  margin: 5px 0;
  background: var(--cream);
}

.view { display: none; min-height: 100vh; }
.view.active { display: block; animation: reveal .45s ease; }
@keyframes reveal {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero {
  position: relative;
  min-height: 100svh;
  background:
    linear-gradient(90deg, rgba(4, 10, 15, .92) 0%, rgba(4, 10, 15, .57) 44%, rgba(4, 10, 15, .12) 75%),
    url("assets/scenes/home-hero.svg") center / cover no-repeat;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, var(--bg) 0%, transparent 28%),
    radial-gradient(circle at 50% 85%, rgba(255, 119, 43, .13), transparent 24rem);
}

.hero-content {
  position: relative;
  z-index: 2;
  width: min(760px, 90%);
  padding: clamp(150px, 21vh, 240px) 0 100px clamp(20px, 7vw, 110px);
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--gold-soft);
  font-family: system-ui, sans-serif;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .17em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 22px;
  font-size: clamp(4rem, 11vw, 8.7rem);
  line-height: .83;
  letter-spacing: -.06em;
  text-shadow: 0 10px 46px rgba(0, 0, 0, .65);
}
h2 {
  margin-bottom: 20px;
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: .96;
  letter-spacing: -.035em;
}
h3 { font-size: clamp(1.5rem, 3vw, 2.35rem); }
.lead {
  max-width: 650px;
  color: #e9dfcf;
  font-size: clamp(1.08rem, 2.2vw, 1.45rem);
  line-height: 1.65;
}

.hero-actions, .quote-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 22px;
  border: 1px solid var(--gold);
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.button:hover { transform: translateY(-2px); }
.button.primary {
  color: #20140c;
  background: linear-gradient(135deg, #ecc57c, #bd7d3d);
  box-shadow: 0 10px 32px rgba(226, 151, 67, .2);
}
.button.ghost {
  color: var(--cream);
  background: rgba(7, 13, 18, .38);
  backdrop-filter: blur(8px);
}
.button.compact { min-height: 46px; }

.omen-card {
  width: min(550px, 100%);
  margin-top: 32px;
  padding: 18px 20px;
  border-left: 3px solid var(--ember);
  background: rgba(8, 16, 22, .57);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
.omen-card span {
  display: block;
  color: var(--gold-soft);
  font-family: system-ui, sans-serif;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .14em;
}
.omen-card strong { display: block; margin-top: 8px; font-size: 1.05rem; }

.scroll-hint {
  position: absolute;
  z-index: 2;
  right: clamp(20px, 5vw, 72px);
  bottom: 34px;
  display: flex;
  align-items: center;
  gap: 13px;
  color: rgba(245, 234, 212, .6);
  font-family: system-ui, sans-serif;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .15em;
}
.scroll-hint i {
  display: block;
  width: 34px;
  height: 1px;
  background: var(--gold);
}

.page-section {
  padding: 150px clamp(20px, 7vw, 110px) 90px;
  background:
    linear-gradient(rgba(9, 16, 24, .96), rgba(9, 16, 24, .98)),
    repeating-linear-gradient(45deg, transparent 0 15px, rgba(214,168,92,.03) 15px 16px);
}
.section-heading {
  max-width: 790px;
  margin-bottom: 55px;
}
.section-heading > p:last-child {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.deity-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.deity-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 390px;
  padding: 34px;
  border: 1px solid var(--line);
  background:
    linear-gradient(150deg, rgba(27, 42, 52, .92), rgba(13, 21, 29, .96));
  box-shadow: var(--shadow);
}
.deity-card::after {
  content: "";
  position: absolute;
  width: 170px;
  height: 170px;
  right: -70px;
  bottom: -70px;
  border: 1px solid rgba(214, 168, 92, .22);
  border-radius: 50%;
  box-shadow: 0 0 0 25px rgba(214, 168, 92, .03), 0 0 0 50px rgba(214, 168, 92, .02);
}
.deity-card p { color: var(--muted); line-height: 1.65; }
.deity-symbol {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 46px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--gold-soft);
  font-size: 1.7rem;
  background: rgba(214, 168, 92, .08);
}
.tag {
  font-family: system-ui, sans-serif;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.text-button {
  position: absolute;
  left: 34px;
  bottom: 32px;
  z-index: 2;
  padding: 0 0 4px;
  border: 0;
  border-bottom: 1px solid var(--gold);
  color: var(--gold-soft);
  background: none;
  cursor: pointer;
}

.deity-actions {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-top: auto;
  padding-top: 22px;
}
.deity-actions .text-button {
  position: static;
  left: auto;
  bottom: auto;
  width: max-content;
  max-width: 100%;
  line-height: 1.3;
}
.deity-actions .lore-button {
  opacity: .78;
}

.story-panel {
  display: grid;
  grid-template-columns: 1.25fr .85fr;
  margin-top: 72px;
  border: 1px solid var(--line);
  background: #0c151e;
  box-shadow: var(--shadow);
}
.story-panel img { width: 100%; height: 100%; object-fit: cover; min-height: 510px; }
.story-copy { padding: clamp(32px, 5vw, 68px); align-self: center; }
.story-copy ol { padding-left: 21px; color: var(--muted); line-height: 1.8; }
.riddle-output {
  margin-top: 28px;
  padding: 18px;
  border-left: 2px solid var(--gold);
  color: var(--gold-soft);
  background: rgba(214, 168, 92, .06);
}

.quotes-section {
  background:
    radial-gradient(circle at 85% 25%, rgba(49, 83, 102, .22), transparent 30rem),
    #090f17;
}
.quote-stage {
  position: relative;
  min-height: 690px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.quote-stage > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.quote-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(5, 10, 15, .93) 0%, rgba(5, 10, 15, .72) 48%, rgba(5, 10, 15, .25) 100%);
}
.quote-card {
  position: relative;
  z-index: 2;
  width: min(670px, 88%);
  padding: clamp(48px, 8vw, 100px);
}
.quote-mark {
  display: block;
  height: 70px;
  color: var(--gold);
  font-size: 8rem;
  line-height: 1;
}
blockquote {
  margin: 20px 0 22px;
  font-size: clamp(2rem, 4.6vw, 4rem);
  line-height: 1.15;
  letter-spacing: -.03em;
}
#quoteAuthor { color: var(--gold-soft); font-style: italic; }
.quote-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 28px;
}
.quote-mini {
  padding: 22px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(17, 28, 39, .8);
  line-height: 1.55;
}

.gallery-grid {
  display: grid;
  grid-template-columns: 1.35fr .65fr;
  gap: 16px;
}
.gallery-item {
  position: relative;
  overflow: hidden;
  min-height: 310px;
  padding: 0;
  border: 1px solid var(--line);
  background: #111;
  cursor: pointer;
}
.gallery-item.wide { grid-row: span 2; min-height: 636px; }
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .55s ease;
}
.gallery-item:hover img { transform: scale(1.035); }
.gallery-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(4, 8, 12, .85), transparent 50%);
}
.gallery-item span {
  position: absolute;
  z-index: 2;
  left: 24px;
  bottom: 22px;
  color: var(--cream);
  font-size: 1.25rem;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 32px clamp(20px, 7vw, 110px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: #070c12;
  font-family: system-ui, sans-serif;
  font-size: .82rem;
}
footer p { margin: 0; }

.lightbox {
  width: min(1100px, 94vw);
  padding: 0;
  border: 1px solid var(--line);
  background: #080e14;
  color: var(--cream);
  box-shadow: var(--shadow);
}
.lightbox::backdrop { background: rgba(0, 0, 0, .82); backdrop-filter: blur(8px); }
.lightbox img { width: 100%; max-height: 78vh; object-fit: contain; }
.lightbox p { margin: 0; padding: 18px 22px; }
.lightbox-close {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 12px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 50%;
  color: white;
  background: rgba(0,0,0,.55);
  font-size: 1.5rem;
  cursor: pointer;
}

.toast {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 20px);
  padding: 13px 18px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: #21150c;
  background: var(--gold-soft);
  opacity: 0;
  pointer-events: none;
  transition: .25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.thunder-flash {
  position: fixed;
  z-index: 100;
  inset: 0;
  pointer-events: none;
  background: rgba(235, 244, 255, .9);
  opacity: 0;
}
.thunder-flash.flash { animation: thunder .55s ease; }
@keyframes thunder {
  0%, 100% { opacity: 0; }
  12% { opacity: .9; }
  23% { opacity: .12; }
  35% { opacity: .67; }
  52% { opacity: 0; }
}

.spark {
  position: fixed;
  z-index: 80;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ff9b46;
  box-shadow: 0 0 13px #ff8a3d;
  pointer-events: none;
  animation: sparkFly 1.5s ease-out forwards;
}
@keyframes sparkFly {
  from { opacity: 1; transform: translate(0,0) scale(1); }
  to { opacity: 0; transform: translate(var(--x), var(--y)) scale(.2); }
}

@media (max-width: 900px) {
  .menu-toggle { display: block; }
  .main-nav {
    position: absolute;
    top: 74px;
    left: 18px;
    right: 18px;
    display: none;
    flex-direction: column;
    padding: 12px;
    border: 1px solid var(--line);
    background: rgba(7, 13, 20, .96);
    backdrop-filter: blur(16px);
  }
  .main-nav.open { display: flex; }
  .deity-grid { grid-template-columns: 1fr; }
  .story-panel { grid-template-columns: 1fr; }
  .story-panel img { min-height: 360px; }
  .gallery-grid { grid-template-columns: 1fr; }
  .gallery-item, .gallery-item.wide { min-height: 350px; grid-row: auto; }
  .quote-list { grid-template-columns: 1fr; }
  footer { flex-direction: column; }
}

@media (max-width: 600px) {
  .hero {
    background-position: 63% center;
  }
  .hero-content {
    width: 100%;
    padding: 150px 20px 90px;
  }
  h1 { font-size: 4.3rem; }
  .page-section { padding-top: 120px; }
  .scroll-hint { display: none; }
  .quote-stage { min-height: 660px; }
  .quote-card { width: 100%; padding: 46px 24px; }
  blockquote { font-size: 2rem; }
  .story-copy, .deity-card { padding: 28px; }
  .text-button { left: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  #fireflies { display: none; }
}


.sound-toggle {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--gold-soft);
  background: rgba(214, 168, 92, .08);
  cursor: pointer;
  transition: .2s ease;
}
.sound-toggle.active {
  color: #1b1109;
  background: var(--gold-soft);
  box-shadow: 0 0 24px rgba(214, 168, 92, .28);
}

.oracle-section {
  background:
    radial-gradient(circle at 10% 30%, rgba(54, 85, 70, .2), transparent 30rem),
    #091018;
}
.oracle-layout {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 20px;
}
.oracle-board, .title-forge, .guest-scroll, .encounter-panel {
  border: 1px solid var(--line);
  background: linear-gradient(150deg, rgba(21, 35, 42, .95), rgba(11, 19, 27, .98));
  box-shadow: var(--shadow);
}
.oracle-board { padding: clamp(28px, 5vw, 58px); }
.forest-clock {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 34px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.forest-clock span {
  color: var(--gold-soft);
  font-family: system-ui, sans-serif;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .13em;
}
.forest-clock strong { font-size: 1.6rem; }
.forest-clock small { width: 100%; color: var(--muted); }

.sign-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 13px;
}
.forest-sign {
  min-height: 190px;
  border: 1px solid var(--line);
  color: var(--cream);
  background:
    radial-gradient(circle at 50% 30%, rgba(214, 168, 92, .14), transparent 50%),
    rgba(6, 12, 18, .7);
  cursor: default;
  transition: transform .35s ease, border-color .35s ease;
}
.forest-sign.revealed {
  transform: translateY(-5px);
  border-color: rgba(243, 212, 155, .65);
}
.forest-sign span {
  display: block;
  color: var(--gold-soft);
  font-size: 4rem;
  line-height: 1;
}
.forest-sign small {
  display: block;
  margin-top: 20px;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.oracle-button { margin-top: 22px; }
.oracle-reading {
  margin-top: 22px;
  padding: 22px;
  border-left: 3px solid var(--gold);
  background: rgba(214, 168, 92, .06);
}
.oracle-reading p { margin: 8px 0 0; color: var(--muted); line-height: 1.65; }

.title-forge { padding: clamp(28px, 5vw, 52px); }
.title-forge > p:not(.eyebrow) { color: var(--muted); line-height: 1.65; }
.title-forge label {
  display: block;
  margin: 28px 0 9px;
  color: var(--gold-soft);
  font-family: system-ui, sans-serif;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.title-form { display: flex; gap: 10px; }
.title-form input, .guest-scroll input, .guest-scroll textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: 0;
  color: var(--cream);
  background: rgba(4, 10, 15, .72);
  font: inherit;
}
.title-form input { min-height: 46px; padding: 0 14px; }
.guest-scroll input, .guest-scroll textarea { padding: 13px 14px; }
.title-form input:focus, .guest-scroll input:focus, .guest-scroll textarea:focus {
  border-color: var(--gold);
}
.forged-title {
  min-height: 150px;
  display: grid;
  place-items: center;
  margin-top: 24px;
  padding: 24px;
  border: 1px dashed rgba(214, 168, 92, .42);
  text-align: center;
  color: var(--gold-soft);
  background: rgba(214, 168, 92, .04);
}
.forged-title strong { font-size: 1.55rem; line-height: 1.35; }

.guest-scroll {
  display: grid;
  grid-template-columns: .75fr 1fr 1.1fr;
  gap: 28px;
  margin-top: 22px;
  padding: clamp(28px, 5vw, 52px);
}
.guest-scroll > div > p:not(.eyebrow) { color: var(--muted); line-height: 1.65; }
#guestForm { display: flex; flex-direction: column; gap: 10px; }
.guest-entries {
  max-height: 310px;
  overflow: auto;
  padding-right: 6px;
}
.guest-entry {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.guest-entry strong, .guest-entry small { display: block; }
.guest-entry small { margin-top: 5px; color: var(--muted); }
.guest-entry p { margin: 8px 0 0; line-height: 1.45; }

.bestiary-section {
  background:
    radial-gradient(circle at 85% 18%, rgba(65, 76, 42, .2), transparent 30rem),
    #091018;
}
.creature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.creature-card {
  position: relative;
  overflow: hidden;
  min-height: 350px;
  padding: 32px;
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(27, 42, 43, .94), rgba(10, 18, 24, .98));
  box-shadow: var(--shadow);
}
.creature-card::before {
  content: "";
  position: absolute;
  width: 210px;
  height: 210px;
  right: -105px;
  top: -105px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(214,168,92,.15), transparent 68%);
}
.creature-icon {
  margin-bottom: 22px;
  font-size: 3rem;
  filter: sepia(.2);
}
.danger-level {
  display: block;
  margin-bottom: 10px;
  color: var(--gold-soft);
  font-family: system-ui, sans-serif;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.creature-card p { color: var(--muted); line-height: 1.65; }
.creature-action {
  position: absolute;
  left: 32px;
  bottom: 28px;
  padding: 0 0 4px;
  border: 0;
  border-bottom: 1px solid var(--gold);
  color: var(--gold-soft);
  background: none;
  cursor: pointer;
}
.encounter-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 22px;
  padding: clamp(28px, 5vw, 48px);
}
.encounter-panel p { margin-bottom: 0; color: var(--muted); }

.leaf-cursor {
  position: fixed;
  z-index: 120;
  left: 0;
  top: 0;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity .2s ease;
}

@media (max-width: 1000px) {
  .oracle-layout { grid-template-columns: 1fr; }
  .guest-scroll { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sound-toggle { align-self: flex-start; margin-left: 12px; }
  .creature-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .sign-row { grid-template-columns: 1fr; }
  .forest-sign { min-height: 145px; }
  .title-form { flex-direction: column; }
  .encounter-panel { align-items: flex-start; flex-direction: column; }
}


.bestiary-feature {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 20px;
  margin-top: 22px;
  border: 1px solid var(--line);
  background: rgba(10, 18, 24, .95);
  box-shadow: var(--shadow);
}
.bestiary-feature img {
  width: 100%;
  height: 100%;
  min-height: 420px;
  object-fit: cover;
}
.bestiary-feature-copy {
  padding: clamp(26px, 4vw, 48px);
}
.bestiary-feature-copy p:not(.eyebrow),
.bestiary-feature-copy li {
  color: var(--muted);
  line-height: 1.7;
}

.map-section {
  background:
    radial-gradient(circle at 85% 15%, rgba(56, 72, 97, .24), transparent 32rem),
    linear-gradient(rgba(9, 16, 24, .97), rgba(9, 16, 24, .99));
}
.map-layout {
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 20px;
  align-items: start;
}
.map-stage {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0a1218;
  box-shadow: var(--shadow);
}
.map-stage > img {
  width: 100%;
  display: block;
}
.map-pin {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(243, 212, 155, .7);
  border-radius: 50%;
  color: #1f140c;
  background: radial-gradient(circle, #f2d39b 0%, #d19a55 75%);
  box-shadow: 0 0 0 0 rgba(236, 197, 124, .6);
  cursor: pointer;
  transform: translate(-50%, -50%);
  animation: pulsePin 2.8s infinite;
}
.map-pin span {
  font-weight: 700;
}
@keyframes pulsePin {
  0% { box-shadow: 0 0 0 0 rgba(236, 197, 124, .48); }
  70% { box-shadow: 0 0 0 18px rgba(236, 197, 124, 0); }
  100% { box-shadow: 0 0 0 0 rgba(236, 197, 124, 0); }
}
.map-card {
  position: sticky;
  top: 105px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(18, 28, 39, .96), rgba(9, 16, 24, .98));
  box-shadow: var(--shadow);
}
.map-card p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.75;
}
.map-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 26px;
}
.map-legend span {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: .88rem;
}
.map-legend i {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #1f140c;
  background: var(--gold-soft);
  font-style: normal;
  font-weight: 700;
}

.map-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-top: 26px;
}
.map-story-card {
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(11, 18, 25, .95);
  box-shadow: var(--shadow);
}
.map-story-card img {
  width: 100%;
  height: 290px;
  object-fit: cover;
}
.map-story-card div {
  padding: 22px;
}
.map-story-card p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.65;
}

.expanded-gallery {
  grid-template-columns: 1.25fr .75fr .75fr;
}
.expanded-gallery .gallery-item.wide {
  grid-row: span 3;
  min-height: 962px;
}

@media (max-width: 1000px) {
  .bestiary-feature,
  .map-layout,
  .map-gallery {
    grid-template-columns: 1fr;
  }
  .map-card {
    position: static;
  }
  .expanded-gallery {
    grid-template-columns: 1fr 1fr;
  }
  .expanded-gallery .gallery-item.wide {
    grid-column: span 2;
    grid-row: auto;
    min-height: 540px;
  }
}

@media (max-width: 700px) {
  .expanded-gallery {
    grid-template-columns: 1fr;
  }
  .expanded-gallery .gallery-item.wide {
    grid-column: auto;
    min-height: 390px;
  }
  .map-legend {
    grid-template-columns: 1fr;
  }
}


/* ===== Шахматы Перуна ===== */
.game-pin {
  border-color: rgba(198, 226, 255, .95);
  background: radial-gradient(circle, #f8e6b4 0%, #d99f50 58%, #8e4f24 100%);
}
.game-pin::after {
  content: "♜";
  position: absolute;
  right: -11px;
  top: -12px;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid var(--gold-soft);
  border-radius: 50%;
  color: #23160d;
  background: var(--gold-soft);
  font-size: .9rem;
  box-shadow: 0 5px 18px rgba(0,0,0,.45);
}

.chess-dialog {
  width: min(1440px, 97vw);
  max-height: 96vh;
  padding: 0;
  border: 1px solid rgba(214, 168, 92, .48);
  color: var(--cream);
  background:
    radial-gradient(circle at 78% 8%, rgba(61, 93, 122, .22), transparent 34rem),
    #071019;
  box-shadow: 0 30px 120px rgba(0,0,0,.72);
}
.chess-dialog::backdrop {
  background: rgba(1, 5, 9, .86);
  backdrop-filter: blur(9px);
}
.chess-shell {
  position: relative;
  min-height: 740px;
  padding: clamp(20px, 3vw, 44px);
  overflow: hidden;
}
.chess-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(6, 13, 20, .82), rgba(6, 13, 20, .95)),
    url("assets/scenes/chess-storm.svg") center / cover no-repeat;
  opacity: .48;
}
.chess-shell > * {
  position: relative;
  z-index: 2;
}
.chess-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 20px;
}
.chess-header h2 {
  margin-bottom: 8px;
  font-size: clamp(2.1rem, 5vw, 4.6rem);
}
.chess-header > div > p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}
.chess-close {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--cream);
  background: rgba(4, 10, 15, .7);
  font-size: 1.65rem;
  cursor: pointer;
}

.chess-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: min(700px, 100%);
  margin-bottom: 24px;
}
.chess-mode {
  padding: 14px 18px;
  border: 1px solid var(--line);
  color: var(--cream);
  text-align: left;
  background: rgba(7, 14, 21, .76);
  cursor: pointer;
  transition: .22s ease;
}
.chess-mode strong,
.chess-mode small {
  display: block;
}
.chess-mode small {
  margin-top: 5px;
  color: var(--muted);
}
.chess-mode.active {
  border-color: var(--gold);
  background: rgba(214, 168, 92, .14);
  box-shadow: inset 0 0 30px rgba(214, 168, 92, .07);
}

.chess-layout {
  display: grid;
  grid-template-columns: minmax(430px, 800px) minmax(280px, 390px);
  gap: clamp(22px, 4vw, 54px);
  align-items: start;
}
.chess-table-area {
  width: min(100%, 800px);
}
.chess-player {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 62px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: rgba(5, 11, 17, .8);
  transition: .25s ease;
}
.chess-player.active {
  border-color: var(--gold);
  background: rgba(214, 168, 92, .13);
  box-shadow: 0 0 28px rgba(214, 168, 92, .09);
}
.chess-player.thinking {
  animation: thinkingPlayer 1.2s infinite alternate;
}
@keyframes thinkingPlayer {
  from { border-color: rgba(214,168,92,.3); }
  to { border-color: rgba(188,218,255,.85); }
}
.chess-player > div {
  flex: 1;
}
.chess-player strong,
.chess-player small {
  display: block;
}
.chess-player small {
  margin-top: 4px;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: .76rem;
}
.player-emblem,
.turn-rune {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--gold-soft);
  background: rgba(214,168,92,.07);
}
.turn-rune {
  opacity: .25;
}
.chess-player.active .turn-rune {
  opacity: 1;
}

.chess-board-frame {
  position: relative;
  margin: 12px 0;
  padding: clamp(13px, 2vw, 23px);
  border: 1px solid #8a542d;
  background:
    linear-gradient(135deg, rgba(207,145,72,.3), transparent 18%),
    repeating-linear-gradient(90deg, #3c2214 0 11px, #4b2b18 11px 22px);
  box-shadow:
    inset 0 0 0 5px rgba(18, 8, 4, .65),
    inset 0 0 35px rgba(0,0,0,.82),
    0 25px 60px rgba(0,0,0,.42);
}
.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid #24140c;
  background: #2c1a10;
  user-select: none;
}
.chess-square {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
  overflow: hidden;
}
.chess-square.light {
  background:
    radial-gradient(circle at 35% 25%, rgba(255,255,255,.1), transparent 45%),
    linear-gradient(135deg, #b9874e, #87572f);
}
.chess-square.dark {
  background:
    radial-gradient(circle at 35% 25%, rgba(255,255,255,.045), transparent 45%),
    linear-gradient(135deg, #4f3826, #2c2118);
}
.chess-square:hover {
  box-shadow: inset 0 0 0 4px rgba(245, 218, 157, .28);
}
.chess-square.selected {
  box-shadow: inset 0 0 0 5px rgba(255, 211, 103, .92);
}
.chess-square.last-move {
  box-shadow: inset 0 0 0 5px rgba(153, 203, 230, .42);
}
.chess-square.check-square {
  background:
    radial-gradient(circle, rgba(196,43,27,.8), rgba(99,18,16,.58)),
    #542019;
}
.chess-square.legal-empty::after {
  content: "";
  width: 22%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(243, 222, 174, .62);
  box-shadow: 0 0 15px rgba(243, 222, 174, .25);
}
.chess-square.legal-capture::after {
  content: "";
  position: absolute;
  inset: 7%;
  border: 4px solid rgba(255, 194, 89, .78);
  border-radius: 50%;
}
.chess-coordinate {
  position: absolute;
  z-index: 3;
  color: rgba(24, 14, 8, .68);
  font-family: system-ui, sans-serif;
  font-size: clamp(.53rem, 1vw, .72rem);
  font-weight: 700;
  pointer-events: none;
}
.chess-coordinate.file {
  right: 4px;
  bottom: 2px;
}
.chess-coordinate.rank {
  left: 4px;
  top: 2px;
}
.chess-square.dark .chess-coordinate {
  color: rgba(232, 205, 153, .64);
}

.chess-piece {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 76%;
  aspect-ratio: 1;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: clamp(1.65rem, 5vw, 4.7rem);
  line-height: 1;
  transition: transform .18s ease;
  pointer-events: none;
}
.chess-square:hover .chess-piece {
  transform: translateY(-2px) scale(1.025);
}
.chess-piece.white {
  color: #24160c;
  text-shadow: 0 1px 0 rgba(255,255,255,.35);
  background:
    radial-gradient(circle at 35% 25%, #fff0c5, #c6924f 62%, #75421f);
  box-shadow:
    inset 0 0 0 3px rgba(54,29,12,.22),
    0 5px 10px rgba(0,0,0,.3);
}
.chess-piece.black {
  color: #e7c887;
  text-shadow: 0 2px 4px #000;
  background:
    radial-gradient(circle at 35% 25%, #4b5361, #1c2732 58%, #080d13);
  box-shadow:
    inset 0 0 0 3px rgba(213,174,102,.13),
    0 5px 12px rgba(0,0,0,.55);
}
.board-corner {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid #b77b3d;
  border-radius: 50%;
  color: var(--gold-soft);
  background: #20120b;
  font-size: .75rem;
}
.corner-one { left: 2px; top: 2px; }
.corner-two { right: 2px; top: 2px; }
.corner-three { left: 2px; bottom: 2px; }
.corner-four { right: 2px; bottom: 2px; }

.chess-panel {
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--line);
  background: rgba(5, 11, 17, .82);
  backdrop-filter: blur(10px);
}
.chess-status-block {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.chess-status-block > span,
.chronicle-title > span {
  color: var(--gold-soft);
  font-family: system-ui, sans-serif;
  font-size: .7rem;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.chess-status-block strong {
  display: block;
  margin-top: 9px;
  font-size: 1.45rem;
}
.chess-status-block p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}
.chess-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  margin: 20px 0;
}
.chess-chronicle {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 19px 0;
}
.chronicle-title {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}
.chronicle-title small {
  color: var(--muted);
}
#moveHistory {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  max-height: 220px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}
.move-row {
  display: grid;
  grid-template-columns: 32px 1fr 1fr;
  gap: 7px;
  padding: 7px 8px;
  color: var(--muted);
  background: rgba(214,168,92,.045);
  font-family: system-ui, sans-serif;
  font-size: .86rem;
}
.move-row b {
  color: var(--gold-soft);
}
.empty-history {
  color: var(--muted);
  font-style: italic;
}
.piece-legend {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 20px;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: .78rem;
}
.piece-legend span {
  display: flex;
  align-items: center;
  gap: 8px;
}
.piece-legend b {
  color: var(--gold-soft);
  font-family: Georgia, serif;
  font-size: 1.35rem;
}
.chess-tech-note {
  margin: 20px 0 0;
  color: rgba(185,179,167,.78);
  font-family: system-ui, sans-serif;
  font-size: .75rem;
  line-height: 1.55;
}

.promotion-panel {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 6, 10, .88);
  backdrop-filter: blur(8px);
}
.promotion-panel[hidden] {
  display: none;
}
.promotion-panel > div {
  width: min(560px, 100%);
  padding: clamp(26px, 5vw, 48px);
  border: 1px solid var(--gold);
  background: #0c1620;
  text-align: center;
  box-shadow: var(--shadow);
}
.promotion-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 24px;
}
.promotion-options button {
  padding: 13px 8px;
  border: 1px solid var(--line);
  color: var(--cream);
  background: rgba(214,168,92,.07);
  cursor: pointer;
}
.promotion-options span {
  display: block;
  color: var(--gold-soft);
  font-size: 2.5rem;
}

@media (max-width: 1050px) {
  .chess-dialog {
    max-height: 98vh;
  }
  .chess-shell {
    overflow-y: auto;
  }
  .chess-layout {
    grid-template-columns: 1fr;
  }
  .chess-table-area {
    margin: 0 auto;
  }
  .chess-panel {
    width: min(800px, 100%);
    margin: 0 auto;
  }
  .chess-controls {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 620px) {
  .chess-shell {
    padding: 15px;
  }
  .chess-header h2 {
    font-size: 2.35rem;
  }
  .chess-mode-switch {
    grid-template-columns: 1fr;
  }
  .chess-board-frame {
    padding: 10px;
  }
  .chess-piece {
    width: 82%;
    font-size: clamp(1.45rem, 10vw, 2.8rem);
  }
  .chess-controls {
    grid-template-columns: 1fr;
  }
  .chess-player {
    padding: 8px;
  }
  .turn-rune {
    display: none;
  }
  .promotion-options {
    grid-template-columns: repeat(2, 1fr);
  }
}


/* ===== Шахматы Перуна v5: мифологические фигуры и живая погода ===== */
.chess-dialog { overflow: hidden; }
.chess-shell { isolation: isolate; transition: background-color 1s ease; }
.chess-atmosphere { position:absolute; inset:0; z-index:0; overflow:hidden; pointer-events:none; }
.chess-atmosphere::before { content:""; position:absolute; inset:0; background:radial-gradient(circle at 50% 18%,rgba(106,132,164,.2),transparent 46%),linear-gradient(180deg,rgba(12,22,34,.3),rgba(3,8,14,.86)); transition:filter 1.2s ease, opacity 1.2s ease; opacity:.62; }
.chess-shell[data-time="day"] .chess-atmosphere::before { filter:brightness(1.28) saturate(.78) contrast(.92); opacity:.72; }
.chess-shell[data-time="dawn"] .chess-atmosphere::before { filter:brightness(1.08) sepia(.12) saturate(.9); opacity:.69; }
.chess-shell[data-time="evening"] .chess-atmosphere::before { filter:brightness(.83) sepia(.2) saturate(1.05); opacity:.72; }
.chess-shell[data-time="night"] .chess-atmosphere::before { filter:brightness(.45) saturate(.9) contrast(1.12); opacity:.82; }
.chess-sky-glow { position:absolute; inset:0; transition:background 1.2s ease; }
.chess-shell[data-time="day"] .chess-sky-glow { background:linear-gradient(180deg,rgba(226,235,222,.27),rgba(20,36,48,.23) 48%,rgba(5,10,16,.9)); }
.chess-shell[data-time="dawn"] .chess-sky-glow { background:linear-gradient(180deg,rgba(230,160,89,.22),rgba(20,35,48,.28) 50%,rgba(5,10,16,.92)); }
.chess-shell[data-time="evening"] .chess-sky-glow { background:linear-gradient(180deg,rgba(181,91,56,.2),rgba(14,27,43,.47) 52%,rgba(4,9,15,.94)); }
.chess-shell[data-time="night"] .chess-sky-glow { background:linear-gradient(180deg,rgba(13,33,58,.48),rgba(2,9,17,.64) 54%,rgba(2,6,11,.97)); }
.chess-clouds { position:absolute; left:-35%; width:170%; height:42%; opacity:.28; filter:blur(24px); background:radial-gradient(ellipse at 15% 45%,rgba(210,220,226,.5),transparent 20%),radial-gradient(ellipse at 45% 36%,rgba(150,167,184,.45),transparent 24%),radial-gradient(ellipse at 77% 52%,rgba(194,205,213,.42),transparent 22%); animation:cloudDrift 46s linear infinite; }
.clouds-one { top:-8%; }
.clouds-two { top:8%; opacity:.17; animation-duration:70s; animation-direction:reverse; }
@keyframes cloudDrift { from{transform:translateX(-7%)} to{transform:translateX(7%)} }
.chess-mist { position:absolute; left:-10%; right:-10%; bottom:-8%; height:38%; background:radial-gradient(ellipse at center,rgba(179,197,207,.16),transparent 67%); filter:blur(18px); animation:mistMove 12s ease-in-out infinite alternate; }
@keyframes mistMove { to{transform:translateX(3%) translateY(-2%)} }
.chess-rain { position:absolute; inset:0; overflow:hidden; opacity:.78; transition:opacity .35s ease; }
.chess-rain.off { opacity:0; }
.rain-drop { position:absolute; top:-18%; width:1px; height:90px; background:linear-gradient(transparent,rgba(193,220,235,.52)); transform:rotate(12deg); animation:rainFall var(--rain-speed) linear infinite; animation-delay:var(--rain-delay); }
@keyframes rainFall { to{transform:translate3d(90px,125vh,0) rotate(12deg)} }
.chess-lightning { position:absolute; inset:0; opacity:0; background:rgba(220,237,255,.5); mix-blend-mode:screen; }
.chess-lightning span { position:absolute; top:-8%; width:3px; height:72%; background:linear-gradient(#eef8ff,rgba(127,190,255,.4),transparent); filter:drop-shadow(0 0 8px #d8efff); clip-path:polygon(42% 0,100% 0,63% 40%,100% 40%,20% 100%,43% 53%,0 53%); }
.chess-lightning span:nth-child(1){left:20%;transform:rotate(8deg)}
.chess-lightning span:nth-child(2){left:67%;height:56%;transform:rotate(-9deg)}
.chess-lightning span:nth-child(3){left:83%;height:40%;transform:rotate(4deg)}
.chess-shell.lightning-strike .chess-lightning { animation:lightningStrike .72s ease; }
@keyframes lightningStrike { 0%,100%{opacity:0} 8%{opacity:.92} 14%{opacity:.08} 22%{opacity:.72} 31%{opacity:0} 44%{opacity:.44} 55%{opacity:0} }
.chess-shell > :not(.chess-atmosphere) { position:relative; z-index:2; }
.chess-header-tools { display:flex; align-items:center; gap:12px; }
.chess-time-badge { min-width:112px; padding:9px 13px; border:1px solid var(--line); background:rgba(4,10,16,.62); text-align:center; backdrop-filter:blur(8px); }
.chess-time-badge span,.chess-time-badge strong{display:block}.chess-time-badge span{color:var(--gold-soft);font:700 .66rem system-ui,sans-serif;letter-spacing:.13em;text-transform:uppercase}.chess-time-badge strong{margin-top:3px;font-size:1rem}
.weather-controls { display:grid; grid-template-columns:1fr 1fr; gap:9px; margin-top:18px; }
.weather-button { display:grid; grid-template-columns:auto 1fr; grid-template-rows:auto auto; gap:1px 9px; align-items:center; padding:11px 12px; border:1px solid var(--line); color:var(--cream); background:rgba(7,14,21,.68); text-align:left; cursor:pointer; }
.weather-button>span{grid-row:1/3;font-size:1.3rem;color:var(--gold-soft)}.weather-button strong{font-size:.84rem}.weather-button small{color:var(--muted);font-size:.67rem}.weather-button.active{border-color:var(--gold);background:rgba(214,168,92,.13)}
.time-explanation { margin:9px 0 0; color:var(--muted); font: .72rem/1.45 system-ui,sans-serif; }
.board-inscription { position:absolute; left:50%; z-index:5; transform:translateX(-50%); color:rgba(232,198,133,.56); font:700 clamp(.48rem,.9vw,.66rem) system-ui,sans-serif; letter-spacing:.22em; white-space:nowrap; }
.top-inscription{top:4px}
.chess-board-frame { background:linear-gradient(135deg,rgba(207,145,72,.3),transparent 18%),repeating-linear-gradient(90deg,#3c2214 0 9px,#4b2b18 9px 18px); }
.chess-square.light { background:radial-gradient(circle at 35% 25%,rgba(255,255,255,.12),transparent 45%),linear-gradient(135deg,#c49a63,#906039); }
.chess-square.dark { background:radial-gradient(circle at 35% 25%,rgba(255,255,255,.05),transparent 45%),linear-gradient(135deg,#4b382a,#29221b); }
.myth-piece { position:relative; z-index:2; display:grid; place-items:center; width:78%; aspect-ratio:1; border:1px solid rgba(255,255,255,.22); border-radius:22%; transition:transform .18s ease,filter .18s ease; pointer-events:none; }
.myth-piece svg { width:62%; height:62%; fill:currentColor; filter:drop-shadow(0 2px 1px rgba(0,0,0,.34)); }
.myth-piece.white { color:#2a180c; background:radial-gradient(circle at 32% 25%,#fff1c8,#c89450 61%,#70401f); box-shadow:inset 0 0 0 3px rgba(65,34,13,.2),0 5px 10px rgba(0,0,0,.32); }
.myth-piece.black { color:#dcbf7b; background:radial-gradient(circle at 32% 24%,#566170,#202c38 58%,#080d13); box-shadow:inset 0 0 0 3px rgba(219,180,105,.12),0 5px 12px rgba(0,0,0,.58); }
.myth-piece-rune { position:absolute; right:5%; bottom:2%; font:bold clamp(.45rem,.8vw,.64rem) Georgia,serif; opacity:.65; }
.chess-square:hover .myth-piece { transform:translateY(-2px) scale(1.035); filter:brightness(1.07); }
.myth-legend i { display:grid; place-items:center; width:31px; height:31px; border:1px solid var(--line); border-radius:7px; color:var(--gold-soft); background:rgba(214,168,92,.07); }
.myth-legend i svg { width:19px; height:19px; fill:currentColor; }
.promotion-options span[data-promotion-icon] { display:grid; place-items:center; height:54px; }
.promotion-options span[data-promotion-icon] svg { width:42px; height:42px; fill:var(--gold-soft); }
.storm-emblem { box-shadow:0 0 22px rgba(125,187,255,.18); }.wolf-emblem { font-size:1.1rem; }
@media (max-width:700px){.chess-header-tools{align-items:flex-end;flex-direction:column-reverse}.chess-time-badge{min-width:88px}.weather-controls{grid-template-columns:1fr}.myth-piece{width:84%}.chess-lightning span:nth-child(2){left:58%}}
@media (prefers-reduced-motion:reduce){.chess-clouds,.chess-mist,.rain-drop{animation:none!important}.chess-rain{opacity:.24}.chess-lightning{display:none}}


/* ===== v5.1 visibility fix: more of the board fits at normal scale ===== */
.chess-dialog {
  width: min(1540px, 97vw);
  max-height: 98vh;
}
.chess-shell {
  min-height: auto;
  padding: clamp(14px, 2vw, 26px);
}
.chess-header {
  margin-bottom: 12px;
  gap: 18px;
}
.chess-header h2 {
  margin-bottom: 6px;
  line-height: .92;
  font-size: clamp(2.55rem, 4.4vw, 4.25rem);
}
.chess-header > div > p:last-child {
  font-size: .98rem;
}
.chess-mode-switch {
  width: min(620px, 100%);
  margin-bottom: 14px;
  gap: 8px;
}
.chess-mode {
  padding: 10px 14px;
}
.chess-mode small {
  font-size: .77rem;
}
.chess-layout {
  grid-template-columns: minmax(520px, 1fr) minmax(280px, 340px);
  gap: clamp(16px, 2.5vw, 26px);
}
.chess-table-area {
  width: min(100%, 780px, calc(100vh - 230px));
  margin-inline: 0 auto;
}
.chess-player {
  min-height: 52px;
  padding: 8px 12px;
}
.chess-player small {
  font-size: .72rem;
}
.chess-board-frame {
  margin: 8px 0;
  padding: clamp(10px, 1.5vw, 16px);
}
.board-inscription {
  letter-spacing: .18em;
}
.chess-panel {
  max-height: min(690px, calc(100vh - 190px));
  overflow: auto;
  padding: 18px 20px;
}
.chess-status-block strong {
  font-size: 1.28rem;
}
.weather-controls {
  margin-top: 14px;
}
.chess-controls {
  margin: 16px 0;
}
#moveHistory {
  max-height: 160px;
}
.piece-legend {
  margin-top: 16px;
}
.chess-tech-note {
  margin: 16px 0 0;
}

@media (max-height: 920px) and (min-width: 900px) {
  .chess-dialog { width: min(1580px, 98vw); }
  .chess-shell { padding: 12px 16px 16px; }
  .chess-header { margin-bottom: 10px; }
  .chess-header h2 { font-size: clamp(2.3rem, 4vw, 3.8rem); }
  .chess-header .eyebrow { margin-bottom: 8px; }
  .chess-header > div > p:last-child { font-size: .92rem; max-width: 44ch; }
  .chess-header-tools { gap: 10px; }
  .chess-close { width: 42px; height: 42px; font-size: 1.45rem; }
  .chess-time-badge { min-width: 94px; padding: 7px 10px; }
  .chess-time-badge strong { font-size: .92rem; }
  .chess-mode-switch { width: min(540px, 100%); margin-bottom: 10px; }
  .chess-mode { padding: 8px 12px; }
  .chess-mode strong { font-size: 1.02rem; }
  .chess-mode small { margin-top: 2px; font-size: .72rem; }
  .chess-layout { grid-template-columns: minmax(500px, 1fr) 310px; gap: 16px; }
  .chess-table-area { width: min(100%, calc(100vh - 190px), 720px); }
  .chess-player { min-height: 48px; padding: 7px 10px; }
  .player-emblem, .turn-rune { width: 34px; height: 34px; }
  .chess-board-frame { margin: 6px 0; padding: 9px; }
  .board-inscription { top: 2px; font-size: .56rem; }
  .chess-panel { max-height: calc(100vh - 155px); padding: 16px 18px; }
  .chess-status-block { padding-bottom: 16px; }
  .chess-status-block strong { margin-top: 6px; font-size: 1.18rem; }
  .chess-status-block p { margin-top: 6px; line-height: 1.42; font-size: .92rem; }
  .weather-controls { margin-top: 12px; gap: 8px; }
  .weather-button { padding: 9px 10px; }
  .weather-button strong { font-size: .8rem; }
  .weather-button small { font-size: .64rem; }
  .time-explanation { margin-top: 8px; font-size: .68rem; }
  .chess-controls { gap: 7px; margin: 14px 0; }
  .chess-controls .button { min-height: 42px; padding-top: 0; padding-bottom: 0; }
  .chess-chronicle { padding: 14px 0; }
  #moveHistory { max-height: 118px; gap: 4px; }
  .move-row { padding: 6px 7px; font-size: .8rem; }
  .piece-legend { margin-top: 14px; gap: 6px; font-size: .73rem; }
  .piece-legend b { font-size: 1.18rem; }
  .chess-tech-note { margin-top: 12px; font-size: .69rem; line-height: 1.45; }
}

@media (max-height: 830px) and (min-width: 900px) {
  .chess-table-area { width: min(100%, calc(100vh - 168px), 660px); }
  .chess-header h2 { font-size: clamp(2rem, 3.7vw, 3.2rem); }
  #moveHistory { max-height: 90px; }
}

@media (max-width: 1050px) {
  .chess-table-area {
    width: min(100%, 780px);
  }
  .chess-panel {
    max-height: none;
    overflow: visible;
  }
}


/* ===== v5.2: fixed chess geometry and viewport fitting ===== */
.chess-shell {
  --perun-board-size: min(
    700px,
    calc(100dvh - 330px),
    calc(100vw - 500px)
  );
}

.chess-layout {
  grid-template-columns: var(--perun-board-size) minmax(280px, 330px);
  justify-content: start;
  gap: clamp(14px, 2vw, 24px);
}

.chess-table-area {
  width: var(--perun-board-size);
  min-width: 0;
  display: grid;
  grid-template-rows: auto var(--perun-board-size) auto;
}

.chess-board-frame {
  box-sizing: border-box;
  width: var(--perun-board-size);
  height: var(--perun-board-size);
  min-width: 0;
  min-height: 0;
  padding: clamp(8px, 1.15vw, 13px);
}

.chess-board {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  aspect-ratio: auto;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
}

.chess-square {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  contain: layout paint;
}

.myth-piece {
  position: absolute;
  inset: 11%;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
}

.chess-square.legal-empty::after {
  position: absolute;
}

.chess-panel {
  box-sizing: border-box;
  height: calc(var(--perun-board-size) + 112px);
  max-height: calc(var(--perun-board-size) + 112px);
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

@media (max-height: 920px) and (min-width: 1051px) {
  .chess-shell {
    --perun-board-size: min(
      640px,
      calc(100dvh - 315px),
      calc(100vw - 470px)
    );
  }

  .chess-layout {
    grid-template-columns: var(--perun-board-size) 300px;
  }

  .chess-panel {
    height: calc(var(--perun-board-size) + 104px);
    max-height: calc(var(--perun-board-size) + 104px);
  }
}

@media (max-height: 820px) and (min-width: 1051px) {
  .chess-shell {
    --perun-board-size: min(
      570px,
      calc(100dvh - 290px),
      calc(100vw - 450px)
    );
  }

  .chess-header > div > p:last-child,
  .chess-tech-note {
    display: none;
  }

  .chess-panel {
    height: calc(var(--perun-board-size) + 100px);
    max-height: calc(var(--perun-board-size) + 100px);
  }
}

@media (max-width: 1050px) {
  .chess-shell {
    --perun-board-size: min(
      720px,
      calc(100vw - 44px)
    );
  }

  .chess-layout {
    grid-template-columns: 1fr;
  }

  .chess-table-area,
  .chess-board-frame {
    width: var(--perun-board-size);
  }

  .chess-table-area {
    grid-template-rows: auto var(--perun-board-size) auto;
    margin-inline: auto;
  }

  .chess-board-frame {
    height: var(--perun-board-size);
  }

  .chess-panel {
    width: min(var(--perun-board-size), 100%);
    height: auto;
    max-height: none;
    overflow: visible;
    margin-inline: auto;
  }
}

@media (max-width: 620px) {
  .chess-shell {
    --perun-board-size: min(
      720px,
      calc(100vw - 28px)
    );
  }

  .chess-board-frame {
    padding: 7px;
  }

  .myth-piece {
    inset: 8%;
  }
}


/* ========================================================================== 
   FOREST AMBIENCE V1 — 2026-09-11
   Pure CSS/JS atmosphere: time-of-day light, mist, moon, wolf eyes, rune secret.
   ========================================================================== */
:root {
  --parallax-x: 0px;
  --parallax-y: 0px;
  --forest-light: rgba(50, 88, 105, .14);
  --forest-warmth: rgba(214, 168, 92, .04);
}

body[data-daypart="dawn"] {
  --forest-light: rgba(124, 96, 104, .18);
  --forest-warmth: rgba(235, 154, 95, .08);
}
body[data-daypart="day"] {
  --forest-light: rgba(71, 112, 117, .15);
  --forest-warmth: rgba(228, 190, 116, .06);
}
body[data-daypart="dusk"] {
  --forest-light: rgba(88, 66, 104, .20);
  --forest-warmth: rgba(227, 126, 72, .08);
}
body[data-daypart="night"] {
  --forest-light: rgba(28, 54, 83, .24);
  --forest-warmth: rgba(130, 149, 189, .04);
}

.forest-ambience {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 70% 14%, var(--forest-light), transparent 28rem),
    linear-gradient(180deg, var(--forest-warmth), transparent 40%);
  transition: background 1.4s ease;
}

main, footer { position: relative; }
.hero-content, .page-section > *, footer > * { position: relative; z-index: 2; }
.scroll-hint { z-index: 2; }
.site-header { z-index: 60; }
#fireflies { z-index: 25; }

.hero {
  background-position: calc(50% + var(--parallax-x)) calc(50% + var(--parallax-y));
  transition: background-position .22s ease-out;
}


.ambient-moon {
  position: fixed;
  right: 4.2vw;
  top: 92px;
  width: 54px;
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
  transform: translate3d(var(--moon-x, 0px), var(--moon-y, 0px), 0);
  background:
    radial-gradient(circle at 32% 30%,
      rgba(255,255,255,.96) 0 10%,
      rgba(242,237,226,.95) 11% 28%,
      rgba(220,214,202,.94) 29% 58%,
      rgba(180,174,165,.92) 59% 78%,
      rgba(145,141,136,.90) 79% 100%);
  box-shadow:
    0 0 18px rgba(231, 223, 201, .16),
    0 0 44px rgba(170, 182, 214, .10);
  filter: saturate(.82);
}

.ambient-moon::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 68% 44%, rgba(0,0,0,.12) 0 7%, transparent 8%),
    radial-gradient(circle at 43% 33%, rgba(0,0,0,.10) 0 5%, transparent 6%),
    radial-gradient(circle at 52% 66%, rgba(0,0,0,.08) 0 4%, transparent 5%),
    radial-gradient(circle at 72% 56%, rgba(0,0,0,.06) 0 10%, transparent 11%),
    radial-gradient(circle at 78% 50%, rgba(0,0,0,.14) 0 52%, rgba(0,0,0,.03) 73%, transparent 100%);
  mix-blend-mode: multiply;
}

.ambient-moon::after {
  content: "";
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(236,229,208,.18) 0%,
    rgba(236,229,208,.08) 38%,
    rgba(236,229,208,0) 72%);
  z-index: -1;
}

.ambient-moon span {
  display: none;
}

body[data-daypart="day"] .ambient-moon { opacity: .04; }
body[data-daypart="dawn"] .ambient-moon { opacity: .16; }
body[data-daypart="dusk"] .ambient-moon { opacity: .26; }
body[data-daypart="night"] .ambient-moon { opacity: .52; }


body[data-daypart="day"] .ambient-moon { opacity: .08; }
body[data-daypart="dawn"] .ambient-moon { opacity: .22; }
body[data-daypart="dusk"] .ambient-moon { opacity: .38; }
body[data-daypart="night"] .ambient-moon { opacity: .78; }

.mist {
  position: absolute;
  left: -30vw;
  width: 160vw;
  height: 34vh;
  min-height: 190px;
  opacity: .16;
  filter: blur(18px);
  background:
    radial-gradient(ellipse at 20% 55%, rgba(214,225,220,.38), transparent 28%),
    radial-gradient(ellipse at 50% 45%, rgba(184,205,205,.27), transparent 31%),
    radial-gradient(ellipse at 80% 60%, rgba(215,226,220,.30), transparent 26%);
  will-change: transform;
}
.mist-one {
  bottom: 3vh;
  animation: forestMist 34s ease-in-out infinite alternate;
}
.mist-two {
  bottom: 24vh;
  opacity: .09;
  transform: scaleX(-1);
  animation: forestMistTwo 47s ease-in-out infinite alternate;
}
@keyframes forestMist {
  from { transform: translate3d(-5vw, 2vh, 0) scale(1.03); }
  to { transform: translate3d(11vw, -2vh, 0) scale(1.11); }
}
@keyframes forestMistTwo {
  from { transform: translate3d(8vw, 0, 0) scaleX(-1) scale(1.08); }
  to { transform: translate3d(-9vw, 3vh, 0) scaleX(-1) scale(1.14); }
}

.ambient-vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(1,5,8,.24), transparent 18%, transparent 82%, rgba(1,5,8,.29)),
    linear-gradient(0deg, rgba(1,5,8,.28), transparent 21%);
}

.wolf-eyes {
  position: absolute;
  left: 82vw;
  top: 46vh;
  display: flex;
  gap: 19px;
  opacity: 0;
  transform: translateY(4px) scale(.84);
  transition: opacity 1.15s ease, transform 1.15s ease;
  filter: drop-shadow(0 0 8px rgba(190, 219, 119, .38));
}
.wolf-eyes.visible {
  opacity: .72;
  transform: translateY(0) scale(1);
}
.wolf-eyes i {
  display: block;
  width: 12px;
  height: 6px;
  border-radius: 60% 40% 60% 40%;
  background: radial-gradient(ellipse, #f3ffd0 0 17%, #b3d263 28% 48%, rgba(61,84,34,.18) 72%);
  box-shadow: 0 0 11px rgba(181, 213, 96, .46);
}
.wolf-eyes i:last-child { transform: scaleX(-1); }

.brand-mark {
  cursor: pointer;
  position: relative;
  transition: transform .3s ease, box-shadow .3s ease, color .3s ease;
  animation: runeBreath 5.5s ease-in-out infinite;
}
.brand-mark:hover,
.brand-mark:focus-visible {
  outline: none;
  color: #fff2c7;
  transform: rotate(-7deg) scale(1.06);
  box-shadow: inset 0 0 24px rgba(214,168,92,.28), 0 0 22px rgba(214,168,92,.16);
}
@keyframes runeBreath {
  0%, 100% { box-shadow: inset 0 0 20px rgba(214,168,92,.18), 0 0 0 rgba(214,168,92,0); }
  50% { box-shadow: inset 0 0 24px rgba(214,168,92,.24), 0 0 18px rgba(214,168,92,.10); }
}

.rune-secret {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%, rgba(33, 45, 54, .36), rgba(3, 7, 10, .94) 52%, rgba(1,3,5,.98));
  backdrop-filter: blur(7px);
  transition: opacity .65s ease, visibility .65s step-end;
}
.rune-secret.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .65s ease;
}
.rune-circle {
  position: relative;
  display: grid;
  place-items: center;
  width: min(78vw, 430px);
  aspect-ratio: 1;
  border: 1px solid rgba(204, 177, 110, .34);
  border-radius: 50%;
  box-shadow: inset 0 0 70px rgba(111,72,121,.10), 0 0 70px rgba(102,78,117,.12);
  text-align: center;
}
.rune-flower-ring {
  position: absolute;
  inset: -4%;
  border-radius: 50%;
  background:
    repeating-conic-gradient(from 5deg, rgba(124,87,148,.0) 0 8deg, rgba(122,82,146,.58) 9deg 12deg, rgba(74,111,86,.42) 13deg 15deg, transparent 16deg 24deg);
  -webkit-mask: radial-gradient(circle, transparent 0 69%, #000 70% 76%, transparent 77%);
  mask: radial-gradient(circle, transparent 0 69%, #000 70% 76%, transparent 77%);
  animation: flowerCircle 18s linear infinite;
}
.rune-circle::before,
.rune-circle::after {
  content: "";
  position: absolute;
  inset: 10%;
  border: 1px solid rgba(223,195,125,.19);
  border-radius: 50%;
  animation: runeOrbit 10s linear infinite;
}
.rune-circle::after { inset: 18%; animation-direction: reverse; animation-duration: 14s; }
.rune-circle strong {
  display: block;
  margin-top: 20px;
  color: #efd79e;
  font-size: clamp(5rem, 16vw, 9rem);
  line-height: .85;
  text-shadow: 0 0 30px rgba(216, 179, 94, .3);
}
.rune-circle span,
.rune-circle small { position: absolute; left: 14%; right: 14%; }
.rune-circle span {
  bottom: 25%;
  color: #f5ead4;
  font-size: clamp(1rem, 3vw, 1.3rem);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.rune-circle small {
  bottom: 16%;
  color: rgba(245,234,212,.62);
  line-height: 1.45;
}
@keyframes flowerCircle { to { transform: rotate(360deg); } }
@keyframes runeOrbit { to { transform: rotate(360deg); } }

.view.active { animation: forestReveal .58s cubic-bezier(.2,.76,.28,1); }
@keyframes forestReveal {
  from { opacity: 0; transform: translateY(10px) scale(.995); filter: blur(2px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

body.ambience-paused .mist,
body.ambience-paused .brand-mark,
body.ambience-paused .rune-flower-ring,
body.ambience-paused .rune-circle::before,
body.ambience-paused .rune-circle::after { animation-play-state: paused !important; }

@media (max-width: 700px), (hover: none) {
  .hero { background-position: center !important; transition: none; }
  .ambient-moon { right: 4.2vw; top: 92px; width: 54px; }
  .mist-two { display: none; }
  .mist-one { opacity: .10; filter: blur(22px); animation-duration: 52s; }
  .wolf-eyes { display: none; }
  #fireflies { opacity: .58; }
  .rune-circle small { bottom: 13%; font-size: .72rem; }
}

@media (prefers-reduced-motion: reduce) {
  .hero { background-position: center !important; transition: none !important; }
  .mist, .brand-mark, .rune-flower-ring, .rune-circle::before, .rune-circle::after { animation: none !important; }
  .view.active { animation: none !important; }
  .wolf-eyes { display: none !important; }
  .rune-secret { transition: none !important; }
}


/* ========================================================================== 
   FOREST AMBIENCE V2 — distant storm, wolf trail, forest underside + chess ladder
   ========================================================================== */
.distant-storm {
  position: absolute;
  inset: 0 0 auto 0;
  height: 54vh;
  overflow: hidden;
  opacity: .46;
  pointer-events: none;
  mix-blend-mode: screen;
}
.storm-cloud {
  position: absolute;
  top: 4vh;
  width: 52vw;
  height: 23vh;
  min-width: 420px;
  filter: blur(24px);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(91,108,128,.18), rgba(16,27,40,.04) 58%, transparent 74%);
}
.storm-cloud-a { right: -7vw; animation: distantCloud 34s ease-in-out infinite alternate; }
.storm-cloud-b { right: 22vw; top: 13vh; opacity: .58; animation: distantCloud 49s ease-in-out infinite alternate-reverse; }
.storm-horizon {
  position: absolute;
  right: -8vw;
  top: 8vh;
  width: 64vw;
  height: 28vh;
  opacity: 0;
  background: radial-gradient(ellipse at 65% 46%, rgba(189,211,236,.42), rgba(102,130,165,.12) 28%, transparent 66%);
}
.storm-bolt {
  position: absolute;
  top: 9vh;
  width: 2px;
  height: 17vh;
  opacity: 0;
  transform-origin: top;
  background: linear-gradient(#e9f4ff, rgba(174,208,239,.2));
  box-shadow: 0 0 9px rgba(201,228,255,.7);
  clip-path: polygon(42% 0,100% 0,64% 39%,100% 39%,18% 100%,42% 54%,0 54%);
}
.storm-bolt-a { right: 17vw; transform: rotate(8deg); }
.storm-bolt-b { right: 36vw; top: 14vh; height: 12vh; transform: rotate(-10deg) scale(.74); }
.distant-storm.flash-one .storm-horizon { animation: horizonFlash 1.15s ease-out; }
.distant-storm.flash-one .storm-bolt-a { animation: boltFlash .72s steps(2,end); }
.distant-storm.flash-two .storm-horizon { animation: horizonFlash .9s ease-out; }
.distant-storm.flash-two .storm-bolt-b { animation: boltFlash .56s steps(2,end); }
@keyframes distantCloud { from { transform: translate3d(-2vw,0,0) scale(1); } to { transform: translate3d(6vw,2vh,0) scale(1.09); } }
@keyframes horizonFlash { 0%,100%{opacity:0} 8%{opacity:.82} 14%{opacity:.1} 23%{opacity:.56} 34%{opacity:0} }
@keyframes boltFlash { 0%,100%{opacity:0} 8%,16%{opacity:.9} 22%{opacity:.15} 31%{opacity:.7} 42%{opacity:0} }

.wolf-trail {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.1s ease;
}
.wolf-trail.visible { opacity: .48; }
.wolf-trail i {
  position: absolute;
  left: var(--px);
  top: var(--py);
  width: 22px;
  height: 26px;
  opacity: 0;
  transform: rotate(var(--pr)) scale(.78);
  filter: blur(.15px) drop-shadow(0 0 7px rgba(191,207,196,.16));
  background:
    radial-gradient(ellipse at 50% 70%, rgba(202,216,205,.72) 0 29%, transparent 31%),
    radial-gradient(circle at 14% 24%, rgba(202,216,205,.72) 0 13%, transparent 15%),
    radial-gradient(circle at 39% 10%, rgba(202,216,205,.72) 0 13%, transparent 15%),
    radial-gradient(circle at 66% 11%, rgba(202,216,205,.72) 0 13%, transparent 15%),
    radial-gradient(circle at 88% 27%, rgba(202,216,205,.72) 0 12%, transparent 14%);
  transition: opacity .75s ease, transform .75s ease;
}
.wolf-trail.visible i { opacity: .72; transform: rotate(var(--pr)) scale(1); }
.wolf-trail i:nth-child(1){transition-delay:.05s}.wolf-trail i:nth-child(2){transition-delay:.35s}.wolf-trail i:nth-child(3){transition-delay:.65s}.wolf-trail i:nth-child(4){transition-delay:.95s}.wolf-trail i:nth-child(5){transition-delay:1.25s}.wolf-trail i:nth-child(6){transition-delay:1.55s}.wolf-trail i:nth-child(7){transition-delay:1.85s}

.rune-circle small { bottom: 20%; }
.rune-portal-button {
  position: absolute;
  bottom: 8.5%;
  z-index: 3;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid rgba(225,192,118,.46);
  border-radius: 999px;
  color: #f3dfb0;
  background: rgba(12,18,24,.64);
  cursor: pointer;
  letter-spacing: .08em;
  transition: .25s ease;
}
.rune-portal-button:hover { transform: translateY(-2px); background: rgba(72,48,82,.58); box-shadow: 0 0 24px rgba(126,88,151,.2); }

.forest-upside {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: #05050a;
  transition: opacity .9s ease, visibility .9s step-end;
}
.forest-upside::before {
  content: "";
  position: absolute;
  inset: -5%;
  background:
    linear-gradient(180deg, rgba(22,10,37,.38), rgba(3,8,12,.72)),
    url("assets/scenes/upside-grove.svg") center / cover no-repeat;
  filter: hue-rotate(58deg) saturate(.72) contrast(1.18) brightness(.48);
  transform: scaleY(-1) scale(1.08);
  animation: upsideBreathe 13s ease-in-out infinite alternate;
}
.forest-upside::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 60%, transparent 0 12%, rgba(4,5,11,.18) 42%, rgba(1,2,6,.74) 85%),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(126,84,157,.018) 4px 5px);
}
.forest-upside.active { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .9s ease; }
body.upside-active { overflow: hidden; }
.upside-stars {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: .46;
  background-image:
    radial-gradient(circle at 20% 25%, #c9b5ed 0 1px, transparent 2px),
    radial-gradient(circle at 72% 18%, #e7d49d 0 1px, transparent 2px),
    radial-gradient(circle at 83% 66%, #b9d6d3 0 1px, transparent 2px),
    radial-gradient(circle at 39% 72%, #d2bbde 0 1px, transparent 2px);
  background-size: 173px 149px, 211px 181px, 137px 191px, 257px 211px;
  animation: upsideStars 18s linear infinite;
}
.upside-content {
  position: relative;
  z-index: 3;
  width: min(720px, 92vw);
  padding: clamp(26px,5vw,54px);
  border: 1px solid rgba(174,136,201,.28);
  border-radius: 18px;
  text-align: center;
  background: rgba(6,8,15,.58);
  backdrop-filter: blur(13px);
  box-shadow: 0 32px 100px rgba(0,0,0,.46), inset 0 0 90px rgba(96,52,122,.08);
}
.upside-content h2 { margin-bottom: 18px; text-shadow: 0 0 30px rgba(173,126,209,.22); }
.upside-content > p:not(.eyebrow) { color: rgba(245,234,212,.74); line-height: 1.7; }
.upside-whisper { margin: 28px auto; padding: 18px; border-top: 1px solid rgba(208,176,225,.18); border-bottom: 1px solid rgba(208,176,225,.18); color: #e5d1ec; font-style: italic; line-height: 1.55; }
.upside-actions { display:flex; justify-content:center; gap:12px; flex-wrap:wrap; }
@keyframes upsideBreathe { from{transform:scaleY(-1) scale(1.06) translate3d(-.5%,0,0)} to{transform:scaleY(-1) scale(1.12) translate3d(.6%,-.5%,0)} }
@keyframes upsideStars { to { transform: translateY(18px); } }

.chess-difficulty {
  position: relative;
  z-index: 4;
  margin: 0 clamp(18px,3vw,38px) 16px;
  padding: 14px;
  border: 1px solid rgba(214,168,92,.18);
  border-radius: 14px;
  background: rgba(5,10,16,.34);
  backdrop-filter: blur(8px);
}
.difficulty-heading { display:flex; align-items:baseline; justify-content:space-between; gap:12px; margin-bottom:10px; }
.difficulty-heading span { color:#f0d59c; font-weight:700; letter-spacing:.08em; text-transform:uppercase; font-size:.72rem; }
.difficulty-heading small { color:rgba(245,234,212,.52); text-align:right; }
.difficulty-grid { display:grid; grid-template-columns:repeat(8,minmax(0,1fr)); gap:7px; }
.difficulty-grid button {
  position:relative;
  min-width:0;
  padding:9px 5px 8px;
  border:1px solid rgba(214,168,92,.15);
  border-radius:9px;
  color:rgba(245,234,212,.68);
  background:rgba(10,16,22,.66);
  cursor:pointer;
  transition:.2s ease;
}
.difficulty-grid button:hover { transform:translateY(-2px); border-color:rgba(214,168,92,.42); color:#fff1d2; }
.difficulty-grid button.active { border-color:rgba(236,197,124,.68); color:#fff3d7; background:linear-gradient(180deg,rgba(121,78,38,.46),rgba(27,22,22,.72)); box-shadow:0 0 22px rgba(219,158,75,.1); }
.difficulty-grid b { position:absolute; top:5px; left:7px; font:700 .62rem/1 system-ui,sans-serif; color:rgba(237,199,129,.62); }
.difficulty-grid span { display:block; font-size:1.22rem; line-height:1.1; margin-bottom:5px; }
.difficulty-grid strong { display:block; overflow:hidden; text-overflow:ellipsis; font-size:.66rem; white-space:nowrap; font-family:system-ui,sans-serif; font-weight:600; }

@media (max-width: 900px) {
  .difficulty-grid { grid-template-columns:repeat(4,1fr); }
  .distant-storm { opacity:.34; }
}
@media (max-width: 620px), (hover:none) {
  .wolf-trail { display:none; }
  .distant-storm { height:42vh; opacity:.26; }
  .storm-bolt { display:none; }
  .difficulty-heading { align-items:flex-start; flex-direction:column; }
  .difficulty-heading small { text-align:left; }
  .difficulty-grid { grid-template-columns:repeat(4,1fr); gap:5px; }
  .difficulty-grid button { padding:8px 3px 7px; }
  .difficulty-grid strong { font-size:.58rem; }
  .rune-circle small { bottom:22%; }
  .rune-portal-button { bottom:7%; font-size:.72rem; }
  .upside-content { padding:26px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .storm-cloud,.upside-stars,.forest-upside::before { animation:none!important; }
  .storm-bolt,.storm-horizon,.wolf-trail { display:none!important; }
  .forest-upside { transition:none!important; }
}


/* STOCKFISH LADDER V1 — 2026-09-11 */
.chess-difficulty { margin: 10px 0 18px; position: relative; z-index: 3; }
.difficulty-heading { display:flex; align-items:baseline; justify-content:space-between; gap:14px; margin-bottom:10px; font-family:system-ui,sans-serif; }
.difficulty-heading span { color:#f1d399; font-size:.78rem; font-weight:800; letter-spacing:.12em; text-transform:uppercase; }
.difficulty-heading small { color:rgba(241,232,214,.55); font-size:.7rem; }
.difficulty-grid { display:grid; grid-template-columns:repeat(21,minmax(78px,1fr)); gap:7px; overflow-x:auto; padding:3px 2px 10px; scrollbar-width:thin; scroll-snap-type:x proximity; }
.difficulty-grid button { scroll-snap-align:start; position:relative; min-width:78px; min-height:96px; overflow:hidden; border:1px solid rgba(214,168,92,.18); border-radius:10px; padding:7px 5px 8px; color:#e9dfcf; background:rgba(7,14,19,.62); cursor:pointer; font-family:system-ui,sans-serif; transition:.22s ease; }
.difficulty-grid button:hover { transform:translateY(-2px); border-color:rgba(229,189,112,.52); }
.difficulty-grid button.active { border-color:#d8ac63; box-shadow:0 0 0 1px rgba(216,172,99,.26),0 8px 24px rgba(0,0,0,.28); background:rgba(91,61,34,.43); }
.opponent-thumb { display:block; width:40px; height:40px; margin:0 auto 4px; border-radius:50%; background-image:linear-gradient(rgba(7,14,18,.05),rgba(7,14,18,.32)),var(--portrait); background-size:cover; background-position:var(--portrait-focus,50% 50%); border:1px solid rgba(239,211,153,.38); box-shadow:inset 0 0 12px rgba(0,0,0,.22); }
.difficulty-grid button b { position:absolute; top:5px; left:6px; width:19px; height:19px; display:grid; place-items:center; border-radius:50%; color:#19130d; background:#d8ac63; font-size:.64rem; }
.difficulty-grid button > span { position:absolute; top:35px; right:7px; display:grid; place-items:center; min-width:21px; height:21px; padding:0 3px; border-radius:50%; color:#f8e9c9; background:rgba(4,9,12,.76); font-size:.74rem; }
.difficulty-grid button strong { display:block; min-height:2.1em; font-size:.66rem; line-height:1.05; font-weight:700; }

.enemy-commentator { display:grid; grid-template-columns:68px 1fr; gap:12px; align-items:center; margin:0 0 12px; padding:10px; border:1px solid rgba(214,168,92,.2); border-radius:12px; background:linear-gradient(135deg,rgba(28,36,42,.78),rgba(9,15,20,.72)); box-shadow:0 12px 34px rgba(0,0,0,.18); }
.enemy-portrait { position:relative; width:64px; height:64px; border-radius:50%; overflow:hidden; border:1px solid rgba(235,204,139,.52); box-shadow:0 0 20px rgba(205,160,84,.12); }
.enemy-portrait img { width:100%; height:100%; object-fit:cover; object-position:50% 50%; filter:saturate(.85) contrast(1.05); }
.enemy-portrait span { position:absolute; right:1px; bottom:1px; min-width:22px; height:22px; padding:0 4px; display:grid; place-items:center; border-radius:50%; background:rgba(5,10,14,.88); color:#f1d399; border:1px solid rgba(241,211,153,.38); font-size:.72rem; }
.enemy-speech span { display:block; margin-bottom:4px; color:#d8ac63; font:700 .68rem/1.2 system-ui,sans-serif; letter-spacing:.1em; text-transform:uppercase; }
.enemy-speech p { margin:0; color:#efe4d1; font-size:.88rem; line-height:1.45; }
.enemy-commentator[data-tone="warning"] { border-color:rgba(227,126,72,.46); }
.enemy-commentator[data-tone="praise"] { border-color:rgba(142,187,119,.42); }
.enemy-commentator[data-tone="storm"] { box-shadow:0 0 28px rgba(104,145,210,.12); }

.stockfish-analysis { margin:0 0 12px; padding:11px; border:1px solid rgba(135,164,188,.18); border-radius:12px; background:rgba(5,11,16,.66); font-family:system-ui,sans-serif; }
.analysis-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:7px; }
.analysis-heading div span,.analysis-heading div strong { display:block; }
.analysis-heading div span { color:rgba(240,231,214,.55); font-size:.63rem; text-transform:uppercase; letter-spacing:.14em; }
.analysis-heading div strong { margin-top:2px; color:#e8d7b5; font-size:.82rem; }
.analysis-toggle { border:1px solid rgba(214,168,92,.28); border-radius:999px; padding:6px 10px; color:#baa98c; background:transparent; cursor:pointer; font-size:.67rem; }
.analysis-toggle.active { color:#1c160f; background:#d8ac63; }
.engine-state { display:flex; align-items:center; gap:7px; color:rgba(235,229,216,.56); font-size:.65rem; margin-bottom:9px; }
.engine-state i { width:7px; height:7px; border-radius:50%; background:#806d56; box-shadow:0 0 0 3px rgba(128,109,86,.12); }
.engine-state.ready i { background:#8fbd79; box-shadow:0 0 0 3px rgba(143,189,121,.13),0 0 8px rgba(143,189,121,.25); }
.engine-state.busy i { background:#d7aa61; animation:enginePulse 1s ease-in-out infinite; }
.engine-state.error i { background:#c86d58; }
@keyframes enginePulse { 50%{transform:scale(1.35);opacity:.55} }
.eval-row { display:grid; grid-template-columns:1fr 54px; align-items:center; gap:9px; margin-bottom:9px; }
.eval-row > strong { color:#f1e5cf; text-align:right; font-size:.82rem; font-variant-numeric:tabular-nums; }
.eval-meter { position:relative; height:11px; overflow:hidden; border-radius:999px; background:linear-gradient(90deg,#242a31 0 50%,#e8dfcc 50% 100%); border:1px solid rgba(255,255,255,.07); }
.eval-meter::after { content:""; position:absolute; top:0; bottom:0; left:50%; width:1px; background:rgba(212,175,111,.75); }
.eval-meter i { position:absolute; z-index:2; left:50%; top:0; bottom:0; width:2px; transform:translateX(-50%); background:#dfad5b; box-shadow:0 0 7px rgba(223,173,91,.55); transition:left .35s ease; }
.move-verdict { display:flex; align-items:baseline; gap:8px; margin:6px 0; }
.move-verdict b { color:#efce8e; font-size:.79rem; }
.move-verdict span { color:rgba(238,230,215,.62); font-size:.68rem; line-height:1.35; }
.move-verdict[data-grade="best"] b,.move-verdict[data-grade="great"] b { color:#92c87e; }
.move-verdict[data-grade="inaccuracy"] b { color:#d7ba69; }
.move-verdict[data-grade="mistake"] b { color:#df935f; }
.move-verdict[data-grade="blunder"] b { color:#e06962; }
.best-line { margin:6px 0 0; color:rgba(231,225,213,.55); font-size:.68rem; line-height:1.4; word-break:break-word; }
.move-review { display:inline-flex; align-items:center; margin-left:4px; padding:1px 4px; border-radius:999px; font:700 .54rem/1.4 system-ui,sans-serif; vertical-align:middle; background:rgba(255,255,255,.08); color:#d7c9ae; }
.move-review.best,.move-review.great { color:#9ed18b; background:rgba(111,164,91,.12); }
.move-review.inaccuracy { color:#d9bd70; background:rgba(204,166,72,.11); }
.move-review.mistake { color:#e09b66; background:rgba(205,117,69,.12); }
.move-review.blunder { color:#ec7770; background:rgba(205,80,75,.13); }
.chess-tech-note a { color:#d8b470; }

@media (max-width:700px) {
  .difficulty-heading { align-items:flex-start; flex-direction:column; gap:3px; }
  .difficulty-grid { grid-template-columns:repeat(21,74px); }
  .difficulty-grid button { min-width:74px; min-height:90px; }
  .opponent-thumb { width:36px; height:36px; }
  .enemy-commentator { grid-template-columns:54px 1fr; }
  .enemy-portrait { width:52px; height:52px; }
  .enemy-speech p { font-size:.8rem; }
}
@media (prefers-reduced-motion:reduce) { .engine-state.busy i { animation:none; } .eval-meter i { transition:none; } }


/* ==========================================================================\n   CHESS LAYOUT HOTFIX V2 — 2026-09-11\n   Board stays square inside the real content width; commentary remains in flow.\n   ========================================================================== */
.chess-dialog {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chess-layout {
  align-items: start;
}

.chess-table-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(700px, calc(100dvh - 310px), calc(100vw - 500px));
  min-width: 0;
}

.chess-board-frame {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  margin: 0;
  flex: 0 0 auto;
}

.chess-board {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
}

.chess-player {
  flex: 0 0 auto;
  min-width: 0;
}
.chess-player > div,
.chess-player strong,
.chess-player small {
  min-width: 0;
}
.chess-player strong,
.chess-player small {
  overflow-wrap: anywhere;
}

.chess-panel {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 0;
  max-height: min(760px, calc(100dvh - 250px));
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.enemy-commentator {
  position: relative;
  isolation: isolate;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: start;
  min-width: 0;
  height: auto;
}
.enemy-portrait {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
}
.enemy-speech {
  min-width: 0;
  overflow: hidden;
}
.enemy-speech span,
.enemy-speech p {
  position: static;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
}
.enemy-speech p {
  line-height: 1.4;
}

.stockfish-analysis {
  position: relative;
  z-index: 1;
  clear: both;
  min-width: 0;
  height: auto;
  flex: 0 0 auto;
}
.analysis-heading {
  flex-wrap: wrap;
}
.engine-state,
.best-line {
  min-width: 0;
  overflow-wrap: anywhere;
}
.move-verdict {
  align-items: flex-start;
  flex-wrap: wrap;
}
.move-verdict b {
  flex: 0 0 auto;
}
.move-verdict span {
  flex: 1 1 150px;
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 1050px) {
  .chess-table-area {
    width: min(720px, 100%);
    margin-inline: auto;
  }
  .chess-board-frame {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }
  .chess-panel {
    width: min(720px, 100%);
    max-height: none;
    overflow: visible;
    margin-inline: auto;
  }
}

@media (max-width: 620px) {
  .chess-shell {
    padding-left: 10px;
    padding-right: 10px;
  }
  .chess-table-area,
  .chess-panel {
    width: 100%;
  }
  .chess-board-frame {
    width: 100%;
    padding: 6px;
  }
  .chess-player {
    gap: 8px;
    padding: 7px 8px;
  }
  .player-emblem,
  .turn-rune {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
  }
  .enemy-commentator {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 9px;
    padding: 9px;
  }
  .enemy-portrait {
    width: 46px;
    height: 46px;
  }
  .enemy-speech span {
    font-size: .61rem;
  }
  .enemy-speech p {
    font-size: .78rem;
    line-height: 1.38;
  }
  .stockfish-analysis {
    padding: 9px;
  }
  .move-verdict {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3px;
  }
}


/* CHESS LAYOUT V3 — opponent rail moved into the side panel. */
@media (min-width: 1051px) {
  .chess-table-area {
    width: min(700px, calc(100dvh - 370px), calc(100vw - 500px));
  }
  .chess-panel {
    max-height: calc(100dvh - 235px);
  }
}

.chess-panel .chess-difficulty {
  margin: 10px 0 12px;
  padding: 0;
}
.chess-panel .difficulty-heading {
  margin-bottom: 7px;
  gap: 7px;
}
.chess-panel .difficulty-heading span {
  font-size: .66rem;
  letter-spacing: .09em;
}
.chess-panel .difficulty-heading small {
  display: none;
}
.chess-panel .difficulty-grid {
  grid-template-columns: repeat(21, 68px);
  gap: 6px;
  padding-bottom: 7px;
}
.chess-panel .difficulty-grid button {
  min-width: 68px;
  min-height: 78px;
  padding: 6px 3px;
}
.chess-panel .opponent-thumb {
  width: 31px;
  height: 31px;
  margin-bottom: 3px;
}
.chess-panel .difficulty-grid button > span {
  top: 29px;
  right: 5px;
  min-width: 18px;
  height: 18px;
  font-size: .62rem;
}
.chess-panel .difficulty-grid button b {
  width: 17px;
  height: 17px;
  top: 4px;
  left: 4px;
  font-size: .57rem;
}
.chess-panel .difficulty-grid button strong {
  min-height: 2em;
  font-size: .58rem;
}

@media (max-width: 1050px) {
  .chess-panel .chess-difficulty {
    margin-top: 8px;
  }
  .chess-panel .difficulty-grid {
    grid-template-columns: repeat(21, 72px);
  }
}


/* CHESS LAYOUT V4 — mobile min-content containment + full desktop fit. */
.chess-layout,
.chess-table-area,
.chess-panel,
.chess-difficulty,
.difficulty-grid,
.enemy-commentator,
.stockfish-analysis {
  min-width: 0;
  max-width: 100%;
}
.chess-panel .difficulty-grid {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  contain: inline-size;
}

@media (min-width: 1051px) {
  .chess-table-area {
    width: min(680px, calc(100dvh - 370px), calc(100vw - 500px));
  }
}

@media (max-width: 1050px) {
  .chess-layout {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100%;
  }
  .chess-table-area,
  .chess-panel {
    width: min(720px, 100%);
    max-width: 100%;
  }
  .chess-panel .difficulty-grid {
    grid-template-columns: repeat(21, 72px);
    max-width: 100%;
  }
}


/* ===== CHESS CINEMATIC V1 — slower play, gliding pieces, unmistakable mate ===== */
.chess-piece-token.piece-glide { z-index:12; animation:pieceGlide .48s cubic-bezier(.18,.76,.24,1) both; will-change:transform,filter,opacity; }
@keyframes pieceGlide { 0%{transform:translate3d(var(--glide-x,0),var(--glide-y,0),0) scale(.94);filter:brightness(1.22) drop-shadow(0 12px 16px rgba(0,0,0,.45))} 68%{transform:translate3d(0,0,0) scale(1.045);filter:brightness(1.1) drop-shadow(0 6px 9px rgba(0,0,0,.35))} 100%{transform:translate3d(0,0,0) scale(1);filter:none} }
.chess-square.capture-arrival::before { content:""; position:absolute; inset:8%; z-index:1; border-radius:50%; border:2px solid rgba(244,187,89,.78); animation:captureArrival .5s ease-out both; pointer-events:none; }
@keyframes captureArrival { from{transform:scale(.35);opacity:1;box-shadow:0 0 28px rgba(244,160,70,.58)} to{transform:scale(1.35);opacity:0;box-shadow:0 0 4px transparent} }
.chess-finale[hidden]{display:none!important}.chess-finale{position:absolute;inset:0;z-index:80;display:grid;place-items:center;padding:clamp(14px,3vw,36px);overflow:auto;background:radial-gradient(circle at 50% 38%,rgba(75,104,132,.22),transparent 32rem),linear-gradient(rgba(2,7,11,.78),rgba(2,6,10,.96));backdrop-filter:blur(8px);animation:finaleReveal .55s ease both}.chess-finale[data-result="mate"]{background:radial-gradient(circle at 50% 38%,rgba(100,131,175,.28),transparent 30rem),linear-gradient(rgba(2,7,13,.76),rgba(2,5,9,.97))}@keyframes finaleReveal{from{opacity:0}to{opacity:1}}
.finale-storm{position:absolute;inset:0;overflow:hidden;pointer-events:none}.finale-storm::before{content:"";position:absolute;inset:0;opacity:0;background:rgba(223,239,255,.85);animation:finaleFlash 1.25s ease-out .12s 1}@keyframes finaleFlash{0%,100%{opacity:0}7%{opacity:.55}13%{opacity:.05}20%{opacity:.32}27%{opacity:0}}.finale-storm i{position:absolute;top:-12%;width:2px;height:68%;background:linear-gradient(#e8f4ff,rgba(147,193,241,.72),transparent);box-shadow:0 0 14px rgba(175,213,255,.55);transform:rotate(18deg);opacity:.22}.finale-storm i:nth-child(1){left:24%}.finale-storm i:nth-child(2){left:68%;transform:rotate(-16deg);height:54%}.finale-storm i:nth-child(3){left:48%;height:42%;opacity:.12}
.finale-card{position:relative;width:min(720px,96%);padding:clamp(22px,4vw,42px);border:1px solid rgba(222,181,103,.42);border-radius:18px;text-align:center;background:linear-gradient(155deg,rgba(25,33,42,.94),rgba(5,11,16,.96));box-shadow:0 34px 100px rgba(0,0,0,.58),inset 0 0 70px rgba(111,87,53,.08)}.finale-card::before,.finale-card::after{content:"";position:absolute;inset:10px;border:1px solid rgba(229,190,113,.08);border-radius:13px;pointer-events:none}.finale-card::after{inset:16px;border-style:dashed;opacity:.45}.finale-opponent{display:flex;justify-content:center;align-items:center;gap:12px;margin-bottom:8px}.finale-opponent>div:last-child{text-align:left}.finale-opponent small,.finale-opponent strong{display:block}.finale-opponent small{color:rgba(239,226,203,.54);font:700 .64rem/1.2 system-ui,sans-serif;letter-spacing:.12em;text-transform:uppercase}.finale-opponent strong{margin-top:3px;color:#f0d49b;font-size:1rem}.finale-portrait{position:relative;width:54px;height:54px;border-radius:50%;overflow:hidden;border:1px solid rgba(239,207,141,.5)}.finale-portrait img{width:100%;height:100%;object-fit:cover}.finale-portrait span{position:absolute;right:0;bottom:0;width:20px;height:20px;display:grid;place-items:center;border-radius:50%;background:#091018;color:#efd393;font-size:.68rem}
.chess-finale h2{margin:6px 0 8px;color:#f7e6c1;font-size:clamp(4.8rem,13vw,9rem);line-height:.78;letter-spacing:.03em;text-shadow:0 0 14px rgba(225,197,142,.16),0 10px 46px rgba(0,0,0,.7)}.chess-finale[data-result="mate"] h2{animation:mateWord .7s cubic-bezier(.12,.75,.24,1.2) both}@keyframes mateWord{from{opacity:0;transform:scale(1.45);filter:blur(7px)}to{opacity:1;transform:scale(1);filter:blur(0)}}.finale-subtitle{max-width:52ch;margin:0 auto 20px;color:#eadfcd;font-size:clamp(.95rem,2vw,1.15rem);line-height:1.5}.finale-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin:0 0 12px}.finale-stats div{padding:11px 6px;border:1px solid rgba(214,168,92,.15);border-radius:10px;background:rgba(255,255,255,.025)}.finale-stats strong,.finale-stats span{display:block}.finale-stats strong{color:#f0d29a;font:700 1.12rem/1 system-ui,sans-serif}.finale-stats span{margin-top:5px;color:rgba(238,228,211,.5);font:.62rem/1.15 system-ui,sans-serif;text-transform:uppercase;letter-spacing:.06em}.finale-grades{display:flex;flex-wrap:wrap;justify-content:center;gap:6px;margin:12px 0}.finale-grades span{display:inline-flex;align-items:center;gap:5px;padding:5px 8px;border-radius:999px;color:#bfb3a0;background:rgba(255,255,255,.045);font:600 .63rem/1 system-ui,sans-serif}.finale-grades b{color:#f0dfbe}.finale-grades [data-grade="best"],.finale-grades [data-grade="great"]{color:#9bc989}.finale-grades [data-grade="inaccuracy"]{color:#d7b968}.finale-grades [data-grade="mistake"]{color:#e09964}.finale-grades [data-grade="blunder"]{color:#e6776f}.finale-verdict{margin:14px auto 18px;max-width:58ch;color:rgba(241,230,210,.76);line-height:1.5;font-size:.88rem}.finale-actions{display:flex;justify-content:center;flex-wrap:wrap;gap:9px}.checkmate-scene .chess-board-frame{animation:mateBoardPulse 1.3s ease-out 1}@keyframes mateBoardPulse{0%,100%{filter:none}14%{filter:brightness(1.45);box-shadow:inset 0 0 0 5px rgba(18,8,4,.65),0 0 55px rgba(128,181,236,.45)}38%{filter:brightness(.82)}}.checkmate-scene .check-square .chess-piece-token{animation:mateKingPulse 1s ease-in-out infinite alternate}@keyframes mateKingPulse{from{filter:drop-shadow(0 0 4px rgba(219,77,60,.35));transform:scale(1)}to{filter:drop-shadow(0 0 18px rgba(239,89,68,.88));transform:scale(.92)}}
@media(max-width:700px){.chess-finale{padding:18px 10px 10px;align-items:start}.finale-card{width:100%;padding:20px 14px}.chess-finale h2{font-size:clamp(4rem,24vw,6rem)}.finale-stats{grid-template-columns:repeat(2,1fr)}.finale-verdict{font-size:.8rem}.finale-opponent{margin-bottom:12px}}
@media(prefers-reduced-motion:reduce){.chess-piece-token.piece-glide,.chess-square.capture-arrival::before,.chess-finale,.chess-finale h2,.finale-storm::before,.checkmate-scene .chess-board-frame,.checkmate-scene .check-square .chess-piece-token{animation:none!important}}

/* ========================================================================== */

/* ===== CHESS LADDER CHAPTERS + FINALE INSIGHTS — world v5 ===== */
.brand-home{color:inherit;text-decoration:none;letter-spacing:.04em}.brand-home strong,.brand-home small{display:block}.brand-home strong{font-size:1rem}.brand-home small{margin-top:2px;color:var(--muted);font-size:.72rem}.brand-mark{padding:0;font-family:inherit}
.chess-chapter-bar{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px;margin:0 0 8px}.chess-chapter-bar button{min-width:0;padding:6px 3px;border:1px solid rgba(216,172,99,.15);border-radius:7px;color:rgba(239,228,209,.52);background:rgba(255,255,255,.025);font:700 .56rem/1.15 system-ui,sans-serif;cursor:pointer}.chess-chapter-bar button.active{color:#251a10;background:#d8ac63;border-color:#ebc985}.difficulty-grid button[hidden]{display:none!important}.difficulty-grid button.defeated::after{content:"✓";position:absolute;right:5px;top:5px;width:18px;height:18px;display:grid;place-items:center;border-radius:50%;color:#dff0d4;background:rgba(45,88,42,.9);border:1px solid rgba(174,218,151,.36);font:900 .62rem/1 system-ui,sans-serif}.finale-insights{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;margin:12px 0}.finale-insights>div{padding:9px;border:1px solid rgba(216,172,99,.14);border-radius:9px;background:rgba(255,255,255,.025)}.finale-insights span,.finale-insights strong{display:block}.finale-insights span{color:rgba(239,228,209,.45);font:700 .58rem/1.1 system-ui,sans-serif;text-transform:uppercase;letter-spacing:.08em}.finale-insights strong{margin-top:5px;color:#e8d4ae;font-size:.72rem;line-height:1.35}
@media(max-width:700px){.chess-chapter-bar{grid-template-columns:repeat(3,1fr)}.chess-chapter-bar button{font-size:.53rem}.finale-insights{grid-template-columns:1fr}.finale-insights>div{padding:7px 8px}}

/* NETWORK CHESS V1 — registered players, lobby and live server-authoritative matches */
.chess-mode-switch{grid-template-columns:repeat(3,minmax(0,1fr));width:min(980px,100%)}
.network-chess-panel{margin:10px 0 18px;padding:14px;border:1px solid rgba(216,168,92,.19);border-radius:14px;background:linear-gradient(145deg,rgba(9,18,25,.92),rgba(4,10,15,.96));box-shadow:inset 0 0 32px rgba(216,168,92,.025)}
.network-chess-panel[hidden]{display:none}.network-chess-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.network-chess-head span,.network-chess-head strong{display:block}.network-chess-head span{color:#d8ac63;font:800 .62rem/1 system-ui,sans-serif;text-transform:uppercase;letter-spacing:.12em}.network-chess-head strong{margin-top:4px;color:#efe0c6;font-size:.9rem}.network-chess-head>button{width:32px;height:32px;border:1px solid rgba(216,168,92,.2);border-radius:50%;color:#e8cf9e;background:rgba(216,168,92,.04);cursor:pointer}
.network-stats{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0}.network-stats span{padding:5px 7px;border:1px solid rgba(216,168,92,.11);border-radius:999px;color:rgba(239,228,209,.62);background:rgba(255,255,255,.022);font-size:.62rem}.network-message{margin:8px 0;color:rgba(239,228,209,.58);font-size:.73rem;line-height:1.4}.network-lobby{display:grid;gap:7px;max-height:230px;overflow:auto}.network-player{display:grid;grid-template-columns:34px minmax(0,1fr) auto;gap:8px;align-items:center;padding:8px;border:1px solid rgba(216,168,92,.11);border-radius:10px;background:rgba(255,255,255,.018)}.network-player>i{display:grid;place-items:center;width:32px;height:32px;border-radius:50%;font-style:normal;color:#e8c98e;background:rgba(216,168,92,.07)}.network-player b,.network-player small{display:block}.network-player b{color:#eadcc4;font-size:.72rem}.network-player small{margin-top:2px;color:rgba(239,228,209,.43);font-size:.6rem}.network-player button{min-height:32px;padding:5px 8px;border:1px solid rgba(216,168,92,.22);border-radius:8px;color:#e9d6b5;background:rgba(216,168,92,.07);cursor:pointer;font-size:.62rem}.network-player.busy{opacity:.55}.network-player.busy button{cursor:not-allowed}.network-game-card{padding:10px;border:1px solid rgba(130,178,112,.22);border-radius:11px;background:rgba(86,139,69,.06)}.network-game-card strong,.network-game-card span,.network-game-card small{display:block}.network-game-card strong{color:#e9ddc6}.network-game-card span{margin-top:4px;color:#c9ab79;font-size:.7rem}.network-game-card small{margin-top:3px;color:rgba(239,228,209,.48);font-size:.62rem}.network-game-tools{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:9px}.network-game-tools[hidden]{display:none}.network-game-tools .button{min-height:38px;padding:6px 8px;font-size:.66rem}.network-game-tools #networkClaim{grid-column:1/-1;color:#e3bf81}.chess-shell.network-active .stockfish-analysis{display:none}.chess-shell.network-live .enemy-commentator{display:none}.chess-shell.network-live #chessUndo{display:none}.chess-shell.network-live .chess-tech-note{opacity:.6}
@media(max-width:820px){.chess-mode-switch{grid-template-columns:1fr}.network-lobby{max-height:190px}.network-player{grid-template-columns:32px minmax(0,1fr) auto}}
@media(max-width:520px){.network-player{grid-template-columns:30px minmax(0,1fr)}.network-player button{grid-column:1/-1;width:100%}.network-game-tools{grid-template-columns:1fr}}
.network-analyze{width:100%;margin-top:8px;min-height:38px}.network-analyze[hidden]{display:none}

/* CHESS PIECE THEMES V1 — shared Wolf Veda / classic renderer */
.piece-theme-switch{display:grid;grid-template-columns:auto 1fr 1fr;gap:7px;align-items:center;margin:12px 0 4px;padding:7px;border:1px solid rgba(216,168,92,.14);border-radius:11px;background:rgba(5,12,18,.52)}
.piece-theme-switch>span{padding:0 4px;color:rgba(239,228,209,.48);font:800 .58rem/1 system-ui,sans-serif;letter-spacing:.1em;text-transform:uppercase}
.piece-theme-switch button{min-height:34px;padding:5px 8px;border:1px solid rgba(216,168,92,.12);border-radius:8px;color:rgba(239,228,209,.62);background:rgba(255,255,255,.018);cursor:pointer;font:700 .64rem/1.1 system-ui,sans-serif}
.piece-theme-switch button.active{border-color:rgba(216,168,92,.5);color:#f2ddb3;background:rgba(216,168,92,.12);box-shadow:inset 0 0 18px rgba(216,168,92,.05)}
.chess-piece-token{pointer-events:none;user-select:none}
.classic-piece{position:relative;z-index:2;display:grid;place-items:center;width:86%;height:86%;font-family:"DejaVu Sans","Segoe UI Symbol","Noto Sans Symbols 2","Arial Unicode MS",serif;font-size:clamp(2.1rem,5.2vw,4.6rem);line-height:1;transition:transform .18s ease,filter .18s ease}
.classic-piece.white{color:#f5ead5;text-shadow:-1px -1px 0 #2d1b10,1px -1px 0 #2d1b10,-1px 1px 0 #2d1b10,1px 1px 0 #2d1b10,0 3px 4px rgba(0,0,0,.4)}
.classic-piece.black{color:#17100b;text-shadow:-1px -1px 0 rgba(239,207,145,.78),1px -1px 0 rgba(239,207,145,.78),-1px 1px 0 rgba(239,207,145,.78),1px 1px 0 rgba(239,207,145,.78),0 3px 4px rgba(0,0,0,.42)}
.chess-square:hover .classic-piece{transform:translateY(-2px) scale(1.035);filter:brightness(1.08)}
.myth-legend [data-piece-label]{font:inherit;color:inherit}
.myth-legend i.classic{font-size:1.55rem;line-height:1}
.classic-legend-piece,.classic-promotion-piece{font-family:"DejaVu Sans","Segoe UI Symbol","Noto Sans Symbols 2","Arial Unicode MS",serif;line-height:1}
.classic-promotion-piece{font-size:2.4rem;color:var(--gold-soft);text-shadow:0 2px 3px rgba(0,0,0,.4)}
.promotion-options [data-promotion-label]{font:inherit;color:inherit}
@media(max-width:700px){.piece-theme-switch{grid-template-columns:1fr 1fr}.piece-theme-switch>span{grid-column:1/-1}.classic-piece{font-size:clamp(2rem,11vw,3.7rem)}}

/* CHESS STAGE 3 — materialization, theme-aware highlights, richer depth */
.chess-piece-token.piece-enter{animation:pieceMaterialize .42s cubic-bezier(.16,.78,.25,1) var(--piece-delay,0ms) both}
@keyframes pieceMaterialize{0%{opacity:0;transform:translateY(8px) scale(.76);filter:blur(4px) brightness(1.35)}65%{opacity:1;transform:translateY(-2px) scale(1.045);filter:blur(0) brightness(1.12)}100%{opacity:1;transform:translateY(0) scale(1);filter:none}}
.chess-board[data-piece-theme="myth"] .myth-piece{box-shadow:inset 0 0 0 2px rgba(255,232,181,.08),inset 0 -8px 18px rgba(0,0,0,.18),0 7px 14px rgba(0,0,0,.38),0 0 0 1px rgba(216,168,92,.12);filter:saturate(1.04)}
.chess-board[data-piece-theme="myth"] .myth-piece.white{filter:drop-shadow(0 2px 2px rgba(50,27,12,.28))}
.chess-board[data-piece-theme="myth"] .myth-piece.black{filter:drop-shadow(0 3px 3px rgba(0,0,0,.48))}
.chess-board[data-piece-theme="classic"] .classic-piece{filter:drop-shadow(0 4px 2px rgba(0,0,0,.28));transform-origin:50% 58%}
.chess-board[data-piece-theme="myth"] .chess-square.last-move{box-shadow:inset 0 0 0 4px rgba(231,184,90,.52),inset 0 0 26px rgba(231,184,90,.13)}
.chess-board[data-piece-theme="classic"] .chess-square.last-move{box-shadow:inset 0 0 0 4px rgba(132,187,220,.58),inset 0 0 24px rgba(132,187,220,.12)}
.chess-board[data-piece-theme="myth"] .chess-square.selected{box-shadow:inset 0 0 0 5px rgba(255,213,108,.95),inset 0 0 34px rgba(255,194,77,.18),0 0 15px rgba(226,174,78,.16)}
.chess-board[data-piece-theme="classic"] .chess-square.selected{box-shadow:inset 0 0 0 5px rgba(215,233,246,.88),inset 0 0 30px rgba(129,184,221,.16),0 0 13px rgba(129,184,221,.14)}
.chess-board[data-piece-theme="myth"] .chess-square:hover .myth-piece{filter:brightness(1.08) drop-shadow(0 5px 5px rgba(0,0,0,.38))}
.chess-board[data-piece-theme="classic"] .chess-square:hover .classic-piece{filter:brightness(1.1) drop-shadow(0 5px 3px rgba(0,0,0,.32))}
.network-finished-tools{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;margin-top:8px}.network-finished-tools:has(>button[hidden]+button[hidden]){display:none}
.network-export[hidden],#chessExportPgn[hidden]{display:none!important}
#chessExportPgn,#finaleExportPgn,.network-export{position:relative}
#chessExportPgn::before,#finaleExportPgn::before,.network-export::before{content:"⇩";margin-right:.38em;color:var(--gold-soft)}
@media(max-width:560px){.network-finished-tools{grid-template-columns:1fr}}
@media(prefers-reduced-motion:reduce){.chess-piece-token.piece-enter{animation:none!important}}

/* SERVER GUESTBOOK V1 — shared scroll + moderation */
.guest-entry{position:relative}
.guest-entry-meta{padding-right:84px}
.guest-entry-delete{position:absolute;top:12px;right:0;padding:5px 8px;border:1px solid rgba(216,172,99,.16);border-radius:7px;color:rgba(239,228,209,.5);background:rgba(255,255,255,.02);font:700 .6rem/1 system-ui,sans-serif;cursor:pointer}
.guest-entry-delete:hover{border-color:rgba(216,172,99,.38);color:#ead8b7;background:rgba(216,172,99,.06)}
.guest-entry-delete:disabled{opacity:.45;cursor:wait}
@media(max-width:620px){.guest-entry-meta{padding-right:0}.guest-entry-delete{position:static;margin-top:8px}}
