:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --ink: #202426;
  --muted: #66706b;
  --line: #d7ded8;
  --panel: #ffffff;
  --accent: #1f7a6d;
  --accent-dark: #12594f;
  --accent-soft: #e4f2ee;
  --warn: #9a5b1d;
  --shadow: 0 16px 40px rgba(25, 35, 31, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(31, 122, 109, 0.12), transparent 38%),
    linear-gradient(225deg, rgba(154, 91, 29, 0.1), transparent 34%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}

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

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

button:hover {
  background: var(--accent-dark);
}

button:active {
  transform: translateY(1px);
}

button.secondary {
  background: #eef1ed;
  color: var(--ink);
}

button.secondary:hover {
  background: #e1e7e2;
}

.icon-button {
  width: 42px;
  padding: 0;
  font-size: 1.25rem;
}

.app-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 20px;
}

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

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 4vw, 2.7rem);
  line-height: 1.18;
}

h2 {
  margin-bottom: 0;
  font-size: 1.08rem;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(56px, 1fr));
  gap: 8px;
  min-width: min(420px, 100%);
}

.status-strip span {
  display: block;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

.workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 36px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.field-group {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

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

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

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

textarea {
  resize: vertical;
  padding: 12px;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.source-card {
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  padding: 14px 14px 4px;
  background: #f9fbf8;
}

.source-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.source-meta span {
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 700;
}

#sourceText {
  margin-bottom: 8px;
  white-space: pre-line;
}

.compact-details {
  margin-top: 14px;
  color: var(--muted);
}

.compact-details summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
}

.compact-details ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.timer {
  display: flex;
  align-items: center;
  gap: 8px;
}

#timerText {
  min-width: 66px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: #fbfcfa;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.score-grid label {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fbfcfa;
}

input[type="range"] {
  min-height: auto;
  padding: 0;
  accent-color: var(--accent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.records {
  display: grid;
  gap: 10px;
}

.record-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fbfcfa;
}

.record-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.record-card p {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
}

@media (max-width: 860px) {
  .app-header {
    display: grid;
    align-items: start;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .score-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .app-header,
  .workspace {
    width: min(100% - 20px, 1180px);
  }

  .panel {
    padding: 14px;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }

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

  .timer {
    width: 100%;
  }

  #timerBtn {
    flex: 1;
  }
}
