:root {
  color-scheme: dark;
  --bg: #07111b;
  --bg-elevated: rgba(12, 24, 36, 0.88);
  --bg-panel: rgba(8, 16, 24, 0.88);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.2);
  --text: #eff6ff;
  --muted: #9db1c6;
  --accent: #8ff7d1;
  --accent-strong: #45e0b0;
  --danger: #ff8d8d;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --serif: "Roboto", "Segoe UI", system-ui, sans-serif;
  --sans: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --mono: "SFMono-Regular", "Cascadia Mono", "Roboto Mono", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(69, 224, 176, 0.16), transparent 34%),
    radial-gradient(circle at 80% 20%, rgba(143, 247, 209, 0.1), transparent 26%),
    linear-gradient(160deg, #07111b 0%, #0b1723 54%, #050b12 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  background: transparent;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at center, black, transparent 90%);
  opacity: 0.35;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

main {
  width: min(980px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 20px 0 36px;
}

.app-shell {
  display: grid;
  gap: 18px;
}

.hero,
.records-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(9, 18, 27, 0.84), rgba(9, 18, 27, 0.68));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero {
  padding: 22px;
}

.hero::after,
.records-card::after {
  content: "";
  position: absolute;
  inset: auto -20% -50% auto;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(143, 247, 209, 0.2), transparent 68%);
  pointer-events: none;
}

.hero-copy {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
}

h1,
h2 {
  margin: 0;
  font-family: var(--serif);
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2.6rem, 8vw, 5rem);
  line-height: 0.95;
}

.lede {
  margin: 0;
  max-width: 34rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.timer-card {
  display: grid;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius-xl) - 4px);
  background: linear-gradient(180deg, rgba(5, 10, 16, 0.7), rgba(9, 18, 27, 0.9));
}

.restore-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--text);
  background: rgba(143, 247, 209, 0.08);
  border: 1px solid rgba(143, 247, 209, 0.22);
  font-size: 0.92rem;
  line-height: 1.4;
}

.restore-notice::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(143, 247, 209, 0.16);
  flex: 0 0 auto;
}

.timer-readout {
  display: grid;
  gap: 6px;
}

.timer-label {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.timer-value {
  font-family: var(--mono);
  font-size: clamp(3.2rem, 15vw, 6.5rem);
  line-height: 1;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
}

.timer-actions {
  display: grid;
  gap: 10px;
}

.primary-action,
.ghost-action {
  min-height: 52px;
  padding: 0 18px;
  border-radius: 999px;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.primary-action {
  color: #04110d;
  background: linear-gradient(135deg, var(--accent), #d6fff1);
  box-shadow: 0 16px 28px rgba(69, 224, 176, 0.18);
  font-weight: 700;
}

.ghost-action {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.primary-action:active,
.ghost-action:active {
  transform: translateY(1px) scale(0.99);
}

.primary-action:hover,
.ghost-action:hover {
  border-color: var(--border-strong);
}

.status-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.records-card {
  padding: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2 {
  font-size: 1.4rem;
}

.table-wrap {
  overflow: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 100%;
  background: rgba(3, 8, 13, 0.45);
}

.history-table th,
.history-table td {
  padding: 14px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.history-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  background: rgba(255, 255, 255, 0.02);
}

.history-table td {
  font-size: 0.96rem;
}

.history-table td:nth-child(2),
.history-table td:nth-child(3) {
  color: var(--muted);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.empty-row td {
  color: var(--muted);
  text-align: center;
  padding: 24px 14px;
}

.name-dialog {
  width: min(92vw, 480px);
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(180deg, #0d1722, #07111b);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 0;
}

.name-dialog::backdrop {
  background: rgba(1, 5, 8, 0.74);
  backdrop-filter: blur(4px);
}

.dialog-form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.dialog-form p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.field span {
  color: var(--muted);
  font-size: 0.88rem;
}

.field input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  outline: none;
}

.field input:focus {
  border-color: rgba(143, 247, 209, 0.65);
  box-shadow: 0 0 0 4px rgba(69, 224, 176, 0.14);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (min-width: 700px) {
  main {
    padding: 28px 0 48px;
  }

  .hero {
    padding: 30px;
  }

  .timer-card {
    grid-template-columns: 1.3fr 0.9fr;
    align-items: end;
    padding: 22px;
  }

  .timer-actions {
    justify-items: end;
  }

  .status-text {
    text-align: right;
    max-width: 18rem;
  }

  .records-card {
    padding: 22px 22px 8px;
  }
}
