:root {
  color-scheme: light;
  --ink: #1f2328;
  --muted: #626b74;
  --line: #d8d1c6;
  --paper: #f8f6f0;
  --panel: #fffdf8;
  --red: #a7352a;
  --red-strong: #84261e;
  --green: #28715f;
  --gold: #b57b19;
  --charcoal: #27231f;
  --shadow: 0 14px 34px rgba(45, 35, 23, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(167, 53, 42, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(40, 113, 95, 0.06) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.side {
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.92);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  background: var(--charcoal);
  color: #fffdf8;
  font-weight: 800;
  border-radius: 6px;
}

.brand h1,
.topbar h2,
.panel h3 {
  margin: 0;
}

.brand p,
.eyebrow,
.score-label,
.phase-meta,
.hero-copy span,
.hero-metrics span,
.score-grid span {
  color: var(--muted);
}

.brand h1 {
  font-size: 24px;
}

.brand p {
  margin: 4px 0 0;
}

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

.setup-panel,
.score-panel,
.rules-panel,
.final-reward-panel,
.mission-panel,
.cloud-sync-panel,
.source-panel {
  padding: 16px;
  margin-bottom: 16px;
}

.setup-panel label,
.review-grid label,
.slider-grid label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.date-row,
.day-controls,
.share-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

input[type="date"],
input[type="number"],
input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

input[type="date"],
input[type="number"],
input[type="text"],
input[type="password"] {
  height: 40px;
  padding: 0 10px;
}

textarea {
  resize: vertical;
  padding: 10px 12px;
  line-height: 1.65;
}

.icon-btn,
.ghost-btn,
.primary-btn {
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid var(--line);
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  white-space: nowrap;
}

.icon-btn {
  width: 44px;
  padding: 0;
  font-weight: 800;
}

.primary-btn {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  font-weight: 800;
}

.primary-btn:hover {
  background: var(--red-strong);
}

.ghost-btn:hover,
.icon-btn:hover {
  border-color: var(--charcoal);
}

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

.score-number {
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
  color: var(--red);
}

.score-label {
  margin-top: 6px;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.score-grid div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 8px;
  background: #fff;
}

.score-grid strong,
.score-grid span {
  display: block;
}

.score-grid strong {
  font-size: 18px;
}

.score-grid span {
  margin-top: 4px;
  font-size: 12px;
}

.phase-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.phase-item {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 12px;
}

.phase-item.active {
  border-color: var(--red);
  box-shadow: inset 4px 0 0 var(--red);
}

.phase-item strong,
.phase-item span {
  display: block;
}

.phase-item strong {
  font-size: 15px;
}

.phase-meta {
  margin-top: 6px;
  font-size: 12px;
}

.source-panel h2,
.rules-panel h2,
.final-reward-panel h2,
.mission-panel h2,
.cloud-sync-panel h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.source-panel p,
.rules-panel p {
  margin: 0;
  line-height: 1.7;
  color: var(--muted);
}

.rules-panel {
  border-color: rgba(181, 123, 25, 0.38);
  background: #fffaf0;
}

.final-reward-panel {
  display: grid;
  gap: 10px;
}

.mission-panel {
  display: grid;
  gap: 10px;
}

.mission-panel textarea {
  min-height: 210px;
  font-size: 13px;
}

.cloud-sync-panel {
  display: grid;
  gap: 10px;
}

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

.cloud-status {
  min-height: 38px;
  border-radius: 6px;
  padding: 10px 12px;
  background: rgba(167, 53, 42, 0.08);
  color: var(--red);
  line-height: 1.55;
  font-size: 13px;
}

.reward-status {
  min-height: 38px;
  border-radius: 6px;
  padding: 10px 12px;
  background: rgba(40, 113, 95, 0.08);
  color: var(--green);
  line-height: 1.55;
  font-size: 13px;
}

.main {
  min-width: 0;
  padding: 28px;
}

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

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.topbar h2 {
  font-size: 30px;
}

.day-controls input {
  width: 76px;
  text-align: center;
  font-weight: 800;
}

.hero-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 20px;
  align-items: stretch;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(39, 35, 31, 0.96), rgba(92, 43, 34, 0.94)),
    var(--charcoal);
  color: #fffdf8;
  border-radius: 8px;
  margin-bottom: 20px;
}

