:root {
  color-scheme: dark;
  --ink: #05060b;
  --night: #0a0d18;
  --night-2: #11172a;
  --violet: #211332;
  --wine: #4b1425;
  --gold: #d8ad5f;
  --gold-bright: #ffe6a3;
  --silver: #edf3ff;
  --mist: rgba(237, 243, 255, 0.72);
  --muted: rgba(237, 243, 255, 0.58);
  --panel: rgba(9, 12, 22, 0.72);
  --panel-strong: rgba(6, 8, 15, 0.9);
  --line: rgba(231, 196, 122, 0.34);
  --line-bright: rgba(255, 230, 163, 0.62);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.56);
  --max: 1240px;
  font-family: "Noto Serif SC", "Microsoft YaHei", "PingFang SC", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--silver);
  background:
    radial-gradient(circle at 50% 4%, rgba(216, 173, 95, 0.18), transparent 34rem),
    radial-gradient(circle at 12% 20%, rgba(102, 40, 101, 0.22), transparent 30rem),
    radial-gradient(circle at 88% 12%, rgba(90, 123, 183, 0.14), transparent 28rem),
    linear-gradient(180deg, #04050a 0%, #0d1020 52%, #08070d 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(4, 5, 10, 0.88), rgba(8, 9, 18, 0.24) 48%, rgba(4, 5, 10, 0.7)),
    linear-gradient(180deg, rgba(5, 7, 14, 0.16), rgba(5, 7, 14, 0.88)),
    url("./assets/hero-celestial-castle.webp") center / cover no-repeat;
  filter: saturate(1.05);
  transform: scale(1.03);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 49.9%, rgba(216, 173, 95, 0.07) 50%, transparent 50.1%),
    linear-gradient(0deg, transparent 49.9%, rgba(216, 173, 95, 0.05) 50%, transparent 50.1%);
  background-size: 92px 92px;
  mask-image: radial-gradient(circle at 50% 18%, black, transparent 72%);
  opacity: 0.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

img {
  max-width: 100%;
}

#starfield {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#starfield {
  z-index: -1;
  opacity: 0.78;
}

.page-shell {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  align-content: start;
  justify-items: center;
  gap: 32px;
  padding: 32px 24px 80px;
}

.home-shell {
  align-content: center;
  gap: clamp(24px, 4vw, 42px);
}

.home-hero,
.records-header,
.rules-header,
.dice-panel,
.campaign-panel,
.chat-layout,
.tarot-oracle-panel,
.content-panel {
  width: min(100%, var(--max));
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(11, 14, 26, 0.82), rgba(28, 18, 42, 0.62)),
    var(--panel);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(18px);
}

.home-hero,
.records-header,
.rules-header {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 16px;
  min-height: 320px;
  align-content: end;
  padding: clamp(28px, 6vw, 72px);
  isolation: isolate;
}

.home-hero {
  min-height: clamp(340px, 42vh, 500px);
  align-content: center;
  padding-block: clamp(34px, 5vw, 58px);
}

.home-hero .site-name {
  font-size: clamp(0.9rem, 1.5vw, 1.08rem);
}

.home-hero h1 {
  font-size: clamp(3rem, 7vw, 6.5rem);
}

.home-hero::before,
.records-header::before,
.rules-header::before,
.dice-panel::before,
.campaign-panel::before,
.chat-layout::before,
.tarot-oracle-panel::before {
  content: "";
  position: absolute;
  inset: 0.85rem;
  border: 1px solid rgba(255, 230, 163, 0.28);
  border-radius: 13px;
  pointer-events: none;
}

.home-hero::after,
.records-header::after,
.rules-header::after,
.campaign-panel::after,
.dice-panel::after,
.chat-layout::after,
.tarot-oracle-panel::after {
  content: "";
  position: absolute;
  right: 8%;
  bottom: 0;
  left: 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--gold-bright), var(--gold), transparent);
  box-shadow: 0 0 22px rgba(216, 173, 95, 0.55);
}

