/* =====================================================================
   Modern: a clean, flat take on Grimwar. Slate surfaces, hairline
   borders, soft depth, one ember accent. Runs on the base rules in
   app.css with the classic skin (classic.css) switched off. Every rule
   is scoped to html.modern so the other themes are untouched.
   ===================================================================== */
html.modern {
  --bg: #0b0d12; --bg-2: #0f1218;
  --panel: #141821; --panel-2: #191e29; --panel-3: #222836;
  --line: #232938; --line-2: #313849;
  --text: #e9ebf1; --text-2: #b9c0cd; --muted: #7f8899;
  --accent: #f2b24c; --accent-ink: #1a1204; --accent-soft: rgba(242, 178, 76, .13);
  --good: #4ade80; --bad: #f87171; --warn: #fbbf24; --info: #60a5fa; --magic: #a78bfa;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .38);
  --shadow-s: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 12px rgba(0, 0, 0, .22);
  --radius: 14px; --radius-s: 9px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Alegreya", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --ui: var(--font); --ui-caps: var(--font);
  --display: "Cinzel", "Trajan Pro", "Palatino Linotype", serif;
  /* names the panel feature styles (features.css, map.css) expect from the classic skins */
  --gold-hi: #ffd88f; --gold: var(--accent); --gold-mid: #b98232; --gold-lo: #5a3d10; --gold-deep: #2a1a05;
  --wow-gold: var(--accent); --border: var(--line); --page-bg: var(--bg);
  --tip-bg: var(--panel-2); --tip-line: var(--line-2); --ink-on-frame: var(--text);
  --glass: color-mix(in srgb, var(--bg) 78%, transparent);
  --hover: rgba(255, 255, 255, .05);
  color-scheme: dark;
}
html.modern[data-theme="light"] {
  --bg: #f3f4f7; --bg-2: #ffffff;
  --panel: #ffffff; --panel-2: #f7f8fa; --panel-3: #edeff3;
  --line: #e2e5eb; --line-2: #ccd1da;
  --text: #151922; --text-2: #394050; --muted: #6a7284;
  --accent: #b45309; --accent-ink: #fff; --accent-soft: rgba(180, 83, 9, .1);
  --good: #15803d; --bad: #c2410c; --warn: #a16207; --info: #1d4ed8; --magic: #7c3aed;
  --shadow: 0 1px 2px rgba(20, 25, 40, .06), 0 10px 30px rgba(20, 25, 40, .08);
  --shadow-s: 0 1px 2px rgba(20, 25, 40, .06), 0 3px 10px rgba(20, 25, 40, .05);
  --gold-hi: #d97706; --gold-mid: #b45309; --gold-lo: #fcd9a8;
  --hover: rgba(20, 25, 40, .045);
  color-scheme: light;
}

html.modern body {
  font: 14px/1.5 var(--font); letter-spacing: -.003em; color: var(--text);
  background: radial-gradient(1100px 520px at 50% -260px, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%), var(--bg);
  background-attachment: fixed; font-feature-settings: "cv11", "ss01";
}
html.modern h1, html.modern h2, html.modern h3, html.modern h4 { font-family: var(--font); font-weight: 650; letter-spacing: -.01em; }
html.modern h5 { font-family: var(--font); color: var(--muted); letter-spacing: .06em; }
html.modern .prose { font-family: var(--serif); font-size: 15.5px; line-height: 1.62; }
html.modern .prose h2, html.modern .prose h3 { font-family: var(--font); color: var(--text); }
html.modern ::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
html.modern * { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text) 18%, transparent) transparent; }
html.modern ::-webkit-scrollbar { width: 10px; height: 10px; }
html.modern ::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 16%, transparent); border: 3px solid transparent; background-clip: padding-box; border-radius: 99px; }
html.modern ::-webkit-scrollbar-track { background: transparent; }
html.modern :focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }

/* ---------- Controls ---------- */
html.modern .input { background: var(--bg-2); border-color: var(--line-2); border-radius: var(--radius-s); }
html.modern .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
html.modern .input::placeholder { color: var(--muted); opacity: .85; }
html.modern .btn { border-radius: var(--radius-s); border-color: var(--line-2); background: var(--panel-2); font-weight: 550; box-shadow: var(--shadow-s); }
html.modern .btn:hover { background: var(--panel-3); border-color: color-mix(in srgb, var(--text) 22%, transparent); }
html.modern .btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 4px 14px color-mix(in srgb, var(--accent) 28%, transparent); }
html.modern .btn.primary:hover { filter: brightness(1.07); }
html.modern .btn.danger.primary { background: var(--bad); color: #fff; }
html.modern .icon-btn { border-radius: 8px; color: var(--text-2); }
html.modern .icon-btn:hover { background: var(--hover); color: var(--text); }
html.modern .icon-btn.on, html.modern .icon-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
html.modern .seg { border-color: var(--line-2); background: var(--bg-2); border-radius: var(--radius-s); padding: 2px; gap: 2px; }
html.modern .seg button { border-radius: 7px; }
html.modern .seg button + button { border-left: 0; }
html.modern .seg button.active { background: var(--panel-3); color: var(--text); box-shadow: var(--shadow-s); }
html.modern .chip { background: var(--panel-2); border-color: var(--line-2); }
html.modern .tab.active { color: var(--text); border-color: var(--accent); }
html.modern kbd { background: var(--panel-3); border-color: var(--line-2); color: var(--muted); }

/* ---------- Header ---------- */
html.modern .chrome {
  position: sticky; top: 0; z-index: 30;
  background: var(--glass); -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid var(--line);
}
html.modern .topbar { position: static; background: none; backdrop-filter: none; border: 0; padding: 10px 18px 6px; gap: 10px; min-height: 56px; }
html.modern .brand { gap: 9px; margin-right: 6px; }
html.modern .brand img { width: 32px; height: 32px; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .45)); }
html.modern .wordmark { font: 700 17px/1 var(--display); letter-spacing: .1em; color: var(--text); text-transform: uppercase; }
html.modern .campaign select { max-width: 200px; background: var(--panel-2); font-weight: 600; height: 36px; }
html.modern .search-btn {
  flex: 1 1 260px; max-width: 440px; height: 36px; padding: 0 12px; border-radius: var(--radius-s);
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--muted); font: 13.5px var(--font);
}
html.modern .search-btn:hover { border-color: color-mix(in srgb, var(--text) 25%, transparent); color: var(--text-2); }
html.modern .quick-roll input { width: 210px; height: 36px; background: var(--panel-2); }
html.modern .topbar > .btn.sm { height: 36px; padding: 0 12px; }
html.modern .topbar > .icon-btn { width: 36px; height: 36px; }

