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

:root {
  --bg: #07070f;
  --bg-2: #0d0d1a;
  --surface: rgba(20, 20, 35, 0.7);
  --surface-2: rgba(28, 28, 48, 0.6);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --neon-cyan: #22d3ee;
  --neon-magenta: #d946ef;
  --neon-purple: #a855f7;
  --neon-lime: #84cc16;

  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --danger: #f43f5e;
  --success: #34d399;

  --radius: 18px;
  --radius-sm: 12px;

  --font-display: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --shadow-neon-cyan: 0 0 24px rgba(34, 211, 238, 0.35);
  --shadow-neon-magenta: 0 0 24px rgba(217, 70, 239, 0.35);
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  justify-content: center;
  padding: 32px 16px 64px;
  position: relative;
  isolation: isolate;
}

/* ─── Background neon glow ─── */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 15% 10%, rgba(34, 211, 238, 0.18), transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 20%, rgba(217, 70, 239, 0.18), transparent 60%),
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(168, 85, 247, 0.12), transparent 70%),
    var(--bg);
}
.bg-glow::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 30%, transparent 80%);
}

/* ─── App container ─── */
.app {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
}

/* ─── Header ─── */
.app-header {
  text-align: center;
  padding: 16px 0 4px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  backdrop-filter: blur(12px);
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 12px var(--neon-cyan);
  animation: pulse-dot 1.6s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.brand-name {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--text-muted);
}

.brand-accent {
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-left: 2px;
}

.current-time {
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, var(--neon-cyan) 0%, var(--neon-magenta) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 16px rgba(217, 70, 239, 0.4));
  line-height: 1;
}

.current-date {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* ─── Tabs ─── */
.tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px;
  backdrop-filter: blur(16px);
}

.tab {
  position: relative;
  z-index: 2;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  padding: 12px 16px;
  border-radius: 999px;
  transition: color 0.25s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tab:hover { color: var(--text-muted); }
.tab.active { color: var(--text); }

.tab-icon { font-size: 1.05rem; }

.tab-indicator {
  position: absolute;
  z-index: 1;
  top: 6px;
  bottom: 6px;
  left: 6px;
  width: calc(50% - 6px);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.18), rgba(217, 70, 239, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: transform 0.35s cubic-bezier(0.5, 0, 0.2, 1);
}

.tabs[data-active="pomodoro"] .tab-indicator {
  transform: translateX(100%);
  background: linear-gradient(135deg, rgba(217, 70, 239, 0.2), rgba(168, 85, 247, 0.18));
  box-shadow: 0 0 24px rgba(217, 70, 239, 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* ─── Panels ─── */
.panel {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.panel.active {
  display: flex;
  animation: panel-in 0.35s ease-out;
}

.panel[hidden] { display: none; }

@keyframes panel-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Card ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.25), transparent 40%, rgba(217, 70, 239, 0.2));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  opacity: 0.6;
}

.card-title {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 16px;
}

/* ─── Form ─── */
.alarm-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.alarm-form input[type="time"],
.alarm-form input[type="text"] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1rem;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.alarm-form input[type="time"] {
  flex: 0 0 130px;
  font-family: var(--font-display);
  font-weight: 600;
}

.alarm-form input[type="text"] { flex: 1 1 140px; }

.alarm-form input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}

/* ─── Buttons ─── */
.btn {
  cursor: pointer;
  border: 0;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 11px 20px;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s, color 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:active { transform: translateY(1px); }
.btn[hidden] { display: none; }

.btn-lg { padding: 13px 24px; font-size: 1rem; }

.btn-primary {
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta));
  color: #fff;
  box-shadow: 0 4px 20px rgba(217, 70, 239, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
  box-shadow: 0 6px 28px rgba(217, 70, 239, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.btn-ghost {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-danger {
  background: transparent;
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: var(--danger);
  padding: 6px 12px;
  font-size: 0.78rem;
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.12);
  border-color: var(--danger);
}

.btn-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 12px;
  font-size: 0.78rem;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
}

.btn-toggle.active {
  border-color: rgba(52, 211, 153, 0.5);
  color: var(--success);
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.25);
}

