:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #1a1612;
  background: #f5ecdc;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #1a1612;
  --paper: #fffaf0;
  --cream: #f5ecdc;
  --red: #e24936;
  --red-soft: #ffd4cb;
  --blue: #cfe8ef;
  --green: #d8edc6;
  --yellow: #f4d66f;
  --muted: #706358;
  --night: #1e2c42;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--cream); }
body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 93% 1%, rgba(244, 214, 111, 0.68), transparent 310px),
    linear-gradient(90deg, rgba(26, 22, 18, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(26, 22, 18, 0.045) 1px, transparent 1px),
    var(--cream);
  background-size: auto, 34px 34px, 34px 34px, auto;
}

button, input, select { font: inherit; }
button { cursor: pointer; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 18px 0 36px; }
.topbar, .footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand, .privacy-pill { border: 2px solid var(--ink); background: var(--paper); font-weight: 950; }
.brand { display: inline-flex; align-items: center; gap: 8px; border-radius: 8px; box-shadow: 4px 4px 0 var(--ink); padding: 10px 13px; text-decoration: none; }
.brand span { color: var(--red); font-size: 19px; }
.privacy-pill { border-radius: 999px; padding: 8px 12px; color: #4e453d; font-size: 13px; }

.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 32px; padding: 46px 0 28px; }
.eyebrow { margin: 0 0 12px; color: var(--red); font-size: 13px; font-weight: 1000; letter-spacing: 0.14em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 16px; font-size: clamp(44px, 6.3vw, 76px); line-height: 0.98; letter-spacing: -0.05em; }
h1 span { color: var(--red); }
.lead { max-width: 770px; margin: 0; color: #50443a; font-size: 18px; font-weight: 720; line-height: 1.7; }
.time-stamp { display: grid; min-width: 205px; justify-items: center; border: 3px solid var(--ink); border-radius: 16px; background: var(--yellow); box-shadow: 7px 7px 0 var(--ink); padding: 15px 20px; text-align: center; transform: rotate(1.8deg); }
.time-stamp span, .time-stamp small { font-weight: 900; }
.time-stamp strong { margin: 3px 0; font-size: 43px; line-height: 1; letter-spacing: -0.05em; }
.time-stamp small { color: #655735; font-size: 12px; }

.workspace { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(430px, 1.1fr); align-items: start; gap: 20px; }
.panel { min-width: 0; border: 3px solid var(--ink); border-radius: 14px; background: var(--paper); box-shadow: 8px 8px 0 var(--ink); padding: 22px; }
.panel-title { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.panel-title h2 { margin-bottom: 4px; font-size: 25px; line-height: 1.08; }
.panel-title p { margin: 0; color: var(--muted); font-size: 14px; font-weight: 720; line-height: 1.55; }
.step-number { display: grid; width: 44px; height: 44px; flex: 0 0 auto; place-items: center; border: 2px solid var(--ink); border-radius: 8px; background: var(--blue); box-shadow: 3px 3px 0 var(--ink); font-weight: 1000; }
.step-number.red { background: var(--red-soft); color: #9f281c; }
.step-number.yellow { background: var(--yellow); }

.basic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; min-width: 0; align-content: start; gap: 7px; font-size: 13px; font-weight: 900; }
.field > span { display: flex; align-items: center; justify-content: space-between; }
.field i { color: var(--muted); font-size: 11px; font-style: normal; }
.field small { min-height: 38px; color: var(--muted); font-weight: 700; line-height: 1.4; }
.input-with-unit { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; }
.input-with-unit input { min-width: 0; border-radius: 8px 0 0 8px; }
.input-with-unit em { display: grid; min-width: 56px; place-items: center; border: 2px solid var(--ink); border-left: 0; border-radius: 0 8px 8px 0; background: var(--blue); padding: 0 8px; font-size: 12px; font-style: normal; }
input, select { width: 100%; min-height: 46px; border: 2px solid var(--ink); border-radius: 8px; background: #fffefa; padding: 9px 10px; color: var(--ink); font-weight: 850; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 22px 0 10px; border-top: 2px dashed var(--ink); padding-top: 18px; }
.section-head strong, .section-head small { display: block; }
.section-head strong { font-size: 18px; }
.section-head small { margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 720; }
.section-head button, .form-actions button, .result-topline button { min-height: 42px; border: 2px solid var(--ink); border-radius: 8px; background: white; box-shadow: 3px 3px 0 var(--ink); padding: 8px 11px; font-weight: 950; }
.section-head button { white-space: nowrap; background: var(--green); }
.section-columns, .section-row { display: grid; grid-template-columns: 34px minmax(115px, 1fr) 70px 82px 34px; align-items: center; gap: 7px; }
.section-columns { padding: 0 2px 6px; color: var(--muted); font-size: 10px; font-weight: 900; text-align: center; }
.section-columns span:nth-child(2) { text-align: left; }
.sections-list { display: grid; gap: 8px; }
.section-row { border: 2px solid var(--ink); border-radius: 9px; background: #fffdf8; padding: 8px; }
.section-index { color: var(--red); font-size: 12px; font-weight: 1000; }
.section-row input, .section-row select { min-height: 39px; padding: 7px 8px; font-size: 13px; }
.section-pages-input { text-align: center; }
.remove-section { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: #9b3529; font-size: 24px; line-height: 1; }
.remove-section:hover { background: var(--red-soft); }
.form-error { margin: 14px 0 0; border-left: 4px solid var(--red); background: #fff0ec; padding: 9px 11px; color: #992d22; font-size: 13px; font-weight: 850; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }
.form-actions button { flex: 1; }
.form-actions .primary-button { background: var(--yellow); }

.result-panel { position: sticky; top: 14px; background: var(--night); color: white; }
.result-topline { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.result-topline span { color: #bfd0df; font-size: 12px; font-weight: 900; }
.result-topline h2 { margin: 4px 0 0; color: #ff8b79; font-size: clamp(31px, 4vw, 45px); line-height: 1; }
.result-topline h2[data-tone="green"] { color: #bce69b; }
.result-topline h2[data-tone="yellow"] { color: var(--yellow); }
.result-topline h2[data-tone="blue"] { color: #a9dcea; }
.result-topline button { flex: 0 0 auto; border-color: white; background: transparent; box-shadow: 3px 3px 0 white; color: white; }
.clock-comparison { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 12px; margin-top: 22px; }
.clock-comparison article { border: 2px solid white; border-radius: 10px; background: rgba(255,255,255,0.07); padding: 12px; }
.clock-comparison article span { display: block; color: #c4d2de; font-size: 11px; font-weight: 900; }
.clock-comparison article strong { display: block; margin-top: 4px; font-size: clamp(34px, 4vw, 49px); letter-spacing: -0.05em; }
.clock-comparison .target-clock { border-color: var(--yellow); }
.clock-comparison .target-clock strong { color: var(--yellow); }
.clock-comparison > b { align-self: center; color: #9eb2c5; font-size: 25px; }
.clock-comparison > small { grid-column: 1 / -1; color: #c4d2de; font-weight: 760; text-align: right; }
.pressure-track { position: relative; height: 13px; overflow: hidden; margin-top: 15px; border: 2px solid white; border-radius: 999px; background: #0e1a2b; }
.pressure-track i { display: block; width: 100%; height: 100%; background: #ff7f6d; transition: width 180ms ease; }
.pressure-track i[data-tone="green"] { background: #a8dc82; }
.pressure-track i[data-tone="yellow"] { background: var(--yellow); }
.pressure-track i[data-tone="blue"] { background: #82c9dc; }
.safe-mark { position: absolute; top: 0; bottom: 0; left: 86%; width: 2px; background: white; }
.pressure-caption { margin: 7px 0 0; color: #d3e0ea; font-size: 12px; font-weight: 760; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 17px; }
.metric-grid article { min-width: 0; border: 2px solid rgba(255,255,255,0.78); border-radius: 8px; padding: 10px; }
.metric-grid span { display: block; color: #bbcad7; font-size: 10px; font-weight: 850; }
.metric-grid strong { display: block; margin-top: 5px; overflow-wrap: anywhere; font-size: 18px; }
.metric-grid b { color: var(--yellow); font-size: 24px; }

.timeline-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; border-top: 2px dashed rgba(255,255,255,0.5); padding-top: 18px; }
.timeline-head > div { display: flex; align-items: flex-start; gap: 10px; }
.timeline-head h3 { margin: 0 0 3px; font-size: 20px; }
.timeline-head p { margin: 0; color: #c2d1de; font-size: 11px; font-weight: 700; }
.deadline-key { flex: 0 0 auto; color: var(--yellow); font-size: 11px; font-weight: 900; }
.timeline-list { display: grid; gap: 8px; margin-top: 13px; }
.timeline-row { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 12px; border: 2px solid rgba(255,255,255,0.82); border-radius: 9px; background: rgba(255,255,255,0.06); padding: 10px; }
.timeline-row.level-core { border-left: 7px solid var(--red); }
.timeline-row.level-normal { border-left: 7px solid var(--blue); }
.timeline-row.level-brief { border-left: 7px solid var(--yellow); }
.timeline-time { display: grid; align-content: center; border-right: 1px solid rgba(255,255,255,0.28); }
.timeline-time strong { font-size: 20px; letter-spacing: -0.03em; }
.timeline-time small { color: #b9c8d4; font-size: 10px; font-weight: 760; }
.timeline-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.timeline-heading strong { min-width: 0; overflow-wrap: anywhere; font-size: 15px; }
.level-badge { flex: 0 0 auto; border: 1px solid white; border-radius: 999px; padding: 2px 7px; color: #d9e6ef; font-size: 9px; font-weight: 900; }
.timeline-detail p { margin: 5px 0 0; color: #c1d0dc; font-size: 11px; font-weight: 720; }
.coach-note { margin-top: 17px; border-left: 5px solid var(--yellow); background: #fff8e8; padding: 13px 15px; color: var(--ink); }
.coach-note strong { font-size: 14px; }
.coach-note ol { margin: 7px 0 0; padding-left: 18px; }
.coach-note li { margin-top: 5px; font-size: 12px; font-weight: 740; line-height: 1.45; }

.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 24px; }
.compact-panel { box-shadow: 6px 6px 0 var(--ink); }
.compact-title { margin-bottom: 15px; }
.method-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.method-list li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; }
.method-list li > span { display: grid; width: 32px; height: 32px; place-items: center; border: 2px solid var(--ink); border-radius: 50%; background: var(--green); font-weight: 1000; }
.method-list strong { font-size: 14px; }
.method-list p { margin: 3px 0 0; color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.5; }
.caution-panel { background: #fff3ef; }
.caution-panel > p { color: #584b43; font-size: 14px; font-weight: 720; line-height: 1.7; }
.caution-panel > strong { display: block; border: 2px solid var(--ink); background: var(--yellow); padding: 10px 12px; font-size: 14px; }
.source-note { margin-top: 24px; border: 2px dashed var(--ink); border-radius: 12px; background: rgba(255,250,240,0.82); padding: 18px; }
.source-note > strong { font-size: 17px; }
.source-note p { margin: 7px 0 10px; color: var(--muted); font-size: 13px; font-weight: 700; line-height: 1.65; }
.source-note a { color: #235472; font-size: 13px; font-weight: 900; }
.footer { margin-top: 26px; border-top: 2px solid var(--ink); padding-top: 18px; color: var(--muted); font-size: 13px; font-weight: 800; }
.footer nav { display: flex; gap: 14px; }

@media (max-width: 940px) {
  .workspace { grid-template-columns: 1fr; }
  .result-panel { position: static; }
}

@media (max-width: 660px) {
  .app { width: min(100% - 20px, 1180px); padding-top: 10px; }
  .privacy-pill { display: none; }
  .hero { grid-template-columns: 1fr; gap: 18px; padding: 34px 0 22px; }
  h1 { font-size: 45px; }
  .lead { font-size: 16px; }
  .time-stamp { width: min(250px, 84%); justify-self: end; }
  .panel { border-width: 2px; box-shadow: 5px 5px 0 var(--ink); padding: 16px; }
  .basic-grid, .info-grid { grid-template-columns: 1fr; }
  .field small { min-height: 0; }
  .section-columns { display: none; }
  .section-row { grid-template-columns: 30px minmax(0, 1fr) 66px 78px 30px; gap: 5px; padding: 6px; }
  .section-row input, .section-row select { min-height: 40px; padding: 6px; }
  .section-name-input { font-size: 12px !important; }
  .result-topline { align-items: center; }
  .result-topline h2 { font-size: 31px; }
  .result-topline button { max-width: 110px; }
  .clock-comparison { gap: 7px; }
  .clock-comparison article { padding: 9px; }
  .clock-comparison article strong { font-size: 34px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-grid article:first-child { grid-column: 1 / -1; }
  .form-actions { flex-direction: column; }
  .footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 390px) {
  h1 { font-size: 40px; }
  .section-head { align-items: start; }
  .section-head button { font-size: 12px; }
  .section-row { grid-template-columns: 26px minmax(0, 1fr) 58px 68px 28px; gap: 4px; }
  .section-index { font-size: 10px; }
  .section-row input, .section-row select { font-size: 11px !important; padding: 5px; }
  .remove-section { width: 28px; height: 28px; }
  .clock-comparison article strong { font-size: 29px; }
  .timeline-row { grid-template-columns: 62px minmax(0, 1fr); gap: 8px; }
}
