/* ── CSS VARIABLES & RESET ─────────────────────────────────── */
:root {
  --gold:       #FFD700;
  --gold-dim:   #B8960C;
  --green:      #00FF88;
  --red:        #FF4455;
  --blue:       #00BFFF;
  --bg:         rgba(8,8,14,0.91);
  --panel:      rgba(14,14,22,0.91);
  --border:     rgba(50,50,70,0.85);
  --text:       #e0e0e0;
  --dim:        #aaa;
  --level-color: #FFD700;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 18px; }

body {
  background: #0a0a0f;
  color: var(--text);
  font-family: 'Segoe UI', sans-serif;
  font-size: 1rem;
  height: 100vh;
  min-width: 900px;
  overflow: hidden;
  position: relative;
}

/* ── DYNAMIC BACKGROUND ──────────────────────────────────────── */
#bgBlur {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  z-index: -1;
  background-color: #0a0a0f;
  background-size: cover;
  background-position: center;
  filter: brightness(0.78) saturate(1.1);
  transform: scale(1.08);
  transition: background-image 1.2s ease;
  pointer-events: none;
}

/* ── LEVEL-UP FLASH ──────────────────────────────────────────── */
.level-flash {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(255,215,0,0);
  pointer-events: none;
  z-index: 9998;
  transition: none;
}
.level-flash.active {
  animation: flashAnim 0.8s ease-out forwards;
}
@keyframes flashAnim {
  0%   { background: rgba(255,215,0,0.35); }
  100% { background: rgba(255,215,0,0); }
}

/* ── NOTIFICATION POPUP ──────────────────────────────────────── */
.notif-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9990;
  align-items: flex-start;
  justify-content: center;
  pointer-events: none;
  padding-top: 22px;
}
.notif-overlay.show { display: flex; }
.notif-popup {
  pointer-events: auto;
  position: relative;
  background: radial-gradient(ellipse at top, rgba(28,18,55,0.99), rgba(8,6,18,0.99));
  border: 1px solid rgba(255,215,0,0.45);
  border-radius: 18px;
  padding: 22px 38px 20px;
  min-width: 280px;
  max-width: 420px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: 0 0 60px rgba(255,215,0,0.2), 0 0 0 1px rgba(255,215,0,0.06), 0 16px 50px rgba(0,0,0,0.95);
  animation: notifSlideDown 0.32s cubic-bezier(0.22,1,0.36,1);
}
@keyframes notifSlideDown {
  from { opacity: 0; transform: translateY(-30px); }
  to   { opacity: 1; transform: translateY(0); }
}
.notif-close-btn {
  position: absolute;
  top: 12px; right: 14px;
  background: none; border: none;
  color: rgba(255,255,255,0.22);
  font-size: 1rem; cursor: pointer;
  font-family: inherit;
  transition: color 0.15s;
}
.notif-close-btn:hover { color: rgba(255,215,0,0.6); }
.notif-icon { font-size: 2.6rem; filter: drop-shadow(0 0 16px rgba(255,215,0,0.5)); margin-bottom: 4px; }
.notif-title {
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(255,215,0,0.5);
}
.notif-msg { font-size: 0.95rem; font-weight: 700; color: #FFD700; line-height: 1.4; text-shadow: 0 0 20px rgba(255,215,0,0.4); margin-top: 2px; }

/* ── VOID TRADE TOAST ────────────────────────────────────────── */
.void-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  top: auto;
  left: auto;
  z-index: 9995;
  width: 280px;
  background: linear-gradient(135deg, rgba(28,14,4,0.98) 0%, rgba(14,8,2,0.99) 100%);
  border: 1px solid rgba(220,140,40,0.45);
  border-radius: 14px;
  padding: 16px 18px 12px;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(180,100,20,0.2), 0 12px 40px rgba(0,0,0,0.95), inset 0 1px 0 rgba(255,200,80,0.08);
  display: flex;
  gap: 12px;
  align-items: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.22,1,0.36,1);
}
.void-toast.vt-show { opacity: 1; transform: translateY(0); }
.vt-icon { font-size: 1.5rem; flex-shrink: 0; filter: drop-shadow(0 0 8px rgba(255,180,60,0.5)); }
.vt-body { flex: 1; min-width: 0; }
.vt-title {
  font-size: 0.42rem; letter-spacing: 3px; text-transform: uppercase;
  color: rgba(220,140,40,0.75); font-weight: 800; margin-bottom: 4px;
}
.vt-asset { font-size: 0.88rem; font-weight: 800; color: #fff; letter-spacing: 0.5px; }
.vt-refund { font-size: 0.62rem; color: rgba(255,215,0,0.65); margin-top: 3px; font-weight: 600; }
.vt-bar { position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: rgba(180,100,20,0.15); }
.vt-bar-fill { height: 100%; width: 100%; background: linear-gradient(90deg, rgba(220,140,40,0.8), rgba(180,80,10,0.5)); transform-origin: left; transition: transform linear; }

/* ── PORTAL ACTIVATION TOAST ─────────────────────────────────── */
.portal-toast {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 9995;
  width: 280px;
  background: radial-gradient(ellipse at top left, rgba(30,16,60,0.98), rgba(6,4,16,0.99));
  border: 1px solid rgba(255,215,0,0.55);
  border-radius: 16px;
  padding: 16px 18px 10px;
  overflow: hidden;
  box-shadow: 0 0 50px rgba(255,215,0,0.18), 0 12px 40px rgba(0,0,0,0.9);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-110%);
  transition: opacity 0.32s ease, transform 0.35s cubic-bezier(0.22,1,0.36,1);
}
.portal-toast.pt-show {
  opacity: 1;
  transform: translateY(0);
}
.pt-glow {
  position: absolute;
  top: -40px; left: -40px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(255,215,0,0.12), transparent 70%);
  pointer-events: none;
}
.pt-icon {
  font-size: 2rem;
  flex-shrink: 0;
  filter: drop-shadow(0 0 12px rgba(255,215,0,0.7));
  animation: ptSpin 3s linear infinite;
}
@keyframes ptSpin { from { filter: drop-shadow(0 0 10px rgba(255,215,0,0.6)); } 50% { filter: drop-shadow(0 0 22px rgba(255,215,0,1)); } to { filter: drop-shadow(0 0 10px rgba(255,215,0,0.6)); } }
.pt-body { flex: 1; min-width: 0; }
.pt-title {
  font-size: 0.42rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(255,215,0,0.55);
  font-weight: 800;
  margin-bottom: 4px;
}
.pt-asset {
  font-size: 1.05rem;
  font-weight: 800;
  color: #FFD700;
  letter-spacing: 1px;
  text-shadow: 0 0 18px rgba(255,215,0,0.5);
  line-height: 1.1;
  margin-bottom: 5px;
}
.pt-details { display: flex; gap: 10px; align-items: center; }
.pt-risk {
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255,100,100,0.9);
  background: rgba(255,80,80,0.1);
  border: 1px solid rgba(255,80,80,0.28);
  border-radius: 5px;
  padding: 2px 7px;
}
.pt-entry {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.55);
}
.pt-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(255,215,0,0.1);
}
.pt-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, rgba(255,215,0,0.7), rgba(255,140,0,0.5));
  transform-origin: left;
  transition: transform linear;
}

