:root,
body {
  --gold: #d75b38;
  --gold-dim: #8f3624;
  --border: #5b3d35;
  --panel-base: #100e0e;
  --panel-edge: #070606;
  --panel-bg: linear-gradient(155deg, rgba(25, 17, 15, 0.97), rgba(10, 9, 9, 0.98) 58%, rgba(7, 6, 6, 0.99));
  --panel-l0-bg: rgba(7, 6, 6, 0.97);
  --panel-l1-bg: linear-gradient(145deg, rgba(27, 19, 17, 0.96), rgba(11, 9, 9, 0.98));
  --panel-l2-bg: rgba(36, 24, 20, 0.96);
  --panel-border: #5b3d35;
  --color-primary: #d75b38;
  --color-primary-dim: #8f3624;
  --color-primary-glow: rgba(215, 91, 56, 0.2);
  --color-primary-glow-heavy: rgba(215, 91, 56, 0.38);
  --color-gold: #df8a62;
  --color-accent: #df8a62;
  --color-border-default: #5b3d35;
  --color-border-showcase: #49312b;
  --color-border-focus: #df8a62;
  --color-text-light: #eee5d1;
  --color-text-muted: #a99c88;
  --color-text-heading: #f2dfc7;
  --color-bg-dark: #080707;
  --color-bg-input: #0d0b0b;
  --color-surface-raised: #241814;
  --cr-client-paper: #eee5d1;
  --cr-client-muted: #b4a791;
  --cr-client-ember: #d75b38;
  --cr-client-ember-bright: #f1764c;
  --cr-client-copper: #c89768;
  --cr-client-line: rgba(231, 214, 181, 0.18);
  --cr-client-serif: "Cinzel", "Palatino Linotype", Georgia, serif;
  --cr-client-body: "Alegreya Sans", "Segoe UI", sans-serif;
}

/* Entry, authentication, realm, and character selection */
body:not(.game-active) #start-screen {
  color: var(--cr-client-paper);
  background: #080707;
  font-family: var(--cr-client-body);
}

body:not(.game-active) #start-screen-backdrop {
  background:
    linear-gradient(90deg, rgba(5, 4, 4, 0.92), rgba(8, 6, 6, 0.4) 50%, rgba(5, 4, 4, 0.92)),
    linear-gradient(180deg, rgba(6, 5, 5, 0.12), rgba(6, 5, 5, 0.86)),
    url("/realm-art/infernal-citadel.webp") center 32% / cover no-repeat;
  filter: none;
}

body:not(.game-active) #start-screen-backdrop::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    radial-gradient(circle at 50% 32%, rgba(188, 53, 24, 0.2), transparent 36%),
    linear-gradient(180deg, transparent 44%, #080707 100%);
}

body:not(.game-active) #start-screen-backdrop :is(
  #bg-trailer,
  #bg-home,
  .bg-trailer-scrim,
  .portal-ring,
  .portal-ring-reverse,
  .nebula-overlay,
  .embers-container
) {
  display: none !important;
}

body:not(.game-active) .homepage-header.cr-site-header {
  position: relative;
  display: block;
  width: 100%;
  height: 76px;
  min-height: 76px;
  flex: 0 0 76px;
  border: 0;
  border-bottom: 1px solid var(--cr-client-line);
  background: linear-gradient(180deg, rgba(5, 5, 5, 0.98), rgba(7, 6, 6, 0.88));
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

body:not(.game-active) .homepage-header.cr-site-header::before {
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--cr-client-ember), var(--cr-client-copper), transparent);
}

body:not(.game-active) .homepage-header.cr-site-header .cr-site-header-inner {
  display: grid;
  width: 100%;
  height: 76px;
  min-height: 76px;
  grid-template-rows: 1fr;
}

body:not(.game-active) .header-logo-container {
  position: relative;
  min-width: 180px;
  gap: 12px;
}

body:not(.game-active) .header-logo-container::before {
  width: 38px;
  height: 44px;
  content: "";
  border: 1px solid rgba(218, 177, 108, 0.58);
  clip-path: polygon(50% 0, 94% 24%, 82% 78%, 50% 100%, 18% 78%, 6% 24%);
  background:
    linear-gradient(35deg, transparent 46%, var(--cr-client-paper) 47% 51%, transparent 52%),
    linear-gradient(-35deg, transparent 46%, var(--cr-client-paper) 47% 51%, transparent 52%),
    linear-gradient(145deg, rgba(221, 157, 70, 0.22), rgba(97, 24, 13, 0.48));
}

