:root {
  color-scheme: dark;
  --ink: #f8fafc;
  --muted: #cbd5e1;
  --panel: rgba(12, 18, 28, 0.74);
  --panel-strong: rgba(8, 13, 22, 0.88);
  --line: rgba(255, 255, 255, 0.18);
  --accent: #22c55e;
  --accent-hot: #f97316;
  --danger: #ef4444;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.48);
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(4, 8, 13, 0.42), rgba(4, 8, 13, 0.72)),
    url("bg.jpg") center / cover fixed;
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
}

.timer-shell,
.report-shell {
  width: min(100% - 32px, 980px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 0 40px;
}

.top-nav {
  display: flex;
  justify-content: flex-end;
}

.top-nav a,
.small-button,
.tab {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(8, 13, 22, 0.66);
  text-decoration: none;
  cursor: pointer;
}

.top-nav a {
  padding: 10px 14px;
  backdrop-filter: blur(10px);
}

.timer-stage {
  display: grid;
  place-items: center;
  min-height: 58vh;
  padding: 28px 0;
  text-align: center;
}

.tom-button {
  width: clamp(170px, 30vw, 300px);
  aspect-ratio: 1;
  padding: 0;
  border: 5px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  background: #111827;
  box-shadow: var(--shadow);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.tom-button:hover {
  transform: translateY(-2px) scale(1.015);
}

.tom-button img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.tom-button.is-running {
  border-color: var(--accent);
  box-shadow: 0 0 0 10px rgba(34, 197, 94, 0.22), var(--shadow);
  animation: pulse 1.3s ease-in-out infinite;
}

.tom-button:disabled {
  cursor: wait;
  opacity: 0.78;
}

.timer-state {
  min-height: 24px;
  margin: 22px 0 8px;
  color: var(--muted);
  font-size: 1rem;
}

.elapsed {
  min-height: 58px;
  margin: 0;
  font-size: clamp(2.35rem, 8vw, 5rem);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 6px 34px rgba(0, 0, 0, 0.7);
}

.log-panel,
.table-wrap,
.summary-grid,
.report-header,
.entry-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.log-panel {
  padding: 18px;
}

.section-heading,
.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1,
h2,
p {
  margin-top: 0;
}

.section-heading h1,
.report-header h1,
.table-wrap h2 {
  margin-bottom: 0;
  font-size: 1.2rem;
}

.small-button {
  padding: 8px 12px;
}

.primary-button {
  border-color: rgba(34, 197, 94, 0.8);
  background: rgba(34, 197, 94, 0.24);
}

.session-list {
  max-height: 320px;
  margin-top: 16px;
  overflow: auto;
}

.session-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.session-row strong {
  color: var(--ink);
}

.empty-state {
  margin: 16px 0 0;
  color: var(--muted);
}

.report-shell {
  display: grid;
  align-content: start;
  gap: 18px;
}

.report-header {
  padding: 20px;
}

.entry-panel {
  padding: 18px;
}

.entry-panel[hidden] {
  display: none;
}

.entry-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.entry-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.entry-form input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: rgba(8, 13, 22, 0.72);
}

.form-status {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab {
  padding: 9px 13px;
}

.tab.is-active {
  border-color: rgba(34, 197, 94, 0.8);
  background: rgba(34, 197, 94, 0.2);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  background: var(--line);
}

.summary-item {
  min-height: 94px;
  padding: 16px;
  background: var(--panel-strong);
}

.summary-item span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.summary-item strong {
  display: block;
  margin-top: 8px;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  padding: 18px;
  overflow-x: auto;
}

.table-heading {
  margin-bottom: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

th,
td {
  padding: 12px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
  color: var(--muted);
}

th {
  color: var(--ink);
  font-size: 0.86rem;
  text-transform: uppercase;
}

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

.text-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 9px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.danger-button {
  border-color: rgba(239, 68, 68, 0.5);
  color: #fecaca;
}

@keyframes pulse {
  50% {
    box-shadow: 0 0 0 18px rgba(34, 197, 94, 0.08), var(--shadow);
  }
}

@media (max-width: 720px) {
  .timer-shell,
  .report-shell {
    width: min(100% - 20px, 980px);
  }

  .timer-stage {
    min-height: 54vh;
  }

  .section-heading,
  .report-header {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    width: 100%;
  }

  .tab {
    flex: 1;
  }

  .entry-form {
    grid-template-columns: 1fr;
  }

  .table-heading {
    align-items: center;
    flex-direction: row;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .session-row {
    grid-template-columns: minmax(82px, 1.15fr) minmax(58px, 0.8fr) minmax(58px, 0.8fr) minmax(72px, auto);
    gap: 6px;
    align-items: center;
    padding: 10px 0;
    font-size: 0.82rem;
  }
}
