:root { --grid: rgba(255, 200, 87, 0.04); }
html, body { background: #0A0E14; }
body {
  font-family: 'Inter', sans-serif;
  color: #E5E7EB;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(240, 168, 48, 0.10), transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(178, 58, 43, 0.06), transparent 60%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: auto, auto, 48px 48px, 48px 48px;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  opacity: 0.035; mix-blend-mode: overlay; z-index: 100;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.corner-frame { position: relative; }
.corner-frame::before, .corner-frame::after {
  content: ""; position: absolute; width: 14px; height: 14px;
  border-color: #F0A830; border-style: solid; border-width: 0;
}
.corner-frame::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.corner-frame::after  { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }

input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

.input-field { transition: all 220ms ease; }
.input-field:focus {
  outline: none; border-color: #F0A830;
  box-shadow: 0 0 0 1px #F0A830, 0 0 24px rgba(240, 168, 48, 0.18);
  background: #0A0E14;
}
.input-field.filled-by-ai {
  border-color: #4ade80;
  box-shadow: 0 0 0 1px #4ade80, 0 0 18px rgba(74, 222, 128, 0.15);
  animation: aiPop 500ms ease both;
}
@keyframes aiPop {
  0%   { transform: scale(1.0); }
  40%  { transform: scale(1.025); }
  100% { transform: scale(1.0); }
}

.label-stamp { letter-spacing: 0.22em; text-transform: uppercase; }

.deploy-btn {
  background: linear-gradient(180deg, #FFC857 0%, #F0A830 60%, #C97A1B 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 225, 0.5),
    inset 0 -2px 0 rgba(140, 74, 14, 0.6),
    0 8px 24px -8px rgba(240, 168, 48, 0.5);
  transition: transform 120ms ease, box-shadow 220ms ease;
}
.deploy-btn:hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 225, 0.6),
    inset 0 -2px 0 rgba(140, 74, 14, 0.6),
    0 12px 36px -8px rgba(240, 168, 48, 0.7);
  transform: translateY(-1px);
}
.deploy-btn:active { transform: translateY(0); }

.ai-btn {
  background: transparent;
  border: 1px solid rgba(124, 141, 163, 0.5);
  color: #7C8DA3;
  transition: all 200ms ease;
}
.ai-btn:hover:not(:disabled) {
  border-color: #FFC857;
  color: #FFC857;
  box-shadow: 0 0 18px rgba(240, 168, 48, 0.12);
}
.ai-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ai-btn.loading {
  border-color: rgba(74, 222, 128, 0.5);
  color: #4ade80;
  animation: aiBlink 1.2s ease-in-out infinite;
}
@keyframes aiBlink { 50% { opacity: 0.6; } }

.glyph-divider { display: flex; align-items: center; gap: 12px; color: rgba(240, 168, 48, 0.5); }
.glyph-divider::before, .glyph-divider::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240, 168, 48, 0.35), transparent);
}

.troop-row { transition: background 200ms ease; }
.troop-row:hover { background: rgba(240, 168, 48, 0.04); }

.stat-bar { height: 4px; background: rgba(240, 168, 48, 0.10); border-radius: 999px; overflow: hidden; }
.stat-bar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, #C97A1B, #FFC857);
  border-radius: 999px; transform-origin: left;
  animation: fill 800ms cubic-bezier(.22,.94,.4,1) both;
}
@keyframes fill { from { transform: scaleX(0); } }

.reveal   { animation: reveal 600ms cubic-bezier(.22,.94,.4,1) both; }
.reveal-1 { animation-delay: 80ms; }
.reveal-2 { animation-delay: 180ms; }
.reveal-3 { animation-delay: 280ms; }
.reveal-4 { animation-delay: 360ms; }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #FFC857; box-shadow: 0 0 12px #FFC857;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; box-shadow: 0 0 4px #FFC857; } }