body:not(.game-active) :is(.header-logo-btn, .header-logo) {
  display: none;
}

body:not(.game-active) .homepage-header .cr-site-brand-text {
  display: grid;
  gap: 4px;
  margin: 0;
  color: var(--cr-client-paper);
  font-size: 0;
  line-height: 1;
  letter-spacing: 0;
}

body:not(.game-active) .homepage-header .cr-site-brand-text::before,
body:not(.game-active) .homepage-header .cr-site-brand-text::after {
  display: block;
  font-family: var(--cr-client-serif);
  font-weight: 600;
}

body:not(.game-active) .homepage-header .cr-site-brand-text::before {
  content: "CRYPTIC";
  font-size: 15px;
  letter-spacing: 0.2em;
}

body:not(.game-active) .homepage-header .cr-site-brand-text::after {
  color: var(--cr-client-copper);
  content: "REALM";
  font-size: 9px;
  letter-spacing: 0.55em;
}

body:not(.game-active) .homepage-header .nav-link {
  color: var(--cr-client-muted);
  font: 700 12px/1 var(--cr-client-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body:not(.game-active) .homepage-header .nav-link:is(:hover, :focus-visible, .active),
body:not(.game-active) .homepage-header .nav-link[aria-current="page"] {
  color: var(--cr-client-paper);
  border-color: rgba(215, 91, 56, 0.62);
  background: rgba(215, 91, 56, 0.1);
}

body:not(.game-active) .mobile-menu-toggle .hamburger-bar {
  background: var(--cr-client-paper);
}

body:not(.game-active) #homepage-views-container {
  position: relative;
  z-index: 2;
  min-height: 0;
  flex: 1 1 auto;
  padding: 20px 24px;
}

body:not(.game-active) #hero-view {
  display: flex;
  width: 100%;
  min-height: 100%;
  padding: clamp(20px, 4vh, 46px) 24px 28px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

body:not(.game-active) :is(#title-logo, .official-site-copy, #token-ca, .play-tip) {
  display: none !important;
}

.cr-play-intro {
  display: grid;
  justify-items: center;
  margin-bottom: 26px;
  text-align: center;
  text-shadow: 0 8px 34px rgba(0, 0, 0, 0.82);
}

.cr-play-intro p {
  margin: 0 0 10px;
  color: var(--cr-client-copper);
  font: 700 11px/1 var(--cr-client-body);
  letter-spacing: 0.34em;
}

.cr-play-intro strong,
.cr-play-intro span {
  font-family: var(--cr-client-serif);
  font-weight: 500;
  line-height: 0.86;
}

.cr-play-intro strong {
  color: var(--cr-client-paper);
  font-size: clamp(54px, 7.2vw, 108px);
  letter-spacing: 0.05em;
}

.cr-play-intro span {
  margin-top: 14px;
  color: var(--cr-client-copper);
  font-size: clamp(23px, 2.4vw, 38px);
  letter-spacing: 0.52em;
  transform: translateX(0.24em);
}

.cr-play-intro small {
  margin-top: 22px;
  color: var(--cr-client-muted);
  font-size: 16px;
  letter-spacing: 0.08em;
}

body:not(.game-active) #mode-select {
  width: min(560px, calc(100vw - 36px));
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body:not(.game-active) .play-console,
body:not(.game-active) :is(#login-panel, #forgot-panel, #reset-panel, #discord-choice-panel, #realm-panel, #charselect-panel, #charcreate-panel, #offline-select) {
  border: 1px solid rgba(218, 177, 108, 0.28);
  border-radius: 3px;
  background:
    linear-gradient(135deg, rgba(215, 91, 56, 0.07), transparent 42%),
    rgba(13, 11, 10, 0.93);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.64), inset 0 1px rgba(255, 255, 255, 0.04);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

body:not(.game-active) .play-console {
  display: grid;
  gap: 14px;
  padding: 18px;
}

body:not(.game-active) :is(.server-select-trigger, .server-select-menu) {
  border-color: var(--cr-client-line);
  border-radius: 2px;
  color: var(--cr-client-paper);
  background: rgba(255, 255, 255, 0.035);
}

body:not(.game-active) .server-select-menu {
  z-index: 20;
  border-color: rgba(218, 177, 108, 0.42);
  background: rgba(10, 8, 8, 0.99);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.74);
}

body:not(.game-active):not([data-start-panel="mode-select"]) .cr-play-intro {
  display: none;
}

