:root {
  color-scheme: dark;
  --ink: #140b03;
  --ink-soft: #2c1908;
  --gold-deep: #7c4d13;
  --gold: #c99536;
  --gold-bright: #e7bd65;
  --champagne: #f1d9a2;
  --ivory: #fff7dd;
  --white: #fffdf6;
  --line: rgba(255, 238, 188, 0.28);
  --glass: rgba(26, 14, 4, 0.64);
  --serif: "Bodoni 72", Didot, "Songti SC", "STSong", serif;
  --sans: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

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

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #080502;
  color: var(--ivory);
  font-family: var(--sans);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 1px solid var(--champagne);
  outline-offset: 3px;
}

.h5-shell {
  position: relative;
  width: min(100vw, 500px);
  height: 100vh;
  height: 100svh;
  min-height: 620px;
  margin: 0 auto;
  overflow: hidden;
  isolation: isolate;
  background: var(--ink);
  box-shadow: 0 0 90px rgba(211, 157, 54, 0.12);
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px) scale(1.01);
  transition: opacity 0.45s ease, transform 0.55s cubic-bezier(0.2, 0.75, 0.2, 1), visibility 0.45s;
}

.screen.is-active {
  z-index: 2;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

.brand-mark {
  margin: 0;
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.23em;
  text-align: center;
}

.eyebrow {
  margin: 0;
  color: var(--champagne);
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.24em;
  line-height: 1.4;
}

.topbar {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  min-height: 76px;
  padding: max(16px, env(safe-area-inset-top)) 20px 8px;
}

.round-action {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(18, 10, 3, 0.36);
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 13px;
  backdrop-filter: blur(12px);
}

.round-action.ghost {
  border-color: transparent;
  background: transparent;
}

.round-action:active {
  transform: scale(0.94);
}

/* Loading */
.loading-screen {
  display: grid;
  overflow: hidden;
  place-items: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(229, 182, 85, 0.2), transparent 27%),
    linear-gradient(145deg, #070401 0%, #251405 50%, #080401 100%);
}

.loading-screen::before,
.loading-screen::after {
  position: absolute;
  content: "";
  width: 140%;
  height: 28%;
  border: 1px solid rgba(230, 184, 91, 0.16);
  background: linear-gradient(100deg, rgba(126, 76, 16, 0.04), rgba(255, 235, 174, 0.08));
  transform: rotate(-17deg);
}

.loading-screen::before {
  top: 2%;
  left: -20%;
}

.loading-screen::after {
  right: -25%;
  bottom: 0;
  transform: rotate(21deg);
}

.light-rings {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 360px;
  height: 360px;
  border: 1px solid rgba(242, 211, 139, 0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: slow-spin 16s linear infinite;
}

.light-rings::before,
.light-rings::after {
  position: absolute;
  content: "";
  border: 1px solid rgba(242, 211, 139, 0.1);
  border-radius: 50%;
}

.light-rings::before {
  inset: 38px;
}

.light-rings::after {
  inset: 90px;
  border-style: dashed;
}

.loading-lockup {
  position: relative;
  z-index: 2;
  width: min(78vw, 330px);
  text-align: center;
}

.loading-lockup .brand-mark {
  margin-bottom: 62px;
}

.loading-orb {
  position: relative;
  width: 88px;
  height: 88px;
  margin: 0 auto 32px;
  border: 1px solid rgba(255, 241, 195, 0.78);
  border-radius: 50%;
  background: radial-gradient(circle at 31% 25%, #fffbdc 0 5%, #edc870 18%, #a26718 48%, #2b1502 78%);
  box-shadow: 0 0 25px rgba(234, 188, 91, 0.35), 0 0 90px rgba(223, 165, 57, 0.19);
}

.loading-orb::before,
.loading-orb::after,
.loading-orb span {
  position: absolute;
  content: "";
  border: 1px solid rgba(255, 234, 172, 0.28);
  border-radius: 50%;
}

.loading-orb::before { inset: -14px; }
.loading-orb::after { inset: -29px; }
.loading-orb span { inset: -45px; animation: loading-pulse 2s ease-out infinite; }

.loading-kicker {
  margin: 0 0 6px;
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.4em;
}

.loading-lockup h1 {
  margin: 0 0 42px;
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 400;
  letter-spacing: 0.18em;
}

.loading-line {
  display: block;
  width: 170px;
  height: 1px;
  margin: 0 auto 10px;
  overflow: hidden;
  background: rgba(255, 243, 208, 0.16);
}

.loading-line i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--ivory));
  box-shadow: 0 0 12px var(--gold-bright);
  transition: width 0.16s ease-out;
}

