:root {
  --primary-glow: transparent;
  --secondary: #990000;
  --secondary-glow: transparent;
  --font-mono: 'Fira Code', monospace;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-x: hidden;
  padding: 2rem 1rem 4rem;
}

/* Header */
header {
  text-align: center; margin-bottom: 2rem; position: relative; z-index: 10;
  animation: slideDown 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.logo-container {
  display: inline-flex; align-items: center; justify-content: center;
  width: 96px; height: 96px; border-radius: 50%;
  background: transparent;
  border: none;
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.2);
  margin-bottom: 1.5rem; position: relative;
  overflow: hidden;
}
.logo-container img {
  width: 100%; height: 100%; object-fit: cover;
}
h1 { font-size: 2.8rem; font-weight: 800; letter-spacing: -1px; color: #ffffff; }
.sub { color: var(--text-muted); font-size: 1.05rem; margin-top: 0.5rem; font-weight: 400; }

/* Main Card */
/* Account Info */
.account-box {
  background: rgba(255,255,255,0.03); border: 1px solid var(--panel-border);
  padding: 1.5rem; border-radius: 16px; margin-bottom: 2rem;
  font-size: 0.95rem; color: var(--text-muted); line-height: 1.6;
  display: flex; align-items: flex-start; gap: 16px;
}
.account-box svg { flex-shrink: 0; width: 24px; height: 24px; stroke: var(--primary); }
.account-box b { color: var(--text-main); font-weight: 600; }
.account-box .wid { font-family: var(--font-mono); color: var(--primary); font-size: 0.95rem; font-weight: 600; padding: 4px 8px; background: rgba(205,1,0,0.1); border-radius: 6px;}

/* Security Notice */
.notice-warn {
  display: flex; align-items: flex-start; gap: 10px;
  background: rgba(245,158,11,0.06); border: 1px solid rgba(245,158,11,0.22);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 1.75rem;
}
.notice-warn svg { flex-shrink: 0; width: 16px; height: 16px; stroke: var(--warning); margin-top: 1px; }
.notice-warn b { display: block; font-size: 0.7rem; font-weight: 700; color: var(--warning); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 3px; }
.notice-warn p { font-size: 0.8rem; color: var(--text-muted); line-height: 1.55; margin: 0; }

/* Tabs */
.tabs {
  display: flex; gap: 16px; background: rgba(255,255,255,0.03);
  padding: 8px; border-radius: 20px; margin-bottom: 3rem;
  border: 1px solid var(--panel-border);
}
.tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 16px; background: transparent; border: none;
  color: var(--text-muted); font-size: 1.05rem; font-weight: 600; font-family: var(--font-main);
  cursor: pointer; border-radius: 16px; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.tab svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2; fill: none; transition: transform 0.3s; }