body:not(.game-active) .server-select-trigger:is(:hover, :focus-visible) {
  border-color: rgba(218, 177, 108, 0.55);
  background: rgba(218, 177, 108, 0.06);
}

body:not(.game-active) :is(.server-select-value, .server-opt-name) {
  color: var(--cr-client-paper);
}

body:not(.game-active) :is(.server-select-sub, .server-opt-desc, .server-opt-stats) {
  color: var(--cr-client-muted);
}

body:not(.game-active) .btn-play {
  min-height: 66px;
  border: 1px solid rgba(241, 118, 76, 0.78);
  border-radius: 2px;
  color: #fff6e9;
  background: linear-gradient(180deg, #c84b2b, #8f2718);
  box-shadow: 0 13px 34px rgba(97, 24, 13, 0.34), inset 0 1px rgba(255, 255, 255, 0.22);
  font-family: var(--cr-client-serif);
  letter-spacing: 0.18em;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
}

body:not(.game-active) .btn-play:is(:hover, :focus-visible) {
  border-color: var(--cr-client-copper);
  background: linear-gradient(180deg, #df6138, #a8311d);
  transform: translateY(-2px);
}

body:not(.game-active) :is(#login-panel, #forgot-panel, #reset-panel, #discord-choice-panel, #realm-panel, #charselect-panel, #charcreate-panel, #offline-select) {
  width: min(760px, calc(100vw - 36px));
  max-height: calc(100vh - 128px);
  padding: clamp(24px, 4vw, 42px);
  color: var(--cr-client-paper);
  overflow: auto;
}

body:not(.game-active) :is(.auth-title, .panel-title, #realm-panel h2, #charselect-panel h2, #offline-select h2) {
  color: var(--cr-client-paper);
  font-family: var(--cr-client-serif);
  font-weight: 500;
  letter-spacing: 0.08em;
}

body:not(.game-active) :is(input, select, textarea) {
  border-color: var(--cr-client-line);
  border-radius: 2px;
  color: var(--cr-client-paper);
  background: rgba(255, 255, 255, 0.045);
}

body:not(.game-active) :is(input, select, textarea):focus {
  border-color: var(--cr-client-copper);
  box-shadow: 0 0 0 3px rgba(200, 151, 104, 0.12);
}

body:not(.game-active) :is(.btn-primary, #btn-login-sso) {
  border-color: rgba(241, 118, 76, 0.72) !important;
  color: #fff8ec !important;
  background: linear-gradient(180deg, #c84b2b, #8f2718) !important;
}

body:not(.game-active) :is(.realm-row, .character-card, .mini-class) {
  border-color: var(--cr-client-line);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.035);
}

body:not(.game-active) :is(.realm-row, .character-card, .mini-class):is(:hover, :focus-visible, .sel) {
  border-color: rgba(218, 177, 108, 0.58);
  background: rgba(215, 91, 56, 0.08);
}

/* Loaded world, HUD, dialogs, and all menu/window surfaces */
body.game-active :is(.panel, .window, .window-frame, #ctx-menu, #tooltip, #discord-window) {
  border-color: var(--cr-client-line);
  border-radius: 2px;
  background:
    linear-gradient(135deg, rgba(215, 91, 56, 0.055), transparent 36%),
    linear-gradient(155deg, rgba(24, 17, 15, 0.96), rgba(9, 8, 8, 0.98) 62%);
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.58), inset 0 1px rgba(255, 255, 255, 0.035);
}

body.game-active .window-frame::before,
body.game-active .window-frame::after,
body.game-active #options-menu.perf-wide::before {
  display: none !important;
}