.site-name,
.module-kicker,
.character-player {
  margin: 0;
  color: var(--gold-bright);
  font: 800 0.78rem/1.2 "Segoe UI", sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
.module-title,
.campaign-heading h2,
.section-heading h2,
.session-content h3,
.oneshot-card h3 {
  margin-bottom: 0;
  color: #fff6dc;
  line-height: 1.05;
  letter-spacing: 0;
  text-shadow: 0 0 34px rgba(216, 173, 95, 0.34), 0 16px 60px rgba(0, 0, 0, 0.8);
  text-wrap: nowrap;
  white-space: nowrap;
}

h1 {
  max-width: 100%;
  font-size: clamp(3.3rem, 8vw, 7.6rem);
}

.records-header h1,
.rules-header h1,
.dice-panel h1 {
  max-width: 100%;
  font-size: clamp(2.6rem, 5.8vw, 5.6rem);
}

.hero-copy,
.lead {
  width: min(100%, 760px);
  margin: 0;
  color: rgba(241, 246, 255, 0.86);
  font-size: clamp(1rem, 2vw, 1.3rem);
  line-height: 1.8;
}

.hero-actions,
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 1.2rem;
}

.primary-action,
.ghost-action,
.primary-button,
.secondary-button,
.back-link {
  min-height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.78rem 1.15rem;
  color: #fff8e4;
  background: rgba(8, 9, 18, 0.56);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.primary-action,
.primary-button {
  border-color: rgba(255, 230, 163, 0.7);
  background: linear-gradient(135deg, #775120, #d2a85b 48%, #fff0b9);
  color: #170e08;
  font-weight: 900;
}

.back-link::before {
  content: "<";
  margin-right: 0.55rem;
  color: var(--gold-bright);
}

.primary-action:hover,
.ghost-action:hover,
.primary-button:hover,
.secondary-button:hover,
.back-link:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 230, 163, 0.86);
}

.module-grid,
.record-entry-grid,
.oneshot-grid {
  display: grid;
  width: min(100%, var(--max));
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1rem, 2.5vw, 1.6rem);
  align-items: start;
  justify-items: center;
  perspective: 1600px;
}

.record-entry-grid,
.oneshot-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.module-card,
.oneshot-card {
  position: relative;
  min-width: 0;
  min-height: 300px;
  display: grid;
  align-content: end;
  gap: 13px;
  overflow: hidden;
  border: 1px solid rgba(255, 230, 163, 0.46);
  border-radius: 18px;
  padding: 24px;
  color: var(--silver);
  background:
    linear-gradient(180deg, rgba(5, 7, 14, 0.1), rgba(5, 7, 14, 0.88)),
    radial-gradient(circle at 50% 14%, rgba(216, 173, 95, 0.22), transparent 10rem),
    linear-gradient(145deg, rgba(33, 19, 50, 0.95), rgba(5, 7, 14, 0.98));
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.52);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform 220ms ease, border-color 220ms ease, filter 220ms ease, box-shadow 220ms ease;
}

