/* ============================
   CHECK BM V2 — GLASSMORPHISM
   ============================ */

/* ============================
   DESIGN TOKENS
   ============================ */
:root,
[data-theme="dark"] {
  --bg-primary: #060a14;
  --bg-gradient: radial-gradient(ellipse at top center, #0d1b3e 0%, #060a14 55%, #030508 100%);
  --glass-card: rgba(12, 18, 36, 0.7);
  --glass-card-inner: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 255, 255, 0.15);
  --glass-highlight: rgba(255, 255, 255, 0.04);

  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent1: #818cf8;
  --accent2: #34d399;
  --accent1-rgb: 129, 140, 248;
  --accent2-rgb: 52, 211, 153;

  --live-color: #34d399;
  --live-rgb: 52, 211, 153;
  --die-color: #f87171;
  --die-rgb: 248, 113, 113;
  --fail-color: #fbbf24;
  --fail-rgb: 251, 191, 36;
}

[data-theme="light"] {
  --bg-primary: #f0f4ff;
  --bg-gradient: linear-gradient(180deg, #e8eeff 0%, #f0f4ff 100%);
  --glass-card: rgba(255, 255, 255, 0.75);
  --glass-card-inner: rgba(255, 255, 255, 0.5);
  --glass-border: rgba(148, 163, 184, 0.3);
  --glass-border-hover: rgba(148, 163, 184, 0.5);
  --glass-highlight: rgba(255, 255, 255, 0.8);

  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --live-color: #059669;
  --die-color: #dc2626;
  --fail-color: #d97706;
}

/* ============================
   RESET & BASE
   ============================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Inter", system-ui, sans-serif;
  min-height: 100vh;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text);
  background: var(--bg-gradient);
  position: relative;
  overflow-x: hidden;
}

/* ============================
   ANIMATED BACKGROUND
   ============================ */
.bg-orbs {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.2;
  animation: orb-float 20s ease-in-out infinite;
}

.bg-orb:nth-child(1) {
  width: 500px; height: 500px;
  background: var(--accent1);
  top: -10%; left: -5%;
}
.bg-orb:nth-child(2) {
  width: 400px; height: 400px;
  background: var(--accent2);
  bottom: -10%; right: -5%;
  animation-delay: -7s;
}
.bg-orb:nth-child(3) {
  width: 300px; height: 300px;
  background: #a78bfa;
  top: 40%; left: 50%;
  animation-delay: -14s;
}

@keyframes orb-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(40px, 30px) scale(1.02); }
}

#particles {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* ============================
   BIG TITLE (outside card)
   ============================ */
.hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 920px;
  position: relative;
  z-index: 2;
  margin-bottom: 12px;
}

.hero-title {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  margin: 0;
}

.hero-title-text {
  background: linear-gradient(135deg, #c4b5fd 0%, #818cf8 40%, #34d399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 12px rgba(129, 140, 248, 0.25));
}

.hero-title img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  margin-right: 12px;
  filter: drop-shadow(0 2px 8px rgba(129, 140, 248, 0.3));
}

[data-theme="light"] .hero-title-text {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 30%, #059669 70%, #10b981 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 1px 4px rgba(79, 70, 229, 0.15));
}

/* ============================
   MAIN GLASS CONTAINER
   ============================ */
.main-card {
  width: 100%;
  max-width: 920px;
  background: var(--glass-card);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.4),
    0 0 40px rgba(var(--accent1-rgb), 0.08),
    inset 0 1px 0 var(--glass-highlight);
  position: relative;
  z-index: 2;
  overflow: hidden;
  padding: 24px;
}

.main-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(var(--accent1-rgb), 0.25),
    rgba(var(--accent2-rgb), 0.15),
    rgba(var(--accent1-rgb), 0.08)
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ============================
   SUMMARY BAR
   ============================ */
.summary-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 600;
  flex-wrap: wrap;
}

.summary-bar .summary-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent1), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.summary-bar .summary-label {
  font-weight: 700;
  color: var(--text);
}

.summary-bar .dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.summary-bar .stat-live { color: var(--live-color); font-weight: 700; }
.summary-bar .stat-die { color: var(--die-color); font-weight: 700; }
.summary-bar .stat-total { color: var(--text-secondary); font-weight: 600; }

