/*
 * RaidRU × Midnight
 *
 * A self-contained visual theme inspired by Azeroth's conflict between
 * starlight, the Void and ancient gilded craft. It deliberately uses no
 * third-party fonts, images or runtime requests: the working surfaces stay
 * quiet while atmosphere lives in light, borders and depth.
 */

:root {
  color-scheme: dark;
  --panel: #100f1c;
  --panel2: #171427;
  --line: #393052;
  --muted: #aaa7bd;
  --accent: #8066ef;
  --good: #55d8a6;
  --warn: #e9b85c;
  --bad: #ff6d88;
  --midnight-void-1000: #04030a;
  --midnight-void-950: #080711;
  --midnight-void-900: #0d0a18;
  --midnight-void-850: #121022;
  --midnight-void-800: #19142d;
  --midnight-metal: #302943;
  --midnight-metal-bright: #594b71;
  --midnight-violet: #8d6cff;
  --midnight-violet-deep: #4c2c9a;
  --midnight-astral: #62c9ff;
  --midnight-astral-soft: #bdeaff;
  --midnight-gold: #d9a84e;
  --midnight-gold-bright: #f3d287;
  --midnight-ink: #06050d;
  --midnight-text: #f3f0fa;
  --midnight-muted: #aaa7bd;
  --midnight-surface: linear-gradient(145deg, rgba(25, 20, 45, .96), rgba(10, 9, 19, .97));
  --midnight-surface-raised: linear-gradient(145deg, rgba(34, 27, 57, .96), rgba(14, 12, 25, .98));
  --midnight-edge: linear-gradient(90deg, transparent, rgba(243, 210, 135, .7), rgba(111, 91, 185, .88), transparent);
  --midnight-shadow: 0 22px 58px rgba(0, 0, 0, .44), 0 0 42px rgba(75, 43, 153, .09);
  --midnight-inset: inset 0 1px 0 rgba(255, 255, 255, .045), inset 0 0 28px rgba(4, 3, 10, .44);
  font-family: "Trebuchet MS", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--midnight-text);
  background: var(--midnight-void-1000);
}

html {
  background: var(--midnight-void-1000);
  scrollbar-color: #5d4a82 #090711;
  scrollbar-width: thin;
}

.theme-midnight {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  color: var(--midnight-text);
  background:
    radial-gradient(circle at 16% -8%, rgba(76, 44, 154, .44) 0, transparent 34%),
    radial-gradient(circle at 86% 4%, rgba(28, 119, 169, .25) 0, transparent 30%),
    radial-gradient(ellipse at 50% 108%, rgba(81, 47, 155, .16) 0, transparent 44%),
    linear-gradient(180deg, #090713 0%, #06050d 47%, #090711 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

.theme-midnight::before,
.theme-midnight::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: -1;
}

.theme-midnight::before {
  inset: 0;
  opacity: .34;
  background-image:
    radial-gradient(circle at 8% 14%, rgba(196, 232, 255, .95) 0 1px, transparent 1.6px),
    radial-gradient(circle at 20% 38%, rgba(142, 108, 255, .8) 0 1px, transparent 1.8px),
    radial-gradient(circle at 34% 9%, rgba(255, 222, 151, .72) 0 1px, transparent 1.7px),
    radial-gradient(circle at 47% 29%, rgba(183, 222, 255, .72) 0 1px, transparent 1.6px),
    radial-gradient(circle at 61% 12%, rgba(142, 108, 255, .75) 0 1px, transparent 1.7px),
    radial-gradient(circle at 73% 42%, rgba(206, 236, 255, .74) 0 1px, transparent 1.7px),
    radial-gradient(circle at 91% 22%, rgba(243, 210, 135, .72) 0 1px, transparent 1.7px),
    radial-gradient(circle at 12% 77%, rgba(157, 126, 255, .7) 0 1px, transparent 1.6px),
    radial-gradient(circle at 39% 68%, rgba(211, 239, 255, .7) 0 1px, transparent 1.6px),
    radial-gradient(circle at 67% 82%, rgba(157, 126, 255, .65) 0 1px, transparent 1.7px),
    radial-gradient(circle at 88% 70%, rgba(203, 234, 255, .66) 0 1px, transparent 1.7px);
  background-size: 470px 430px, 630px 590px, 730px 520px, 540px 680px, 680px 470px, 790px 610px, 610px 760px, 520px 590px, 690px 520px, 770px 680px, 590px 740px;
}

.theme-midnight::after {
  width: min(78vw, 1180px);
  height: 360px;
  top: -240px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(98, 201, 255, .22), rgba(119, 73, 223, .2) 34%, transparent 70%);
  box-shadow: 0 0 120px rgba(115, 76, 220, .2);
}