.module-card.tarot-entry,
.oneshot-card.tarot-entry {
  width: min(100%, 320px);
  min-height: 0;
  aspect-ratio: 2 / 3;
  align-content: end;
  gap: 10px;
  border-width: 2px;
  border-radius: 22px;
  padding: 18px;
  isolation: isolate;
  background:
    linear-gradient(180deg, rgba(4, 5, 10, 0.02), rgba(4, 5, 10, 0.1)),
    radial-gradient(circle at 50% 5%, rgba(255, 230, 163, 0.28), transparent 36%),
    linear-gradient(160deg, #2a172f, #070811 72%);
  box-shadow:
    0 22px 54px rgba(0, 0, 0, 0.52),
    0 0 0 1px rgba(255, 230, 163, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.module-card.zodiac-card,
.oneshot-card.zodiac-card {
  width: min(100%, 300px);
  min-height: 0;
  aspect-ratio: 2 / 3;
  align-content: end;
  gap: 10px;
  border-width: 2px;
  border-radius: 22px;
  padding: 18px;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 230, 163, 0.22), transparent 34%),
    linear-gradient(160deg, #20152c, #060811 74%);
  box-shadow:
    0 22px 54px rgba(0, 0, 0, 0.52),
    0 0 0 1px rgba(255, 230, 163, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.module-card:nth-child(1)::before,
.module-card:nth-child(2)::before,
.module-card:nth-child(3)::before,
.oneshot-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  opacity: 0.62;
  transform: scale(1.02);
  transition: transform 700ms ease, opacity 220ms ease;
}

.module-card:nth-child(1)::before {
  background-image: url("./assets/card-astral-observatory.png");
}

.module-card:nth-child(2)::before {
  background-image: url("./assets/card-archive-grimoire.png");
}

.module-card:nth-child(3)::before,
.oneshot-card::before {
  background-image: url("./assets/card-guild-hall.png");
}

.module-card.zodiac-card::before,
.oneshot-card.zodiac-card::before,
.module-card.tarot-entry::before,
.oneshot-card.tarot-entry::before {
  content: "";
  position: absolute;
  background-image: var(--card-art);
  opacity: 0.72;
}

.module-card.zodiac-card::before,
.oneshot-card.zodiac-card::before {
  inset: 10px;
  border-radius: 16px;
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.96;
  transform: none;
  filter: saturate(1.05) contrast(1.02);
}

.module-card.tarot-entry::before,
.oneshot-card.tarot-entry::before {
  inset: 10px;
  border-radius: 16px;
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.96;
  transform: none;
  filter: saturate(1.03) contrast(1.02);
}

.module-card::after,
.oneshot-card::after {
  content: "";
  position: absolute;
  inset: 0.75rem;
  border: 1px solid rgba(255, 230, 163, 0.38);
  border-radius: 12px;
  box-shadow: inset 0 0 34px rgba(216, 173, 95, 0.16);
  pointer-events: none;
}

.module-card.tarot-entry::after,
.oneshot-card.tarot-entry::after {
  inset: 10px;
  border: 2px solid rgba(255, 230, 163, 0.78);
  border-radius: 16px;
  box-shadow:
    inset 0 0 0 1px rgba(63, 34, 13, 0.86),
    inset 0 0 0 7px rgba(7, 8, 14, 0.34),
    inset 0 0 28px rgba(255, 230, 163, 0.22),
    0 0 24px rgba(216, 173, 95, 0.24);
}

.module-card.zodiac-card::after,
.oneshot-card.zodiac-card::after {
  inset: 10px;
  border: 2px solid rgba(255, 230, 163, 0.74);
  border-radius: 16px;
  box-shadow:
    inset 0 0 0 1px rgba(63, 34, 13, 0.86),
    inset 0 0 0 7px rgba(7, 8, 14, 0.3),
    inset 0 0 28px rgba(255, 230, 163, 0.2),
    0 0 24px rgba(216, 173, 95, 0.22);
}

.module-card > *,
.oneshot-card > * {
  position: relative;
  z-index: 1;
}

.module-card.tarot-entry > *,
.oneshot-card.tarot-entry > * {
  justify-self: stretch;
  border: 1px solid rgba(255, 230, 163, 0.34);
  padding: 7px 9px;
  background: rgba(5, 7, 14, 0.68);
  backdrop-filter: blur(7px);
}

.module-card.zodiac-card > *,
.oneshot-card.zodiac-card > * {
  justify-self: stretch;
  border: 1px solid rgba(255, 230, 163, 0.34);
  padding: 7px 9px;
  background: rgba(5, 7, 14, 0.68);
  backdrop-filter: blur(7px);
}

.module-card.tarot-entry .module-kicker,
.oneshot-card.tarot-entry .module-kicker {
  border-radius: 999px 999px 6px 6px;
  font-size: 0.68rem;
  text-align: center;
}

.module-card.zodiac-card .module-kicker,
.oneshot-card.zodiac-card .module-kicker {
  border-radius: 999px 999px 6px 6px;
  font-size: 0.68rem;
  text-align: center;
}

.module-card.tarot-entry .module-title,
.oneshot-card.tarot-entry .module-title {
  border-radius: 7px;
  text-align: center;
}

.module-card.zodiac-card .module-title,
.oneshot-card.zodiac-card h3,
.oneshot-card.zodiac-card .module-title {
  border-radius: 7px;
  text-align: center;
}

.module-card.tarot-entry .module-copy,
.oneshot-card.tarot-entry .module-copy {
  border-radius: 7px 7px 14px 14px;
  font-size: 0.82rem;
  line-height: 1.55;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(6px);
  transition:
    max-height 220ms ease,
    padding 220ms ease,
    opacity 180ms ease,
    transform 220ms ease;
}

.module-card.zodiac-card .module-copy,
.oneshot-card.zodiac-card p:not(.module-kicker) {
  border-radius: 7px 7px 14px 14px;
  font-size: 0.82rem;
  line-height: 1.55;
}

.module-card:hover,
.oneshot-card:hover,
.character-card:hover {
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-0.55rem);
  border-color: rgba(255, 230, 163, 0.84);
  filter: brightness(1.06);
}

.module-card.tarot-entry:hover,
.oneshot-card.tarot-entry:hover {
  z-index: 5;
  transform:
    rotateX(var(--rx, 0deg))
    rotateY(var(--ry, 0deg))
    translateY(-1rem)
    scale(1.045);
  border-color: rgba(255, 238, 188, 0.96);
  box-shadow:
    0 34px 76px rgba(0, 0, 0, 0.64),
    0 0 0 1px rgba(255, 230, 163, 0.52),
    0 0 42px rgba(216, 173, 95, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.module-card.zodiac-card:hover,
.oneshot-card.zodiac-card:hover {
  z-index: 5;
  transform:
    rotateX(var(--rx, 0deg))
    rotateY(var(--ry, 0deg))
    translateY(-1rem)
    scale(1.045);
  border-color: rgba(255, 238, 188, 0.96);
  box-shadow:
    0 34px 76px rgba(0, 0, 0, 0.64),
    0 0 0 1px rgba(255, 230, 163, 0.52),
    0 0 42px rgba(216, 173, 95, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.module-card.tarot-entry:hover .module-copy,
.oneshot-card.tarot-entry:hover .module-copy,
.module-card.tarot-entry:focus-visible .module-copy,
.oneshot-card.tarot-entry:focus-visible .module-copy {
  max-height: 7.5rem;
  padding-top: 7px;
  padding-bottom: 7px;
  opacity: 1;
  transform: translateY(0);
}

.module-card:hover::before,
.oneshot-card:hover::before {
  opacity: 0.76;
  transform: scale(1.08);
}

.module-card.tarot-entry:hover::before,
.oneshot-card.tarot-entry:hover::before {
  opacity: 1;
  transform: translateY(-2px);
}

.module-card.zodiac-card:hover::before,
.oneshot-card.zodiac-card:hover::before {
  opacity: 1;
  transform: translateY(-2px);
}

.record-carousel-panel {
  gap: clamp(20px, 4vw, 36px);
}

.card-carousel {
  position: relative;
  width: 100%;
  min-height: clamp(460px, 54vw, 620px);
  display: grid;
  align-items: center;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: clamp(12px, 2vw, 22px);
  padding: clamp(10px, 2vw, 18px);
}

.card-carousel::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 46%;
  border: 1px solid rgba(255, 230, 163, 0.2);
  border-top: 0;
  border-radius: 0 0 999px 999px;
  transform: translateY(-10%);
  pointer-events: none;
  box-shadow: inset 0 -24px 60px rgba(216, 173, 95, 0.08);
}

.carousel-stage {
  position: relative;
  min-height: clamp(430px, 50vw, 580px);
  overflow: visible;
  perspective: 1600px;
}

.carousel-card {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: 0;
  pointer-events: none;
  opacity: 0;
  --carousel-x: 0px;
  --carousel-y: 0px;
  --carousel-scale: 0.78;
  --carousel-rotate: 0deg;
  --carousel-z: 0;
  transform:
    translate(-50%, -50%)
    translate(var(--carousel-x), var(--carousel-y))
    rotate(var(--carousel-rotate))
    scale(var(--carousel-scale));
  transition:
    transform 320ms ease,
    opacity 220ms ease,
    filter 220ms ease;
}

.carousel-card.is-active,
.carousel-card.is-left,
.carousel-card.is-right,
.carousel-card.is-far-left,
.carousel-card.is-far-right {
  opacity: 1;
  pointer-events: auto;
}

.carousel-card.is-active {
  --carousel-scale: 1;
  --carousel-y: -8px;
  z-index: 5;
  filter: brightness(1.08);
}

.carousel-card.is-left {
  --carousel-x: clamp(-220px, -21vw, -150px);
  --carousel-y: 38px;
  --carousel-scale: 0.78;
  --carousel-rotate: -10deg;
  z-index: 3;
  filter: brightness(0.82) saturate(0.92);
}

.carousel-card.is-right {
  --carousel-x: clamp(150px, 21vw, 220px);
  --carousel-y: 38px;
  --carousel-scale: 0.78;
  --carousel-rotate: 10deg;
  z-index: 3;
  filter: brightness(0.82) saturate(0.92);
}

.carousel-card.is-far-left {
  --carousel-x: clamp(-320px, -31vw, -210px);
  --carousel-y: 88px;
  --carousel-scale: 0.62;
  --carousel-rotate: -18deg;
  z-index: 1;
  filter: brightness(0.66) saturate(0.78);
}

.carousel-card.is-far-right {
  --carousel-x: clamp(210px, 31vw, 320px);
  --carousel-y: 88px;
  --carousel-scale: 0.62;
  --carousel-rotate: 18deg;
  z-index: 1;
  filter: brightness(0.66) saturate(0.78);
}

.carousel-card.zodiac-card:hover,
.carousel-card.zodiac-card:focus-visible {
  transform:
    translate(-50%, -50%)
    translate(var(--carousel-x), calc(var(--carousel-y) - 14px))
    rotate(var(--carousel-rotate))
    scale(calc(var(--carousel-scale) * 1.045));
}

.carousel-card.tarot-entry:hover,
.carousel-card.tarot-entry:focus-visible {
  transform:
    translate(-50%, -50%)
    translate(var(--carousel-x), calc(var(--carousel-y) - 14px))
    rotate(var(--carousel-rotate))
    scale(calc(var(--carousel-scale) * 1.045));
}

.carousel-card[aria-disabled="true"] {
  cursor: default;
}

.carousel-button {
  position: relative;
  z-index: 8;
  display: grid;
  width: clamp(42px, 5vw, 58px);
  height: clamp(42px, 5vw, 58px);
  place-items: center;
  border: 1px solid rgba(255, 230, 163, 0.62);
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 230, 163, 0.18), transparent 54%),
    rgba(5, 7, 14, 0.86);
  color: var(--gold-bright);
  font-size: 1.4rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.carousel-button:hover {
  transform: translateY(-2px) scale(1.04);
  border-color: rgba(255, 238, 188, 0.92);
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 230, 163, 0.3), transparent 54%),
    rgba(13, 16, 31, 0.92);
}

@media (max-width: 760px) {
  .card-carousel {
    min-height: 520px;
    grid-template-columns: 1fr 1fr;
    align-items: end;
  }

  .carousel-stage {
    grid-column: 1 / -1;
    grid-row: 1;
    min-height: 440px;
  }

  .carousel-button {
    grid-row: 2;
    justify-self: center;
  }

  .carousel-card.is-left {
    --carousel-x: -96px;
    --carousel-y: 48px;
    --carousel-scale: 0.62;
  }

  .carousel-card.is-right {
    --carousel-x: 96px;
    --carousel-y: 48px;
    --carousel-scale: 0.62;
  }

  .carousel-card.is-far-left {
    --carousel-x: -142px;
    --carousel-y: 92px;
    --carousel-scale: 0.48;
  }

  .carousel-card.is-far-right {
    --carousel-x: 142px;
    --carousel-y: 92px;
    --carousel-scale: 0.48;
  }
}

.module-title {
  font-size: clamp(1.45rem, 2.4vw, 2.15rem);
  font-weight: 900;
  overflow-wrap: normal;
}

.module-copy,
.oneshot-card p {
  margin: 0;
  color: var(--mist);
  line-height: 1.75;
}

.content-panel,
.dice-panel,
.campaign-panel,
.tarot-oracle-panel,
.comment-panel {
  position: relative;
  display: grid;
  gap: 24px;
  padding: clamp(18px, 3vw, 32px);
}

.campaign-panel {
  overflow: hidden;
}

.section-heading,
.campaign-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem 2rem;
  align-items: end;
}

.section-heading h2,
.campaign-heading h2 {
  font-size: clamp(1.8rem, 4vw, 4rem);
}

.section-heading p {
  margin: 0;
  color: var(--mist);
  line-height: 1.8;
}

.character-section,
.session-section {
  display: grid;
  gap: 18px;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  perspective: 1600px;
}

.character-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  border: 1px solid rgba(255, 230, 163, 0.3);
  border-radius: 16px;
  padding: 14px;
  background:
    radial-gradient(circle at 50% 0%, rgba(216, 173, 95, 0.14), transparent 9rem),
    linear-gradient(180deg, rgba(23, 27, 45, 0.9), rgba(7, 9, 17, 0.96));
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 180ms ease, border-color 180ms ease;
}

