:root {
  color-scheme: light;
  --bg: #f3f6f5;
  --paper: #ffffff;
  --paper-soft: #f8fbfa;
  --ink: #17212b;
  --muted: #667384;
  --line: #d9e4e2;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #e8f6f3;
  --blue: #2563eb;
  --warn: #b45309;
  --danger: #dc2626;
  --shadow: 0 18px 42px rgba(23, 33, 43, 0.09);
  --radius: 8px;
}

* {
  box-sizing: border-box;
  min-width: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(243, 246, 245, 0.9)),
    radial-gradient(circle at 12% 4%, rgba(15, 118, 110, 0.1), transparent 28%),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

.app-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 44px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 18px;
  align-items: end;
  margin-bottom: 18px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 900;
  text-decoration: none;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.topbar p {
  max-width: 720px;
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.65;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.today-card,
.timer-panel,
.plan-panel,
.record-panel,
.timeline-section,
.history-section,
.settings-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.today-card {
  padding: 16px;
}

.today-card span,
.today-card small {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.today-card strong {
  display: block;
  margin: 4px 0;
  color: var(--accent-strong);
  font-size: 1.45rem;
  line-height: 1.1;
}

.dashboard {
  display: grid;
  grid-template-columns: 330px minmax(0, 1.05fr) minmax(300px, 0.85fr);
  gap: 14px;
  align-items: stretch;
}

.timer-panel,
.plan-panel,
.record-panel {
  padding: 16px;
}

.timer-panel {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.timer-ring {
  position: relative;
  width: min(100%, 260px);
  aspect-ratio: 1;
}

.timer-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-ring circle {
  fill: none;
  stroke-width: 8;
}

.timer-ring .track {
  stroke: #e4ecef;
}

.timer-ring .progress {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 240ms ease;
}

.timer-time {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.timer-time strong {
  font-size: clamp(2.6rem, 7vw, 4.3rem);
  line-height: 1;
}

.timer-time span {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 900;
}

.timer-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.timer-actions button,
.input-row button,
.record-tools button,
.small-button,
.danger-button {
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 950;
}

.timer-actions button.secondary,
.small-button {
  border-color: var(--line);
  background: #fff;
  color: var(--accent-strong);
}

.timer-actions button.ghost {
  border-color: var(--line);
  background: var(--paper-soft);
  color: #334155;
}

.pending-box {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(180, 83, 9, 0.3);
  border-radius: var(--radius);
  background: #fff7ed;
  color: #7c2d12;
}

.pending-box h2 {
  font-size: 1.05rem;
}

.pending-box p {
  margin-top: 4px;
  color: #9a3412;
  font-size: 0.9rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

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

.section-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  gap: 8px;
  margin-top: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  outline: none;
}

input,
select {
  min-height: 42px;
  padding: 0 11px;
}

textarea {
  resize: vertical;
  padding: 11px;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(15, 118, 110, 0.6);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.plan-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.plan-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 8px;
  border: 1px solid #e5eef0;
  border-radius: var(--radius);
  background: var(--paper-soft);
}

.plan-item input {
  width: 18px;
  height: 18px;
  min-height: 0;
  accent-color: var(--accent);
}

.plan-item.done .plan-text {
  color: var(--muted);
  text-decoration: line-through;
}

.plan-text {
  font-weight: 850;
  overflow-wrap: anywhere;
}

.icon-button {
  display: grid;
  place-items: center;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
}

.icon-button:hover {
  border-color: var(--line);
  background: #fff;
  color: var(--danger);
}

.record-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.field {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 0.86rem;
  font-weight: 900;
}

.record-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 8px;
}

.timeline-section,
.history-section,
.settings-section {
  margin-top: 14px;
  padding: 18px;
}

.section-actions,
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.settings-actions {
  margin-top: 12px;
}

.small-button,
.danger-button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.86rem;
}

.danger-button {
  border-color: rgba(220, 38, 38, 0.32);
  background: #fff;
  color: var(--danger);
}

.timeline-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.timeline-item {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid #e5eef0;
  border-radius: var(--radius);
  background: #fff;
}

.timeline-time {
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 950;
}

.timeline-body strong {
  display: block;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.timeline-body p {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.timeline-body span {
  display: inline-flex;
  margin-top: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 900;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 74px;
  border: 1px dashed #cbd8dc;
  border-radius: var(--radius);
  background: var(--paper-soft);
  color: var(--muted);
  font-weight: 800;
}

.date-picker {
  display: grid;
  gap: 5px;
  min-width: 180px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.history-view {
  margin-top: 14px;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.history-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
}

.history-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.history-card ul,
.history-card ol {
  margin: 0;
  padding-left: 20px;
}

.history-card li {
  margin: 6px 0;
}

.reminder-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.72);
}

.reminder-modal[hidden] {
  display: none;
}

.reminder-dialog {
  width: min(520px, 100%);
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.28);
}

.reminder-kicker {
  margin: 0 0 6px;
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 950;
}

.reminder-dialog h2 {
  margin: 0;
  font-size: 1.85rem;
}

.reminder-dialog p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.modal-later-button {
  width: 100%;
  min-height: 40px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: #334155;
  font-weight: 900;
}

@media (max-width: 1050px) {
  .dashboard {
    grid-template-columns: 1fr 1fr;
  }

  .timer-panel {
    grid-row: span 2;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 1280px);
    padding-top: 18px;
    overflow-x: hidden;
  }

  .topbar,
  .dashboard,
  .history-grid {
    grid-template-columns: 1fr;
  }

  .timer-panel {
    grid-row: auto;
  }

  h1 {
    font-size: clamp(1.9rem, 9vw, 2.3rem);
    line-height: 1.06;
  }

  .topbar p {
    font-size: 0.95rem;
  }

  .timer-actions,
  .record-tools,
  .input-row {
    grid-template-columns: 1fr;
  }

  .section-head {
    display: grid;
  }

  .section-actions,
  .settings-actions {
    justify-content: stretch;
  }

  .section-actions button,
  .settings-actions button {
    flex: 1 1 auto;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }
}