.loading-value {
  margin: 0;
  color: rgba(255, 243, 208, 0.55);
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.18em;
}

/* Home */
.home-screen {
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(30, 15, 2, 0.1) 0%, rgba(20, 10, 2, 0.02) 38%, rgba(16, 8, 2, 0.32) 62%, #100802 96%),
    url("./assets/el-hero.jpeg") center 48% / auto 100% no-repeat;
}

.home-screen::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(24, 12, 2, 0.36), transparent 28%, transparent 72%, rgba(24, 12, 2, 0.36)),
    radial-gradient(circle at 50% 55%, transparent 0 38%, rgba(13, 6, 1, 0.18) 75%);
}

.home-topbar {
  position: absolute;
  inset: 0 0 auto;
}

.sound-glyph {
  transition: opacity 0.2s;
}

#sound-toggle[aria-pressed="false"] .sound-glyph {
  opacity: 0.35;
  text-decoration: line-through;
}

.home-copy {
  position: absolute;
  z-index: 3;
  top: clamp(90px, 12.5vh, 128px);
  left: 26px;
  width: calc(100% - 52px);
  text-align: center;
}

.home-copy .eyebrow {
  color: #6f4614;
  font-weight: 600;
}

.home-copy h1 {
  margin: 10px 0 8px;
  color: #2a1605;
  font-family: var(--serif);
  font-size: clamp(38px, 10.5vw, 54px);
  font-weight: 500;
  letter-spacing: 0.09em;
  line-height: 1.02;
  text-shadow: 0 1px 0 rgba(255, 251, 227, 0.65);
}

.home-copy h1 span {
  display: block;
  margin-bottom: 8px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.52em;
  transform: translateX(0.26em);
}

.home-subtitle {
  margin: 0;
  color: rgba(50, 28, 7, 0.72);
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.18em;
}

.facet {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  border: 1px solid rgba(255, 246, 207, 0.28);
  background: linear-gradient(120deg, rgba(255, 247, 216, 0.1), rgba(139, 84, 12, 0.05));
  backdrop-filter: blur(1px);
}

.facet-one {
  top: 23%;
  left: -24%;
  width: 90%;
  height: 17%;
  clip-path: polygon(0 37%, 100% 0, 76% 100%, 18% 84%);
  animation: facet-drift 8s ease-in-out infinite alternate;
}

.facet-two {
  right: -28%;
  bottom: 27%;
  width: 82%;
  height: 22%;
  clip-path: polygon(18% 0, 100% 20%, 88% 100%, 0 74%);
  animation: facet-drift 10s ease-in-out -3s infinite alternate-reverse;
}

.home-orbit {
  position: absolute;
  z-index: 2;
  top: 46%;
  left: 50%;
  width: min(78vw, 390px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.orbit-ring {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 244, 205, 0.31);
  border-radius: 50%;
  transform: rotate(-18deg) scaleY(0.31);
}

.orbit-ring-b {
  inset: 16%;
  border-style: dashed;
  opacity: 0.7;
  transform: rotate(24deg) scaleY(0.4);
}

.orbit-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ivory);
  box-shadow: 0 0 15px 4px rgba(246, 215, 142, 0.72);
}

.dot-a { top: 46%; left: 2%; animation: orbit-glint 2.2s ease-in-out infinite; }
.dot-b { right: 10%; bottom: 41%; animation: orbit-glint 2.2s ease-in-out 1.1s infinite; }