.theme-midnight ::selection {
  color: #fff;
  background: rgba(126, 91, 235, .74);
}

.theme-midnight ::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

.theme-midnight ::-webkit-scrollbar-track {
  background: #090711;
}

.theme-midnight ::-webkit-scrollbar-thumb {
  border: 3px solid #090711;
  border-radius: 999px;
  background: linear-gradient(#66518f, #3d315b);
}

.theme-midnight a {
  color: #bcaeff;
  text-decoration-color: rgba(188, 174, 255, .42);
  text-underline-offset: 3px;
}

.theme-midnight a:hover {
  color: var(--midnight-astral-soft);
  text-decoration-color: currentColor;
}

.theme-midnight h1,
.theme-midnight h2,
.theme-midnight h3,
.theme-midnight h4,
.theme-midnight .brand strong {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: .012em;
  text-wrap: balance;
}

.theme-midnight h2,
.theme-midnight h3,
.theme-midnight h4 {
  color: #f2edf9;
  text-shadow: 0 1px 0 #000, 0 0 18px rgba(119, 83, 210, .12);
}

.theme-midnight .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--midnight-gold-bright);
  font-size: 11px;
  letter-spacing: .16em;
  text-shadow: 0 0 16px rgba(217, 168, 78, .22);
}

.theme-midnight .eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  transform: rotate(45deg);
  border: 1px solid var(--midnight-gold);
  background: #392553;
  box-shadow: 0 0 9px rgba(141, 108, 255, .75);
}

/* Warcraft-like frame: metal outside, calm data surface inside. */
.theme-midnight .topbar {
  min-height: 72px;
  height: auto;
  border: 0;
  border-bottom: 1px solid #6d5a83;
  background:
    linear-gradient(180deg, rgba(31, 25, 47, .97), rgba(10, 8, 17, .97)),
    #0a0811;
  box-shadow: 0 1px 0 rgba(235, 200, 124, .38), 0 12px 35px rgba(0, 0, 0, .5), 0 0 30px rgba(92, 55, 170, .12);
  backdrop-filter: blur(18px) saturate(128%);
  z-index: 60;
}

.theme-midnight .topbar::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: min(720px, 72vw);
  height: 1px;
  transform: translateX(-50%);
  background: var(--midnight-edge);
  box-shadow: 0 0 15px rgba(141, 108, 255, .45);
}

.theme-midnight .topbar-inner {
  position: relative;
}

.theme-midnight .brand {
  color: #fff7e8;
  text-decoration: none;
}

.theme-midnight .brand strong {
  font-size: 21px;
  color: var(--midnight-gold-bright);
  letter-spacing: .045em;
  text-shadow: 0 2px 0 #3a2108, 0 0 18px rgba(217, 168, 78, .25);
}

.theme-midnight .brand small {
  color: #aaa5b8;
  letter-spacing: .035em;
}