html.modern .layout-rail { display: flex; align-items: center; gap: 10px; padding: 4px 18px 10px; }
html.modern .sigil-tabs { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 2px; }
html.modern .sigil-tabs::-webkit-scrollbar { display: none; }
html.modern .sigil-tab {
  display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; height: 38px; padding: 0 14px 0 5px; cursor: pointer;
  background: none; border: 1px solid transparent; border-radius: 999px; color: var(--muted); font: 550 13.5px var(--font);
  transition: background .15s, color .15s, border-color .15s;
}
html.modern .sigil-tab:hover { background: var(--hover); color: var(--text); }
html.modern .sigil-tab.active { background: var(--panel-2); border-color: var(--line-2); color: var(--text); box-shadow: var(--shadow-s); }
html.modern .slot {
  position: relative; display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%;
  color: color-mix(in srgb, var(--hue) 55%, #fff); background: color-mix(in srgb, var(--hue) 20%, transparent);
  transition: background .15s, color .15s;
}
html.modern .slot .sigil-svg { width: 18px; height: 18px; stroke-width: 2.2; }
html.modern .slot kbd { display: none; }
html.modern .sigil-tab:not(.active) .slot { filter: saturate(.6); }
html.modern .sigil-tab.active .slot { color: #fff; background: color-mix(in srgb, var(--hue) 75%, #000); box-shadow: 0 0 0 2px color-mix(in srgb, var(--hue) 35%, transparent); }
html.modern[data-theme="light"] .slot { color: color-mix(in srgb, var(--hue) 80%, #000); background: color-mix(in srgb, var(--hue) 14%, #fff); }
html.modern[data-theme="light"] .sigil-tab.active .slot { color: #fff; background: var(--hue); }
html.modern .layout-ctl .btn { height: 34px; }
html.modern .sigil-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
html.modern .sigil-opt { display: grid; justify-items: center; gap: 8px; padding: 12px 4px 8px; background: none; border: 1px solid transparent; border-radius: 12px; color: var(--text-2); cursor: pointer; font: 12px var(--font); }
html.modern .sigil-opt:hover { background: var(--hover); }
html.modern .sigil-opt.on { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
html.modern .sigil-opt .slot { width: 46px; height: 46px; }
html.modern .sigil-opt .slot .sigil-svg { width: 26px; height: 26px; }
@media (max-width: 1100px) { html.modern .sigil-tab:not(.active) .sigil-name { display: none; } html.modern .sigil-tab:not(.active) { padding-right: 5px; } }

/* ---------- Panels ---------- */
html.modern .grid { gap: 14px; padding: 16px 18px 48px; }
html.modern .panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-s); transition: box-shadow .2s, border-color .2s; }
html.modern .panel:hover { border-color: var(--line-2); }
html.modern .panel-head { min-height: 46px; padding: 6px 8px 6px 14px; background: none; border-bottom: 1px solid var(--line); }
html.modern .ptitle { font: 650 13.5px var(--font); letter-spacing: -.005em; color: var(--text); gap: 9px; }
html.modern .ptitle .ic { color: var(--accent); }
html.modern .panel-ctl { opacity: .55; }
html.modern .panel-body { padding: 12px 14px; }
html.modern .resize { right: 4px; bottom: 4px; }
html.modern .resize::after { border-color: color-mix(in srgb, var(--text) 22%, transparent); border-radius: 0 0 3px 0; }
html.modern .panel:hover .resize::after { border-color: var(--accent); }
html.modern .panel.maxed { inset: calc(var(--chrome, 104px) + 12px) 18px 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
html.modern .panel.drop-target { outline: 2px dashed var(--accent); outline-offset: 3px; }
html.modern .panel.flash { animation: flash-modern 1s ease; }
@keyframes flash-modern { 0%, 100% { box-shadow: var(--shadow-s); } 30% { box-shadow: 0 0 0 3px var(--accent), 0 0 24px color-mix(in srgb, var(--accent) 35%, transparent); } }
html.modern .empty-grid p, html.modern .empty p { font-family: var(--font); }

/* ---------- Overlays ---------- */
html.modern .popover { background: var(--panel-2); border-color: var(--line-2); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
html.modern .pop-item { border-radius: 8px; }
html.modern .pop-item:hover { background: var(--hover); }
html.modern .modal-wrap, html.modern .palette-wrap { background: rgba(5, 7, 12, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
html.modern[data-theme="light"] .modal-wrap, html.modern[data-theme="light"] .palette-wrap { background: rgba(20, 25, 40, .3); }
html.modern .modal, html.modern .palette { background: var(--panel); border-color: var(--line-2); border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
html.modern .modal header { padding: 18px 20px 8px; }
html.modern .modal-body { padding: 8px 20px 14px; }
html.modern .modal footer { padding: 14px 20px; border-color: var(--line); }
html.modern .pal-item.sel { background: var(--accent-soft); }
html.modern .toast { background: var(--panel-2); border-color: var(--line-2); border-radius: 12px; box-shadow: var(--shadow); }
html.modern .toast.roll .toast-body > b { font-family: var(--font); font-weight: 750; }
html.modern .drawer { top: var(--chrome, 104px); background: var(--panel); border-left: 1px solid var(--line-2); }

/* ---------- Login ---------- */
html.modern .login-crest { display: block; margin: 0 auto 6px; }
html.modern .login-card { border-radius: 18px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
html.modern .login-card .wordmark { font-size: 1.4rem; text-align: center; justify-self: center; }