.home-actions {
  position: absolute;
  z-index: 5;
  right: 22px;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 22px;
}

.player-chip {
  display: flex;
  width: fit-content;
  margin: 0 auto 12px;
  align-items: center;
  gap: 7px;
  color: rgba(255, 247, 221, 0.72);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.chip-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 9px var(--gold-bright);
}

.primary-cta {
  position: relative;
  display: grid;
  width: 100%;
  height: 60px;
  padding: 0 9px 0 24px;
  grid-template-columns: 1fr 43px;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 236, 175, 0.62);
  background: linear-gradient(110deg, #15100a, #3a2309 58%, #171006);
  color: var(--ivory);
  box-shadow: 0 18px 42px rgba(20, 10, 2, 0.32), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.2em;
}

.primary-cta::before {
  position: absolute;
  top: 0;
  left: -50%;
  width: 36%;
  height: 100%;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 243, 199, 0.16), transparent);
  transform: skewX(-18deg);
  animation: cta-shine 4.5s 1.4s ease-in-out infinite;
}

.primary-cta span {
  padding-left: 43px;
}

.primary-cta i {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #f6e1a4, #bd8126);
  color: #1a0e03;
  font-family: var(--sans);
  font-size: 17px;
  font-style: normal;
  letter-spacing: 0;
}

.primary-cta:active {
  transform: translateY(1px) scale(0.995);
}

.primary-cta.compact {
  height: 54px;
  font-size: 15px;
}

.quick-nav {
  display: grid;
  margin-top: 15px;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.quick-nav button {
  display: flex;
  height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 240, 195, 0.15);
  background: rgba(18, 9, 2, 0.42);
  color: rgba(255, 247, 221, 0.78);
  font-size: 11px;
  letter-spacing: 0.15em;
  backdrop-filter: blur(16px);
}

.quick-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid rgba(255, 239, 188, 0.38);
  border-radius: 50%;
  color: var(--champagne);
  font-family: var(--serif);
  font-size: 11px;
}