.hero-copy h3 {
  margin: 8px 0;
  font-size: 28px;
}

.hero-copy p {
  margin: 0;
  max-width: 860px;
  line-height: 1.7;
  color: rgba(255, 253, 248, 0.82);
}

.hero-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.hero-metrics div {
  display: grid;
  align-content: center;
  border: 1px solid rgba(255, 253, 248, 0.22);
  border-radius: 6px;
  padding: 14px;
}

.hero-metrics strong {
  font-size: 30px;
}

.hero-metrics span {
  color: rgba(255, 253, 248, 0.72);
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.work-grid .panel {
  padding: 18px;
}

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

.lead {
  line-height: 1.75;
  margin: 0 0 14px;
}

.quote-box,
.reward-box,
.mentor-message {
  border-left: 4px solid var(--gold);
  background: #fff8e8;
  border-radius: 6px;
  padding: 12px 14px;
  line-height: 1.65;
}

.source-open-status {
  min-height: 0;
  margin-top: 12px;
  border-radius: 6px;
  color: var(--muted);
  line-height: 1.6;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.source-open-status.active {
  min-height: 42px;
  padding: 10px 12px;
  background: rgba(181, 123, 25, 0.11);
  border: 1px solid rgba(181, 123, 25, 0.32);
}

.check-line {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 14px 0;
  font-weight: 700;
}

.check-line input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.tag {
  border: 1px solid rgba(40, 113, 95, 0.35);
  background: rgba(40, 113, 95, 0.1);
  color: var(--green);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.action-list {
  display: grid;
  gap: 10px;
}

.action-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fff;
}

.action-item input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
}

.action-item strong {
  display: block;
  margin-bottom: 4px;
}

.action-item p {
  margin: 0;
  line-height: 1.55;
  color: var(--muted);
}

.review-card,
.mentor-card {
  grid-column: span 2;
}

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

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

.slider-grid label {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fff;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--red);
}

.reward-box {
  margin-top: 14px;
  min-height: 52px;
}

.mentor-chat {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.mentor-message {
  border-left-color: var(--green);
  background: #edf7f2;
}

.mentor-head {
  align-items: center;
}

.mentor-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.mentor-photo {
  width: 78px;
  height: 78px;
  flex: 0 0 78px;
  object-fit: cover;
  object-position: center 36%;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 8px 22px rgba(39, 35, 31, 0.18);
  background: #fff;
}

.mentor-motto {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.james-rubric {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.rubric-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px;
}

.rubric-item strong,
.rubric-item span {
  display: block;
}

.rubric-item strong {
  color: var(--red);
  font-size: 13px;
  margin-bottom: 6px;
}

.rubric-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.mentor-card textarea {
  min-height: 230px;
}

.lark-send-panel {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.lark-config-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 10px;
}

.lark-config-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.lark-status {
  min-height: 38px;
  border-radius: 6px;
  padding: 10px 12px;
  background: rgba(40, 113, 95, 0.08);
  color: var(--green);
  line-height: 1.55;
  font-size: 13px;
}

.share-row {
  justify-content: flex-end;
  margin-top: 12px;
  flex-wrap: wrap;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .hero-band,
  .work-grid {
    grid-template-columns: 1fr;
  }

  .review-card,
  .mentor-card {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  .main,
  .side {
    padding: 16px;
  }

  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .mentor-head {
    align-items: stretch;
  }

  .mentor-identity {
    align-items: center;
  }

  .day-controls,
  .date-row {
    width: 100%;
  }

  .day-controls .ghost-btn,
  .date-row input {
    flex: 1;
  }

  .phase-list,
  .cloud-row,
  .lark-config-grid,
  .review-grid,
  .slider-grid,
  .hero-metrics,
  .james-rubric {
    grid-template-columns: 1fr;
  }
}
