:root {
  --ink-950: #07090d;
  --ink-900: #0e1015;
  --ink-800: #171a21;
  --ink-700: #232733;
  --steel: #9ea2aa;
  --gold: #c7a86a;
  --gold-strong: #e6c57e;
  --text: #ebedf2;
  --muted: #b5bac5;
  --danger: #d06d6d;
  --ok: #89cd9f;
  --card-border: rgba(230, 197, 126, 0.3);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background:
    radial-gradient(circle at 15% -5%, rgba(198, 153, 85, 0.19), transparent 35%),
    radial-gradient(circle at 100% 30%, rgba(69, 84, 130, 0.2), transparent 40%),
    linear-gradient(180deg, #090b10 0%, #0a0c11 45%, #07080c 100%);
  color: var(--text);
  font-family: "Manrope", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.02), transparent 40%),
    linear-gradient(225deg, rgba(255, 255, 255, 0.01), transparent 45%);
}

.container {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 0 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--gold-strong);
}

.brand-name {
  font-family: "Cinzel", Georgia, serif;
  font-size: 1rem;
  letter-spacing: 0.14em;
}

.nav {
  display: inline-flex;
  gap: 1.1rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.93rem;
}

.nav a:hover {
  color: var(--gold-strong);
}

.hero {
  margin-top: 0.85rem;
  padding: 1.35rem 1.45rem;
  border-radius: calc(var(--radius) + 6px);
  border: 1px solid var(--card-border);
  display: grid;
  grid-template-columns: minmax(430px, 1.2fr) minmax(340px, 1fr);
  gap: 2.2rem;
  min-height: 372px;
  align-items: stretch;
  background:
    linear-gradient(115deg, rgba(8, 10, 16, 0.95), rgba(17, 22, 33, 0.7)),
    url("assets/CharacterSlot.jpg") center/cover no-repeat;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Home page hero: explicit layout overrides for stronger visual structure */
.hero-home {
  margin-top: 1rem;
  padding: 1.1rem;
  grid-template-columns: minmax(420px, 1.18fr) minmax(320px, 1fr);
  gap: 1.35rem;
  height: clamp(320px, 34vw, 390px);
  min-height: 0;
  align-items: stretch;
  background: linear-gradient(115deg, rgba(8, 10, 16, 0.95), rgba(17, 22, 33, 0.7));
}

.hero-home .hero-logo {
  height: 100%;
}

.hero-home .hero-logo img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}

.hero-home .hero-copy {
  padding: 0.3rem 0.5rem 0.35rem 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  justify-content: center;
}

.hero-home .hero-copy h1 {
  font-size: clamp(1.72rem, 2.15vw, 2.45rem);
  margin-bottom: 0.75rem;
}

.hero-home .hero-copy p {
  font-size: 1.02rem;
  line-height: 1.4;
  max-width: 38ch;
}

.hero-logo {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
}

.hero-logo img {
  width: 100%;
  min-height: 0;
  max-height: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 14px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 0.55rem 1rem 0.65rem 0;
}

.hero-copy h1 {
  margin: 0.28rem 0 1.2rem;
  font-family: "Cinzel", Georgia, serif;
  font-weight: 600;
  line-height: 1.07;
  font-size: clamp(1.7rem, 2.6vw, 2.5rem);
}

.hero-copy p {
  margin: 0;
  color: var(--muted);
  max-width: 43ch;
  line-height: 1.44;
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 700;
}

.cta {
  margin-top: 1.6rem;
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  padding: 0.72rem 1.15rem;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  color: #1a1407;
  background: linear-gradient(120deg, #c49f62, #f2d797);
  box-shadow: 0 0 0 1px rgba(230, 197, 126, 0.25), 0 10px 25px rgba(0, 0, 0, 0.45);
  transition: transform 180ms ease, filter 180ms ease;
}

.cta:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
}

.content {
  margin-top: 2rem;
}

.launcher-panel {
  padding: 1rem;
}

.launcher-surface {
  margin-top: 1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(180deg, rgba(4, 6, 10, 0.86), rgba(3, 4, 8, 0.94)),
    url("assets/Legion-Card-BG-02.png") center/cover no-repeat;
  padding: 1rem;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(420px, 1.25fr);
  align-items: center;
  gap: 1.2rem;
}

.launcher-copy h2 {
  margin: 0.25rem 0 0.7rem;
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(1.4rem, 2vw, 1.95rem);
}

.launcher-copy p {
  margin: 0;
  color: var(--muted);
}

.launcher-visual {
  width: min(700px, 100%);
  margin-left: auto;
}

.launcher-shot {
  margin: 0;
}