/* Game */
.game-screen {
  overflow: hidden;
  background: #1a0e03;
  touch-action: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.game-hud {
  position: absolute;
  z-index: 4;
  top: 0;
  right: 0;
  left: 0;
  display: grid;
  padding: max(18px, env(safe-area-inset-top)) 18px 0;
  grid-template-columns: 46px 1fr 1fr;
  align-items: start;
  pointer-events: none;
}

.hud-button {
  width: 39px;
  height: 39px;
  border: 1px solid rgba(255, 239, 191, 0.34);
  border-radius: 50%;
  background: rgba(23, 12, 3, 0.45);
  color: var(--champagne);
  font-family: var(--serif);
  font-size: 12px;
  backdrop-filter: blur(12px);
  pointer-events: auto;
}

.hud-readout {
  padding-left: 8px;
}

.hud-readout.align-right {
  text-align: right;
}

.hud-readout small {
  display: block;
  margin-bottom: 3px;
  color: rgba(255, 245, 213, 0.58);
  font-size: 9px;
  letter-spacing: 0.2em;
}

.hud-readout strong {
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-shadow: 0 0 15px rgba(236, 192, 102, 0.36);
}

.power-rail {
  position: absolute;
  z-index: 4;
  top: max(90px, calc(env(safe-area-inset-top) + 72px));
  right: 15px;
  display: grid;
  gap: 9px;
  pointer-events: none;
}

.power-item {
  display: grid;
  width: 46px;
  min-height: 52px;
  place-items: center;
  border: 1px solid rgba(255, 238, 189, 0.15);
  background: rgba(28, 15, 3, 0.34);
  opacity: 0.35;
  backdrop-filter: blur(8px);
  transition: opacity 0.25s, transform 0.25s, border-color 0.25s;
}

.power-item.is-on {
  border-color: rgba(255, 226, 144, 0.72);
  opacity: 1;
  transform: translateX(-4px);
  box-shadow: 0 0 20px rgba(211, 155, 55, 0.18);
}

.power-item i {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid rgba(255, 235, 177, 0.42);
  border-radius: 50%;
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 10px;
  font-style: normal;
}

.power-item span {
  color: rgba(255, 247, 220, 0.7);
  font-size: 8px;
  letter-spacing: 0.1em;
}

.combo-badge {
  position: absolute;
  z-index: 5;
  top: 24%;
  left: 50%;
  padding: 7px 13px;
  border: 1px solid rgba(255, 231, 164, 0.38);
  background: rgba(30, 15, 3, 0.48);
  color: var(--champagne);
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.15em;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.2s, transform 0.35s;
  backdrop-filter: blur(10px);
}

.combo-badge.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.game-prompt {
  position: absolute;
  z-index: 4;
  bottom: calc(max(66px, env(safe-area-inset-bottom) + 50px));
  left: 50%;
  width: max-content;
  max-width: 84%;
  padding: 9px 14px;
  border: 1px solid rgba(255, 237, 182, 0.2);
  background: rgba(21, 10, 2, 0.47);
  color: rgba(255, 247, 219, 0.82);
  font-size: 10px;
  letter-spacing: 0.13em;
  text-align: center;
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
  transition: opacity 0.5s;
}

.game-prompt.is-hidden { opacity: 0; }

.touch-controls {
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 0;
  display: grid;
  padding: 0 24px;
  grid-template-columns: 1fr 1fr;
  color: rgba(255, 242, 202, 0.33);
  font-size: 9px;
  letter-spacing: 0.16em;
  pointer-events: none;
}

.touch-controls span:last-child { text-align: right; }

/* Inner screens */
.inner-screen {
  overflow: hidden auto;
  overscroll-behavior: contain;
  background:
    linear-gradient(155deg, rgba(93, 53, 8, 0.18), transparent 34%),
    linear-gradient(180deg, #150b03, #090501 78%);
  scrollbar-width: none;
}

.inner-screen::-webkit-scrollbar { display: none; }

.inner-screen::before {
  position: absolute;
  z-index: 0;
  top: -16%;
  right: -42%;
  width: 100%;
  aspect-ratio: 1;
  content: "";
  border: 1px solid rgba(237, 192, 99, 0.09);
  border-radius: 50%;
  box-shadow: 0 0 0 54px rgba(218, 164, 61, 0.015), 0 0 0 108px rgba(218, 164, 61, 0.012);
  pointer-events: none;
}

.section-heading {
  position: relative;
  z-index: 1;
  padding: 28px 25px 24px;
}

.section-heading h1,
.archive-copy h1 {
  margin: 8px 0 10px;
  font-family: var(--serif);
  font-size: 35px;
  font-weight: 400;
  letter-spacing: 0.08em;
}

.section-heading > p:last-child,
.archive-copy > p:last-child {
  margin: 0;
  color: rgba(255, 246, 217, 0.56);
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.08em;
  line-height: 1.8;
}

.compact-heading {
  padding-bottom: 18px;
}

.segmented {
  position: relative;
  z-index: 1;
  display: grid;
  margin: 0 24px 18px;
  padding: 3px;
  grid-template-columns: 1fr 1fr;
  border: 1px solid rgba(255, 236, 178, 0.16);
  background: rgba(255, 255, 255, 0.025);
}

.segmented button {
  height: 39px;
  background: transparent;
  color: rgba(255, 245, 214, 0.48);
  font-size: 11px;
  letter-spacing: 0.14em;
}

.segmented button.is-active {
  background: linear-gradient(110deg, #a96e1c, #e0b35b);
  color: #1c0f03;
}

.rank-list {
  position: relative;
  z-index: 1;
  display: grid;
  margin: 0 24px;
  gap: 8px;
}

.rank-row {
  display: grid;
  min-height: 63px;
  padding: 8px 13px;
  grid-template-columns: 34px 38px 1fr auto;
  align-items: center;
  border: 1px solid rgba(255, 238, 184, 0.11);
  background: linear-gradient(105deg, rgba(255, 255, 255, 0.035), rgba(188, 125, 31, 0.03));
}

.rank-row.is-me {
  border-color: rgba(238, 192, 93, 0.55);
  background: linear-gradient(105deg, rgba(169, 106, 20, 0.22), rgba(238, 193, 96, 0.08));
}

.rank-no {
  color: rgba(255, 238, 194, 0.5);
  font-family: var(--serif);
  font-size: 13px;
}

.rank-row:nth-child(-n + 3) .rank-no { color: var(--gold-bright); font-size: 19px; }

.rank-avatar {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid rgba(255, 235, 177, 0.25);
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #f8e5aa, #9d6414 62%, #241203);
  color: #1a0e02;
  font-family: var(--serif);
  font-size: 10px;
}

.rank-name strong,
.rank-name small { display: block; }
.rank-name strong { font-family: var(--serif); font-size: 13px; font-weight: 400; letter-spacing: 0.08em; }
.rank-name small { margin-top: 3px; color: rgba(255, 243, 208, 0.38); font-size: 8px; letter-spacing: 0.1em; }
.rank-score { color: var(--champagne); font-family: var(--serif); font-size: 16px; letter-spacing: 0.06em; }

.board-cta {
  position: relative;
  z-index: 1;
  width: calc(100% - 48px);
  margin: 18px 24px max(26px, env(safe-area-inset-bottom));
}

/* Rules */
.rule-hero {
  position: relative;
  z-index: 1;
  height: 176px;
  margin: 0 24px 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 230, 160, 0.2);
}

.rule-hero::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent 0 30%, rgba(14, 7, 1, 0.28) 55%, rgba(14, 7, 1, 0.95));
}

