:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --surface: #ffffff;
  --surface-soft: #f1eee6;
  --ink: #16211f;
  --muted: #63706b;
  --line: #d9ddd4;
  --primary: #0f766e;
  --primary-dark: #0a5752;
  --accent: #d97706;
  --sky: #2563eb;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(20, 35, 32, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), transparent 380px),
    var(--bg);
  color: var(--ink);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Noto Sans SC",
    system-ui,
    sans-serif;
}

a {
  color: inherit;
}

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

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 28px;
  align-items: stretch;
  min-height: 560px;
  padding: 42px 0 24px;
}

.hero-copy {
  display: flex;
  min-height: 500px;
  flex-direction: column;
  justify-content: center;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.92), rgba(22, 33, 31, 0.92)),
    url("https://images.unsplash.com/photo-1550751827-4bd374c3f58b?auto=format&fit=crop&w=1400&q=80") center/cover;
  color: #fff;
  padding: clamp(28px, 5vw, 64px);
  overflow: hidden;
  position: relative;
}

.hero-copy::after {
  content: "";
  position: absolute;
  inset: auto 28px 28px auto;
  width: 180px;
  height: 180px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
}

.kicker,
.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-copy .kicker {
  color: #a7f3d0;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: clamp(2.5rem, 8vw, 6.7rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.15;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.lead {
  max-width: 760px;
  margin-bottom: 28px;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(1rem, 2vw, 1.24rem);
  line-height: 1.75;
}

.hero-actions,
.form-actions,
.map-legend,
.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

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

.hero-copy .button.primary {
  background: #fff;
  color: var(--primary-dark);
}

.button.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.hero-copy .button.secondary {
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.text-button {
  min-height: 36px;
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}

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

.map-panel,
.log-surface,
.side-surface {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.map-panel {
  display: flex;
  min-height: 500px;
  flex-direction: column;
  justify-content: space-between;
  padding: 26px;
}

.panel-heading,
.section-heading {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-heading.compact {
  margin-bottom: 14px;
}

.completion-pill {
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  padding: 7px 11px;
  font-weight: 900;
}

#mapCanvas {
  width: 100%;
  height: min(360px, 52vh);
  border-radius: 8px;
  background: #f8fafc;
}

.map-legend {
  color: var(--muted);
  font-size: 0.92rem;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 50%;
}

.legend-dot.done {
  background: var(--primary);
}

.legend-dot.active {
  background: var(--accent);
}

.legend-dot.idle {
  background: #cbd5e1;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 12px 0 24px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}

.metric-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.metric strong {
  font-size: 1.85rem;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
  gap: 18px;
  align-items: start;
}

.log-surface,
.side-surface {
  padding: 24px;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

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

textarea {
  resize: vertical;
}

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

.wide {
  grid-column: 1 / -1;
}

.confidence-label {
  grid-template-columns: 1fr auto;
}

.confidence-label input {
  grid-column: 1 / -1;
  padding: 0;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

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

.rhythm-list li {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0 0 11px;
  color: var(--ink);
}

.rhythm-list span {
  border-radius: 999px;
  background: #ecfeff;
  color: #155e75;
  padding: 6px 8px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 900;
}

.rule-box {
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  color: #7c2d12;
  padding: 16px;
}

.rule-box p {
  margin-bottom: 0;
  line-height: 1.7;
}

.week-bars {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.week-bar {
  display: grid;
  grid-template-columns: 54px 1fr 48px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--sky));
}

.roadmap-section,
.entries-section {
  margin-top: 18px;
  padding: 24px 0;
}

.section-note {
  max-width: 440px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  text-align: right;
}

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

.week-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.week-card.is-complete {
  border-color: rgba(15, 118, 110, 0.48);
  background: #f0fdfa;
}

.week-card-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.week-number {
  color: var(--primary);
  font-weight: 900;
}

.week-card h3 {
  margin: 0;
  line-height: 1.35;
}

.week-card ul {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.58;
}

.week-status {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  padding: 5px 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.week-card.is-complete .week-status {
  border-color: transparent;
  background: var(--primary);
  color: #fff;
}

.entry-list {
  display: grid;
  gap: 12px;
}

.entry-card {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 16px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.entry-date {
  color: var(--primary-dark);
  font-weight: 900;
}

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

.entry-meta span {
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 5px 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.entry-card p {
  margin-bottom: 8px;
  line-height: 1.68;
}

.delete-entry {
  min-width: 38px;
  min-height: 38px;
  border-color: #fecaca;
  background: #fff1f2;
  color: var(--danger);
  padding: 0 10px;
}

.empty-state {
  border: 1px dashed #b8c2bd;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  padding: 22px;
  text-align: center;
}

.footer {
  justify-content: center;
  padding: 26px 0 40px;
  color: var(--muted);
  font-size: 0.92rem;
}

.footer a {
  color: var(--primary-dark);
  font-weight: 800;
}

@media (max-width: 980px) {
  .hero,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-copy,
  .map-panel {
    min-height: auto;
  }

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

@media (max-width: 640px) {
  .shell {
    width: min(100% - 22px, 1180px);
  }

  .hero {
    gap: 14px;
    padding-top: 20px;
  }

  .hero-copy,
  .map-panel,
  .log-surface,
  .side-surface {
    padding: 18px;
  }

  .roadmap-section,
  .entries-section {
    padding: 18px 0;
  }

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

  .section-heading,
  .panel-heading {
    flex-direction: column;
  }

  .section-note {
    text-align: left;
  }

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

  .delete-entry {
    width: 100%;
  }

  #mapCanvas {
    height: 520px;
  }
}