.character-portrait {
  position: relative;
  display: grid;
  aspect-ratio: 1 / 1;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 230, 163, 0.36);
  border-radius: 12px;
  background: #05060b;
}

.character-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.superhero-page .character-portrait img {
  object-fit: contain;
}

.character-main {
  display: grid;
  gap: 12px;
}

.character-main h3 {
  margin: 0;
  color: #fff6dc;
  font-size: clamp(1.08rem, 2vw, 1.35rem);
}

.character-actor,
.job,
.character-bio,
.session-content p,
.session-hooks li {
  color: var(--mist);
  line-height: 1.78;
}

.character-actor,
.job {
  margin: 0;
  font-size: 0.94rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.stat-grid div,
.character-bio,
.session-summary-grid section,
.session-hooks section {
  border: 1px solid rgba(255, 230, 163, 0.22);
  border-radius: 12px;
  background: rgba(255, 244, 201, 0.055);
}

.stat-grid div {
  display: grid;
  min-height: 56px;
  align-content: center;
  gap: 3px;
  padding: 8px;
}

.stat-grid dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.stat-grid dd {
  margin: 0;
  color: var(--gold-bright);
  font-size: 1.15rem;
  font-weight: 900;
}

.character-bio {
  margin: 0;
  padding: 12px;
}

.session-picker,
.record-tabs {
  display: flex;
  gap: 8px;
  padding: 5px;
  border: 1px solid rgba(255, 230, 163, 0.28);
  border-radius: 999px;
  background: rgba(7, 8, 14, 0.68);
}

.session-button,
.record-tab {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 16px;
  background: transparent;
  color: var(--mist);
  cursor: pointer;
  font-weight: 900;
}

.session-button-active,
.record-tab-active {
  border-color: rgba(255, 230, 163, 0.78);
  background: linear-gradient(135deg, #775120, #d2a85b 48%, #fff0b9);
  color: #170e08;
}

.session-content {
  display: none;
  border: 1px solid rgba(255, 230, 163, 0.24);
  border-radius: 16px;
  padding: clamp(16px, 2.5vw, 24px);
  background:
    radial-gradient(circle at 20% 0%, rgba(154, 56, 80, 0.18), transparent 20rem),
    linear-gradient(145deg, rgba(13, 16, 31, 0.92), rgba(7, 8, 14, 0.96));
}

.session-content-active {
  display: grid;
  gap: 16px;
}

.session-content h3 {
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.session-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.session-summary-grid section,
.session-hooks section {
  padding: 14px;
}

.session-summary-grid h4,
.session-scene-body h4,
.session-hooks h4 {
  margin: 0;
  color: var(--gold-bright);
  line-height: 1.35;
}

.session-quote-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.session-quote-cloud span {
  border: 1px solid rgba(255, 230, 163, 0.38);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--gold-bright);
  background: rgba(75, 20, 37, 0.58);
  font-size: 0.88rem;
  font-weight: 900;
}

.session-scene-list {
  display: grid;
  gap: 12px;
}

.session-scene-card {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(255, 230, 163, 0.24);
  border-radius: 16px;
  background: rgba(5, 7, 14, 0.62);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.32);
  content-visibility: auto;
  contain-intrinsic-size: 240px;
}

.session-scene-index {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 7px;
  padding: 14px 8px;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 226, 148, 0.24), transparent 42%),
    linear-gradient(180deg, #5d274d, #160b1e 72%);
  color: var(--gold-bright);
  text-align: center;
}