.rule-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rule-hero div {
  position: absolute;
  z-index: 2;
  top: 22px;
  right: 18px;
  bottom: 18px;
  width: 48%;
}

.rule-hero span {
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 26px;
}

.rule-hero p {
  margin: 14px 0 0;
  color: rgba(255, 248, 225, 0.78);
  font-size: 11px;
  line-height: 1.8;
}

.rule-grid {
  position: relative;
  z-index: 1;
  display: grid;
  margin: 0 24px;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.rule-grid article {
  display: grid;
  min-height: 128px;
  padding: 14px 12px;
  grid-template-columns: 34px 1fr;
  align-content: start;
  align-items: center;
  border: 1px solid rgba(255, 236, 179, 0.13);
  background: rgba(255, 255, 255, 0.025);
}

.rule-grid i {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(255, 230, 161, 0.32);
  border-radius: 50%;
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 11px;
  font-style: normal;
}

.rule-grid span {
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.1em;
}

.rule-grid p {
  grid-column: 2;
  margin: 8px 0 0;
  color: rgba(255, 246, 216, 0.48);
  font-size: 9px;
  line-height: 1.6;
}

.truffle-mini {
  background: radial-gradient(circle, #0a0705 0 43%, #9f671d 46% 53%, transparent 55%);
}

.rule-footnote {
  position: relative;
  z-index: 1;
  display: grid;
  margin: 12px 24px 0;
  padding: 13px 15px;
  grid-template-columns: 40px 1fr;
  border-left: 2px solid var(--gold);
  background: rgba(161, 100, 20, 0.09);
}

.rule-footnote strong { color: var(--gold-bright); font-size: 10px; letter-spacing: 0.16em; }
.rule-footnote p { margin: 0; color: rgba(255, 246, 215, 0.55); font-size: 9px; line-height: 1.6; }

/* Result */
.result-screen {
  background:
    radial-gradient(circle at 50% 42%, rgba(205, 148, 50, 0.24), transparent 30%),
    linear-gradient(180deg, #291703 0%, #100802 58%, #070401 100%);
}

.result-halo {
  position: absolute;
  z-index: 0;
  top: 14%;
  left: 50%;
  width: 340px;
  height: 340px;
  border: 1px solid rgba(255, 228, 155, 0.09);
  border-radius: 50%;
  transform: translateX(-50%);
}

.result-halo::before,
.result-halo::after,
.result-halo span {
  position: absolute;
  content: "";
  border: 1px solid rgba(255, 228, 155, 0.08);
  border-radius: 50%;
}

.result-halo::before { inset: 35px; }
.result-halo::after { inset: 74px; }
.result-halo span { inset: 112px; background: radial-gradient(circle, rgba(249, 220, 148, 0.19), transparent 68%); }

.result-content {
  position: relative;
  z-index: 2;
  padding: 32px 23px max(24px, env(safe-area-inset-bottom));
  text-align: center;
}

.result-content h1 {
  margin: 8px 0 6px;
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 400;
  letter-spacing: 0.17em;
}

.result-note {
  margin: 0;
  color: rgba(255, 245, 213, 0.5);
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.score-medallion {
  position: relative;
  display: grid;
  width: 176px;
  height: 176px;
  margin: 32px auto 26px;
  align-content: center;
  border: 1px solid rgba(255, 226, 151, 0.43);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, rgba(255, 246, 209, 0.2), rgba(170, 105, 19, 0.18) 48%, rgba(15, 7, 1, 0.4));
  box-shadow: 0 0 0 9px rgba(227, 178, 80, 0.03), 0 0 60px rgba(210, 150, 45, 0.16);
}

.score-medallion small,
.score-medallion span { color: rgba(255, 242, 202, 0.52); font-size: 8px; letter-spacing: 0.22em; }
.score-medallion strong { margin: 4px 0; color: var(--ivory); font-family: var(--serif); font-size: 43px; font-weight: 400; line-height: 1; }

.result-stats {
  display: grid;
  margin-bottom: 25px;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid rgba(255, 236, 177, 0.13);
  border-bottom: 1px solid rgba(255, 236, 177, 0.13);
}

.result-stats div {
  padding: 13px 5px 12px;
  border-right: 1px solid rgba(255, 236, 177, 0.1);
}
.result-stats div:last-child { border-right: 0; }
.result-stats small, .result-stats strong { display: block; }
.result-stats small { margin-bottom: 4px; color: rgba(255, 244, 211, 0.42); font-size: 8px; letter-spacing: 0.12em; }
.result-stats strong { color: var(--champagne); font-family: var(--serif); font-size: 18px; font-weight: 400; }

.split-actions {
  display: grid;
  margin-top: 9px;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.outline-button {
  height: 46px;
  border: 1px solid rgba(255, 232, 170, 0.24);
  background: rgba(255, 255, 255, 0.02);
  color: rgba(255, 246, 217, 0.72);
  font-size: 11px;
  letter-spacing: 0.14em;
}

/* Archive */
.archive-copy {
  position: relative;
  z-index: 1;
  padding: 34px 25px 24px;
}

.truffle-card {
  position: relative;
  z-index: 1;
  margin: 0 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 230, 158, 0.17);
  background: #140b03;
}

.truffle-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1.32;
  object-fit: cover;
}

.truffle-card figcaption {
  padding: 18px 18px 20px;
  background: linear-gradient(115deg, rgba(94, 54, 8, 0.36), rgba(13, 7, 2, 0.88));
}

.truffle-card span { color: var(--gold-bright); font-family: var(--serif); font-size: 9px; letter-spacing: 0.22em; }
.truffle-card h2 { margin: 6px 0; font-family: var(--serif); font-size: 25px; font-weight: 400; letter-spacing: 0.12em; }
.truffle-card p { margin: 0; color: rgba(255, 244, 209, 0.48); font-size: 10px; line-height: 1.7; }

.energy-progress {
  position: relative;
  z-index: 1;
  display: grid;
  margin: 18px 24px 0;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 8px;
}

.energy-progress span { color: rgba(255, 243, 207, 0.48); font-size: 9px; letter-spacing: 0.12em; }
.energy-progress strong { color: var(--champagne); font-family: var(--serif); font-size: 22px; font-weight: 400; }
.energy-progress i { display: block; height: 2px; grid-column: 1 / -1; background: rgba(255, 238, 190, 0.11); }
.energy-progress b { display: block; width: 6%; height: 100%; background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright), var(--ivory)); box-shadow: 0 0 8px var(--gold); transition: width 0.6s ease; }