body.game-active :is(.window > .panel-title, .window-titlebar, .panel > .panel-title) {
  min-height: 42px;
  border: 0;
  border-bottom: 1px solid var(--cr-client-line);
  border-radius: 0;
  color: var(--cr-client-paper);
  background: linear-gradient(90deg, rgba(215, 91, 56, 0.14), rgba(255, 255, 255, 0.02) 48%, transparent);
  font-family: var(--cr-client-serif);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

body.game-active :is(.window > .panel-title, .window-titlebar)::before {
  align-self: stretch;
  width: 3px;
  margin: -11px 6px -7px -12px;
  content: "";
  background: linear-gradient(180deg, var(--cr-client-ember-bright), var(--cr-client-ember));
}

body.game-active :is(.btn, .opt-btn, .micro-btn, .x-btn, .icon-btn, .set-choice-btn, .set-toggle, .chip, button) {
  border-radius: 2px;
}

body.game-active :is(.btn, .opt-btn, .set-choice-btn, .set-toggle, .kb-key) {
  border-color: #533930;
  color: var(--cr-client-paper);
  background: linear-gradient(180deg, rgba(48, 33, 28, 0.98), rgba(20, 15, 14, 0.98));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
}

body.game-active :is(.btn, .opt-btn, .set-choice-btn, .set-toggle, .kb-key):is(:hover, :focus-visible):not(:disabled) {
  border-color: var(--cr-client-ember-bright);
  color: #fff7ed;
  background: linear-gradient(180deg, rgba(113, 48, 32, 0.98), rgba(43, 23, 19, 0.98));
}

body.game-active :is(.btn.is-primary, .btn-primary, .graphics-apply-btn) {
  border-color: var(--cr-client-ember-bright);
  color: #fff8ed;
  background: linear-gradient(180deg, #c84b2b, #8f2718);
}

body.game-active :is(input, select, textarea) {
  border-color: #49332d;
  border-radius: 2px;
  color: var(--cr-client-paper);
  background: #0d0b0b;
}

body.game-active :is(input, select, textarea):focus {
  border-color: var(--cr-client-copper);
  outline-color: var(--cr-client-copper);
  box-shadow: 0 0 0 3px rgba(200, 151, 104, 0.12);
}

body.game-active :is(.opt-tab, .set-seg-btn, .chip) {
  border-color: #49332d;
  border-radius: 2px;
  color: var(--cr-client-muted);
  background: rgba(255, 255, 255, 0.025);
}

body.game-active :is(.opt-tab.on, .set-seg-btn.active, .chip[aria-pressed="true"]) {
  border-color: var(--cr-client-ember);
  color: var(--cr-client-paper);
  background: rgba(215, 91, 56, 0.12);
  box-shadow: inset 3px 0 var(--cr-client-ember);
}

body.game-active :is(.card, .perf-card, .gfx-card, .set-row, .kb-row, .list-row, .data-table tr) {
  border-color: rgba(231, 214, 181, 0.11);
  border-radius: 2px;
}

body.game-active #options-menu {
  border-left: 3px solid var(--cr-client-ember);
  border-radius: 2px;
}

body.game-active #options-menu .window-title {
  color: var(--cr-client-paper);
  text-shadow: none;
}

body.game-active #options-menu :is(.kb-cat, .set-subhead) {
  color: var(--cr-client-copper);
  border-color: var(--cr-client-line);
  letter-spacing: 0.12em;
}

body.game-active :is(#actionbar, #actionbar2, #actionbar3, #petbar, #stancebar) {
  border-color: rgba(231, 214, 181, 0.16);
  border-radius: 2px;
  background: rgba(8, 7, 7, 0.88);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.48);
}

body.game-active :is(.action-slot, .ability-slot, .item-cell, .bag-item) {
  border-color: #49332d;
  border-radius: 2px;
  background-color: #0c0a0a;
}

body.game-active :is(.action-slot, .ability-slot, .item-cell, .bag-item):is(:hover, :focus-visible) {
  border-color: var(--cr-client-copper);
  box-shadow: 0 0 0 1px rgba(200, 151, 104, 0.22);
}

body.game-active :is(#chatlog-frame, .mt-panel, #target-auras-window) {
  border-color: rgba(231, 214, 181, 0.14);
  border-radius: 2px;
  background: rgba(8, 7, 7, 0.76);
}

body.game-active #tooltip {
  border-left: 3px solid var(--cr-client-ember);
  color: var(--cr-client-paper);
}

body.game-active ::-webkit-scrollbar-thumb {
  border: 2px solid #0b0909;
  border-radius: 0;
  background: #644034;
}

body.game-active {
  scrollbar-color: #644034 #0b0909;
}

@media (max-width: 860px) {
  body:not(.game-active) .homepage-header.cr-site-header,
  body:not(.game-active) .homepage-header.cr-site-header .cr-site-header-inner {
    min-height: 66px;
  }

  body:not(.game-active) .homepage-header.cr-site-header .header-menu-container {
    border-color: var(--cr-client-line);
    background: rgba(8, 7, 7, 0.99);
  }

  body:not(.game-active) #hero-view {
    min-height: calc(100vh - 66px);
    padding: 30px 18px 54px;
  }

  .cr-play-intro {
    margin-bottom: 20px;
  }

  .cr-play-intro strong {
    font-size: clamp(46px, 14vw, 68px);
  }

  .cr-play-intro small {
    margin-top: 17px;
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body:not(.game-active) .btn-play {
    transition: none;
  }
}