.session-scene-index strong {
  font-size: 2rem;
  line-height: 1;
}

.session-scene-index span {
  color: rgba(255, 230, 163, 0.75);
  font-size: 0.76rem;
  font-weight: 900;
}

.session-scene-body {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.session-scene-body p,
.session-content p {
  margin: 0;
}

.session-hooks ul {
  display: grid;
  gap: 7px;
  margin: 8px 0 0;
  padding-left: 20px;
}

.dice-panel {
  justify-items: center;
  text-align: center;
}

.dice-stage {
  position: relative;
  width: min(100%, 760px);
  aspect-ratio: 16 / 10;
  min-height: 240px;
  overflow: hidden;
  border: 1px solid rgba(255, 230, 163, 0.28);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 0%, rgba(119, 213, 255, 0.16), transparent 55%),
    #080b12;
}

.dice-stage canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.dice-stage-result {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  gap: 4px;
  margin: 0;
  border: 1px solid rgba(255, 230, 163, 0.18);
  border-radius: 12px;
  padding: 9px 12px;
  background: rgba(8, 10, 18, 0.78);
  text-align: left;
  pointer-events: none;
}

.dice-stage-total,
.current-roll,
.result {
  margin: 0;
  color: var(--mist);
  line-height: 1.55;
}

.dice-stage-line2 {
  border: 0;
  background: none;
  color: var(--gold-bright);
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
  pointer-events: auto;
}