/* Modals */
.modal-layer {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: grid;
  padding: 22px;
  place-items: center;
  background: rgba(6, 3, 1, 0.76);
  backdrop-filter: blur(12px);
}

.modal-layer[hidden] { display: none; }

.modal-card {
  position: relative;
  width: 100%;
  padding: 30px 24px 24px;
  border: 1px solid rgba(255, 230, 162, 0.28);
  background:
    linear-gradient(145deg, rgba(108, 63, 9, 0.26), transparent 48%),
    #170d04;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
}

.modal-card::before {
  position: absolute;
  inset: 5px;
  content: "";
  border: 1px solid rgba(255, 235, 179, 0.06);
  pointer-events: none;
}

.modal-close {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 236, 181, 0.14);
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 246, 217, 0.62);
}

.modal-card h2 {
  margin: 7px 0 8px;
  font-family: var(--serif);
  font-size: 29px;
  font-weight: 400;
  letter-spacing: 0.1em;
}

.modal-card > p:not(.eyebrow) {
  margin: 0 0 22px;
  color: rgba(255, 243, 209, 0.45);
  font-size: 10px;
  line-height: 1.6;
}

.modal-card form { display: grid; gap: 14px; }

.modal-card label {
  display: grid;
  gap: 7px;
  color: rgba(255, 244, 213, 0.68);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.modal-card input {
  height: 47px;
  padding: 0 13px;
  border: 1px solid rgba(255, 234, 175, 0.16);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.035);
  color: var(--ivory);
  appearance: none;
}

