:root {
  color-scheme: light;
  --ink: #172126;
  --muted: #637078;
  --line: #d8dfdf;
  --paper: #f5f2ea;
  --card: #fffef9;
  --accent: #bd4f32;
  --accent-dark: #8c3521;
  --green: #2f6f62;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    linear-gradient(rgba(34, 62, 64, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 62, 64, .055) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}

.shell { width: min(1080px, calc(100% - 40px)); margin: 0 auto; padding: 58px 0 72px; }
header { max-width: 780px; margin-bottom: 34px; }
.brand-line { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.brand-icon {
  width: 42px;
  height: 42px;
  display: block;
  object-fit: contain;
}
.eyebrow { margin: 0; color: var(--accent); font: 700 12px/1.2 ui-monospace, monospace; letter-spacing: .18em; }
h1 { margin: 0; font-family: "Songti SC", "STSong", serif; font-size: clamp(42px, 6vw, 70px); line-height: 1.08; letter-spacing: -.04em; }
.subtitle { max-width: 700px; margin: 20px 0 0; color: var(--muted); font-size: 17px; line-height: 1.8; }

.card, .status-card, .output-grid article {
  border: 1px solid var(--line);
  background: rgba(255, 254, 249, .94);
  box-shadow: 0 20px 60px rgba(35, 48, 48, .08);
}
.card { padding: 24px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid > * { min-width: 0; }
.upload {
  position: relative;
  min-width: 0;
  min-height: 176px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  border: 1px dashed #aeb9b8;
  background: rgba(250, 249, 244, .68);
  cursor: pointer;
  overflow: hidden;
  transition: border-color .2s ease, background-color .2s ease, transform .2s ease;
}
.upload:hover { border-color: var(--accent); background: #fffdf7; transform: translateY(-2px); }
.upload.has-file { border-style: solid; border-color: #91afa6; background: #fbfdfb; }
.upload input { position: absolute; opacity: 0; pointer-events: none; }
.upload-top { display: flex; align-items: center; justify-content: space-between; }
.step { color: var(--accent); font: 700 12px ui-monospace, monospace; letter-spacing: .12em; }
.file-type {
  padding: 4px 7px;
  color: #7c898d;
  border: 1px solid #d5dcda;
  font: 700 10px/1 ui-monospace, monospace;
  letter-spacing: .08em;
}
.upload-copy { display: block; margin-top: 20px; min-width: 0; }
.upload-copy strong { display: block; font-size: 19px; line-height: 1.35; }
.upload-copy small { display: block; margin-top: 6px; color: var(--muted); line-height: 1.55; }
.file-name {
  width: 100%;
  min-width: 0;
  margin-top: auto;
  padding: 9px 10px 9px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #667377;
  border: 1px solid #dce3e1;
  background: #f2f5f3;
  font-size: 12px;
}
.file-name-text {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-action {
  flex: 0 0 auto;
  color: var(--accent);
  font-weight: 700;
}
.has-file .file-name {
  color: var(--green);
  border-color: #c5d9d2;
  background: #e9f2ee;
}
.has-file .file-action::before {
  content: "✓ ";
}

.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.options > label { min-width: 0; min-height: 82px; padding: 15px 17px; border: 1px solid var(--line); background: rgba(255, 255, 255, .3); }
.options span { display: block; font-size: 14px; }
.option-title { font-weight: 600; }
.week-field select {
  width: 100%;
  margin-top: 10px;
  padding: 8px 32px 8px 0;
  color: var(--ink);
  border: 0;
  border-bottom: 1px solid #9ea9a8;
  border-radius: 0;
  outline: none;
  background-color: transparent;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.week-field small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.switch-row small { display: block; margin-top: 6px; color: var(--muted); line-height: 1.4; }
.switch-row input { width: 46px; height: 24px; accent-color: var(--accent); }
.rules { display: flex; align-items: center; gap: 8px; margin: 20px 0; color: var(--muted); font-size: 12px; }
.rules span { margin-right: 5px; color: var(--ink); font-weight: 700; }
.rules b { padding: 5px 9px; color: var(--green); border: 1px solid #b9cbc5; font-weight: 500; }

button {
  width: 100%; padding: 18px 22px; display: flex; justify-content: space-between; align-items: center;
  border: 0; color: white; background: var(--accent); cursor: pointer; text-align: left;
  transition: .2s ease;
}
button:hover { background: var(--accent-dark); }
button:disabled { opacity: .6; cursor: wait; }
button span { font-size: 18px; font-weight: 700; }
button small { opacity: .78; }

.status-card { margin-top: 18px; padding: 20px 24px; display: flex; align-items: center; gap: 18px; }
.status-card[hidden] { display: none; }
.status-card p { margin: 5px 0 0; color: var(--muted); }
.status-card > div:last-child { flex: 1; }
.progress-track { width: 100%; height: 4px; margin-top: 14px; overflow: hidden; background: #e4e8e6; }
.progress-track i { display: block; width: 0; height: 100%; background: var(--accent); transition: width .25s ease; }
.spinner { width: 26px; height: 26px; border: 3px solid #d8dfdf; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.done { border: 0; border-radius: 0; animation: none; color: var(--green); }
.spinner.done::after { content: "✓"; font-size: 27px; font-weight: 800; }
.spinner.error { border: 0; border-radius: 0; animation: none; color: var(--accent); }
.spinner.error::after { content: "!"; font-size: 27px; font-weight: 800; }
@keyframes spin { to { transform: rotate(360deg); } }

.output-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.output-grid article { min-width: 0; min-height: 150px; padding: 18px; box-shadow: none; }
.output-grid span { color: var(--accent); font: 700 11px ui-monospace, monospace; letter-spacing: .1em; }
.output-grid strong { display: block; margin-top: 24px; font-size: 17px; }
.output-grid p { margin: 9px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

@media (max-width: 760px) {
  .shell { width: min(100% - 24px, 1120px); padding-top: 36px; }
  .brand-line { gap: 10px; margin-bottom: 12px; }
  .brand-icon { width: 36px; height: 36px; }
  .card { padding: 16px; }
  .grid, .options, .output-grid { grid-template-columns: 1fr; }
  .upload { min-height: 168px; }
  .rules { flex-wrap: wrap; }
  button { align-items: flex-start; flex-direction: column; gap: 6px; }
}