/* ============================
   NAVIGATION BAR
   ============================ */
.top-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 920px;
  padding: 6px;
  border-radius: 999px;
  background: var(--glass-card);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.nav-link {
  text-decoration: none;
  border-radius: 999px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.nav-link::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s;
}

.nav-link:hover::after {
  transform: translateX(100%);
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .nav-link:hover {
  background: rgba(0, 0, 0, 0.04);
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(var(--accent1-rgb), 0.2), rgba(var(--accent2-rgb), 0.12));
  color: var(--accent1);
  font-weight: 700;
  border: 1px solid rgba(var(--accent1-rgb), 0.25);
  box-shadow: 0 2px 12px rgba(var(--accent1-rgb), 0.15);
}

[data-theme="light"] .nav-link.active {
  background: linear-gradient(135deg, rgba(var(--accent1-rgb), 0.12), rgba(var(--accent2-rgb), 0.08));
  border: 1px solid rgba(var(--accent1-rgb), 0.2);
}

.nav-spacer {
  flex: 1;
}

.theme-toggle {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.05);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.25s;
  color: var(--text);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: rgba(255,255,255,0.1);
  transform: rotate(20deg);
}

[data-theme="light"] .theme-toggle:hover {
  background: rgba(0,0,0,0.05);
}

/* ============================
   INPUT SECTION (nested glass)
   ============================ */
.input-card {
  background: var(--glass-card-inner);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 20px;
}

.input-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.input-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.input-counter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(var(--accent1-rgb), 0.1);
  border: 1px solid rgba(var(--accent1-rgb), 0.2);
  color: var(--accent1);
}

.input-counter .counter-sep {
  color: var(--text-muted);
  font-weight: 400;
}

.input-header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

textarea {
  width: 100%;
  min-height: 130px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  font-size: 14px;
  line-height: 1.6;
  font-family: "Inter", monospace;
  color: var(--text);
  background: rgba(0, 0, 0, 0.25);
  outline: none;
  resize: vertical;
  transition: border-color 0.3s, box-shadow 0.3s;
  white-space: nowrap;
  overflow-x: auto;
}

textarea::-webkit-scrollbar {
  height: 8px;
  width: 5px;
}

textarea::-webkit-scrollbar-track {
  background: transparent;
}

textarea::-webkit-scrollbar-thumb {
  background: rgba(129, 140, 248, 0.25);
  border-radius: 99px;
}

textarea::-webkit-scrollbar-thumb:hover {
  background: rgba(129, 140, 248, 0.45);
}

textarea::-webkit-scrollbar-corner {
  background: transparent;
}

[data-theme="light"] textarea::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.2);
}

[data-theme="light"] textarea::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.4);
}

[data-theme="light"] textarea {
  background: rgba(255,255,255,0.5);
}

textarea:focus {
  border-color: var(--accent1);
  box-shadow: 0 0 0 3px rgba(var(--accent1-rgb), 0.15);
}

textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

/* Buttons below textarea, aligned right */
.input-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.btn {
  font-size: 14px;
  padding: 10px 22px;
  border-radius: 999px;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s;
}
.btn:hover::after { transform: translateX(100%); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent1), var(--accent2));
  color: #fff;
  box-shadow: 0 8px 24px rgba(var(--accent1-rgb), 0.3);
  animation: pulse-cta 2.5s ease-in-out infinite;
}

@keyframes pulse-cta {
  0%, 100% {
    box-shadow: 0 8px 24px rgba(var(--accent1-rgb), 0.3),
      0 0 0 0 rgba(var(--accent1-rgb), 0.3);
  }
  50% {
    box-shadow: 0 8px 24px rgba(var(--accent1-rgb), 0.3),
      0 0 0 8px rgba(var(--accent1-rgb), 0);
  }
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 32px rgba(var(--accent1-rgb), 0.4);
  animation: none;
}

.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.1);
  transform: translateY(-1px);
}

/* ============================
   OUTPUT SECTION LABEL (XMDN)
   ============================ */
.output-section-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  margin-top: 4px;
  padding-left: 2px;
  letter-spacing: 0.3px;
}

/* ============================
   OUTPUT GRID (LIVE / DIE)
   ============================ */