.dice-grid {
  display: grid;
  width: min(100%, 760px);
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.die-option {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 112px;
  align-content: center;
  justify-items: center;
  gap: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 230, 163, 0.5);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 230, 163, 0.2), transparent 3rem),
    linear-gradient(160deg, rgba(35, 20, 48, 0.98), rgba(7, 9, 18, 0.98));
  color: var(--gold-bright);
  cursor: pointer;
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  transition: transform 150ms ease, filter 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.die-option::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(255, 230, 163, 0.28);
  border-radius: 13px;
  background:
    linear-gradient(90deg, transparent 49%, rgba(255, 230, 163, 0.16) 50%, transparent 51%),
    linear-gradient(0deg, transparent 49%, rgba(255, 230, 163, 0.12) 50%, transparent 51%);
  background-size: 24px 24px;
  pointer-events: none;
}

.die-option::after {
  content: "";
  position: absolute;
  width: 4.2rem;
  height: 4.2rem;
  border: 1px solid rgba(255, 230, 163, 0.28);
  border-radius: 999px;
  box-shadow: inset 0 0 24px rgba(216, 173, 95, 0.12);
  pointer-events: none;
}

.die-option:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: rgba(255, 238, 188, 0.92);
  filter: brightness(1.08);
  box-shadow:
    0 22px 44px rgba(0, 0, 0, 0.5),
    0 0 26px rgba(216, 173, 95, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.die-label {
  position: relative;
  z-index: 1;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 18px rgba(216, 173, 95, 0.4);
}

.die-count {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 230, 163, 0.45);
  background: rgba(75, 20, 37, 0.72);
  color: var(--gold-bright);
  font-weight: 900;
}

