:root {
  color-scheme: light dark;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  --page-bg: #d8d4c8;
  --surface: #eeece4;
  --surface-strong: #f8f6ef;
  --surface-muted: #d2cfc3;
  --ink: #22231f;
  --muted: #65665f;
  --line: #aaa89d;
  --accent: #6e3d23;
  --accent-strong: #4d2816;
  --accent-soft: #d6b28e;
  --positive: #376d4f;
  --warning: #9a6d25;
  --danger: #8f3d38;
  --shadow: 0 24px 70px rgba(39, 35, 25, .18);
  --radius: 18px;
}

:root[data-theme="light"] {
  --page-bg: #f4f1e8;
  --surface: #fffdf7;
  --surface-strong: #ffffff;
  --surface-muted: #ece7da;
  --ink: #1e211d;
  --muted: #666960;
  --line: #cbc6b7;
  --accent: #7c3f20;
  --accent-strong: #572813;
  --accent-soft: #e5c19a;
  --shadow: 0 24px 70px rgba(66, 54, 35, .14);
}

:root[data-theme="dark"] {
  --page-bg: #11130f;
  --surface: #1a1d18;
  --surface-strong: #22261f;
  --surface-muted: #2b3028;
  --ink: #eeeee5;
  --muted: #a7aa9e;
  --line: #3e4439;
  --accent: #c37b48;
  --accent-strong: #e09a64;
  --accent-soft: #704527;
  --positive: #65a87d;
  --warning: #d3a355;
  --danger: #d0746d;
  --shadow: 0 28px 80px rgba(0, 0, 0, .42);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 50% 0, color-mix(in srgb, var(--accent-soft) 35%, transparent), transparent 38rem), var(--page-bg); color: var(--ink); }
a { color: inherit; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 75%, white); outline-offset: 3px; }

.skip-link { position: fixed; z-index: 100; left: 1rem; top: 1rem; padding: .7rem 1rem; background: var(--surface-strong); border: 1px solid var(--line); border-radius: 10px; transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }

.portal-shell { width: min(1500px, calc(100% - 32px)); margin: 16px auto; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.portal-header { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface-strong) 92%, transparent); }
.brand-link { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50% 50% 44% 44%; background: linear-gradient(145deg, var(--accent-strong), var(--accent)); color: #fff8e9; font-family: Georgia, serif; font-size: 1.65rem; font-weight: 800; box-shadow: inset 0 0 0 4px rgba(255,255,255,.12); }
.brand-link strong { display: block; font-family: Georgia, serif; letter-spacing: .12em; font-size: 1.15rem; }
.brand-link small { display: block; margin-top: 3px; color: var(--muted); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.server-pill { display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--muted); background: var(--surface); font-size: .82rem; }
.status-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 4px color-mix(in srgb, var(--muted) 20%, transparent); }
.status-online .status-dot { background: var(--positive); box-shadow: 0 0 0 4px color-mix(in srgb, var(--positive) 20%, transparent); }
.status-offline .status-dot { background: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 20%, transparent); }
.status-maintenance .status-dot { background: var(--warning); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warning) 20%, transparent); }
.play-button { display: inline-flex; align-items: center; gap: 18px; padding: 12px 20px; border-radius: 12px; background: linear-gradient(145deg, var(--accent), var(--accent-strong)); color: #fff8e9; text-decoration: none; font-weight: 800; letter-spacing: .04em; box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 28%, transparent); }
.play-button:hover { transform: translateY(-1px); }
.play-button.is-active { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }

.portal-banner { position: relative; min-height: 255px; overflow: hidden; border-bottom: 1px solid var(--line); background: linear-gradient(#c6bfa8 0 42%, #8f9577 43% 58%, #4e5a3e 59% 100%); isolation: isolate; }
.portal-banner::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 72% 18%, rgba(255,248,208,.82) 0 4%, transparent 4.5%), linear-gradient(180deg, transparent 0 56%, rgba(27,34,22,.22)); }
.portal-banner::after { content: ""; position: absolute; left: -5%; right: -5%; bottom: -40%; height: 78%; border-radius: 50% 50% 0 0; background: linear-gradient(170deg, #65704f, #2e3827); box-shadow: -260px -25px 0 -80px #687352, 280px -10px 0 -70px #414d36; }
.portal-banner-landscape { position: absolute; z-index: 1; left: 14%; bottom: 25%; width: 72%; height: 43%; background: linear-gradient(155deg, transparent 0 23%, #62694f 24% 45%, transparent 46%), linear-gradient(205deg, transparent 0 30%, #73775a 31% 54%, transparent 55%); opacity: .85; filter: drop-shadow(0 12px 7px rgba(30,35,25,.25)); }
.portal-banner-caption { position: absolute; z-index: 3; left: clamp(24px, 7vw, 95px); bottom: 30px; display: flex; align-items: baseline; gap: 14px; padding: 10px 16px; background: color-mix(in srgb, var(--surface-strong) 82%, transparent); border: 1px solid color-mix(in srgb, var(--line) 75%, transparent); backdrop-filter: blur(10px); }
.portal-banner-caption span { font: 800 clamp(1.5rem, 4vw, 3rem)/1 Georgia, serif; letter-spacing: .18em; }
.portal-banner-caption small { color: var(--muted); }

.portal-layout { display: grid; grid-template-columns: minmax(190px, 240px) minmax(0, 1fr) minmax(240px, 320px); min-height: 600px; }
.portal-sidebar { padding: 24px 18px; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--surface-muted) 45%, var(--surface)); }
.primary-nav, .account-nav { display: grid; gap: 5px; }
.primary-nav a, .account-nav a { padding: 11px 13px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: .92rem; }
.primary-nav a:hover, .account-nav a:hover { color: var(--ink); background: var(--surface-strong); }
.primary-nav a.is-active, .account-nav a.is-active { color: #fff8e9; background: var(--accent); font-weight: 700; }
.sidebar-divider { height: 1px; margin: 20px 8px; background: var(--line); }
.alpha-card { margin-top: 26px; padding: 15px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); }
.alpha-card span { display: inline-block; padding: 3px 7px; border-radius: 5px; background: var(--warning); color: #211a0c; font-size: .68rem; font-weight: 900; letter-spacing: .12em; }
.alpha-card p { margin: 10px 0 0; font: .76rem/1.45 ui-monospace, Consolas, monospace; }

.portal-content { min-width: 0; padding: clamp(24px, 4vw, 58px); background: var(--surface-strong); }
.hero-panel { display: grid; grid-template-columns: minmax(0, 1fr) 170px; gap: 28px; align-items: center; padding-bottom: 44px; border-bottom: 1px solid var(--line); }
.eyebrow, .section-kicker, .aside-heading p { margin: 0 0 12px; color: var(--accent); font-size: .72rem; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; max-width: 800px; font: 800 clamp(2rem, 5vw, 4.6rem)/.98 Georgia, serif; letter-spacing: -.035em; }
.hero-lead { max-width: 730px; margin: 22px 0 0; color: var(--muted); font-size: clamp(1rem, 1.8vw, 1.26rem); line-height: 1.65; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 11px; margin-top: 28px; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 46px; padding: 10px 18px; border: 1px solid transparent; border-radius: 11px; text-decoration: none; font-weight: 800; cursor: pointer; }
.button-primary { background: var(--accent); color: #fff8e9; }
.button-secondary { border-color: var(--line); background: var(--surface); }
.button.is-disabled { opacity: .52; }
.hero-sigil { width: 150px; aspect-ratio: 1; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: radial-gradient(circle, var(--accent-soft), transparent 68%); }
.hero-sigil span { width: 105px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff8e9; font: 800 4.2rem Georgia, serif; box-shadow: inset 0 0 0 8px color-mix(in srgb, white 13%, transparent); }
.content-section { padding-top: 42px; }
.content-section h2, .page-panel h1 { margin: 0; font: 800 clamp(1.8rem, 3.5vw, 3rem)/1.08 Georgia, serif; }
.content-section > p:not(.section-kicker), .page-panel > p { max-width: 780px; color: var(--muted); line-height: 1.72; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 30px; }
.feature-card { min-height: 220px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.feature-card h3 { margin: 17px 0 8px; font-family: Georgia, serif; }
.feature-card p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.feature-icon { width: 42px; height: 42px; display: block; border-radius: 13px; background: color-mix(in srgb, var(--accent) 18%, var(--surface-strong)); position: relative; }
.feature-icon::after { content: ""; position: absolute; inset: 12px; border: 2px solid var(--accent); transform: rotate(45deg); }
.feature-world::after { border-radius: 50%; transform: none; }
.feature-access::after { inset: 11px 8px 14px; border-radius: 3px; transform: none; }

.events-aside { padding: 25px 20px; border-left: 1px solid var(--line); background: color-mix(in srgb, var(--surface-muted) 28%, var(--surface)); }
.aside-heading h2 { margin: 0; font: 800 1.35rem/1.1 Georgia, serif; }
.event-list { display: grid; gap: 12px; margin-top: 22px; }
.event-item { display: grid; grid-template-columns: 38px minmax(0,1fr); gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-strong); }
.event-item div { min-width: 0; }
.event-item small, .event-item span { display: block; color: var(--muted); font-size: .7rem; }
.event-item strong { display: block; margin: 4px 0 8px; font-size: .86rem; line-height: 1.28; }
.event-icon { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); position: relative; }
.event-icon::after { content: ""; position: absolute; inset: 9px; border: 2px solid var(--accent); border-radius: 50%; }
.event-sun::after { border-radius: 2px; transform: rotate(45deg); }
.event-tools::after { border-radius: 0; border-width: 0 0 3px 3px; transform: rotate(-45deg); }
.events-note { margin-top: 20px; color: var(--muted); font-size: .78rem; line-height: 1.5; }

.page-panel { max-width: 850px; min-height: 420px; }
.page-panel .text-link { display: inline-block; margin-top: 24px; color: var(--accent); font-weight: 800; }
.notice { display: inline-block; margin-top: 20px; padding: 11px 14px; border: 1px solid color-mix(in srgb, var(--warning) 55%, var(--line)); border-radius: 9px; background: color-mix(in srgb, var(--warning) 14%, transparent); color: var(--ink) !important; font-size: .85rem; }
.portal-form { display: grid; gap: 15px; max-width: 480px; margin-top: 28px; }
.portal-form label { display: grid; gap: 7px; color: var(--muted); font-size: .82rem; font-weight: 700; }
.portal-form input { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); padding: 10px 12px; }
.portal-form input:disabled, .portal-form button:disabled { opacity: .58; cursor: not-allowed; }
.character-placeholders { display: grid; grid-template-columns: repeat(2, minmax(0, 190px)); gap: 15px; margin-top: 28px; }
.character-placeholders article { min-height: 170px; display: grid; place-items: center; align-content: center; gap: 12px; border: 1px dashed var(--line); border-radius: 14px; background: var(--surface); color: var(--muted); }
.character-placeholders span { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-muted); font: 800 1.7rem Georgia, serif; }
.client-frame { min-height: 250px; margin-top: 28px; display: grid; place-items: center; align-content: center; gap: 12px; border: 1px solid var(--line); border-radius: 14px; background: repeating-linear-gradient(135deg, var(--surface) 0 16px, color-mix(in srgb, var(--surface-muted) 34%, var(--surface)) 16px 32px); color: var(--muted); }
.client-frame-mark { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff8e9; font: 800 2.4rem Georgia, serif; }
.status-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; max-width: 570px; margin-top: 28px; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.status-card small { color: var(--muted); }
.status-details { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-top: 15px; color: var(--muted); }

.portal-footer { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px 30px; padding: 18px 22px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface-muted) 50%, var(--surface)); }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-links a { color: var(--muted); font-size: .82rem; text-decoration: none; }
.footer-links a:hover { color: var(--ink); }
.footer-controls { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .78rem; }
.footer-controls select { height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-strong); color: var(--ink); padding: 0 8px; }
.theme-switcher { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.theme-switcher button { border: 0; border-radius: 6px; background: transparent; color: var(--muted); padding: 6px 8px; cursor: pointer; font-size: .72rem; }
.theme-switcher button.is-selected { background: var(--accent); color: #fff8e9; }
.portal-footer > small { grid-column: 1 / -1; color: var(--muted); }

.boot-screen, .fatal-panel { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 14px; text-align: center; }
.boot-screen span { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff8e9; font: 800 2.4rem Georgia, serif; }
.boot-screen p, .fatal-panel p { color: var(--muted); }

@media (max-width: 1050px) {
  .portal-layout { grid-template-columns: 210px minmax(0, 1fr); }
  .events-aside { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  .event-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .portal-shell { width: 100%; margin: 0; border-width: 0; border-radius: 0; }
  .portal-header { align-items: flex-start; padding: 12px 14px; }
  .brand-link small, .server-pill { display: none; }
  .play-button { padding: 11px 15px; }
  .portal-banner { min-height: 190px; }
  .portal-banner-caption { left: 16px; right: 16px; bottom: 16px; align-items: flex-start; flex-direction: column; gap: 4px; }
  .portal-layout { display: flex; flex-direction: column; }
  .portal-sidebar { order: 0; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px; overflow-x: auto; }
  .primary-nav, .account-nav { display: flex; width: max-content; }
  .primary-nav a, .account-nav a { white-space: nowrap; }
  .sidebar-divider, .alpha-card { display: none; }
  .account-nav { margin-top: 7px; }
  .portal-content { order: 1; padding: 28px 18px 38px; }
  .events-aside { order: 2; }
  .hero-panel { grid-template-columns: 1fr; }
  .hero-sigil { display: none; }
  .feature-grid, .event-list { grid-template-columns: 1fr; }
  .feature-card { min-height: auto; }
  .portal-footer { grid-template-columns: 1fr; }
  .footer-controls { align-items: flex-start; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