.output-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.output-card {
  border-radius: 14px;
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.3s;
}

/* LIVE card */
.output-card.live {
  background: rgba(var(--live-rgb), 0.04);
  border: 1.5px solid rgba(var(--live-rgb), 0.4);
  box-shadow:
    0 0 20px rgba(var(--live-rgb), 0.1),
    inset 0 0 20px rgba(var(--live-rgb), 0.03);
}

.output-card.live:hover {
  box-shadow:
    0 0 30px rgba(var(--live-rgb), 0.2),
    inset 0 0 30px rgba(var(--live-rgb), 0.05);
}

/* DIE card */
.output-card.die {
  background: rgba(var(--die-rgb), 0.04);
  border: 1.5px solid rgba(var(--die-rgb), 0.4);
  box-shadow:
    0 0 20px rgba(var(--die-rgb), 0.1),
    inset 0 0 20px rgba(var(--die-rgb), 0.03);
}

.output-card.die:hover {
  box-shadow:
    0 0 30px rgba(var(--die-rgb), 0.2),
    inset 0 0 30px rgba(var(--die-rgb), 0.05);
}

/* FAIL card */
.output-card.fail {
  background: rgba(var(--fail-rgb), 0.04);
  border: 1.5px solid rgba(var(--fail-rgb), 0.35);
  box-shadow:
    0 0 15px rgba(var(--fail-rgb), 0.08),
    inset 0 0 15px rgba(var(--fail-rgb), 0.03);
}

.output-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.output-card-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.output-card.live .output-card-title { color: var(--live-color); }
.output-card.die .output-card-title { color: var(--die-color); }
.output-card.fail .output-card-title { color: var(--fail-color); }

.output-card-tools {
  display: flex;
  gap: 6px;
}

.btn-mini {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 10px;
  cursor: pointer;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.1);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: all 0.2s;
  font-weight: 600;
}

[data-theme="light"] .btn-mini {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-secondary);
  border: 1px solid rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .btn-mini:hover {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(var(--accent1-rgb), 0.4);
  color: var(--accent1);
}

.btn-mini:hover {
  background: rgba(255,255,255,0.1);
  color: var(--accent1);
}

.output-card textarea {
  min-height: 160px;
  background: transparent;
  border: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.7;
  resize: none;
  white-space: nowrap;
  overflow-x: auto;
}

.output-card textarea:focus {
  box-shadow: none;
  border-color: transparent;
}

.output-card.live textarea { color: var(--live-color); }
.output-card.die textarea { color: var(--die-color); }
.output-card.fail textarea { color: var(--fail-color); }

/* ============================
   PROGRESS BAR (mockup style)
   ============================ */
.progress-card {
  position: sticky;
  bottom: 16px;
  width: 100%;
  max-width: 920px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  margin-top: 16px;
  border-radius: 14px;
  background: var(--glass-card);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  z-index: 100;
}

[data-theme="light"] .progress-card {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.progress-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 120px;
}

.progress-bar-bg {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.04);
  position: relative;
}

[data-theme="light"] .progress-bar-bg {
  background: rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent1), var(--accent2));
  background-size: 300% 100%;
  animation: progress-shimmer 3s ease infinite;
  transition: width 0.5s ease;
  box-shadow: 0 0 12px rgba(var(--accent2-rgb), 0.4);
  position: relative;
}

.progress-bar-fill.done {
  animation: none;
  background-size: 100% 100%;
}

.progress-percent {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

@keyframes progress-shimmer {
  0% { background-position: 300% 0; }
  100% { background-position: -300% 0; }
}

.progress-stats {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 110px;
  text-align: right;
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 768px) {
  body { padding: 16px; }
  .hero-title { font-size: 28px; }
  .output-grid { grid-template-columns: 1fr; }
  .main-card { padding: 18px; }
}

@media (max-width: 520px) {
  body { padding: 10px; }
  .hero-title { font-size: 22px; }
  .main-card { padding: 14px; }
  .input-actions { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
  .progress-card { flex-direction: column; gap: 8px; }
  .progress-label, .progress-stats { min-width: auto; text-align: center; }
  .top-bar { justify-content: flex-start; }
  #particles { display: none !important; }
}