.tab.active { background: var(--primary); color: #fff; box-shadow: 0 4px 15px rgba(205,1,0,0.3); }
.tab.active svg { transform: scale(1.1); }
.tab:hover:not(.active) { color: #fff; background: rgba(255,255,255,0.08); }

/* Forms & Inputs */
label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 1rem; }
input[type=text] {
  width: 100%; background: rgba(0,0,0,0.5); border: 1px solid var(--panel-border);
  color: var(--text-main); font-family: var(--font-mono); font-size: 1.05rem;
  padding: 16px 20px; outline: none; margin-bottom: 2rem;
  border-radius: 16px; transition: all 0.3s;
}
input[type=text]:focus { border-color: var(--primary); box-shadow: none; }
input[type=text]::placeholder { color: var(--text-muted); opacity: 0.5; }

/* Day Grid */
.day-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 2.5rem; }
.day-btn {
  background: rgba(0,0,0,0.5); border: 1px solid var(--panel-border);
  color: var(--text-main); font-size: 1.2rem; font-weight: 700; font-family: var(--font-main);
  padding: 20px 10px; cursor: pointer; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); position: relative; overflow: hidden;
}
.day-btn > * { position: relative; z-index: 1; }
.day-btn:hover { border-color: var(--primary); transform: translateY(-2px); background: rgba(205,1,0,0.05); }
.day-btn.selected { border-color: transparent; color: #fff; background: var(--primary); box-shadow: 0 4px 15px rgba(205,1,0,0.3); transform: translateY(-2px); }
.day-btn small { font-size: 0.85rem; font-weight: 500; opacity: 0.9; }

/* Buttons */
.btn {
  width: 100%; padding: 18px;
  background: var(--primary);
  border: none; border-radius: 16px;
  color: #fff; font-size: 1.1rem; font-weight: 700; font-family: var(--font-main);
  cursor: pointer; transition: all 0.3s;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: none;
}
.btn svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2; fill: none; flex-shrink: 0; }
.btn:hover { transform: translateY(-2px); filter: brightness(1.1); box-shadow: 0 4px 15px rgba(205,1,0,0.3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; filter: none; }
.btn.secondary { background: rgba(255,255,255,0.05); border: 1px solid var(--panel-border); box-shadow: none; }
.btn.secondary:hover { background: rgba(255,255,255,0.1); border-color: var(--text-muted); }
.btn.outline { background: transparent; border: 1px dashed var(--text-muted); color: var(--text-muted); box-shadow: none; }
.btn.outline:hover { border-color: var(--text-main); color: var(--text-main); }
.btn-row { display: flex; gap: 16px; margin-top: 2rem; }
.btn-row .btn { margin-top: 0; }

/* Result Box */
.result { display: none; margin-top: 1.5rem; padding: 16px; border-radius: 12px; font-size: 0.9rem; line-height: 1.5; backdrop-filter: blur(10px); }
.result.show { display: block; animation: fadeUp 0.4s ease; }
.result.ok { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); color: #34d399; }
.result.err { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: #fca5a5; }
.result.warn { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.3); color: #fbbf24; }
.result svg { width: 20px; height: 20px; display: inline-block; vertical-align: bottom; margin-right: 6px; flex-shrink:0; }

/* Key Box */
.key-box {
  background: rgba(0,0,0,0.5); border: 1px solid var(--panel-border);
  padding: 16px; font-family: var(--font-mono); font-size: 0.95rem; color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 12px; cursor: pointer; border-radius: 12px;
  transition: all 0.3s;
}
.key-box:hover { border-color: var(--primary); background: rgba(205,1,0,0.1); }
.key-box .copy-icon { width: 20px; height: 20px; stroke: var(--text-muted); transition: stroke 0.3s; fill:none; stroke-width:2; }
.key-box:hover .copy-icon { stroke: var(--primary); }
.key-text { word-break: break-all; flex: 1; }

/* Key Success Panel */
.key-success { padding: 6px 0 2px; }
.ks-badge {
  width: 76px; height: 76px; margin: 0 auto 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(205,1,0,0.4), rgba(205,1,0,0.06));
  border: 1.5px solid rgba(205,1,0,0.5);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 34px rgba(205,1,0,0.3), inset 0 0 22px rgba(205,1,0,0.18);
  position: relative;
  animation: ksPop 0.55s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.ks-badge::after {
  content: ''; position: absolute; inset: -10px; border-radius: 50%;
  border: 1px solid rgba(205,1,0,0.28);
  animation: pulse-ring 2.5s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}
.ks-badge svg { width: 36px; height: 36px; stroke: #fff; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ks-title {
  font-size: 1.18rem; font-weight: 700; color: #fff;
  letter-spacing: -0.3px; margin: 0 0 6px; text-align: center;
}
.ks-sub { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 20px; text-align: center; }
.ks-meta {
  display: flex; gap: 10px; margin-top: 16px;
}
.ks-meta-cell {
  flex: 1; background: rgba(0,0,0,0.4); border: 1px solid var(--panel-border);
  border-radius: 12px; padding: 12px 10px; text-align: center;
}
.ks-meta-cell small {
  display: block; font-size: 0.65rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1.2px; font-weight: 600; margin-bottom: 5px;
}
.ks-meta-cell b { font-family: var(--font-mono); font-size: 0.85rem; color: var(--primary); font-weight: 600; }
.ks-note {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 18px; color: var(--text-muted); font-size: 0.78rem; text-align: center;
}
.ks-note svg { width: 14px; height: 14px; stroke: var(--success); flex-shrink: 0; }
.ks-meta-cell.full { flex: 1 1 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; padding: 14px 16px; }
.ks-meta-cell.full small { margin-bottom: 0; }
.ks-meta-cell.expiry b { color: var(--text-main); font-size: 0.78rem; font-family: var(--font-main); font-weight: 600; }
@keyframes ksPop { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }

/* Info Rows */
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--panel-border); font-size: 0.9rem; }
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.info-label svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; }
.info-val { font-weight: 600; color: var(--text-main); }
.info-val.mono { font-family: var(--font-mono); font-size: 0.85rem; background: rgba(255,255,255,0.05); padding: 4px 8px; border-radius: 6px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; padding: 4px 10px; border-radius: 20px; }
.badge::before { content: ''; display: block; width: 6px; height: 6px; border-radius: 50%; }
.badge.active { background: rgba(16, 185, 129, 0.1); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.2); }
.badge.active::before { background: #34d399; box-shadow: 0 0 8px #34d399; animation: pulse 2s infinite; }
.badge.expired { background: rgba(239, 68, 68, 0.1); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.2); }
.badge.expired::before { background: #fca5a5; }

/* Spin */
.spin { display: inline-block; width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.2); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Step Bar */
.step-bar { display: flex; gap: 8px; margin: 24px 0; }
.step-dot { flex: 1; height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; position: relative; overflow: hidden; }
.step-dot.filled::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, var(--primary), var(--secondary)); animation: fillStep 0.5s ease forwards; }
@keyframes fillStep { from { transform: translateX(-100%); } to { transform: translateX(0); } }

