/* WEBME 2040 HUD — structural layer. Colors still follow theme CSS variables. */
html { scrollbar-width: auto; scrollbar-color: var(--accent-primary, #3ee0ff) #071018; }
body.wme-2040 {
  background:
    radial-gradient(1200px 500px at 10% -10%, color-mix(in srgb, var(--accent-primary, #3ee0ff) 18%, transparent), transparent 60%),
    linear-gradient(180deg, rgba(8,14,24,.2), rgba(5,8,14,.55)),
    var(--bg-primary, #05070d);
  background-attachment: fixed;
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: 0;
}
body.wme-2040::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(62,224,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(62,224,255,.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 30% 0%, #000 0%, transparent 75%);
  z-index: 0;
}
body.wme-2040 > * { z-index: 1; }
body.wme-2040 .nav { position: fixed; z-index: 200; }
body.wme-2040 .modal-overlay { position: fixed; z-index: 300; }
body.wme-2040, body.wme-2040 * { hyphens: none; }
body.wme-2040 h1, body.wme-2040 h2, body.wme-2040 h3, body.wme-2040 p,
body.wme-2040 .tn-name, body.wme-2040 .pi-domain, body.wme-2040 .issue span,
body.wme-2040 label, body.wme-2040 .rh-title {
  overflow-wrap: break-word;
  word-break: normal;
}
body.wme-2040 pre, body.wme-2040 .fix-detail, body.wme-2040 .pi-url, body.wme-2040 .sp-url {
  overflow-wrap: anywhere;
}

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: #071018; }
::-webkit-scrollbar-thumb { background: var(--accent-primary, #3ee0ff); border-radius: 8px; border: 2px solid #071018; }
::-webkit-scrollbar-thumb:hover { filter: brightness(1.15); }

body.wme-2040 :focus-visible {
  outline: 2px solid var(--accent-primary, #3ee0ff);
  outline-offset: 2px;
}

body.wme-2040 .nav {
  height: 64px;
  padding: 0 16px 0 12px;
  background: color-mix(in srgb, var(--bg-primary, #05070d) 82%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--accent-primary, #3ee0ff) 35%, var(--border-primary, #1e293b));
  z-index: 200;
}
body.wme-2040 .logo-link { gap: 10px; min-height: 44px; }
body.wme-2040 .wme-mark {
  width: 28px; height: 28px; border-radius: 8px; display: inline-block;
  background:
    linear-gradient(135deg, transparent 46%, var(--accent-primary, #3ee0ff) 46% 54%, transparent 54%),
    linear-gradient(45deg, transparent 46%, var(--accent-primary, #3ee0ff) 46% 54%, transparent 54%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-primary, #3ee0ff) 50%, transparent), inset 0 0 12px color-mix(in srgb, var(--accent-primary, #3ee0ff) 35%, transparent);
}
body.wme-2040 .nav .logo { font-size: 18px; letter-spacing: .18em; font-weight: 700; }
body.wme-2040 .nav .logo span { color: var(--accent-primary, #3ee0ff); letter-spacing: .18em; }

body.wme-2040 .auth-page {
  min-height: 100vh;
  padding: 88px 20px 32px;
  align-items: flex-start;
  justify-content: center;
}
body.wme-2040 .auth-box {
  width: min(440px, 100%);
  max-width: none;
  margin-top: 6vh;
  background: color-mix(in srgb, var(--bg-card, #111827) 78%, transparent);
  backdrop-filter: blur(18px);
  border: 1px solid color-mix(in srgb, var(--accent-primary, #3ee0ff) 40%, var(--border-primary, #1e293b));
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
body.wme-2040 .auth-box .btn, body.wme-2040 .btn, body.wme-2040 .tool-nav, body.wme-2040 .chip, body.wme-2040 .tab, body.wme-2040 .admin-tab {
  min-height: 44px;
}
body.wme-2040 .btn { border-radius: 10px; }
body.wme-2040 .field input, body.wme-2040 .field textarea, body.wme-2040 .field select, body.wme-2040 .url-bar-top input {
  min-height: 44px;
  border-radius: 10px;
}

body.wme-2040 .app-layout { margin-top: 64px; height: calc(100vh - 64px); width: 100%; }
body.wme-2040 .sidebar {
  top: 64px;
  width: 248px;
  min-width: 248px;
  background: color-mix(in srgb, var(--bg-sidebar, #080b11) 88%, transparent);
  backdrop-filter: blur(12px);
  border-right: 1px solid color-mix(in srgb, var(--accent-primary, #3ee0ff) 22%, var(--border-primary, #1e293b));
}
body.wme-2040 .workspace {
  margin-left: 248px;
  margin-right: 300px;
  width: auto;
  background: transparent;
}
body.wme-2040 .tool-nav { padding: 8px 14px; border-radius: 0; }
body.wme-2040 .tool-nav.active {
  background: color-mix(in srgb, var(--accent-primary, #3ee0ff) 14%, transparent);
}
body.wme-2040 .url-bar-top, body.wme-2040 .project-panel, body.wme-2040 .results-panel, body.wme-2040 .admin-panel, body.wme-2040 .theme-panel {
  padding-left: 20px;
  padding-right: 20px;
}
body.wme-2040 .results-panel { padding-top: 16px; padding-bottom: 28px; }
body.wme-2040 .score-item, body.wme-2040 .stat-card, body.wme-2040 .project-item, body.wme-2040 .fix-card, body.wme-2040 .theme-section, body.wme-2040 .user-detail {
  background: color-mix(in srgb, var(--bg-card, #111827) 80%, transparent);
  backdrop-filter: blur(10px);
  border-color: color-mix(in srgb, var(--accent-primary, #3ee0ff) 22%, var(--border-primary, #1e293b));
}
body.wme-2040 .project-item { transition: transform .18s ease, border-color .18s ease; }
body.wme-2040 .project-item:hover { transform: translateY(-2px); }
body.wme-2040 .score-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
body.wme-2040 .stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
body.wme-2040 .welcome-state { min-height: 0; align-items: stretch; text-align: left; color: var(--text-secondary); padding: 8px 0 24px; }
body.wme-2040 .welcome-state h3, body.wme-2040 .welcome-state p { max-width: none; }

#wme-now {
  display: flex; gap: 12px; align-items: stretch; flex-wrap: wrap;
  padding: 12px 20px; border-bottom: 1px solid var(--border-primary, #1e293b);
  background: color-mix(in srgb, var(--bg-secondary, #111827) 75%, transparent);
}
#wme-now .slot { flex: 1 1 180px; min-width: 0; }
#wme-now .k { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); }
#wme-now .v { font-size: 15px; font-weight: 650; margin-top: 2px; }
#wme-now .go { min-height: 44px; align-self: center; }

#wme-rail {
  position: fixed; top: 64px; right: 0; bottom: 0; width: 300px; z-index: 40;
  overflow: auto; padding: 14px 14px 28px;
  background: color-mix(in srgb, var(--bg-sidebar, #080b11) 90%, transparent);
  border-left: 1px solid color-mix(in srgb, var(--accent-primary, #3ee0ff) 25%, var(--border-primary));
  backdrop-filter: blur(14px);
}
#wme-rail h2 { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); margin: 14px 0 8px; }
#wme-rail .g {
  display: grid; grid-template-columns: 72px 1fr; gap: 10px; align-items: center;
  padding: 10px; border: 1px solid var(--border-primary); border-radius: 12px; margin-bottom: 8px;
  background: color-mix(in srgb, var(--bg-card) 70%, transparent);
}
#wme-rail .ring { width: 64px; height: 64px; }
#wme-rail .muted { color: var(--text-muted); font-size: 13px; }
#wme-rail button, #wme-rail .btn { width: 100%; margin-top: 6px; }
#wme-rail .alert { border-left: 3px solid var(--color-warning, #f59e0b); padding: 8px 10px; margin: 6px 0; font-size: 13px; background: color-mix(in srgb, var(--color-warning, #f59e0b) 10%, transparent); border-radius: 8px; }
#wme-rail .oknote { border-left-color: var(--color-success, #00c48c); background: color-mix(in srgb, var(--color-success, #00c48c) 10%, transparent); }
#wme-rail ul { list-style: none; padding: 0; margin: 0; }
#wme-rail li { padding: 6px 0; border-bottom: 1px solid var(--border-primary); font-size: 13px; }
.heat { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; margin-top: 6px; }
.heat i { display: block; height: 16px; border-radius: 3px; background: var(--border-primary); }
.heat i.on { background: var(--accent-primary, #3ee0ff); }
.map-svg { width: 100%; height: 120px; }
.done-flash { animation: wmeFlash 1.1s ease; }
@keyframes wmeFlash { 0% { box-shadow: inset 0 0 0 0 transparent; } 30% { box-shadow: inset 0 0 0 2px var(--accent-primary, #3ee0ff); } 100% { box-shadow: inset 0 0 0 0 transparent; } }

#wme-palette {
  position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,.55);
  display: none; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px;
}
#wme-palette.open { display: flex; }
#wme-palette .box {
  width: min(640px, 100%);
  background: color-mix(in srgb, var(--bg-card, #111827) 92%, black);
  border: 1px solid color-mix(in srgb, var(--accent-primary) 45%, var(--border-primary));
  border-radius: 16px; padding: 12px; box-shadow: 0 24px 80px rgba(0,0,0,.45);
}
#wme-palette input { width: 100%; min-height: 48px; border-radius: 10px; border: 1px solid var(--border-secondary); background: var(--bg-input); color: var(--text-primary); padding: 0 12px; font-size: 16px; }
#wme-palette .hit { display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: left; background: transparent; color: var(--text-primary); border: 0; border-radius: 8px; padding: 10px 12px; min-height: 44px; cursor: pointer; }
#wme-palette .hit:hover, #wme-palette .hit.active { background: color-mix(in srgb, var(--accent-primary) 16%, transparent); }
#wme-stamp { font-size: 11px; color: var(--text-muted); letter-spacing: .04em; }

body.wme-compact { font-size: 14px; }
body.wme-compact #wme-now { padding: 8px 12px; }
body.wme-compact .results-panel, body.wme-compact .admin-panel, body.wme-compact .theme-panel, body.wme-compact .project-panel { padding-top: 10px; padding-bottom: 12px; }
body.wme-compact .score-item, body.wme-compact .stat-card, body.wme-compact .project-item { padding: 8px 10px; }

@media (max-width: 1100px) {
  body.wme-2040 .workspace { margin-right: 0; }
  #wme-rail { position: static; width: auto; border-left: 0; border-top: 1px solid var(--border-primary); }
  body.wme-2040 .app-layout { height: auto; min-height: calc(100vh - 64px); display: block; }
  body.wme-2040 .sidebar { position: sticky; top: 64px; width: 100%; min-width: 0; height: auto; max-height: 42vh; flex-direction: row; flex-wrap: wrap; overflow: auto; z-index: 50; }
  body.wme-2040 .workspace { margin-left: 0; }
  body.wme-2040 .sidebar-section { min-width: 200px; }
}
@media (max-width: 640px) {
  body.wme-2040 .sidebar { display: flex !important; }
  body.wme-2040 .score-grid, body.wme-2040 .stats-grid, body.wme-2040 .theme-sections { grid-template-columns: 1fr; }
  body.wme-2040 .nav .user-name { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  body.wme-2040 *, body.wme-2040 *::before, body.wme-2040 *::after {
    animation: none !important; transition: none !important;
  }
}
@media print {
  body.wme-2040::before, .nav .right, .sidebar, #wme-rail, #wme-palette, .url-bar-top, .modal-overlay { display: none !important; }
  body.wme-2040 .workspace, body.wme-2040 .app-layout { margin: 0 !important; height: auto !important; display: block !important; }
  body.wme-2040 { background: #fff; color: #111; }
}

body.wme-auth #wme-rail { display: none; }
body.wme-auth #wme-now { display: none; }
