:root {
  --bg: #0f0f10;
  --panel: #17171a;
  --text: #e9e9ec;
  --muted: #a8a8b3;
  --primary: #7dd3fc;
  --accent: #e5e7eb;
  --ring: rgba(125, 211, 252, 0.35);
  --ok: #86efac;
  --danger: #fca5a5;
  --shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --speed: 0.18s;
}

html[data-theme="light"] {
  --bg: #f6f7f8;
  --panel: #ffffff;
  --text: #0b0c0f;
  --muted: #6b7280;
  --primary: #0ea5e9;
  --accent: #e5e7eb;
  --ring: rgba(14, 165, 233, 0.25);
  --ok: #16a34a;
  --danger: #dc2626;
  --shadow: 0 10px 22px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica,
    Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  overflow: auto; /* Permite scroll */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.wrap {
  width: min(980px, 92%);
  margin: 0 auto;
  padding: 0;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--accent);
  position: sticky;
  top: 0;
  backdrop-filter: saturate(120%) blur(6px);
  background: color-mix(in hsl, var(--bg) 92%, transparent);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.logo {
  width: 28px;
  height: 28px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
}
.logo::before,
.logo::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid var(--accent);
  border-radius: 50%;
}
.brand small {
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.08em;
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn,
button {
  appearance: none;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform var(--speed) ease, background var(--speed) ease,
    border-color var(--speed) ease;
  box-shadow: none;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}
.btn.primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}

.main {
  display: block;
  padding: 0 0 8px;
  margin-top: 20px;
}

.hero {
  display: grid;
  gap: 20px;
  justify-items: center;
  padding: 22px 0 6px;
}
.tagline {
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.timer-card {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 18px;
  align-items: center;
  justify-items: center;
}
.timer-display {
  font-variant-numeric: tabular-nums;
  font-size: clamp(48px, 8vw, 96px);
  line-height: 1;
  letter-spacing: 0.06em;
}
.timer-status {
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.9rem;
}
.timer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.soft {
  background: color-mix(in hsl, var(--text) 6%, transparent);
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 18px;
  padding-bottom: 8px;
}
@media (min-width: 880px) {
  .grid {
    grid-template-columns: 1.2fr 0.8fr;
  }
}

.rows {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}
.field {
  display: grid;
  gap: 6px;
}
label {
  color: var(--muted);
  font-size: 0.9rem;
}
input[type="number"],
input[type="url"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  outline: none;
  transition: border-color var(--speed) ease, box-shadow var(--speed) ease;
}
input[type="number"]:focus,
input[type="url"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 6px var(--ring);
}

.card {
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  gap: 14px;
}
.card h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.task-input {
  display: flex;
  gap: 10px;
}
.task-input input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  outline: none;
}
.task-input input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 6px var(--ring);
}

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

.task {
  display: flex;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  transition: background var(--speed) ease, border-color var(--speed) ease;
}

.task:hover {
  background: color-mix(in hsl, var(--text) 4%, transparent);
}
.task.done {
  opacity: 0.75;
}
.task.done .text {
  text-decoration: line-through;
}
.task .text {
  flex-grow: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task button.icon {
  padding: 6px 8px;
  border-radius: 10px;
}

.muted {
  color: var(--muted);
}
.kpi {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.yt-input {
  display: flex;
  gap: 10px;
}
.yt-player-wrap {
  border: 1px solid var(--accent);
  border-radius: 12px;
  overflow: hidden;
}
.yt-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.yt-controls input {
  flex: 1;
  min-width: 100px;
}

footer {
  padding: 20px 0;
  text-align: center;
  color: var(--muted);
  border-top: 1px solid var(--accent);
  margin-top: 20px;
}
footer a {
  color: var(--text);
  text-decoration: none;
}
footer a:hover {
  text-decoration: underline;
}

.scroll-area {
  max-height: 150px;
  overflow-y: auto;
  padding-right: 6px;
}

#overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-content {
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  max-width: 400px;
  width: 90%;
  display: grid;
  gap: 16px;
}
.modal-content h2 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.auto-options {
  display: grid;
  gap: 8px;
}
.auto-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
