:root {
  --bg-gradient: radial-gradient(circle at 50% 0%, #1e1b4b 0%, #0f172a 60%, #090d16 100%);
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-card: rgba(255, 255, 255, 0.06);
  --inset-bg: rgba(0, 0, 0, 0.45);
  --inset-border: rgba(255, 255, 255, 0.12);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent-glow: #6366f1;
  --accent-purple: #a855f7;
  --accent-success: #10b981;
  --accent-danger: #ef4444;
  --shadow-depth: 0 16px 40px 0 rgba(0, 0, 0, 0.55), inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
  --inset-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.6), inset 0 1px 2px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 255, 255, 0.05);
  --radius: 20px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-main);
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-gradient);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 0;
}

.hidden {
  display: none !important;
}

/* Glassmorphism & 3D Utility Cards */
.glass-card, .card-glass, .glass-header {
  background: var(--glass-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-depth);
  border-radius: var(--radius);
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 540px;
  width: 100%;
  margin: 0 auto;
  position: relative;
}

/* Header */
.glass-header {
  margin: 12px 12px 16px 12px;
  padding: 14px 20px;
  border-radius: 16px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  object-fit: cover;
}

.logo {
  font-size: 1.2rem;
  font-weight: 700;
  background: linear-gradient(to right, #818cf8, #e879f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.2px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  padding: 8px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.danger-icon {
  color: var(--accent-danger);
  border-color: rgba(239, 68, 68, 0.3);
}

.danger-icon:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 0 12px 30px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Generator Card */
.generator-card {
  padding: 24px 20px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.glow-orb {
  position: absolute;
  top: -60px;
  right: -40px;
  width: 180px;
  height: 180px;
  background: linear-gradient(135deg, var(--accent-glow), var(--accent-purple));
  filter: blur(60px);
  opacity: 0.35;
  pointer-events: none;
}

.card-title h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.card-title p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Custom Inset Depth Input Box */
.input-wrapper {
  position: relative;
  width: 100%;
}

.inset-input-box {
  display: flex;
  align-items: center;
  background: var(--inset-bg);
  border: 1px solid var(--inset-border);
  border-radius: 16px;
  padding: 6px 14px;
  box-shadow: var(--inset-shadow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.inset-input-box:focus-within {
  border-color: var(--accent-glow);
  box-shadow: var(--inset-shadow), 0 0 18px rgba(99, 102, 241, 0.35);
  background: rgba(0, 0, 0, 0.6);
}

.input-icon {
  font-size: 1.1rem;
  margin-right: 10px;
  opacity: 0.8;
}

.inset-input-box input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  padding: 10px 0;
  font-size: 0.95rem;
  color: var(--text-main);
  font-weight: 500;
}

.inset-input-box input::placeholder {
  color: #64748b;
  font-weight: 400;
}

.clear-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  transition: all 0.2s;
  margin-left: 6px;
}

.clear-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Action Button */
.action-bar {
  display: flex;
  gap: 10px;
}

.glow-btn {
  width: 100%;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  border: none;
  padding: 14px 20px;
  border-radius: 14px;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(99, 102, 241, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.glow-btn:active {
  transform: scale(0.98);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

/* QR Display Container */
.qr-display-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding-top: 10px;
  animation: fadeInSlide 0.3s ease-out;
}

@keyframes fadeInSlide {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.qr-frame {
  width: 220px;
  height: 220px;
  background: #ffffff;
  padding: 14px;
  border-radius: 20px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(168, 85, 247, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.qr-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

.qr-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #1e293b;
}

.qr-loader span {
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--accent-glow);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* QR Action Buttons */
.qr-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}

.action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.download-glow {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.download-glow:active {
  transform: scale(0.97);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* History Card */
.history-card {
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-title h3 {
  font-size: 0.98rem;
  font-weight: 600;
}

.badge {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.4);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 2px;
}

.history-item {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateX(2px);
}

.history-left {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.history-thumb {
  width: 38px;
  height: 38px;
  background: #ffffff;
  border-radius: 8px;
  padding: 2px;
  flex-shrink: 0;
  object-fit: contain;
}

.history-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.history-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-date {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.history-delete-btn {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--accent-danger);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.history-delete-btn:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* Modal Overlay & Custom Dialogs */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 8, 18, 0.82);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: 100%;
  max-width: 360px;
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.7);
}

.modal-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.modal-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.cancel-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
}

.confirm-btn {
  background: linear-gradient(135deg, var(--accent-danger), #dc2626);
  color: #fff;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.35);
}

/* Custom Notification Toast */
.custom-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(129, 140, 248, 0.4);
  box-shadow: 0 15px 35px rgba(0,0,0,0.6);
  padding: 10px 22px;
  border-radius: 30px;
  z-index: 3000;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.2px;
  backdrop-filter: blur(10px);
  animation: toastPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes toastPop {
  from { opacity: 0; transform: translate(-50%, -15px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}