.btn-toggle:hover { border-color: var(--border-strong); }

/* ─── Alarm List ─── */
.alarm-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-state {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.88rem;
  padding: 28px 0;
  font-family: var(--font-display);
  letter-spacing: 0.06em;
}

.alarm-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color 0.2s, opacity 0.2s, box-shadow 0.2s;
}

.alarm-item:hover { border-color: var(--border-strong); }

.alarm-item.off { opacity: 0.4; }

.alarm-item.ringing {
  border-color: var(--neon-magenta);
  box-shadow: 0 0 24px rgba(217, 70, 239, 0.5);
  animation: pulse 0.9s ease-in-out infinite alternate;
}

@keyframes pulse {
  from { box-shadow: 0 0 12px rgba(217, 70, 239, 0.3); }
  to   { box-shadow: 0 0 36px rgba(217, 70, 239, 0.7); }
}

.alarm-time {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--text);
  min-width: 88px;
}

.alarm-info { flex: 1; min-width: 0; }

.alarm-label {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alarm-actions { display: flex; gap: 8px; }

/* ═══ POMODORO ═══ */
.pomodoro-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 28px 22px;
}

.pomo-mode-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pomo-mode-badge {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid;
  text-transform: uppercase;
}

.pomo-mode-badge.mode-focus {
  color: var(--neon-cyan);
  border-color: rgba(34, 211, 238, 0.4);
  background: rgba(34, 211, 238, 0.08);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.2);
}

.pomo-mode-badge.mode-break {
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.08);
  box-shadow: 0 0 16px rgba(52, 211, 153, 0.2);
}

.pomo-mode-badge.mode-long {
  color: var(--neon-magenta);
  border-color: rgba(217, 70, 239, 0.4);
  background: rgba(217, 70, 239, 0.08);
  box-shadow: 0 0 16px rgba(217, 70, 239, 0.2);
}

.pomo-cycle {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.pomo-cycle span {
  color: var(--text);
  font-weight: 700;
}

/* ─── Progress ring ─── */
.ring-wrap {
  position: relative;
  width: 280px;
  height: 280px;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 8;
}

.ring-progress {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 678.58;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.4s linear;
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.pomo-time {
  font-family: var(--font-display);
  font-size: 3.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--text);
  text-shadow: 0 0 24px rgba(34, 211, 238, 0.4);
  line-height: 1;
}

.pomo-status {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.pomo-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.pomo-controls .btn { min-width: 110px; }

.pomo-stats {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 16px;
  width: 100%;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.stat { text-align: center; flex: 1; }

.stat-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  margin-top: 4px;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.stat-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
}

.pomo-info {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.dot-sep { color: var(--neon-purple); opacity: 0.6; }

/* ─── Modal ─── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(7, 7, 15, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.modal.hidden { display: none; }

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 40px 36px;
  text-align: center;
  max-width: 360px;
  width: 90%;
  box-shadow: 0 0 60px rgba(217, 70, 239, 0.4);
  animation: pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.modal-content::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 20px;
  padding: 1px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

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

.modal-icon {
  font-size: 3.4rem;
  margin-bottom: 12px;
  animation: shake 0.5s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 16px rgba(217, 70, 239, 0.5));
}

@keyframes shake {
  from { transform: rotate(-8deg) scale(1); }
  to   { transform: rotate(8deg)  scale(1.06); }
}

.modal-content h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.modal-content p {
  color: var(--text-muted);
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.modal-time {
  font-family: var(--font-display);
  font-size: 2.2rem !important;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text) !important;
  margin: 6px 0 24px !important;
  letter-spacing: 0.02em;
}

.modal-content .btn-primary {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
}

/* ─── Responsive ─── */
@media (max-width: 480px) {
  .current-time { font-size: 3rem; }
  .ring-wrap { width: 240px; height: 240px; }
  .pomo-time { font-size: 3rem; }
  .alarm-time { font-size: 1.4rem; min-width: 72px; }
  .alarm-form input[type="time"] { flex: 1 1 100%; }
  .alarm-form input[type="text"] { flex: 1 1 60%; }
  .pomo-controls .btn { min-width: 0; flex: 1 1 calc(50% - 5px); }
}