.launcher-shot img {
  width: 100%;
  display: block;
  border-radius: 10px;
  border: 1px solid rgba(230, 197, 126, 0.28);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  object-fit: cover;
}

.launcher-actions {
  padding: 0.85rem 0 0.1rem;
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.launcher-actions-left {
  margin-top: 0.9rem;
  justify-content: center;
}

.launcher-btn {
  text-decoration: none;
  border-radius: 10px;
  padding: 0.65rem 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text);
  background: rgba(0, 0, 0, 0.42);
}

.launcher-btn.primary {
  color: #141004;
  border-color: rgba(230, 197, 126, 0.6);
  background: linear-gradient(120deg, #c49f62, #f1d18f);
}

.launcher-btn.primary:hover {
  filter: brightness(1.05);
}

.section-heading h2 {
  margin: 0.2rem 0 0.8rem;
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(1.45rem, 2vw, 2rem);
  font-weight: 600;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  max-width: 76ch;
}

.grid {
  margin-top: 1rem;
  display: grid;
  gap: 1rem;
}

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

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

.card,
.panel {
  background:
    linear-gradient(180deg, rgba(21, 24, 32, 0.95), rgba(12, 14, 20, 0.95)),
    url("assets/Legion-Card-BG-02.png") center/cover no-repeat;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
}

.card {
  padding: 1rem;
}

.card h3 {
  margin: 0 0 0.5rem;
  font-family: "Cinzel", Georgia, serif;
  font-size: 1.05rem;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.framed {
  border-color: rgba(230, 197, 126, 0.35);
}

.panel {
  padding: 1rem 1rem 1.1rem;
}

.panel h3 {
  margin: 0;
  font-family: "Cinzel", Georgia, serif;
}

.panel h4 {
  margin: 0;
  color: var(--gold);
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.96rem;
}

.story-panel {
  padding: 1.35rem 1.2rem 1.45rem;
}

.story-copy {
  max-width: 82ch;
  margin: 0 auto;
}

.story-intro {
  text-align: center;
}

.story-kicker {
  margin: 0 0 0.65rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.77rem;
  font-weight: 700;
}

.story-copy h2 {
  margin: 0.2rem 0 0.85rem;
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(1.35rem, 1.8vw, 1.75rem);
  color: var(--gold-strong);
}

.story-copy h2 + p {
  margin-top: 0;
}

.story-copy p {
  margin: 0.75rem 0 0;
  color: var(--muted);
}

.story-copy blockquote {
  margin: 0.95rem 0;
  padding: 0.85rem 1rem;
  border-left: 3px solid rgba(230, 197, 126, 0.7);
  border-radius: 0 10px 10px 0;
  background: rgba(230, 197, 126, 0.08);
}

.story-copy blockquote p {
  margin: 0;
  color: var(--text);
}

.story-seal {
  margin-top: 1.15rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
}

.story-seal span {
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(230, 197, 126, 0.28);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.84rem;
  letter-spacing: 0.05em;
}

.story-rail {
  display: grid;
  gap: 1rem;
}

.story-chapter {
  padding: 1rem;
}

.story-beat {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.95fr);
  gap: 1.1rem;
  align-items: center;
}

.story-beat-reverse {
  grid-template-columns: minmax(300px, 0.95fr) minmax(0, 1.1fr);
}

.story-figure {
  margin: 0;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(230, 197, 126, 0.2);
  background:
    linear-gradient(180deg, rgba(9, 12, 19, 0.92), rgba(11, 14, 20, 0.98)),
    url("assets/Legion-Card-BG-01.png") center/cover no-repeat;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.38);
}

.story-figure img {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
}

.story-portrait img {
  aspect-ratio: 4 / 5;
}

.story-figure figcaption {
  padding: 0.9rem 1rem 1rem;
  display: grid;
  gap: 0.35rem;
}

.story-figure figcaption strong {
  font-family: "Cinzel", Georgia, serif;
  color: var(--gold-strong);
  font-size: 1.02rem;
}

.story-figure figcaption span {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

ul {
  margin: 0.7rem 0 0;
  padding-left: 1.15rem;
  color: var(--muted);
}

li + li {
  margin-top: 0.35rem;
}

.api-panel {
  margin-top: 1rem;
}

.auth-shell {
  max-width: 980px;
}

.auth-panel {
  margin-top: 1rem;
}

.auth-card {
  max-width: 620px;
  margin: 1rem auto 0;
}

.auth-shell #session-message {
  max-width: 620px;
  margin: 0.8rem auto 0;
  text-align: center;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.auth-tab {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--muted);
  padding: 0.6rem 0.7rem;
}