/* ── SHARED BUTTON STYLES ────────────────────────────────────── */
.btn-log {
  width: 100%;
  padding: 11px;
  background: linear-gradient(135deg, rgba(255,215,0,0.12), rgba(255,215,0,0.06));
  border: 1px solid rgba(255,215,0,0.4);
  border-radius: 10px;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
}
.btn-log:hover {
  background: linear-gradient(135deg, rgba(255,215,0,0.22), rgba(255,215,0,0.12));
  box-shadow: 0 0 20px rgba(255,215,0,0.2);
}

.btn-undo {
  padding: 8px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: var(--dim);
  font-size: 0.72rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s;
}
.btn-undo:hover { border-color: rgba(255,215,0,0.3); color: var(--gold); }

/* ── SHARED PROGRESS BARS ────────────────────────────────────── */
.progress-bar-wrap {
  background: rgba(26,26,40,0.91);
  border-radius: 20px;
  height: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--level-color, #FFD700), #fff8);
  transition: width 0.8s cubic-bezier(0.25,1,0.5,1);
}
.progress-pct {
  text-align: center;
  font-size: 0.72rem;
  color: var(--dim);
  margin-top: 5px;
}

/* ── DISCIPLINE BAR ──────────────────────────────────────────── */
.disc-bar-wrap {
  background: rgba(26,26,40,0.91);
  border-radius: 20px;
  height: 10px;
  overflow: hidden;
  margin: 5px 0;
}
.disc-bar-fill {
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, #4a0000, #ff4444, #ffaa00, #00ff88);
  background-size: 300% 100%;
  background-position: right center;
  transition: width 0.8s ease, background-position 0.8s ease;
}
.disc-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.55rem;
  color: var(--dim);
  margin-top: 3px;
}