.pulse-dot-green {
  width: 8px; height: 8px; border-radius: 50%;
  background: #4ade80; box-shadow: 0 0 10px #4ade80;
  animation: pulse 1.2s ease-in-out infinite;
  flex-shrink: 0;
}

/* Doctrine Cards (replaces strategy tabs) */
.doctrine-row {
  display: flex; gap: 16px; flex-wrap: wrap;
}
.doctrine-card {
  flex: 1; min-width: 220px;
  background: rgba(10, 14, 20, 0.6);
  border: 1px dashed rgba(140, 74, 14, 0.4);
  border-radius: 4px; padding: 18px;
  position: relative; cursor: pointer;
  transition: border-color 240ms ease, background 240ms ease;
}
.doctrine-card:hover {
  border-color: rgba(240, 168, 48, 0.5);
  background: rgba(240, 168, 48, 0.03);
}
.doctrine-card.selected {
  border: 1px solid #F0A830;
  background: rgba(240, 168, 48, 0.06);
}
.doctrine-stamp {
  position: absolute; top: 12px; right: 12px;
  font-family: 'IBM Plex Mono', 'JetBrains Mono', monospace;
  font-size: 9px; font-weight: 700; letter-spacing: 0.1em;
  color: #F0A830; border: 1.5px solid #F0A830;
  border-radius: 3px; padding: 2px 7px;
  transform: rotate(3deg); opacity: 0;
  transition: opacity 200ms ease;
}
.doctrine-card.selected .doctrine-stamp { opacity: 1; }
.doctrine-title {
  font-family: 'Oswald', sans-serif;
  font-size: 16px; font-weight: 600;
  color: #E5E7EB; margin: 0 0 8px;
  padding-right: 70px;
}
.doctrine-desc {
  font-family: 'Inter', sans-serif;
  font-size: 13px; color: #7C8DA3; margin: 0;
  line-height: 1.5;
}

/* Range Slider for Buffs */
.buff-slider {
  -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 2px;
  background: rgba(140, 74, 14, 0.3);
  outline: none; cursor: pointer;
}
.buff-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: #F0A830;
  box-shadow: 0 0 8px rgba(240, 168, 48, 0.4);
  cursor: pointer; transition: transform 120ms ease;
}
.buff-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}
.buff-slider::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: #F0A830; border: none;
  box-shadow: 0 0 8px rgba(240, 168, 48, 0.4);
  cursor: pointer;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 40px; height: 22px;
  background: rgba(30, 35, 45, 0.8);
  border: 1px solid rgba(140, 74, 14, 0.3);
  border-radius: 11px;
  cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease;
  flex-shrink: 0;
}
.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #7C8DA3;
  transition: transform 200ms ease, background 200ms ease;
}
.toggle-switch.on {
  background: rgba(240, 168, 48, 0.2);
  border-color: #F0A830;
}
.toggle-switch.on::after {
  transform: translateX(18px);
  background: #F0A830;
  box-shadow: 0 0 6px rgba(240, 168, 48, 0.5);
}

.upload-zone {
  border: 2px dashed rgba(140, 74, 14, 0.5);
  border-radius: 4px; padding: 20px;
  text-align: center; cursor: pointer;
  transition: all 220ms ease;
  background: rgba(10, 14, 20, 0.4);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: #FFC857;
  background: rgba(240, 168, 48, 0.05);
  box-shadow: 0 0 20px rgba(240, 168, 48, 0.08);
}
.upload-zone.success {
  border-color: #4ade80;
  border-style: solid;
  background: rgba(74, 222, 128, 0.04);
}
.upload-zone.error {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.04);
}
.upload-zone.scanning {
  border-color: #4ade80;
  animation: scanPulse 1s ease-in-out infinite;
}
@keyframes scanPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(74, 222, 128, 0); }
  50% { box-shadow: 0 0 24px rgba(74, 222, 128, 0.2); }
}

