/* ===== DESIGN TOKENS ===== */
:root {
  --clr-bg: #0b0f1a;
  --clr-surface: rgba(255, 255, 255, 0.04);
  --clr-surface-border: rgba(255, 255, 255, 0.08);
  --clr-text: #e8eaf0;
  --clr-text-muted: #8b90a0;
  --clr-primary: #6C63FF;
  --clr-primary-light: #857dff;
  --clr-accent: #3CDFFF;
  --clr-success: #34D399;
  --clr-error: #f87171;
  --clr-gradient: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--clr-bg);
  color: var(--clr-text);
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
}

/* ===== ANIMATED BACKGROUND PARTICLES ===== */
.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-particles span {
  position: absolute;
  border-radius: 50%;
  opacity: 0.12;
  animation: float linear infinite;
}

.bg-particles span:nth-child(1) { width: 300px; height: 300px; background: var(--clr-primary); top: -10%; left: -5%; animation-duration: 22s; }
.bg-particles span:nth-child(2) { width: 200px; height: 200px; background: var(--clr-accent); top: 60%; right: -8%; animation-duration: 18s; animation-delay: -5s; }
.bg-particles span:nth-child(3) { width: 150px; height: 150px; background: var(--clr-success); bottom: -5%; left: 40%; animation-duration: 25s; animation-delay: -10s; }
.bg-particles span:nth-child(4) { width: 100px; height: 100px; background: var(--clr-primary-light); top: 30%; left: 70%; animation-duration: 20s; animation-delay: -3s; }
.bg-particles span:nth-child(5) { width: 250px; height: 250px; background: var(--clr-accent); top: 10%; right: 30%; animation-duration: 28s; animation-delay: -8s; }
.bg-particles span:nth-child(6) { width: 80px; height: 80px; background: var(--clr-primary); bottom: 20%; left: 10%; animation-duration: 16s; animation-delay: -2s; }
.bg-particles span:nth-child(7) { width: 120px; height: 120px; background: var(--clr-success); top: 50%; left: 20%; animation-duration: 24s; animation-delay: -12s; }
.bg-particles span:nth-child(8) { width: 180px; height: 180px; background: var(--clr-primary-light); bottom: 10%; right: 15%; animation-duration: 30s; animation-delay: -7s; }

@keyframes 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(15px, 35px) scale(1.02); }
}

/* ===== CONTAINER ===== */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 20px;
}

/* ===== SCREENS ===== */
.screen {
  display: none;
  animation: fadeSlideIn 0.5s ease-out;
}

.screen.active {
  display: block;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== GLASS CARD ===== */
.card.glass {
  background: var(--clr-surface);
  border: 1px solid var(--clr-surface-border);
  border-radius: var(--radius);
  padding: 36px 28px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
}

/* ===== LOGO & HEADER ===== */
.logo-area {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(108, 99, 255, 0.3)); }
  50% { filter: drop-shadow(0 0 20px rgba(108, 99, 255, 0.6)); }
}

h1 {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.highlight {
  background: var(--clr-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--clr-text-muted);
  font-size: 0.9rem;
  margin-top: 8px;
}

/* ===== FORM FIELDS ===== */
.field {
  margin-bottom: 20px;
  position: relative;
}

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--clr-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.field input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--clr-text);
  font-family: var(--font);
  font-size: 1rem;
  transition: var(--transition);
  outline: none;
}

.field input::placeholder {
  color: var(--clr-text-muted);
  opacity: 0.6;
}

.field input:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.2);
}

.field input.invalid {
  border-color: var(--clr-error);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15);
}

.field-error {
  display: none;
  font-size: 0.78rem;
  color: var(--clr-error);
  margin-top: 6px;
}

.field input.invalid ~ .field-error {
  display: block;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ===== Date input appearance fix ===== */
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--clr-gradient);
  color: #fff;
  box-shadow: 0 4px 16px rgba(108, 99, 255, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(108, 99, 255, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--clr-text-muted);
  border: 1px solid var(--clr-surface-border);
  margin-top: 12px;
}

.btn-ghost:hover {
  color: var(--clr-text);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
}

.btn-large {
  padding: 20px 24px;
  font-size: 1.1rem;
}

.btn-arrow, .btn-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Button ripple effect */
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255,255,255,0.25), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s;
}

.btn-primary:hover::after {
  opacity: 1;
}

/* ===== PHASE SCREEN ===== */
.progress-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar-fill {
  height: 100%;
  width: 7.14%;
  background: var(--clr-gradient);
  border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.phase-counter {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--clr-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 24px;
}

.phase-name {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 32px;
  background: var(--clr-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== TIMER ===== */
.timer-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-bottom: 12px;
  user-select: none;
}

.timer-digit {
  font-size: 3.2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  min-width: 2.2ch;
  text-align: center;
  background: var(--clr-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.timer-sep {
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--clr-text-muted);
  opacity: 0.5;
  animation: blink-sep 1s step-end infinite;
}

@keyframes blink-sep {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.15; }
}

.timer-pulse {
  width: 12px;
  height: 12px;
  margin: 0 auto 32px;
  border-radius: 50%;
  background: var(--clr-success);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  50% { box-shadow: 0 0 0 10px rgba(52, 211, 153, 0); }
}

/* ===== SUMMARY ===== */
.summary-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

#screen-summary h2 {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.summary-meta {
  text-align: center;
  color: var(--clr-text-muted);
  font-size: 0.85rem;
  margin-bottom: 24px;
}

/* ===== TABLE ===== */
.table-wrap {
  margin-bottom: 24px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  overflow-y: auto;
  max-height: 50vh;
  border: 1px solid var(--clr-surface-border);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.9rem;
}

th {
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--clr-text-muted);
}

td {
  border-top: 1px solid var(--clr-surface-border);
}

th:last-child, td:last-child {
  text-align: right;
}

tfoot td {
  background: rgba(108, 99, 255, 0.08);
  border-top: 2px solid var(--clr-surface-border);
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .container {
    padding: 12px;
  }

  .card.glass {
    padding: 28px 20px;
    border-radius: 14px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .timer-digit {
    font-size: 2.6rem;
  }

  .timer-sep {
    font-size: 2.2rem;
  }

  .btn-large {
    padding: 18px 20px;
    font-size: 1rem;
  }
}

@media (max-width: 360px) {
  .timer-digit {
    font-size: 2.2rem;
  }
}

/* ===== SUBMIT STATUS ===== */
.submit-status {
  text-align: center;
  font-size: 0.85rem;
  min-height: 1.2em;
  margin-top: 10px;
  margin-bottom: 2px;
  transition: var(--transition);
}

.submit-status.sending {
  color: var(--clr-accent);
}

.submit-status.success {
  color: var(--clr-success);
}

.submit-status.error {
  color: var(--clr-error);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ===== UTILITY ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