.comment-panel {
  width: min(100%, var(--max));
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(11, 14, 26, 0.82), rgba(28, 18, 42, 0.62)),
    var(--panel);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(18px);
}

.comment-form {
  display: grid;
  gap: 12px;
}

.comment-form label {
  display: grid;
  gap: 7px;
  color: var(--gold-bright);
  font-weight: 900;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  border: 1px solid rgba(255, 230, 163, 0.32);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(6, 8, 14, 0.86);
  color: var(--silver);
  line-height: 1.6;
}

.comment-form textarea {
  min-height: 120px;
  resize: vertical;
}

.comment-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.comment-count {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
}

.comment-list {
  display: grid;
  gap: 10px;
}

.comment-empty,
.comment-item {
  border: 1px solid rgba(255, 230, 163, 0.22);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 244, 201, 0.055);
}

.comment-empty {
  color: var(--muted);
}

.comment-item {
  display: grid;
  gap: 8px;
}

.comment-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  color: var(--gold-bright);
  font-weight: 900;
}

.comment-time {
  color: var(--muted);
  font-size: 0.86rem;
}

.comment-text {
  margin: 0;
  color: var(--mist);
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.actions,
.chat-actions {
  display: grid;
  width: min(100%, 460px);
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.chat-layout {
  position: relative;
  min-height: min(72vh, 760px);
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
}

.chat-messages {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 360px;
  max-height: 62vh;
  padding: 18px;
  overflow-y: auto;
}

.message {
  display: grid;
  width: fit-content;
  max-width: 78%;
  gap: 8px;
  border: 1px solid rgba(255, 230, 163, 0.26);
  border-radius: 16px;
  padding: 14px;
  line-height: 1.7;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
}

.assistant-message {
  justify-self: start;
  background: rgba(255, 244, 201, 0.07);
}

.user-message {
  justify-self: end;
  background: rgba(75, 20, 37, 0.56);
}

.message-role {
  color: var(--gold-bright);
  font-size: 0.85rem;
  font-weight: 900;
}

.message-body {
  color: var(--silver);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-body p,
.message-body h3,
.message-body h4,
.message-body blockquote {
  margin: 0;
}

.message-body p + p,
.message-body p + ol,
.message-body p + ul,
.message-body p + blockquote,
.message-body blockquote + p,
.message-body ol + p,
.message-body ul + p {
  margin-top: 12px;
}

.message-body h3,
.message-body h4,
.message-body strong {
  color: var(--gold-bright);
}

.message-body h3 {
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  line-height: 1.35;
}

.message-body h4 {
  font-size: 1.02rem;
  line-height: 1.45;
}

.message-body ol,
.message-body ul {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding-left: 24px;
}

.message-body blockquote {
  display: grid;
  gap: 8px;
  border-left: 3px solid rgba(255, 230, 163, 0.58);
  border-radius: 0 12px 12px 0;
  padding: 10px 12px;
  background: rgba(255, 244, 201, 0.06);
  color: var(--mist);
}

.message-body hr {
  width: 100%;
  height: 1px;
  border: 0;
  margin: 16px 0;
  background: linear-gradient(90deg, transparent, rgba(255, 230, 163, 0.52), transparent);
}

.message-body code {
  border: 1px solid rgba(255, 230, 163, 0.24);
  border-radius: 6px;
  padding: 0.08rem 0.32rem;
  background: rgba(6, 8, 14, 0.7);
  color: var(--gold-bright);
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 0.92em;
}

.message-body a {
  color: var(--gold-bright);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.thinking-message .message-body {
  animation: thinking-pulse 1.35s ease-in-out infinite;
  color: var(--gold-bright);
  font-weight: 900;
}

.source-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
  color: var(--mist);
  font-size: 0.92rem;
}

.chat-form {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 14px;
  background: rgba(8, 10, 18, 0.78);
}

.chat-form textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid rgba(255, 230, 163, 0.32);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(6, 8, 14, 0.86);
  color: var(--silver);
  line-height: 1.6;
}

.chat-form textarea::placeholder {
  color: var(--muted);
}

.tarot-oracle-panel {
  overflow: hidden;
}

.tarot-form {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
}

.tarot-number-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.tarot-number-grid label,
.tarot-question-label {
  display: grid;
  gap: 8px;
  color: var(--gold-bright);
  font-weight: 900;
}

.tarot-number-grid span,
.tarot-question-label span {
  font-size: 0.9rem;
}

.tarot-number-grid input,
.tarot-question-label textarea {
  width: 100%;
  border: 1px solid rgba(255, 230, 163, 0.32);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(6, 8, 14, 0.86);
  color: var(--silver);
  line-height: 1.6;
}

.tarot-number-grid input {
  min-height: 58px;
  color: var(--gold-bright);
  font-size: 1.35rem;
  font-weight: 900;
}

.tarot-question-label textarea {
  min-height: 132px;
  resize: vertical;
}

.tarot-question-label textarea::placeholder {
  color: var(--muted);
}

.tarot-result {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.tarot-result[hidden] {
  display: none;
}

.tarot-result-heading {
  align-items: start;
}

.tarot-result-heading p:last-child {
  max-width: 520px;
  color: var(--mist);
  line-height: 1.7;
}

.tarot-card-spread {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 20px);
  align-items: start;
}

.tarot-drawn-card {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.tarot-drawn-card img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border: 1px solid rgba(255, 230, 163, 0.58);
  border-radius: 16px;
  background: #05060b;
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.5),
    0 0 28px rgba(216, 173, 95, 0.16);
}

.tarot-drawn-meta {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(255, 230, 163, 0.22);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 244, 201, 0.055);
}