.theme-midnight .logo {
  position: relative;
  width: 42px;
  height: 42px;
  border: 1px solid #b9995c;
  border-radius: 9px;
  clip-path: polygon(18% 0, 82% 0, 100% 18%, 100% 82%, 82% 100%, 18% 100%, 0 82%, 0 18%);
  color: #f9f5ff;
  background:
    radial-gradient(circle at 42% 35%, #bdeaff 0, #6a5de0 24%, #33205e 48%, #0a0814 74%);
  box-shadow: inset 0 0 0 3px rgba(8, 6, 17, .72), inset 0 0 18px rgba(98, 201, 255, .28), 0 0 18px rgba(111, 82, 211, .42);
  text-shadow: 0 2px 4px #000;
}

.theme-midnight .topbar-link,
.theme-midnight .auth-topbar,
.theme-midnight .auth-logout {
  color: #c9c3d5;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.theme-midnight .topbar-link:hover,
.theme-midnight .auth-topbar:hover,
.theme-midnight .auth-logout:hover {
  color: #fff3cf;
  border-color: rgba(217, 168, 78, .35);
  background: rgba(217, 168, 78, .07);
}

.theme-midnight .support-link {
  color: #d5c5ff;
}

.theme-midnight .service-status {
  border-color: #403552;
  color: #a9a5b5;
  background: rgba(8, 7, 15, .54);
  box-shadow: var(--midnight-inset);
}

.theme-midnight .service-dot,
.theme-midnight .account-inline-dot,
.theme-midnight .oauth-login-progress-dot {
  box-shadow: 0 0 9px currentColor;
}

/* Intro / key art area, made entirely from light and geometry. */
.theme-midnight .shell {
  position: relative;
  width: min(1460px, calc(100% - 44px));
}

.theme-midnight .hero {
  position: relative;
  min-height: 260px;
  padding: 44px 48px 36px;
  border: 1px solid #4b3d63;
  border-radius: 4px 4px 20px 20px;
  background:
    radial-gradient(circle at 88% 30%, rgba(98, 201, 255, .13), transparent 20%),
    radial-gradient(circle at 82% 66%, rgba(125, 76, 220, .25), transparent 32%),
    linear-gradient(100deg, rgba(9, 7, 17, .98) 0%, rgba(17, 13, 31, .97) 58%, rgba(24, 15, 45, .92) 100%);
  box-shadow: var(--midnight-shadow), var(--midnight-inset);
  overflow: hidden;
}

.theme-midnight .hero::before {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  right: 5%;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  border: 1px solid rgba(217, 168, 78, .25);
  border-radius: 28%;
  background:
    radial-gradient(circle, rgba(98, 201, 255, .18), rgba(111, 71, 205, .11) 24%, transparent 25%),
    conic-gradient(from 45deg, transparent 0 12%, rgba(141, 108, 255, .12) 12% 14%, transparent 14% 37%, rgba(217, 168, 78, .11) 37% 39%, transparent 39% 62%, rgba(98, 201, 255, .1) 62% 64%, transparent 64% 87%, rgba(141, 108, 255, .12) 87% 89%, transparent 89%);
  box-shadow: inset 0 0 45px rgba(94, 56, 178, .1), 0 0 60px rgba(67, 123, 189, .08);
  opacity: .82;
}

.theme-midnight .hero::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--midnight-edge);
}

.theme-midnight .hero-copy,
.theme-midnight .hero-actions {
  position: relative;
  z-index: 1;
}

.theme-midnight .hero h1 {
  max-width: 960px;
  color: #fff8e9;
  font-size: clamp(36px, 3.7vw, 58px);
  line-height: 1.02;
  letter-spacing: -.018em;
  text-shadow: 0 2px 0 #190d29, 0 0 32px rgba(111, 81, 201, .25);
}

.theme-midnight .hero p {
  max-width: 900px;
  color: #bbb6c8;
  font-size: 17px;
}