.auth-tab.is-active {
  color: #1b1408;
  border-color: rgba(230, 197, 126, 0.6);
  background: linear-gradient(120deg, #c49f62, #f1d18f);
}

.is-hidden {
  display: none !important;
}

.auth-panel .stack-form {
  margin-top: 0.9rem;
}

.auth-actions {
  max-width: 620px;
}

.auth-panel {
  min-height: 320px;
}

.auth-actions {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.7rem;
}

.inline-form {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.6rem;
  align-items: center;
}

.command-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 1.05fr 1.1fr 1fr;
  gap: 1rem;
}

.form-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin-top: 0.7rem;
}

.stack-form {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.5rem;
}

label {
  font-size: 0.85rem;
  color: var(--muted);
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  background: rgba(8, 10, 15, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: rgba(230, 197, 126, 0.65);
  box-shadow: 0 0 0 3px rgba(230, 197, 126, 0.18);
}

button {
  border: 0;
  border-radius: 10px;
  padding: 0.58rem 0.85rem;
  font-weight: 700;
  cursor: pointer;
  color: #1b1408;
  background: linear-gradient(120deg, #c49f62, #f1d18f);
}

button:hover {
  filter: brightness(1.05);
}

.ghost-btn {
  margin-top: 0.7rem;
  width: 100%;
  background: transparent;
  border: 1px solid rgba(230, 197, 126, 0.45);
  color: var(--gold-strong);
}

.status {
  margin: 0.6rem 0 0;
  min-height: 1.2rem;
  font-size: 0.9rem;
  color: var(--ok);
}

.status.error {
  color: var(--danger);
}

.subtle {
  color: var(--muted);
}

.character-list,
.inventory-list {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.6rem;
  max-height: 440px;
  overflow: auto;
  padding-right: 0.2rem;
}

.character-card,
.item-card {
  background:
    linear-gradient(160deg, rgba(14, 17, 23, 0.98), rgba(7, 10, 16, 0.98)),
    url("assets/Legion-Card-BG-01.png") center/cover no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 0.65rem;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: start;
}

.card-head strong {
  display: block;
}

.card-meta {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.83rem;
}

.row-actions {
  margin-top: 0.55rem;
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.row-actions button {
  flex: 1;
  min-width: 90px;
  padding: 0.45rem 0.55rem;
}

.mini-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  font-size: 0.8rem;
}

.mini-btn.warn {
  border-color: rgba(208, 109, 109, 0.6);
  color: #f0c0c0;
}

.footer {
  padding: 2rem 0 2.4rem;
}

.footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

body[data-page="auth"] .footer p {
  text-align: center;
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  animation: enter 760ms ease forwards;
}

.reveal:nth-of-type(2) {
  animation-delay: 120ms;
}

.reveal:nth-of-type(3) {
  animation-delay: 220ms;
}

.reveal:nth-of-type(4) {
  animation-delay: 320ms;
}

@keyframes enter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1020px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 1.3rem;
    padding: 1.05rem;
    min-height: 0;
  }

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

  .command-grid {
    grid-template-columns: 1fr;
  }

  .hero-logo img {
    min-height: 0;
    max-height: 320px;
  }

  .hero-copy {
    padding: 0.15rem 0.25rem 0.25rem;
  }

  .hero-copy p {
    max-width: none;
  }

  .hero-home {
    margin-top: 0.8rem;
    padding: 1.1rem;
    min-height: 0;
    height: auto;
    gap: 1.3rem;
    grid-template-columns: 1fr;
  }

  .hero-home .hero-logo img {
    max-height: 310px;
    height: auto;
  }

  .hero-home .hero-copy {
    height: auto;
    max-height: none;
    overflow: visible;
    padding: 0.15rem 0.25rem 0.25rem;
  }

  .hero-home .hero-copy h1 {
    font-size: clamp(1.85rem, 5.5vw, 2.45rem);
  }

  .launcher-surface {
    grid-template-columns: 1fr;
  }

  .launcher-copy {
    text-align: center;
  }

  .story-beat,
  .story-beat-reverse {
    grid-template-columns: 1fr;
  }

  .launcher-visual {
    width: min(760px, 100%);
    margin: 0 auto;
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.55rem;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .form-split {
    grid-template-columns: 1fr;
  }

  .grid.two,
  .grid.four {
    grid-template-columns: 1fr;
  }

  .launcher-surface {
    display: block;
  }

  .launcher-visual {
    width: 100%;
    margin-left: 0;
  }

  .launcher-actions {
    justify-content: center;
  }

  .launcher-btn {
    flex: 0 1 auto;
    min-width: 220px;
    text-align: center;
  }

  .story-panel,
  .story-chapter {
    padding: 1rem 0.9rem 1.1rem;
  }

  .story-figure figcaption {
    padding: 0.8rem 0.85rem 0.9rem;
  }
}