/* Countdown circle */
#gen-circle-wrap { opacity: 0; transform: scale(0.9); transition: opacity 0.4s ease, transform 0.4s ease; }
#gen-circle-wrap.show { opacity: 1; transform: scale(1); }
#gen-ring { filter: drop-shadow(0 0 8px rgba(205,1,0,0.5)); }

/* Animations */
@keyframes slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* SVG Gradients definitions */
.svg-defs { width: 0; height: 0; position: absolute; }

/* Mobile Responsiveness */
@media (max-width: 600px) {
  body { padding: 1.5rem 0.5rem 3rem; }
  .glass-card { padding: 1.5rem; border-radius: 20px; }
  h1 { font-size: 2.2rem; }
  .logo-container { width: 72px; height: 72px; margin-bottom: 1rem; border-radius: 50%; }
  
  .tabs { gap: 6px; padding: 6px; margin-bottom: 2rem; border-radius: 16px; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 10px 4px; font-size: 0.9rem; gap: 4px; border-radius: 12px; min-width: 80px; flex: 1; flex-direction: column; justify-content: center; }
  .tab svg { width: 22px; height: 22px; }
  
  .day-grid { gap: 10px; margin-bottom: 2rem; }
  .day-btn { padding: 14px 6px; font-size: 1.1rem; border-radius: 12px; }
  
  .account-box { padding: 1rem; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
  .account-box svg { margin-bottom: 4px; }
  
  input[type=text] { padding: 14px 16px; margin-bottom: 1.5rem; font-size: 1rem; border-radius: 12px; }
  .btn { padding: 14px; font-size: 1rem; border-radius: 12px; }
  .btn-row { gap: 10px; margin-top: 1.5rem; flex-wrap: wrap; }
  .btn-row .btn { min-width: 100px; flex: 1; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ===== Bug fixes: overflow, Android tap glitches, perf ===== */
* { min-width: 0; }
.glass-card, .key-box, .result, .account-box { max-width: 100%; overflow-wrap: break-word; }
input, textarea, select { max-width: 100%; }
button, .btn, .tab, .day-btn { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { transform: translateY(-2px); }
  .day-btn:hover { transform: translateY(-2px); }
}
.btn:hover { filter: brightness(1.1); box-shadow: 0 4px 15px rgba(205,1,0,0.3); }
.day-btn:hover { border-color: var(--primary); background: rgba(205,1,0,0.05); }
.btn:active, .day-btn:active { transform: translateY(0); }
@media (max-width: 768px) {
  .glass-card { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
  .bg-grid { display: none; }
}


