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

:root {
  --bg: #0a0410;
  --card: #13091f;
  --card-border: #2a1547;
  --purple: #a855f7;
  --purple-light: #c084fc;
  --purple-dark: #7e22ce;
  --text: #f3e8ff;
  --text-muted: #a78bb8;
  --error: #f87171;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

.bg-glow {
  position: fixed;
  top: 50%; left: 50%;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.25), transparent 70%);
  transform: translate(-50%, -50%);
  filter: blur(60px);
  z-index: 0;
  animation: pulse 6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  background: linear-gradient(145deg, rgba(30, 15, 55, 0.9), rgba(15, 8, 30, 0.95));
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 36px 32px;
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(126, 34, 206, 0.25), 0 0 0 1px rgba(168, 85, 247, 0.1);
}

header { text-align: center; margin-bottom: 28px; }

.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  color: white;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(168, 85, 247, 0.4);
}

h1 {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--purple-light), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 6px;
}

.subtitle { font-size: 13px; color: var(--text-muted); }

.input-group { margin-bottom: 24px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-muted);
}

input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(20, 10, 40, 0.6);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  font-family: "SF Mono", Monaco, monospace;
  letter-spacing: 1px;
  transition: all 0.2s;
  outline: none;
}

input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
  background: rgba(30, 15, 55, 0.8);
}

input::placeholder { color: #5a4570; letter-spacing: normal; }

.error {
  display: block;
  min-height: 18px;
  font-size: 12px;
  color: var(--error);
  margin-top: 6px;
}

.code-box {
  position: relative;
  background: linear-gradient(135deg, rgba(126, 34, 206, 0.15), rgba(168, 85, 247, 0.05));
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
}

.code {
  font-family: "SF Mono", Monaco, monospace;
  font-size: 38px;
  font-weight: 700;
  letter-spacing: 8px;
  color: var(--purple-light);
  text-shadow: 0 0 20px rgba(192, 132, 252, 0.5);
  user-select: all;
}

.code.active { color: #f3e8ff; }

.copy-btn {
  position: absolute;
  top: 12px; right: 12px;
  width: 34px; height: 34px;
  border: none;
  border-radius: 8px;
  background: rgba(168, 85, 247, 0.15);
  color: var(--purple-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.copy-btn:hover { background: rgba(168, 85, 247, 0.3); transform: scale(1.05); }
.copy-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.timer-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.timer-bar {
  flex: 1;
  height: 6px;
  background: rgba(168, 85, 247, 0.15);
  border-radius: 999px;
  overflow: hidden;
}

#timerFill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--purple), var(--purple-light));
  border-radius: 999px;
  transition: width 1s linear;
}

#timerText {
  font-family: "SF Mono", Monaco, monospace;
  font-size: 13px;
  color: var(--text-muted);
  min-width: 32px;
  text-align: right;
}

footer {
  text-align: center;
  padding-top: 18px;
  border-top: 1px solid rgba(168, 85, 247, 0.1);
}

footer p { font-size: 12px; color: var(--text-muted); }

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  color: white;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(168, 85, 247, 0.4);
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  z-index: 10;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 480px) {
  .card { padding: 28px 22px; }
  .code { font-size: 30px; letter-spacing: 5px; }
}