/* ── RESOURCE BARS ───────────────────────────────────────────── */
.res-progress-labels {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
}
.res-bar-wrap {
  background: rgba(26,26,40,0.91);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
  margin: 4px 0;
}
.res-bar-fill {
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--level-color, #FFD700), #fff8);
  transition: width 0.8s ease;
}
.res-unlock-status {
  font-size: 0.68rem;
  color: var(--dim);
  margin-top: 4px;
  text-align: center;
}
.res-unlock-status.ready { color: #00FF88; }

/* ── STAT BOX ────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: 100%;
  margin-top: 8px;
}
.stat-box {
  background: rgba(13,13,24,0.91);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  text-align: center;
}
.stat-box .val { font-size: 1.05rem; font-weight: 700; line-height: 1; }
.stat-box .lbl { font-size: 0.58rem; letter-spacing: 1px; color: var(--dim); text-transform: uppercase; margin-top: 2px; }
.val-gold  { color: var(--gold); }
.val-green { color: var(--green); }
.val-red   { color: var(--red); }
.val-blue  { color: var(--blue); }

.wld-strip { display: flex; gap: 6px; }
.wld-box { flex: 1; background: rgba(13,13,24,0.91); border: 1px solid var(--border); border-radius: 8px; padding: 5px; text-align: center; }
.wld-val { font-size: 0.95rem; font-weight: 700; }
.wld-lbl { font-size: 0.55rem; color: var(--dim); text-transform: uppercase; }

/* ── FORM INPUTS ─────────────────────────────────────────────── */
input[type="text"],
input[type="number"],
select {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.18s;
}
input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: rgba(255,215,0,0.4);
}

/* ── WARBAND SELECT ──────────────────────────────────────────── */
.warband-select {
  padding: 4px 8px;
  font-size: 0.68rem;
  background: rgba(10,8,20,0.8);
  border: 1px solid rgba(255,215,0,0.2);
  border-radius: 6px;
  color: rgba(255,215,0,0.8);
  cursor: pointer;
  max-width: 160px;
}
.warband-select option { background:#0a0814; color:rgba(255,215,0,0.9); }
.btn-warband-add {
  width: 26px; height: 26px;
  background: rgba(255,215,0,0.08);
  border: 1px solid rgba(255,215,0,0.3);
  border-radius: 6px;
  color: var(--gold);
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ── BTC PHASE BADGE ─────────────────────────────────────────── */
.btc-phase-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 4px;
}
.btc-phase-badge.bull   { background: rgba(0,200,80,0.12); color: #00e070; border: 1px solid rgba(0,200,80,0.2); }
.btc-phase-badge.bear   { background: rgba(255,50,50,0.12); color: #ff5555; border: 1px solid rgba(255,50,50,0.2); }
.btc-phase-badge.neutral{ background: rgba(100,100,100,0.12); color: #aaa; border: 1px solid rgba(100,100,100,0.2); }

/* ── FADE-IN ANIMATION ───────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes loreOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── DP SECTIONS ─────────────────────────────────────────────── */
.dp-section {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,215,0,0.06);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}
/* Two-column section row — put adjacent .dp-section elements side-by-side */
.dp-section-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 0;
  align-items: start;
}
.dp-section-row .dp-section { margin-bottom: 10px; }
.dp-section-title {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: rgba(255,215,0,0.5);
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255,215,0,0.08);
  padding-bottom: 6px;
}

/* ── SECTION COLLAPSE TOGGLE ─────────────────────────────────── */
.section-collapse-toggle, .battles-collapse-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 8px 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,215,0,0.08);
  border-radius: 8px;
  color: rgba(255,215,0,0.6);
  font-size: 0.72rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s;
  margin-top: 8px;
}
.section-collapse-toggle:hover,
.battles-collapse-toggle:hover { background: rgba(255,215,0,0.05); }

.battles-collapse-wrap {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s ease;
}
.battles-collapse-wrap.open { max-height: 600px; }

/* ── NEXT LEVEL TEASER ───────────────────────────────────────── */
.next-level-teaser {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,215,0,0.08);
  border-radius: 10px;
}
.teaser-label { font-size: 0.55rem; letter-spacing: 2px; color: var(--dim); text-transform: uppercase; white-space: nowrap; }
.teaser-img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; border: 1px solid rgba(255,215,0,0.2); }
.teaser-name { font-size: 0.78rem; font-weight: 700; color: var(--gold); }
.next-level-teaser.hidden { display: none; }

/* ── KINGDOM HERO ROW ────────────────────────────────────────── */
.kingdom-hero-row { display: flex; gap: 12px; align-items: center; }
.kingdom-hero-text { flex: 1; min-width: 0; }
.kingdom-img { width: 60px; height: 60px; border-radius: 8px; object-fit: cover; border: 1.5px solid rgba(255,215,0,0.3); flex-shrink: 0; }
.kingdom-level { font-size: 0.58rem; letter-spacing: 3px; color: var(--dim); text-transform: uppercase; }
.kingdom-name { font-size: 1.0rem; font-weight: 700; color: var(--level-color, #FFD700); }
.kingdom-tribe { font-size: 0.68rem; color: rgba(255,255,255,0.45); margin-top: 2px; }
.world-info-btn { background: none; border: none; cursor: pointer; font-size: 0.75rem; color: rgba(255,215,0,0.5); padding: 0 2px; }
@keyframes pulseGold {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,215,0,0); border-color: rgba(255,215,0,0.35); }
  50%      { box-shadow: 0 0 14px 3px rgba(255,215,0,0.18); border-color: rgba(255,215,0,0.7); }
}