/* Interactive controls */
.theme-midnight button:not(.support-backdrop),
.theme-midnight .file-action,
.theme-midnight .support-action {
  position: relative;
  border: 1px solid #705ba0;
  border-radius: 8px;
  color: #f8f5ff;
  background: linear-gradient(180deg, #755bc8 0%, #4b328c 52%, #382368 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 -2px 0 rgba(12, 7, 25, .35), 0 6px 16px rgba(0, 0, 0, .22);
  text-shadow: 0 1px 2px #140b27;
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease, color .16s ease, transform .16s ease;
}

.theme-midnight button:not(.support-backdrop):hover:not(:disabled),
.theme-midnight .file-action:hover,
.theme-midnight .support-action:hover {
  border-color: #bd9df4;
  color: #fff;
  background: linear-gradient(180deg, #8a6ee0 0%, #593ba0 52%, #422878 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 8px 20px rgba(42, 21, 79, .38), 0 0 14px rgba(128, 102, 239, .2);
  transform: translateY(-1px);
}

.theme-midnight button:not(.support-backdrop):active:not(:disabled),
.theme-midnight .file-action:active,
.theme-midnight .support-action:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 6px rgba(6, 4, 12, .42);
}

.theme-midnight button:disabled {
  color: #777181;
  border-color: #312a3d;
  background: #1b1822;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025);
  cursor: not-allowed;
  opacity: .72;
}

.theme-midnight :is(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--midnight-astral);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(98, 201, 255, .14), 0 0 18px rgba(98, 201, 255, .28);
}

