:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #68727d;
  --line: rgba(23, 33, 43, 0.14);
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --accent: #0f8b8d;
  --accent-strong: #096c6e;
  --accent-soft: rgba(15, 139, 141, 0.16);
  --warm: #f3b562;
  --danger: #b64c3a;
  --shadow: 0 24px 70px rgba(23, 33, 43, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  background: #e8edf0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

#ambientCanvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  background: #e8edf0;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(280px, 380px);
  gap: 24px;
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
  align-items: stretch;
}

.workspace,
.side-panel {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.workspace {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 64px);
  padding: clamp(20px, 4vw, 44px);
}

.side-panel {
  min-height: calc(100vh - 64px);
  padding: 24px;
  overflow: hidden;
}

.topbar,
.panel-heading,
.timer-actions,
.quick-row {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 4.5rem);
  line-height: 0.98;
  font-weight: 800;
}

h2 {
  font-size: 1.08rem;
}

.icon-button,
.ghost-button,
.secondary-button,
.danger-button,
.primary-button,
.quick-row button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--panel-strong);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.icon-button:hover,
.ghost-button:hover,
.secondary-button:hover,
.danger-button:hover,
.primary-button:hover,
.quick-row button:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 139, 141, 0.38);
}

.icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.icon-button.enabled {
  color: #fff;
  background: var(--accent);
}

.entry-panel,
.timer-panel {
  width: min(620px, 100%);
  min-width: 0;
  margin: auto 0;
}

form {
  display: grid;
  gap: 18px;
  min-width: 0;
  margin-top: 42px;
}

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

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

input {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.quick-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 10px;
}

.quick-row button,
.ghost-button {
  min-height: 38px;
  border-radius: 999px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.quick-row button,
.primary-button {
  width: 100%;
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 800;
}

.primary-button {
  border-color: transparent;
  color: #fff;
  background: var(--accent);
}

.primary-button:hover {
  border-color: transparent;
  background: var(--accent-strong);
}

.timer-panel {
  display: grid;
  gap: 24px;
  justify-items: start;
  margin-top: 48px;
}

.ring-wrap {
  width: min(420px, 100%);
  aspect-ratio: 1;
}

.progress-ring {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    conic-gradient(var(--accent) var(--progress, 0deg), rgba(23, 33, 43, 0.12) 0deg),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.92) 0 61%, transparent 62%);
  box-shadow: inset 0 0 0 1px rgba(23, 33, 43, 0.08), 0 20px 58px rgba(23, 33, 43, 0.16);
}

.ring-core {
  display: grid;
  place-items: center;
  width: 72%;
  height: 72%;
  border-radius: 50%;
  border: 1px solid rgba(23, 33, 43, 0.08);
  background: rgba(255, 255, 255, 0.92);
  text-align: center;
  padding: 24px;
}

.task-label,
#targetLabel,
.status-line {
  color: var(--muted);
  font-weight: 700;
}

.task-label {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(0.9rem, 2vw, 1.08rem);
}

#countdownText {
  display: block;
  width: 100%;
  margin: 14px 0 10px;
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.25rem, 7vw, 5rem);
  line-height: 1;
  letter-spacing: 0;
}

#targetLabel,
.status-line {
  font-size: 0.95rem;
}

.timer-actions {
  flex-wrap: wrap;
  gap: 12px;
}

.danger-button {
  color: var(--danger);
}

.panel-heading {
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.history-list {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 158px);
  margin: 18px 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 14px;
  min-height: 72px;
  border: 1px solid rgba(23, 33, 43, 0.1);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.history-title {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.history-time,
.history-status {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.history-status {
  justify-self: end;
  color: var(--accent-strong);
}

.empty-state {
  margin-top: 22px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 5;
  max-width: min(420px, calc(100% - 44px));
  border: 1px solid rgba(23, 33, 43, 0.12);
  border-radius: 8px;
  padding: 14px 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 42px rgba(23, 33, 43, 0.18);
}

.hidden {
  display: none !important;
}

@media (max-width: 840px) {
  .app-shell {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 680px;
    padding: 12px;
  }

  .workspace,
  .side-panel {
    min-height: auto;
  }

  .workspace {
    padding: 22px;
  }

  .entry-panel,
  .timer-panel {
    margin: 32px 0 0;
  }

  .ring-wrap {
    margin: 0 auto;
  }

  .timer-panel {
    justify-items: stretch;
  }

  .timer-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .history-list {
    max-height: 360px;
  }
}

@media (max-width: 700px) {
  .app-shell {
    max-width: 360px;
  }

  .quick-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 420px) {
  .topbar {
    align-items: flex-start;
  }

  .ring-core {
    width: 76%;
    height: 76%;
    padding: 18px;
  }
}