.ai-card {
  border: 1px solid rgba(74, 222, 128, 0.3);
  background: linear-gradient(135deg, rgba(10, 14, 20, 0.9), rgba(17, 22, 31, 0.9));
  box-shadow: 0 0 40px rgba(74, 222, 128, 0.06);
}
.ai-card strong { color: #ffffff; }
.ai-section-header {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.2em;
  text-transform: uppercase; color: #4ade80;
  margin-top: 1rem; margin-bottom: 0.25rem;
}
.ai-line {
  display: flex; gap: 8px; margin: 2px 0;
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
}
.ai-line-label { color: #7C8DA3; flex-shrink: 0; }
.ai-line-value { color: #FFC857; font-weight: 600; }
.ai-prose { font-size: 14px; line-height: 1.7; color: rgba(229, 231, 235, 0.85); }
.ai-tip {
  border-left: 2px solid #4ade80;
  padding-left: 12px; margin-top: 4px;
  color: rgba(229, 231, 235, 0.85); font-size: 14px; line-height: 1.7;
}

.typewriter-cursor {
  display: inline-block; width: 2px; height: 1em;
  background: #4ade80; vertical-align: text-bottom;
  animation: blink 0.8s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.tier-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 0;
  border: 1px solid rgba(140, 74, 14, 0.2);
  border-radius: 4px;
  overflow: hidden;
  background: rgba(10, 14, 20, 0.4);
}
.tier-label {
  display: flex; align-items: center; justify-content: center;
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.04em;
  color: rgba(10, 14, 20, 0.85);
  padding: 8px;
}
.tier-cells {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px;
  align-items: center;
}
.tier-s   .tier-label { background: #f4a0a0; }
.tier-a   .tier-label { background: #f4c890; }
.tier-b   .tier-label { background: #f4e090; }
.tier-na  .tier-label { background: #f4f060; }
.tier-trash .tier-label { background: #a0e890; }

.hero-cell {
  position: relative;
  width: 64px; height: 80px;
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  cursor: help;
  transition: transform 160ms ease;
}
.hero-cell:hover { transform: translateY(-2px); }
.hero-cell .face {
  width: 56px; height: 56px;
  border-radius: 8px;
  border: 2px solid rgba(240, 168, 48, 0.4);
  background: linear-gradient(135deg, rgba(240,168,48,0.18), rgba(178,58,43,0.18));
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.hero-cell .face img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 200ms ease;
}
.hero-cell .face img.loaded { opacity: 1; }
.hero-cell .face .face-fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 24px;
  color: #FFC857;
}
.hero-cell.tier-s-cell .face    { border-color: #f4a0a0; }
.hero-cell.tier-a-cell .face    { border-color: #f4c890; }
.hero-cell.tier-b-cell .face    { border-color: #f4e090; }
.hero-cell.tier-na-cell .face   { border-color: #f4f060; }
.hero-cell.tier-trash-cell .face { border-color: #a0e890; }
.hero-cell .gen-badge {
  position: absolute;
  top: -2px; right: -2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px; font-weight: 700;
  padding: 1px 3px;
  border-radius: 4px;
  background: rgba(10, 14, 20, 0.95);
  color: #FFC857;
  border: 1px solid rgba(240, 168, 48, 0.5);
  line-height: 1;
}
.hero-cell .name {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  color: #E5E7EB;
  text-align: center;
  line-height: 1.1;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hero-cell .role-dot {
  position: absolute;
  bottom: 22px; right: 2px;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(10, 14, 20, 0.95);
  box-shadow: 0 0 4px rgba(0,0,0,0.6);
}
.role-host   { background: #FFC857; }
.role-joiner { background: #4ade80; }
.role-both   { background: linear-gradient(135deg, #FFC857 50%, #4ade80 50%); }

.hero-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 14, 20, 0.98);
  border: 1px solid rgba(240, 168, 48, 0.4);
  border-radius: 4px;
  padding: 8px 10px;
  min-width: 200px;
  max-width: 260px;
  font-size: 11px;
  color: #E5E7EB;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}
.hero-cell:hover .hero-tooltip { opacity: 1; }
.hero-tooltip .tt-name {
  font-family: 'Oswald', sans-serif;
  font-size: 13px;
  color: #FFC857;
  margin-bottom: 4px;
}
.hero-tooltip .tt-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: #7C8DA3;
  margin-bottom: 4px;
}
.hero-tooltip .tt-note {
  font-size: 10px;
  line-height: 1.4;
  color: rgba(229, 231, 235, 0.85);
}

.pt-grid {
  display: grid;
  grid-template-columns: 110px repeat(5, minmax(100px, 1fr));
  gap: 4px;
  min-width: 700px;
}
.pt-gen-header {
  display: flex; align-items: center; justify-content: center;
  font-family: 'Oswald', sans-serif;
  font-size: 13px;
  color: #FFC857;
  padding: 6px 4px;
  border-bottom: 1px solid rgba(140, 74, 14, 0.3);
  letter-spacing: 0.04em;
}
.pt-row-label {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  padding: 8px 10px;
  border-radius: 4px;
  gap: 2px;
}
.pt-row-label .pt-title {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
}
.pt-row-label .pt-desc {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: rgba(229, 231, 235, 0.55);
  line-height: 1.3;
}
.pt-row-spender { background: linear-gradient(135deg, rgba(240,168,48,0.18), rgba(199,122,27,0.10)); border: 1px solid rgba(240,168,48,0.35); }
.pt-row-spender .pt-title { color: #FFC857; }
.pt-row-f2p     { background: linear-gradient(135deg, rgba(74,222,128,0.14), rgba(34,197,94,0.08));  border: 1px solid rgba(74,222,128,0.30); }
.pt-row-f2p .pt-title { color: #4ade80; }

.pt-cell {
  display: flex; flex-direction: column; gap: 3px;
  padding: 6px 4px;
  background: rgba(10, 14, 20, 0.35);
  border: 1px solid rgba(140, 74, 14, 0.15);
  border-radius: 4px;
}
.pt-hero {
  position: relative;
  display: flex; align-items: center; gap: 6px;
  padding: 3px 4px;
  border-radius: 3px;
  cursor: help;
  transition: background 160ms ease;
}
.pt-hero:hover { background: rgba(240, 168, 48, 0.08); }
.pt-hero .pt-face {
  width: 32px; height: 32px;
  flex-shrink: 0;
  border-radius: 4px;
  border: 1.5px solid rgba(240, 168, 48, 0.3);
  background: rgba(10, 14, 20, 0.8);
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(240,168,48,0.18), rgba(178,58,43,0.18));
}
.pt-hero .pt-face img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 200ms ease;
}
.pt-hero .pt-face img.loaded { opacity: 1; }
.pt-hero .pt-fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #FFC857;
}
.pt-hero .pt-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.pt-hero .pt-name {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  color: #E5E7EB;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pt-hero .pt-tier {
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  display: inline-block;
  width: fit-content;
}
.pt-tier-s { background: rgba(244,160,160,0.25); color: #ffd0d0; }
.pt-tier-a { background: rgba(244,200,144,0.25); color: #ffd9a8; }
.pt-tier-b { background: rgba(244,224,144,0.25); color: #fff0a0; }
.pt-tier-na { background: rgba(244,240,96,0.25); color: #ffffa0; }

.pt-hero .pt-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  background: rgba(10, 14, 20, 0.98);
  border: 1px solid rgba(240, 168, 48, 0.4);
  border-radius: 4px;
  padding: 6px 8px;
  min-width: 180px;
  max-width: 240px;
  font-size: 10px;
  color: #E5E7EB;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}
.pt-hero:hover .pt-tooltip { opacity: 1; }
.pt-tooltip .pt-tt-name { font-family: 'Oswald', sans-serif; font-size: 12px; color: #FFC857; margin-bottom: 3px; }
.pt-tooltip .pt-tt-note { font-size: 10px; line-height: 1.4; color: rgba(229, 231, 235, 0.85); }