.tarot-drawn-meta h3,
.tarot-drawn-meta p {
  margin: 0;
}

.tarot-drawn-meta h3 {
  color: #fff6dc;
  font-size: clamp(1rem, 2vw, 1.35rem);
  line-height: 1.3;
}

.tarot-drawn-meta p {
  color: var(--mist);
  font-weight: 900;
}

.tarot-reading {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(255, 230, 163, 0.26);
  border-radius: 16px;
  padding: clamp(14px, 2vw, 18px);
  background: rgba(255, 244, 201, 0.07);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes thinking-pulse {
  0%,
  100% {
    opacity: 0.55;
  }

  50% {
    opacity: 1;
  }
}

@media (max-width: 1180px) {
  .character-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .module-grid,
  .record-entry-grid,
  .oneshot-grid,
  .section-heading,
  .campaign-heading {
    grid-template-columns: 1fr;
  }

  .character-grid,
  .session-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .page-shell {
    gap: 22px;
    padding: 18px 12px 48px;
  }

  .home-hero,
  .records-header,
  .rules-header {
    min-height: 320px;
    padding: 24px;
  }

  .home-hero {
    min-height: 300px;
    padding-block: 26px;
  }

  h1,
  .records-header h1,
  .rules-header h1,
  .dice-panel h1 {
    font-size: clamp(2.4rem, 12vw, 4.2rem);
  }

  .module-card.tarot-entry,
  .oneshot-card.tarot-entry {
    width: min(100%, 340px);
  }

  .module-card.tarot-entry .module-title,
  .oneshot-card.tarot-entry .module-title {
    font-size: clamp(1.2rem, 7vw, 1.9rem);
  }

  .character-grid,
  .session-summary-grid {
    grid-template-columns: 1fr;
  }

  .session-scene-card {
    grid-template-columns: 1fr;
  }

  .session-scene-index {
    min-height: 92px;
  }

  .die-option {
    min-height: 92px;
  }

  .dice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actions,
  .chat-actions,
  .primary-action,
  .ghost-action {
    width: 100%;
  }

  .actions,
  .chat-actions {
    grid-template-columns: 1fr;
  }

  .tarot-number-grid,
  .tarot-card-spread {
    grid-template-columns: 1fr;
  }

  .message {
    max-width: 100%;
  }
}

@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;
  }
}