.modal-card input::placeholder { color: rgba(255, 244, 210, 0.23); }
.modal-card form .primary-cta { margin-top: 5px; }

.pause-card { text-align: center; }
.pause-card .primary-cta span { padding-left: 30px; }

.text-button {
  margin-top: 13px;
  padding: 8px 18px;
  background: transparent;
  color: rgba(255, 242, 205, 0.45);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.toast {
  position: absolute;
  z-index: 50;
  bottom: max(28px, env(safe-area-inset-bottom));
  left: 50%;
  width: max-content;
  max-width: 82%;
  padding: 11px 16px;
  border: 1px solid rgba(255, 231, 165, 0.28);
  background: rgba(19, 10, 3, 0.88);
  color: var(--champagne);
  font-size: 10px;
  letter-spacing: 0.08em;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.25s, transform 0.3s;
  backdrop-filter: blur(10px);
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@keyframes slow-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes loading-pulse { 0% { opacity: 0.7; transform: scale(0.76); } 80%, 100% { opacity: 0; transform: scale(1.18); } }
@keyframes facet-drift { to { transform: translate3d(7%, -3%, 0) rotate(1deg); } }
@keyframes orbit-glint { 50% { opacity: 0.2; transform: scale(0.55); } }
@keyframes cta-shine { 0%, 56% { left: -50%; } 82%, 100% { left: 125%; } }

@media (max-height: 720px) {
  .home-copy { top: 82px; }
  .home-copy h1 { font-size: 37px; }
  .home-subtitle { display: none; }
  .home-actions { bottom: max(12px, env(safe-area-inset-bottom)); }
  .quick-nav { margin-top: 9px; }
  .result-content { padding-top: 10px; }
  .score-medallion { width: 145px; height: 145px; margin: 18px auto; }
  .score-medallion strong { font-size: 36px; }
  .result-content h1 { font-size: 34px; }
  .result-stats { margin-bottom: 16px; }
}

@media (min-width: 700px) {
  body { background: radial-gradient(circle at 50% 40%, #2b1805, #050301 62%); }
  .h5-shell { border-right: 1px solid rgba(255, 231, 164, 0.1); border-left: 1px solid rgba(255, 231, 164, 0.1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
