:root {
  --bg1: #0e1420;
  --bg2: #1c2638;
  --panel: rgba(16, 22, 34, 0.72);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #e9eef7;
  --muted: #9aa7bd;
  --accent: #e0b36a;
  --accent-2: #f1d3a0;
  --danger: #e07a6a;
  font-family: "Inter", "SF Pro Text", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--text);
  background: radial-gradient(120% 90% at 65% 40%, var(--bg2) 0%, var(--bg1) 70%);
}

#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

#panel {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 320px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 18px 18px 12px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  scrollbar-width: thin;
}

#panel header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: 0.02em;
}
#panel header .sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

#panel section { margin-top: 16px; }
#panel h2 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.readout { text-align: center; }
.time {
  font-variant-numeric: tabular-nums;
  font-size: 52px;
  font-weight: 300;
  letter-spacing: 0.04em;
  line-height: 1;
  margin-top: 6px;
}
.time .tenths { font-size: 24px; color: var(--muted); }
.status {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
}
.status.running { color: var(--accent-2); }
.status.done { color: var(--accent); font-weight: 600; }

.bar {
  margin-top: 10px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.25s linear;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
button {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  padding: 7px 11px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
button:hover { background: rgba(255, 255, 255, 0.12); }
button:active { transform: translateY(1px); }
button.active {
  background: rgba(224, 179, 106, 0.18);
  border-color: rgba(224, 179, 106, 0.6);
  color: var(--accent-2);
}
button.primary {
  background: linear-gradient(180deg, #e7bd77, #c9963f);
  border-color: transparent;
  color: #1b1408;
  font-weight: 650;
}
button.primary:hover { filter: brightness(1.06); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.row { display: flex; gap: 6px; margin-top: 8px; }
.row input {
  flex: 1;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  padding: 7px 10px;
  outline: none;
}
.row input:focus { border-color: rgba(224, 179, 106, 0.6); }

.controls { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 6px; }
.controls button { padding: 10px 8px; }

.opt {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.opt:last-child { border-bottom: none; }
.opt select {
  font: inherit;
  font-size: 12px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  padding: 4px 6px;
}
.opt input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

.stats dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  margin: 0;
  font-size: 12px;
}
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; }

footer p {
  margin: 14px 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}
kbd {
  font: inherit;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

#loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 22, 0.85);
  color: var(--muted);
  font-size: 14px;
  z-index: 10;
  transition: opacity 0.4s, visibility 0s 0.4s;
}
#loading.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  #panel {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 55vh;
    border-radius: 16px 16px 0 0;
  }
  .time { font-size: 40px; }
}