.theme-midnight :is(.secondary, .hero-secondary, .account-inline, .adapter-import-btn, .nsrt-filter-actions button, .snapshot-frames button, .legacy-planner-toolbar button, .fight-review-toolbar button, .report-quick-nav button) {
  color: #d8d2e2;
  border-color: #4c405f;
  background: linear-gradient(180deg, #242033, #171420);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .055), 0 4px 12px rgba(0, 0, 0, .16);
}

.theme-midnight :is(.secondary, .hero-secondary, .account-inline, .adapter-import-btn, .nsrt-filter-actions button, .snapshot-frames button, .legacy-planner-toolbar button, .fight-review-toolbar button, .report-quick-nav button):hover:not(:disabled) {
  color: #fff3d1;
  border-color: #9a7ec4;
  background: linear-gradient(180deg, #322a46, #20192f);
}

.theme-midnight :is(.hero-primary, #resolve-button, #analyze-fight, .review-primary) {
  border-color: #d0a85e;
  background: linear-gradient(180deg, #8f6ce0 0%, #5b3aa8 48%, #3c246f 100%);
  box-shadow: inset 0 1px 0 rgba(255, 244, 211, .25), inset 0 -2px 0 rgba(35, 18, 65, .6), 0 8px 24px rgba(73, 41, 141, .35), 0 0 0 1px rgba(217, 168, 78, .12);
}

.theme-midnight .topbar-link,
.theme-midnight .table-sort-button,
.theme-midnight .support-backdrop,
.theme-midnight .auth-topbar,
.theme-midnight .auth-logout,
.theme-midnight .support-close,
.theme-midnight .oauth-setup-close {
  transform: none;
}

.theme-midnight .support-backdrop {
  border: 0;
  border-radius: 0;
  background: rgba(3, 2, 8, .82);
  box-shadow: none;
  backdrop-filter: blur(7px);
}

.theme-midnight .table-sort-button {
  border: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  text-shadow: none;
}

.theme-midnight input,
.theme-midnight select,
.theme-midnight textarea {
  color: #f2eef8;
  border: 1px solid #443a59;
  border-radius: 8px;
  outline: none;
  background: linear-gradient(180deg, rgba(6, 5, 13, .96), rgba(14, 11, 24, .96));
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, .36), 0 1px 0 rgba(255, 255, 255, .025);
  caret-color: var(--midnight-astral);
}

.theme-midnight input::placeholder,
.theme-midnight textarea::placeholder {
  color: #777285;
}

.theme-midnight input:hover,
.theme-midnight select:hover,
.theme-midnight textarea:hover {
  border-color: #655578;
}

.theme-midnight input:focus,
.theme-midnight select:focus,
.theme-midnight textarea:focus {
  border-color: var(--midnight-astral);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, .34), 0 0 0 3px rgba(98, 201, 255, .11), 0 0 16px rgba(98, 201, 255, .12);
}

.theme-midnight input[type="checkbox"],
.theme-midnight input[type="radio"] {
  accent-color: var(--midnight-violet);
}

.theme-midnight code,
.theme-midnight pre,
.theme-midnight kbd {
  color: #d8d0ff;
  border-color: #3d3351;
  background: #090711;
}

/* Major information frames */
.theme-midnight :is(.workspace, .help-guide, .fight-review, .session-review, .strategy-review, .raid-coach, .russian-coach, .raid-night-coach, .coach-planner-bridge, .raid-notes, .support-card, .legacy-planner) {
  border-color: #443752;
  background: var(--midnight-surface);
  box-shadow: var(--midnight-shadow), var(--midnight-inset);
}

.theme-midnight :is(.workspace, .help-guide, .fight-review, .session-review, .strategy-review, .raid-coach, .russian-coach, .raid-night-coach, .coach-planner-bridge, .raid-notes, .support-card) {
  position: relative;
}

.theme-midnight :is(.workspace, .help-guide, .fight-review, .session-review, .strategy-review, .raid-coach, .russian-coach, .raid-night-coach, .coach-planner-bridge, .raid-notes, .support-card)::before {
  content: "";
  position: absolute;
  inset: 0 34px auto;
  height: 1px;
  pointer-events: none;
  background: var(--midnight-edge);
  opacity: .62;
}

.theme-midnight .workspace {
  border-radius: 12px 12px 22px 22px;
  overflow: visible;
}

.theme-midnight .panel {
  border-radius: inherit;
  background:
    radial-gradient(circle at 12% 0, rgba(116, 82, 203, .08), transparent 28%),
    linear-gradient(180deg, rgba(16, 13, 27, .91), rgba(8, 7, 14, .95));
}

.theme-midnight .panel-head h2,
.theme-midnight .review-entry-head h2 {
  color: #f6eedb;
}

.theme-midnight .pillars {
  position: relative;
}

.theme-midnight .pillar {
  position: relative;
  border-color: #40344e;
  border-radius: 9px 9px 16px 16px;
  background:
    radial-gradient(circle at 82% 10%, rgba(126, 93, 217, .1), transparent 30%),
    linear-gradient(150deg, rgba(27, 22, 42, .96), rgba(10, 9, 17, .98));
  box-shadow: var(--midnight-inset), 0 12px 30px rgba(0, 0, 0, .22);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.theme-midnight .pillar::after {
  content: "";
  position: absolute;
  inset: 0 22px auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(217, 168, 78, .58), transparent);
}

.theme-midnight .pillar:hover {
  transform: translateY(-2px);
  border-color: #6a5680;
  box-shadow: var(--midnight-inset), 0 17px 36px rgba(0, 0, 0, .3), 0 0 24px rgba(92, 54, 168, .09);
}

.theme-midnight .pillar .icon {
  color: #e9e5ff;
  border: 1px solid #79639f;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #8ddcff, #6452bc 36%, #241638 70%);
  box-shadow: inset 0 0 0 3px rgba(11, 8, 19, .58), 0 0 17px rgba(100, 82, 188, .33);
  text-shadow: 0 2px 3px #000;
}

.theme-midnight .strategy-card .icon {
  border-color: #b28a4e;
  background: radial-gradient(circle at 40% 35%, #ffe7a5, #a26c27 38%, #3b220c 72%);
}

.theme-midnight .planner-card .icon {
  border-color: #4f91b0;
  background: radial-gradient(circle at 40% 35%, #c7f1ff, #4289b0 35%, #183247 72%);
}

.theme-midnight .pillar h2 {
  color: #eee8f8;
}

.theme-midnight .pillar p,
.theme-midnight .hero p,
.theme-midnight .panel-head p,
.theme-midnight .review-title p,
.theme-midnight .section-title p {
  color: var(--midnight-muted);
}

.theme-midnight :is(.resolve-result.empty, .resolve-result.loading, .analysis-loading, .notice, .empty-state, .filter-empty-state) {
  color: #aaa5b8;
  border-color: #3e344d;
  background: linear-gradient(145deg, rgba(20, 17, 32, .92), rgba(9, 8, 16, .94));
  box-shadow: var(--midnight-inset);
}

.theme-midnight :is(.encounter-head, .review-actions, .report-quick-nav, .fight-review-toolbar, .sticky-filters, .session-trend-summary, .raid-coach-summary, .russian-coach-hero, .coach-plan-summary > div:first-child, .large-table-hint) {
  border-color: #493b5a;
  background: linear-gradient(180deg, rgba(34, 28, 50, .96), rgba(19, 16, 30, .97));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 6px 18px rgba(0, 0, 0, .17);
}

.theme-midnight :is(.ingest-tools, .ingest-card, .help-guide article, .quick-result, .strategy-role-card, .strategy-mechanic, .strategy-phase, .session-mechanic, .next-pull, .root-pattern, .root-cause-card, .raid-coach-card, .russian-coach-item, .session-trend-focus, .session-trend-progress, .session-trend-mini, .raid-note-grid article, .raid-note-personal, .raid-note-user, .coach-plan-chip) {
  border-color: #3e334d;
  background: linear-gradient(145deg, rgba(23, 19, 36, .96), rgba(10, 9, 17, .97));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035), 0 7px 19px rgba(0, 0, 0, .16);
}

.theme-midnight :is(.ingest-card, .help-guide article, .quick-result, .strategy-role-card, .strategy-mechanic, .strategy-phase, .session-mechanic, .next-pull, .root-cause-card, .raid-coach-card, .russian-coach-item, .session-trend-focus, .raid-note-grid article, .raid-note-personal, .coach-plan-chip):hover {
  border-color: #5e4d73;
}

.theme-midnight details {
  border-color: #40344f;
}

.theme-midnight summary {
  color: #d8d1e3;
}

.theme-midnight summary:hover {
  color: #fff0c9;
}

/* Tabs, attempts, badges and compact game-like tokens */
.theme-midnight :is(.chip, .stage, .fight-badge, .status, .session-confidence, .benchmark-status, .source-state, .raid-note-summary span, .raid-coach-meta span, .qa-severity-badge, .qa-episode-count, .mechanic-timeline-count, .planner-stage, .quick-mechanic-chip) {
  color: #d9d2e5;
  border: 1px solid #4b3d5c;
  background: linear-gradient(180deg, #272136, #17131f);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .045);
}

.theme-midnight .chip.strong,
.theme-midnight .fight-badge {
  color: #fff1c9;
  border-color: #735b72;
}

.theme-midnight .attempts {
  border-color: #40344f;
  background: rgba(7, 6, 13, .78);
}

.theme-midnight .attempt {
  color: #d9d4e0;
  border-color: #3c334b;
  background: linear-gradient(180deg, #211c2d, #15121d);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}

.theme-midnight .attempt:hover:not(:disabled) {
  border-color: #725c91;
  background: linear-gradient(180deg, #302641, #1b1628);
}

.theme-midnight .attempt.selected,
.theme-midnight [aria-selected="true"],
.theme-midnight .active[data-filter] {
  color: #fff5dc;
  border-color: var(--midnight-gold);
  background: linear-gradient(180deg, #41305f, #25183f);
  box-shadow: inset 0 0 0 1px rgba(243, 210, 135, .15), 0 0 18px rgba(110, 73, 195, .18);
}

.theme-midnight .attempt-number,
.theme-midnight .mechanic-replay-link,
.theme-midnight .root-replay {
  color: #c5b7ff;
}

.theme-midnight :is(.kill, .good, .success, .authenticated) {
  --midnight-state: #55d8a6;
}

.theme-midnight :is(.wipe, .warning, .probable) {
  --midnight-state: #e9b85c;
}

.theme-midnight :is(.critical, .bad, .error, .confirmed-error) {
  --midnight-state: #ff6d88;
}

.theme-midnight :is(.fight-review.kill-result, .authenticated, .session-trend-focus.improving, .session-trend-progress.resolved) {
  border-color: rgba(85, 216, 166, .48);
  box-shadow: inset 3px 0 #55d8a6, var(--midnight-shadow);
}

.theme-midnight :is(.fight-review.wipe-result, .raid-coach-card.high, .session-trend-focus.new) {
  border-color: rgba(233, 184, 92, .46);
  box-shadow: inset 3px 0 #e9b85c, var(--midnight-shadow);
}

.theme-midnight :is(.mechanic-failure.critical, .raid-coach-card.critical, .raid-note-personal.confirmed-error) {
  border-color: rgba(255, 109, 136, .5);
  box-shadow: inset 3px 0 #ff6d88, 0 10px 28px rgba(0, 0, 0, .24);
}

/* Data tables: parchment colour is kept for emphasis, never as a reading surface. */
.theme-midnight .large-table-scroll,
.theme-midnight .table-scroll,
.theme-midnight .players-wrap {
  border-color: #4a3c5b;
  border-radius: 9px;
  background: #090711;
  box-shadow: inset 0 0 22px rgba(0, 0, 0, .35), 0 12px 28px rgba(0, 0, 0, .24);
}

.theme-midnight table {
  color: #dad6e2;
  border-color: #392f47;
  background: rgba(9, 7, 17, .84);
}

.theme-midnight table :is(th, td) {
  border-color: #342b41;
}

.theme-midnight table thead th,
.theme-midnight .sortable-data-table thead th {
  color: #f2e8d0 !important;
  border-color: #5b4965;
  background: linear-gradient(180deg, #30273f, #1d1827) !important;
  box-shadow: 0 1px 0 rgba(217, 168, 78, .34), 0 8px 18px rgba(2, 1, 6, .72);
}

.theme-midnight table tbody tr:nth-child(even) > :is(td, th),
.theme-midnight .sortable-data-table tbody tr:nth-child(even) > :is(td, th) {
  background-color: rgba(31, 25, 44, .72);
}

.theme-midnight table tbody tr:hover > :is(td, th),
.theme-midnight .sortable-data-table tbody tr:hover > :is(td, th) {
  background-color: #2a213b !important;
}

.theme-midnight .sortable-data-table tbody th[scope="row"] {
  color: #f2edf7;
  background: #17131f;
  box-shadow: 1px 0 0 #4a3b55;
}

.theme-midnight .table-sort-button:hover,
.theme-midnight .table-sort-button:focus-visible {
  color: #fff3cf;
  background: rgba(141, 108, 255, .14);
  transform: none;
}

.theme-midnight th[aria-sort="ascending"] .table-sort-indicator,
.theme-midnight th[aria-sort="descending"] .table-sort-indicator {
  color: #f5dd9e;
  background: rgba(141, 108, 255, .22);
}

/* Planner chrome only. Arena geometry, transforms and tokens stay untouched. */
.theme-midnight :is(.legacy-workspace, .legacy-planner-shell, .planner-timeline-shell) {
  border-color: #4a3b59;
  background: #090711;
  box-shadow: var(--midnight-shadow);
}

.theme-midnight :is(.legacy-workspace-head, .legacy-planner-toolbar, .legacy-scene-strip, .planner-timeline-head, .pw-footer, .raidplan-network-import) {
  border-color: #4c3d5b;
  background: linear-gradient(180deg, #292235, #17131f);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .045);
}

.theme-midnight :is(.legacy-palette, .planner-timeline, .planner-map-panel) {
  border-color: #463751;
  background: linear-gradient(180deg, #14101e, #090711);
}

.theme-midnight .legacy-arena {
  border-color: #8a6f77;
  background-color: #07060c;
  box-shadow: inset 0 0 0 2px rgba(217, 168, 78, .13), 0 0 0 1px #20172c, 0 18px 45px rgba(0, 0, 0, .5), 0 0 28px rgba(117, 75, 198, .12);
}

.theme-midnight :is(.legacy-scene-strip button.selected, .legacy-scene-strip button[aria-current="true"], .snapshot-frames button.active) {
  color: #fff3cf;
  border-color: var(--midnight-gold);
  background: linear-gradient(180deg, #47345e, #281b40);
}

.theme-midnight :is(.legacy-palette-group, .raidplan-relations, .raidplan-inspector-meta) {
  border-color: #41334d;
  background: rgba(12, 9, 18, .9);
}

.theme-midnight .legacy-palette::-webkit-scrollbar-thumb,
.theme-midnight .planner-timeline::-webkit-scrollbar-thumb {
  background: #55436f;
}

/* Coach / notes retain semantic colours within the Midnight frame. */
.theme-midnight :is(.raid-coach-action, .russian-coach-next, .session-trend-action, .raid-coach-stable, .russian-coach-works) {
  border-color: rgba(85, 216, 166, .32);
  background: linear-gradient(145deg, rgba(13, 35, 29, .86), rgba(10, 17, 18, .92));
}

.theme-midnight :is(.raid-coach-why, .mechanic-consequences, .root-chain-dot, .raid-note-action) {
  border-color: #3d466e;
  background: linear-gradient(145deg, rgba(24, 25, 48, .86), rgba(13, 13, 25, .93));
}

.theme-midnight .raid-notes textarea {
  color: #e4dcf2;
  background: #07060d;
}

.theme-midnight .site-footer {
  color: #827d8d;
  border-top-color: #342a40;
}

.theme-midnight .footer-support {
  color: #bfb2d8;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.theme-midnight .support-card {
  border-color: #806498;
  background:
    radial-gradient(circle at 80% 0, rgba(112, 72, 197, .2), transparent 35%),
    var(--midnight-surface-raised);
}

.theme-midnight .support-note {
  color: #ddd0f1;
  border-color: #564163;
  background: rgba(80, 49, 103, .22);
}

@media (max-width: 1000px) {
  .theme-midnight .shell {
    width: min(100% - 20px, 1460px);
  }

  .theme-midnight .hero {
    min-height: 0;
    padding: 34px 30px 30px;
  }

  .theme-midnight .hero::before {
    right: -90px;
    opacity: .48;
  }
}

@media (max-width: 700px) {
  .theme-midnight {
    background-attachment: scroll;
  }

  .theme-midnight .topbar {
    border-bottom-color: #4d405e;
  }

  .theme-midnight .shell {
    width: min(100% - 12px, 1460px);
    padding-top: 14px;
  }

  .theme-midnight .hero {
    padding: 28px 20px 22px;
    border-radius: 4px 4px 15px 15px;
  }

  .theme-midnight .hero::before {
    width: 210px;
    height: 210px;
    right: -120px;
  }

  .theme-midnight .hero h1 {
    font-size: clamp(31px, 10.5vw, 42px);
  }

  .theme-midnight .workspace,
  .theme-midnight :is(.fight-review, .session-review, .strategy-review, .raid-coach, .russian-coach, .raid-night-coach, .coach-planner-bridge, .raid-notes) {
    border-radius: 10px;
    box-shadow: var(--midnight-inset), 0 12px 28px rgba(0, 0, 0, .3);
  }

  .theme-midnight button:not(.support-backdrop):hover:not(:disabled),
  .theme-midnight .file-action:hover,
  .theme-midnight .pillar:hover {
    transform: none;
  }
}

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

@media (prefers-contrast: more) {
  .theme-midnight {
    --line: #67597b;
    --muted: #c8c3d0;
    --midnight-muted: #c8c3d0;
  }

  .theme-midnight :is(button, input, select, textarea, .workspace, .pillar, .fight-review) {
    border-width: 2px;
  }
}
