:root {
  --bg: #0a0a0b;
  --bg-soft: #18181b;
  --card: #18181b;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --accent: #6366F1;
  --accent-2: #8B5CF6;
  --ring-track: rgba(255, 255, 255, 0.08);
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

body.theme-light {
  --bg: #f5f3ef;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --text: #171717;
  --muted: #5d6570;
  --accent: #ff725e;
  --accent-2: #3e7bfa;
  --ring-track: rgba(0, 0, 0, 0.08);
  --shadow: 0 30px 80px rgba(22, 28, 45, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Outfit", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 700px at 20% 20%, rgba(255, 107, 94, 0.12), transparent),
    radial-gradient(900px 600px at 80% 0%, rgba(63, 208, 201, 0.18), transparent),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app {
  max-width: 1020px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #ffb199);
  color: #101318;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: var(--shadow);
}

.brand-title {
  font-weight: 600;
  font-size: 20px;
}

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

.topbar-actions {
  display: flex;
  gap: 12px;
}

.icon-btn {
  border: 1px solid #27272a;
  background: transparent;
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 10px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 18px;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

.main {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.timer-card,
.stats-card {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.05), transparent), var(--card);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  margin-bottom: 18px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.ring {
  width: min(320px, 80vw);
  aspect-ratio: 1;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--progress, 0) * 1turn), var(--ring-track) 0);
  padding: 12px;
  transition: background 0.3s ease;
}

.ring-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-soft);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.2);
}

.time {
  font-family: "Space Mono", monospace;
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 700;
  letter-spacing: 2px;
}

.subtime {
  color: var(--muted);
  margin-top: 8px;
  font-size: 13px;
}

.controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 15px;
  border: none;
  border-radius: 14px;
  padding: 12px 22px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button.primary {
  background: linear-gradient(135deg, var(--accent), #ffb199);
  color: #161b22;
  font-weight: 600;
  box-shadow: 0 20px 40px rgba(255, 107, 94, 0.3);
}

button.primary:hover {
  transform: translateY(-2px);
}

button.ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

button.ghost:hover {
  background: rgba(255, 255, 255, 0.16);
}

.stats-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}

.stat {
  background: rgba(255, 255, 255, 0.06);
  padding: 18px;
  border-radius: 18px;
}

.stat-value {
  font-size: 28px;
  font-weight: 600;
}

.stat-label {
  font-size: 13px;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  z-index: 20;
}

.modal.show {
  display: grid;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 12, 0.7);
  backdrop-filter: blur(6px);
}

.modal-panel {
  position: relative;
  background: var(--card);
  width: min(460px, 90vw);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
  z-index: 1;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-body {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-size: 13px;
  color: var(--muted);
}

.field input[type="number"] {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 15px;
  color: var(--text);
}

.field input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 107, 94, 0.2);
}

.field.checkbox {
  display: flex;
  align-items: center;
}

.field.checkbox label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.modal-footer {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .timer-card,
  .stats-card {
    padding: 22px;
  }

  .ring {
    width: min(260px, 78vw);
  }
}
