:root {
  color-scheme: dark;
  --bg: #050908;
  --panel: rgba(7, 17, 16, .86);
  --panel-strong: rgba(4, 11, 11, .95);
  --line: rgba(133, 255, 212, .2);
  --text: #f0fff9;
  --muted: #91aaa2;
  --cyan: #3fffe2;
  --lime: #a8ff3e;
  --pink: #ff47cc;
  --violet: #9b6cff;
  --danger: #ff536d;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, select, input { font: inherit; }
button { color: inherit; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.screen { width: 100%; height: 100%; }
.hidden { display: none !important; }
.menu-screen {
  overflow-y: auto;
  background:
    radial-gradient(circle at 50% 10%, rgba(63,255,226,.12), transparent 38%),
    radial-gradient(circle at 12% 88%, rgba(155,108,255,.12), transparent 32%),
    linear-gradient(145deg, #06100f, #050608 58%, #0d0812);
}
.menu-screen::before { content:""; position:fixed; inset:0; pointer-events:none; opacity:.35; background-image: radial-gradient(circle, rgba(107,255,215,.45) 0 1px, transparent 1.3px); background-size: 42px 42px; mask-image: linear-gradient(to bottom, black, transparent 75%); }
.menu-shell { width: min(1120px, calc(100% - 28px)); margin: 0 auto; padding: 48px 0 44px; position: relative; }
.eyebrow { font-size: .72rem; letter-spacing: .22em; color: var(--cyan); font-weight: 800; }
h1 { margin: 10px 0 -6px; font-size: clamp(3.2rem, 9vw, 7rem); line-height: .88; letter-spacing: -.06em; text-shadow: 0 0 34px rgba(63,255,226,.16); }
h2 { margin: 0; color: var(--lime); font-size: clamp(1rem, 3vw, 1.8rem); letter-spacing: .42em; }
.tagline { max-width: 720px; color: var(--muted); font-size: clamp(1rem, 2vw, 1.18rem); line-height: 1.6; }
.setup-grid { display: grid; grid-template-columns: 1.4fr .8fr; gap: 18px; margin-top: 30px; }
.setup-panel { border: 1px solid var(--line); background: linear-gradient(180deg, rgba(9,22,20,.82), rgba(4,10,10,.9)); border-radius: 22px; padding: 20px; backdrop-filter: blur(12px); }
.setup-panel h3 { margin: 0 0 16px; font-size: 1rem; letter-spacing: .08em; text-transform: uppercase; }
.commander-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.commander-card { text-align: left; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.025); border-radius: 16px; padding: 15px; min-height: 142px; cursor: pointer; transition: transform .16s ease, border-color .16s ease, background .16s ease; }
.commander-card:hover { transform: translateY(-2px); border-color: var(--team); }
.commander-card.active { border-color: var(--team); background: color-mix(in srgb, var(--team) 12%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--team) 25%, transparent); }
.commander-cap { width: 42px; height: 22px; border-radius: 55% 55% 35% 35%; background: var(--team); box-shadow: 0 0 20px var(--team); margin-bottom: 12px; position: relative; }
.commander-cap::after { content:""; position:absolute; width:10px; height:18px; left:16px; top:16px; border-radius:4px; background: color-mix(in srgb, var(--team) 45%, white); }
.commander-card strong { display:block; font-size:1rem; }
.commander-card small { display:block; margin-top:5px; color:var(--muted); line-height:1.35; }
.commander-card em { display:block; margin-top:9px; color:var(--team); font-size:.72rem; font-style:normal; font-weight:800; letter-spacing:.07em; }
.match-panel { display:flex; flex-direction:column; }
.field-label { margin: 4px 0 7px; color:var(--muted); font-size:.78rem; font-weight:700; text-transform:uppercase; letter-spacing:.09em; }
.segmented { display:grid; grid-template-columns:repeat(3,1fr); border:1px solid var(--line); border-radius:12px; overflow:hidden; margin-bottom:18px; }
.segmented button { border:0; border-right:1px solid var(--line); background:rgba(255,255,255,.025); padding:11px; cursor:pointer; }
.segmented button:last-child { border-right:0; }
.segmented button.active { background:var(--cyan); color:#03100e; font-weight:900; }
select { width:100%; border:1px solid var(--line); border-radius:12px; padding:11px; background:#071311; color:var(--text); margin-bottom:18px; }
.map-card { display:flex; align-items:center; gap:12px; border:1px solid var(--line); border-radius:15px; padding:12px; margin-bottom:18px; background:rgba(63,255,226,.035); }
.map-card strong, .map-card small { display:block; }
.map-card small { color:var(--muted); margin-top:3px; line-height:1.3; }
.map-glyph { width:62px; aspect-ratio:1; border:1px solid rgba(63,255,226,.25); border-radius:14px; position:relative; flex:0 0 auto; background:radial-gradient(circle, rgba(168,255,62,.28), transparent 25%), #06100f; }
.map-glyph span { position:absolute; width:10px; height:10px; border-radius:50%; background:var(--cyan); box-shadow:0 0 10px var(--cyan); }
.map-glyph span:nth-child(1){left:8px;top:8px}.map-glyph span:nth-child(2){right:8px;top:8px}.map-glyph span:nth-child(3){left:8px;bottom:8px}.map-glyph span:nth-child(4){right:8px;bottom:8px}.map-glyph i{position:absolute;inset:24px;border:2px solid var(--lime);border-radius:50%}
.primary-button, .secondary-button { border-radius:13px; padding:13px 16px; font-weight:900; letter-spacing:.08em; cursor:pointer; }
.primary-button { border:0; background:linear-gradient(100deg,var(--cyan),var(--lime)); color:#03110e; box-shadow:0 0 28px rgba(63,255,226,.16); }
.secondary-button { border:1px solid var(--line); background:rgba(255,255,255,.035); }
.control-note { color:var(--muted); font-size:.75rem; line-height:1.45; margin:12px 0 0; }
.game-screen { position:relative; background:#030706; touch-action:none; }
#gameCanvas { display:block; width:100%; height:100%; cursor:crosshair; }
.hud-top { position:absolute; z-index:5; top:0; left:0; right:0; height:62px; display:flex; align-items:center; gap:18px; padding:8px max(10px, env(safe-area-inset-left)); background:linear-gradient(180deg,rgba(3,10,9,.96),rgba(3,10,9,.65),transparent); pointer-events:none; }
.brand-lockup { margin-right:auto; line-height:1; }
.brand-lockup strong, .brand-lockup span { display:block; }
.brand-lockup strong { font-size:.88rem; letter-spacing:.08em; }
.brand-lockup span { font-size:.56rem; color:var(--lime); letter-spacing:.16em; margin-top:4px; }
.resource-readout, .match-readout { border-left:1px solid var(--line); padding-left:14px; min-width:98px; }
.resource-readout strong, .match-readout strong { display:block; font-size:.95rem; }
.resource-readout small, .match-readout small { display:block; color:var(--muted); font-size:.54rem; letter-spacing:.09em; margin-top:2px; }
.nutrient-dot { float:left; width:10px; height:10px; border-radius:50%; margin:5px 7px 0 0; background:var(--lime); box-shadow:0 0 12px var(--lime); }
.icon-button { pointer-events:auto; width:42px; height:42px; border:1px solid var(--line); border-radius:12px; background:var(--panel); cursor:pointer; font-weight:900; }
.objective-panel { position:absolute; z-index:4; left:12px; top:72px; width:min(280px,calc(100% - 24px)); padding:10px 12px; border-left:3px solid var(--cyan); background:rgba(4,13,12,.72); backdrop-filter:blur(6px); pointer-events:none; }
.objective-panel span, .objective-panel strong { display:block; }
.objective-panel span { color:var(--cyan); font-size:.55rem; letter-spacing:.14em; }
.objective-panel strong { font-size:.72rem; margin-top:3px; }
.selection-panel { position:absolute; z-index:5; left:12px; right:12px; bottom:calc(12px + var(--safe-bottom)); min-height:82px; display:flex; gap:14px; align-items:center; padding:10px; border:1px solid var(--line); border-radius:17px; background:var(--panel-strong); backdrop-filter:blur(12px); }
.selection-info { min-width:230px; display:flex; align-items:center; gap:10px; }
.selection-icon { width:50px; height:50px; border-radius:14px; border:1px solid var(--line); display:grid; place-items:center; color:var(--cyan); font-size:1.4rem; background:rgba(63,255,226,.04); }
.selection-info strong, .selection-info small { display:block; }
.selection-info small { color:var(--muted); font-size:.68rem; margin-top:4px; }
.command-grid { flex:1; display:flex; gap:8px; justify-content:flex-end; flex-wrap:wrap; }
.command-button { min-width:92px; min-height:54px; border:1px solid var(--line); border-radius:12px; background:rgba(255,255,255,.035); padding:7px 10px; cursor:pointer; text-align:left; touch-action:manipulation; -webkit-tap-highlight-color:transparent; -webkit-user-select:none; user-select:none; }
.command-button:hover { border-color:var(--cyan); }
.command-button strong, .command-button small { display:block; }
.command-button strong { font-size:.72rem; }
.command-button small { color:var(--muted); font-size:.6rem; margin-top:4px; }
.command-button.active { border-color:var(--lime); background:rgba(168,255,62,.1); }
.command-button:disabled { opacity:.42; cursor:not-allowed; }
.status-toast { position:absolute; z-index:7; top:72px; left:50%; transform:translateX(-50%) translateY(-14px); background:rgba(3,12,11,.92); border:1px solid var(--line); border-radius:999px; padding:8px 14px; font-size:.72rem; opacity:0; transition:.18s; pointer-events:none; }
.status-toast.show { opacity:1; transform:translateX(-50%) translateY(0); }
.modal-overlay { position:absolute; z-index:20; inset:0; display:grid; place-items:center; padding:20px; background:rgba(1,5,5,.78); backdrop-filter:blur(8px); }
.modal-card { width:min(380px,100%); border:1px solid var(--line); border-radius:22px; padding:24px; background:#07110f; text-align:center; }
.modal-card h3 { font-size:2rem; margin:9px 0 16px; }
.modal-card p { color:var(--muted); line-height:1.5; }
.modal-card button { width:100%; margin-top:9px; }
.result-card { width:min(520px,100%); max-height:min(92vh,760px); overflow-y:auto; }
.result-card h3 { font-size:clamp(2.7rem,10vw,4.5rem); letter-spacing:-.06em; }
.match-recap { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:17px 0 13px; text-align:left; }
.match-recap > div { border:1px solid var(--line); border-radius:12px; padding:10px 11px; background:rgba(255,255,255,.025); }
.match-recap span, .match-recap strong { display:block; }
.match-recap span { color:var(--muted); font-size:.57rem; letter-spacing:.08em; }
.match-recap strong { margin-top:4px; color:var(--cyan); font-size:1rem; }
@media (max-width: 760px) {
  .menu-shell { padding-top:28px; }
  .setup-grid { grid-template-columns:1fr; }
  .commander-grid { grid-template-columns:1fr 1fr; }
  .commander-card { min-height:128px; padding:12px; }
  .hud-top { gap:9px; }
  .brand-lockup { display:none; }
  .resource-readout { margin-right:auto; border-left:0; padding-left:0; }
  .match-readout { min-width:80px; }
  .selection-panel { left:6px; right:6px; bottom:calc(6px + var(--safe-bottom)); min-height:70px; padding:7px; gap:7px; }
  .selection-info { min-width:138px; max-width:42%; }
  .selection-icon { width:42px; height:42px; }
  .selection-info strong { font-size:.76rem; }
  .selection-info small { font-size:.57rem; }
  .command-grid { flex-wrap:nowrap; overflow-x:auto; justify-content:flex-start; }
  .command-button { min-width:82px; min-height:50px; }
  .objective-panel { top:59px; left:6px; padding:7px 9px; width:auto; max-width:75%; }
}
@media (max-height: 520px) {
  .hud-top { height:52px; }
  .objective-panel { top:54px; }
  .selection-panel { min-height:62px; }
  .selection-icon { width:38px; height:38px; }
  .command-button { min-height:44px; }
}
#app { width: 100%; height: 100%; }
.commander-cap { display: block; }

/* v0.3.0 macro battlefield, free-for-all diplomacy, faction identity, and paid repair */
.quick-start-card {
  border: 1px solid rgba(168,255,62,.22);
  background: rgba(168,255,62,.045);
  border-radius: 15px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.quick-start-card > strong { display:block; color:var(--lime); font-size:.7rem; letter-spacing:.1em; }
.quick-start-card ol { margin:8px 0 0 19px; padding:0; color:var(--muted); font-size:.73rem; line-height:1.5; }
.quick-start-card b { color:var(--text); }
.help-launch { width:100%; margin-top:9px; }
.menu-modal { position:fixed; }
.help-card { width:min(650px,100%); text-align:left; max-height:min(86vh,720px); overflow-y:auto; }
.help-card h3 { text-align:center; font-size:clamp(1.5rem,5vw,2.35rem); margin-bottom:18px; }
.help-card > .eyebrow { display:block; text-align:center; }
.control-columns { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.control-columns section { border:1px solid var(--line); border-radius:14px; padding:13px; background:rgba(255,255,255,.025); }
.control-columns section > strong { color:var(--cyan); font-size:.72rem; letter-spacing:.1em; }
.control-columns p { margin:7px 0 0; font-size:.8rem; line-height:1.55; }
.production-flow { border-left:3px solid var(--lime); background:rgba(168,255,62,.055); padding:11px 13px; margin:13px 0 5px; }
.production-flow strong, .production-flow span { display:block; }
.production-flow strong { color:var(--lime); font-size:.68rem; letter-spacing:.1em; }
.production-flow span { margin-top:5px; font-size:.8rem; line-height:1.45; }
.briefing-steps { display:grid; gap:8px; margin-bottom:13px; }
.briefing-steps > div { display:flex; align-items:center; gap:10px; border:1px solid var(--line); border-radius:12px; padding:9px 11px; background:rgba(255,255,255,.022); }
.briefing-steps b { width:28px; height:28px; flex:0 0 auto; display:grid; place-items:center; border-radius:50%; background:var(--cyan); color:#03110e; }
.briefing-steps span { font-size:.8rem; line-height:1.35; }
.help-card > p { font-size:.78rem; margin:9px 0; }
.coach-panel { position:absolute; z-index:5; left:12px; top:128px; width:min(330px,calc(100% - 24px)); padding:10px 12px; border:1px solid rgba(168,255,62,.22); border-left:3px solid var(--lime); background:rgba(4,13,12,.82); backdrop-filter:blur(7px); pointer-events:none; transition:opacity .2s ease, transform .2s ease; }
.coach-panel.complete { opacity:0; transform:translateY(-8px); }
.coach-panel span, .coach-panel strong { display:block; }
.coach-panel span { color:var(--lime); font-size:.55rem; letter-spacing:.14em; }
.coach-panel strong { font-size:.72rem; margin-top:4px; line-height:1.35; }
.minimap { position:absolute; z-index:5; right:12px; top:72px; width:220px; height:146px; border:1px solid rgba(63,255,226,.28); border-radius:13px; background:rgba(2,8,8,.88); box-shadow:inset 0 0 0 1px rgba(255,255,255,.025); cursor:pointer; touch-action:none; }
@media (max-width: 760px) {
  .control-columns { grid-template-columns:1fr; }
  .help-card { max-height:90vh; padding:18px; }
  .coach-panel { left:6px; top:100px; max-width:64%; padding:7px 9px; }
  .minimap { right:6px; top:59px; width:132px; height:88px; border-radius:10px; }
}
@media (max-height: 520px) {
  .coach-panel { top:90px; max-width:58%; }
  .minimap { top:54px; width:124px; height:82px; }
  .help-card { max-height:94vh; }
}

.economy-strip { display:flex; flex-wrap:wrap; gap:7px; align-items:center; margin:-4px 0 14px; padding:10px 12px; border:1px solid var(--line); border-radius:13px; background:rgba(255,255,255,.022); }
.economy-strip strong { color:var(--cyan); font-size:.65rem; letter-spacing:.1em; margin-right:3px; }
.economy-strip span { border:1px solid rgba(255,255,255,.08); border-radius:999px; padding:4px 7px; color:var(--muted); font-size:.62rem; }

/* v0.4.1 mobile command reliability, touch multi-select, finite fields, and camera buffer */
.cinematic-overlay {
  position:absolute;
  z-index:30;
  inset:0;
  display:grid;
  place-items:center;
  overflow:hidden;
  padding:20px;
  background:
    radial-gradient(circle at 50% 45%, rgba(63,255,226,.08), transparent 38%),
    linear-gradient(135deg, rgba(2,8,7,.98), rgba(10,5,13,.98));
}
.cinematic-overlay.hidden { display:none; }
.cinematic-canvas {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  pointer-events:none;
}
.cinematic-grid {
  position:absolute;
  inset:-20%;
  opacity:.16;
  background-image:
    linear-gradient(rgba(63,255,226,.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(63,255,226,.10) 1px, transparent 1px);
  background-size:42px 42px;
  transform:perspective(700px) rotateX(62deg) translateY(18%);
  animation:cinematic-grid-drift 7s linear infinite;
}
.cinematic-scanlines {
  position:absolute;
  inset:0;
  pointer-events:none;
  opacity:.18;
  background:repeating-linear-gradient(180deg, transparent 0 3px, rgba(255,255,255,.08) 4px);
  animation:cinematic-scan 5s linear infinite;
}
.cinematic-shell {
  position:relative;
  z-index:3;
  align-self:end;
  width:min(680px,100%);
  margin-bottom:clamp(16px,4vh,42px);
  text-align:center;
  padding:clamp(18px,4vw,34px);
  border-top:1px solid rgba(63,255,226,.32);
  border-bottom:1px solid rgba(168,255,62,.22);
  background:linear-gradient(90deg,transparent,rgba(3,12,11,.88) 17%,rgba(3,12,11,.88) 83%,transparent);
  backdrop-filter:blur(3px);
  animation:cinematic-enter .62s ease both;
}
.cinematic-emblem {
  --cinematic-color:var(--cyan);
  position:relative;
  width:68px;
  height:68px;
  margin:0 auto 10px;
  border:1px solid color-mix(in srgb, var(--cinematic-color) 60%, transparent);
  border-radius:50%;
  box-shadow:0 0 42px color-mix(in srgb, var(--cinematic-color) 25%, transparent), inset 0 0 28px rgba(255,255,255,.035);
  animation:cinematic-pulse 2.2s ease-in-out infinite;
}
.cinematic-emblem::before,
.cinematic-emblem::after,
.cinematic-emblem span,
.cinematic-emblem i,
.cinematic-emblem b { position:absolute; content:""; display:block; }
.cinematic-emblem::before { inset:9px; border:2px dashed var(--cinematic-color); border-radius:50%; animation:cinematic-spin 8s linear infinite; }
.cinematic-emblem::after { left:15px; right:15px; top:17px; height:17px; border-radius:50% 50% 18% 18%; background:var(--cinematic-color); box-shadow:0 0 22px var(--cinematic-color); }
.cinematic-emblem span { left:29px; top:30px; width:9px; height:23px; border-radius:7px; background:#eafff8; }
.cinematic-emblem i { left:12px; right:12px; bottom:10px; height:2px; background:linear-gradient(90deg,transparent,var(--cinematic-color),transparent); }
.cinematic-emblem b { inset:4px; border:1px solid rgba(255,255,255,.08); border-radius:50%; animation:cinematic-spin 13s linear infinite reverse; }
.cinematic-eyebrow { display:block; color:var(--cyan); font-size:.66rem; letter-spacing:.24em; font-weight:900; }
.cinematic-shell h3 { margin:7px 0 9px; font-size:clamp(2rem,7vw,4.4rem); line-height:.92; letter-spacing:-.055em; text-shadow:0 0 30px rgba(63,255,226,.14); }
.cinematic-shell p { margin:0; color:var(--text); font-size:clamp(1rem,2.5vw,1.28rem); font-weight:800; }
.cinematic-shell small { display:block; max-width:590px; margin:9px auto 16px; color:var(--muted); line-height:1.55; font-size:.82rem; }
.cinematic-shell button { width:min(310px,100%); }
.cinematic-overlay.victory { background:radial-gradient(circle at 50% 45%, rgba(168,255,62,.10), transparent 40%),linear-gradient(135deg,rgba(2,8,7,.98),rgba(5,14,7,.98)); }
.cinematic-overlay.victory .cinematic-eyebrow { color:var(--lime); }
.cinematic-overlay.defeat { background:radial-gradient(circle at 50% 45%, rgba(255,83,109,.11), transparent 40%),linear-gradient(135deg,rgba(10,3,5,.99),rgba(3,5,6,.99)); }
.cinematic-overlay.defeat .cinematic-eyebrow { color:var(--danger); }
.cinematic-overlay.defeat .cinematic-emblem { filter:grayscale(.35); animation:cinematic-fail 1.7s ease-in-out infinite; }
@keyframes cinematic-enter { from { opacity:0; transform:scale(.96) translateY(14px); } to { opacity:1; transform:none; } }
@keyframes cinematic-spin { to { transform:rotate(360deg); } }
@keyframes cinematic-pulse { 50% { transform:scale(1.035); filter:brightness(1.18); } }
@keyframes cinematic-fail { 0%,100% { transform:translateX(0); opacity:1; } 47% { transform:translateX(0); } 48% { transform:translateX(-5px); opacity:.72; } 50% { transform:translateX(4px); } 52% { transform:translateX(0); opacity:1; } }
@keyframes cinematic-grid-drift { to { transform:perspective(700px) rotateX(62deg) translateY(8%); } }
@keyframes cinematic-scan { to { background-position-y:80px; } }
@media (max-height:520px) {
  .cinematic-shell { padding:10px 20px; margin-bottom:8px; }
  .cinematic-emblem { display:none; }
  .cinematic-shell h3 { margin:6px 0 8px; font-size:clamp(1.8rem,8vw,3.4rem); }
  .cinematic-shell small { margin:5px auto 8px; }
}

@media (prefers-reduced-motion:reduce) {
  .cinematic-grid, .cinematic-scanlines, .cinematic-shell, .cinematic-emblem,
  .cinematic-emblem::before, .cinematic-emblem b { animation:none !important; }
}

/* v0.4.2 instant combat deployment and procedural intro/result cutscenes */

/* v0.5.0 command, formation, AI strategy, balance, and match recap pass */
@media (max-width:480px) {
  .result-card { padding:18px; }
  .result-card h3 { margin-bottom:8px; }
  .result-card p { margin:6px 0; }
  .match-recap { gap:6px; margin:12px 0 9px; }
  .match-recap > div { padding:8px 9px; }
}

/* v0.5.1 local commander profile and persistent battle record */
.menu-utility {
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:18px;
}
.profile-chip {
  --profile-color:var(--cyan);
  display:flex;
  align-items:center;
  gap:11px;
  width:min(310px,100%);
  min-height:64px;
  margin-top:-10px;
  padding:9px 12px;
  border:1px solid color-mix(in srgb,var(--profile-color) 36%,var(--line));
  border-radius:16px;
  background:linear-gradient(110deg,color-mix(in srgb,var(--profile-color) 9%,rgba(4,12,11,.92)),rgba(4,12,11,.86));
  text-align:left;
  cursor:pointer;
  box-shadow:inset 0 0 24px color-mix(in srgb,var(--profile-color) 5%,transparent);
}
.profile-chip:hover { border-color:var(--profile-color); }
.profile-chip-glyph,
.hud-profile > span {
  --profile-color:var(--cyan);
  display:grid;
  place-items:center;
  flex:0 0 auto;
  color:var(--profile-color);
  border:1px solid color-mix(in srgb,var(--profile-color) 55%,transparent);
  background:color-mix(in srgb,var(--profile-color) 8%,#06100f);
  box-shadow:0 0 20px color-mix(in srgb,var(--profile-color) 18%,transparent),inset 0 0 15px color-mix(in srgb,var(--profile-color) 8%,transparent);
}
.profile-chip-glyph { width:43px; height:43px; border-radius:13px; font-size:1.15rem; }
.profile-chip-copy { min-width:0; flex:1; }
.profile-chip-copy small,
.profile-chip-copy strong,
.profile-chip-copy em { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.profile-chip-copy small { color:var(--muted); font-size:.52rem; letter-spacing:.13em; }
.profile-chip-copy strong { margin-top:3px; font-size:.84rem; letter-spacing:.04em; }
.profile-chip-copy em { margin-top:3px; color:var(--profile-color); font-size:.56rem; font-style:normal; letter-spacing:.08em; }
.profile-chip > b { color:var(--profile-color); font-size:1.35rem; font-weight:400; }

.profile-overlay { z-index:50; }
.profile-card {
  --profile-color:var(--cyan);
  width:min(560px,100%);
  max-height:min(94vh,820px);
  overflow-y:auto;
  padding:26px;
  text-align:left;
  background:
    radial-gradient(circle at 50% 0,color-mix(in srgb,var(--profile-color) 11%,transparent),transparent 38%),
    #07110f;
}
.profile-card > .eyebrow,
.profile-card > h3,
.profile-intro { text-align:center; }
.profile-card > h3 { margin:8px 0 5px; font-size:clamp(1.7rem,6vw,2.45rem); letter-spacing:-.035em; }
.profile-intro { margin:0 0 19px; font-size:.83rem; }
.profile-identity { display:flex; align-items:center; gap:13px; }
.profile-preview {
  --profile-color:var(--cyan);
  width:68px;
  height:68px;
  flex:0 0 auto;
  display:grid;
  place-items:center;
  border:1px solid color-mix(in srgb,var(--profile-color) 62%,transparent);
  border-radius:19px;
  color:var(--profile-color);
  background:radial-gradient(circle,color-mix(in srgb,var(--profile-color) 18%,transparent),rgba(4,11,10,.92));
  box-shadow:0 0 30px color-mix(in srgb,var(--profile-color) 17%,transparent),inset 0 0 22px color-mix(in srgb,var(--profile-color) 7%,transparent);
  font-size:1.9rem;
}
.profile-name-field { flex:1; min-width:0; }
.profile-name-field span,
.profile-option-label {
  display:block;
  color:var(--muted);
  font-size:.61rem;
  font-weight:800;
  letter-spacing:.11em;
}
.profile-name-field input {
  width:100%;
  margin-top:6px;
  border:1px solid var(--line);
  border-radius:12px;
  padding:12px 13px;
  background:#050d0c;
  color:var(--text);
  font-weight:800;
}
.profile-name-field input::placeholder { color:#668078; }
.profile-error { display:block; min-height:18px; margin:4px 0 3px 81px; color:var(--danger); font-size:.68rem; }
.profile-option-label { margin:13px 0 8px; }
.profile-options { display:flex; flex-wrap:wrap; gap:8px; }
.profile-options button {
  width:44px;
  height:42px;
  margin:0;
  padding:0;
  border:1px solid var(--line);
  border-radius:11px;
  background:rgba(255,255,255,.025);
  cursor:pointer;
}
.profile-glyphs button { font-size:1.05rem; }
.profile-glyphs button.active {
  color:var(--profile-color);
  border-color:var(--profile-color);
  background:color-mix(in srgb,var(--profile-color) 10%,transparent);
  box-shadow:0 0 16px color-mix(in srgb,var(--profile-color) 12%,transparent);
}
.profile-colors button { position:relative; }
.profile-colors button::before {
  content:"";
  position:absolute;
  inset:9px;
  border-radius:50%;
  background:var(--profile-option-color);
  box-shadow:0 0 13px var(--profile-option-color);
}
.profile-colors button.active { border-color:var(--profile-option-color); box-shadow:inset 0 0 0 1px var(--profile-option-color); }
.profile-record { margin-top:18px; padding:15px; border:1px solid var(--line); border-radius:15px; background:rgba(255,255,255,.022); }
.profile-rank-line { display:flex; align-items:end; justify-content:space-between; gap:12px; }
.profile-rank-line small,
.profile-rank-line strong { display:block; }
.profile-rank-line small { color:var(--muted); font-size:.55rem; letter-spacing:.12em; }
.profile-rank-line strong { margin-top:4px; color:var(--profile-color); font-size:.83rem; letter-spacing:.06em; }
.profile-rank-line > span { color:var(--muted); font-size:.61rem; }
.profile-progress { height:5px; margin:9px 0 13px; overflow:hidden; border-radius:999px; background:rgba(255,255,255,.07); }
.profile-progress i { display:block; width:0; height:100%; border-radius:inherit; background:linear-gradient(90deg,var(--profile-color),var(--lime)); box-shadow:0 0 10px var(--profile-color); transition:width .28s ease; }
.profile-stats { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; }
.profile-stats > div { min-width:0; padding:8px 9px; border:1px solid rgba(255,255,255,.065); border-radius:10px; background:rgba(255,255,255,.018); }
.profile-stats span,
.profile-stats strong { display:block; overflow:hidden; text-overflow:ellipsis; }
.profile-stats span { color:var(--muted); font-size:.5rem; letter-spacing:.07em; white-space:nowrap; }
.profile-stats strong { margin-top:4px; color:var(--text); font-size:.82rem; }
.profile-storage-note { margin:15px 0 3px; text-align:center; color:var(--muted); font-size:.65rem; }
.profile-card > .primary-button,
.profile-card > .secondary-button { width:100%; margin-top:9px; }
.profile-reset {
  display:block;
  width:auto !important;
  margin:12px auto 0 !important;
  padding:6px 8px;
  border:0;
  color:#718a82;
  background:transparent;
  font-size:.58rem;
  font-weight:800;
  letter-spacing:.1em;
  cursor:pointer;
}
.profile-reset:hover,
.profile-reset.confirm { color:var(--danger); }

.brand-lockup { margin-right:0; }
.hud-profile {
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
  margin-right:auto;
  line-height:1;
}
.hud-profile > span { width:36px; height:36px; border-radius:11px; font-size:.9rem; }
.hud-profile small,
.hud-profile strong { display:block; }
.hud-profile small { color:var(--muted); font-size:.46rem; letter-spacing:.11em; }
.hud-profile strong { max-width:140px; margin-top:4px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.69rem; letter-spacing:.04em; }
.profile-result {
  --profile-color:var(--cyan);
  display:flex;
  align-items:center;
  justify-content:center;
  flex-wrap:wrap;
  gap:6px 11px;
  margin:0 0 13px;
  padding:10px 12px;
  border:1px solid color-mix(in srgb,var(--profile-color) 30%,var(--line));
  border-radius:12px;
  background:color-mix(in srgb,var(--profile-color) 5%,transparent);
}
.profile-result span { width:100%; color:var(--muted); font-size:.53rem; letter-spacing:.12em; }
.profile-result strong { color:var(--profile-color); font-size:.9rem; }
.profile-result small { color:var(--text); font-size:.58rem; letter-spacing:.08em; }

@media (max-width:760px) {
  .menu-utility { display:block; }
  .profile-chip { margin:13px 0 2px; width:100%; }
  .hud-profile { margin-right:auto; }
  .hud-profile > div { display:none; }
  .resource-readout { margin-right:0; }
}
@media (max-width:480px) {
  .profile-overlay { padding:8px; }
  .profile-card { max-height:96dvh; padding:18px; border-radius:18px; }
  .profile-identity { gap:10px; }
  .profile-preview { width:58px; height:58px; border-radius:16px; font-size:1.55rem; }
  .profile-error { margin-left:68px; }
  .profile-stats { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-height:560px) and (orientation:landscape) {
  .profile-card { max-height:96vh; padding:15px 20px; }
  .profile-card > h3 { margin:4px 0; font-size:1.5rem; }
  .profile-intro { margin-bottom:10px; }
  .profile-preview { width:54px; height:54px; }
  .profile-option-label { margin-top:8px; }
  .profile-record { margin-top:10px; padding:10px; }
  .profile-stats { grid-template-columns:repeat(6,minmax(0,1fr)); }
  .profile-storage-note { margin-top:8px; }
}
