:root {
  --ink: #111316;
  --muted: #6a6f76;
  --line: #d8dce1;
  --gray: #f2f2f2;
  --white: #ffffff;
  --green: #164b3c;
  --space: clamp(76px, 10vw, 150px);
  --gutter: clamp(22px, 4.5vw, 72px);
  font-family: Inter, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--gray);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--gray); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 1; }

.tool-header {
  display: flex;
  min-height: 80px;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.tool-header__brand { flex: 0 0 auto; color: var(--ink); font-size: 18px; font-weight: 600; }
.tool-header__project { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: 18px; font-weight: 600; text-align: right; }

main { min-height: calc(100vh - 178px); }
.workspace { width: min(1180px, calc(100% - (2 * var(--gutter)))); margin: 0 auto; padding: clamp(70px, 8vw, 112px) 0 var(--space); }
.workspace-heading { display: flex; align-items: flex-end; justify-content: flex-end; gap: 36px; margin-bottom: 34px; }
.workspace-heading h2 { margin: 0; font-size: clamp(42px, 4.1vw, 70px); font-weight: 600; letter-spacing: -.045em; line-height: 1.08; }
.workspace-heading p { margin: 15px 0 0; color: var(--muted); font-size: 16px; line-height: 1.7; }

.sample-button { flex: 0 0 auto; padding: 12px 17px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); color: var(--ink); font-size: 14px; }
.sample-button:hover { border-color: var(--green); color: var(--green); }
.sample-button:focus-visible, .primary-button:focus-visible { outline: 3px solid rgba(22, 75, 60, .22); outline-offset: 3px; }

.drop-zone { display: flex; min-height: 310px; align-items: center; justify-content: center; flex-direction: column; padding: 42px; border: 1px dashed var(--line); border-radius: 10px; background: var(--white); transition: background .18s, border-color .18s; }
.drop-zone.is-dragging { border-color: var(--green); background: var(--white); }
.file-icon { display: grid; width: 48px; height: 56px; place-items: center; margin-bottom: 24px; border: 1px solid var(--line); border-radius: 5px; color: var(--green); font-size: 18px; font-weight: 650; }
.drop-zone p { margin: 0 0 8px; font-size: 18px; font-weight: 540; text-align: center; }
.drop-zone > span { color: var(--muted); font-size: 14px; }
.primary-button { margin-top: 26px; padding: 14px 25px; border: 1px solid var(--ink); border-radius: 6px; background: var(--ink); color: var(--white); font-size: 14px; font-weight: 620; }
.primary-button:hover { border-color: #2e3135; background: #2e3135; }
.primary-button:disabled { border-color: var(--line); background: #e4e7e9; color: #858a90; opacity: 1; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.error-message { margin-top: 32px; padding: 22px 24px; border-left: 1px solid var(--line); background: var(--white); }
.error-message strong { display: block; margin-bottom: 9px; }
.error-message pre { margin: 0; white-space: pre-wrap; color: #a63a3a; font: inherit; line-height: 1.65; }

.results { margin-top: 40px; }
.file-status { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 20px; border: 1px solid var(--line); background: var(--white); }
.file-status div { display: flex; min-width: 0; flex-direction: column; gap: 5px; }
.file-status strong { overflow-wrap: anywhere; }
.file-status div > span { color: var(--muted); font-size: 14px; }
.file-status p { flex: 0 0 auto; margin: 0; color: #164b3c; font-size: 14px; }
.file-status p span { display: inline-grid; width: 20px; height: 20px; place-items: center; margin-right: 7px; border-radius: 50%; background: #164b3c; color: var(--white); }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); margin: 34px 0; border-block: 1px solid var(--line); background: var(--white); }
.metrics article { display: flex; align-items: center; flex-direction: column; padding: 27px 24px; border-right: 1px solid var(--line); }
.metrics article:last-child { border-right: 0; }
.metrics small { display: flex; align-items: center; gap: 9px; color: #4f555c; font-size: 14px; }
.metrics strong { margin: 9px 0 4px; font-size: clamp(42px, 4.1vw, 70px); font-weight: 600; letter-spacing: -.04em; }
.metrics article > span { color: var(--muted); font-size: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.work-dot { background: #164b3c; }
.rest-dot { background: #c84a40; }
.total-dot { background: #4f555c; }
.work-text { color: #164b3c; }
.rest-text { color: #c84a40; }

.stacked-chart { display: flex; height: 72px; overflow: hidden; border: 1px solid var(--line); background: #c84a40; color: var(--white); font-size: 18px; font-weight: 650; }
.stacked-chart > div { display: flex; min-width: 0; align-items: center; justify-content: center; }
.work-segment { background: #164b3c; }
.rest-segment { background: #c84a40; }
.table-wrap { overflow-x: auto; margin-top: 30px; border: 1px solid var(--line); background: var(--white); }
table { width: 100%; min-width: 720px; border-collapse: collapse; }
th, td { padding: 16px 19px; border-bottom: 1px solid var(--line); text-align: right; }
thead th { background: var(--gray); color: #4f555c; font-size: 14px; font-weight: 600; }
th:first-child, td:first-child { text-align: left; }
tbody th { font-weight: 560; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }

.site-footer { display: flex; min-height: 98px; align-items: center; justify-content: space-between; gap: 28px; padding: 0 var(--gutter); border-top: 1px solid var(--line); background: var(--white); color: var(--muted); }
.site-footer small { font-size: 14px; line-height: 1.6; }
.site-footer small:last-child { text-align: right; }

@media (max-width: 800px) {
  .tool-header { min-height: 68px; gap: 20px; }
  .tool-header__brand, .tool-header__project { font-size: 14px; }
  main { min-height: calc(100vh - 158px); }
  .workspace { padding: 54px 0 var(--space); }
  .workspace-heading { align-items: flex-start; flex-direction: column; gap: 24px; }
  .workspace-heading h2 { font-size: clamp(25px, 2.5vw, 38px); }
  .drop-zone { min-height: 280px; padding: 34px 18px; }
  .metrics { grid-template-columns: 1fr; }
  .metrics article { padding: 24px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .metrics article:last-child { border-bottom: 0; }
  .stacked-chart { height: 60px; font-size: 14px; }
  .file-status { align-items: flex-start; flex-direction: column; }
  .site-footer { min-height: 96px; justify-content: flex-end; }
  .site-footer small:last-child { text-align: right; }
}

@media (max-width: 520px) {
  .workspace-heading h2 { font-size: clamp(25px, 2.5vw, 38px); }
  .drop-zone p { font-size: 17px; }
  .stacked-chart { height: 54px; font-size: 14px; }
}

.workspace-heading { flex-wrap: wrap; }
.tool-help { max-width: 780px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.tool-state { margin: 16px 0; color: var(--muted); font-size: 14px; }
.tool-state.is-success { color: #2f6b4f; }
.tool-state.is-error { color: #a63a3a; }
.tool-spinner { display: inline-block; width: 24px; height: 24px; margin-right: 10px; vertical-align: middle; border: 2px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tool-primary-button, .tool-secondary-button { min-height: 44px; border-radius: 9px; font-size: 14px; }
.tool-secondary-button { display: inline-flex; align-items: center; padding: 12px 17px; border: 1px solid var(--line); background: var(--white); color: var(--ink); text-decoration: none; }
.tool-secondary-button:hover { border-color: var(--ink); color: var(--ink); }
button:disabled { cursor: not-allowed; opacity: 1; border-color: var(--line); background: #e4e7e9; color: #858a90; opacity: 1; }
a:focus-visible, button:focus-visible, input:focus-visible, .tool-table-wrap:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.tool-upload { border: 1px dashed var(--line); }
.tool-upload { cursor: pointer; }
.tool-upload:focus-within { outline: 2px solid var(--green); outline-offset: 3px; }
.tool-upload:has(input:disabled) { cursor: not-allowed; }
.tool-upload:has(input:disabled) .primary-button { border-color: var(--line); background: #e4e7e9; color: #858a90; opacity: 1; }
.drop-zone > .primary-button { color: var(--white); }
.tool-upload.is-dragover { border-color: var(--green); background: var(--white); }
.file-icon { border-color: var(--ink); color: var(--ink); }
.work-dot, .work-segment { background: #164b3c; }
.rest-dot, .rest-segment { background: #c84a40; }
.work-text, .rest-text { color: var(--ink); }
.rest-segment { color: var(--white); }
.file-status p { color: #2f6b4f; }
.file-status p span { background: #2f6b4f; }
.error-message { border: 1px solid var(--line); background: var(--white); }
.error-message pre { color: #a63a3a; }
.tool-table thead th { position: sticky; top: 0; background: var(--gray); }
.tool-table tbody tr:hover { background: var(--gray); }
.site-footer { min-height: 112px; justify-content: flex-end; }
.site-footer small { font-size: 14px; }
@media (max-width: 800px) { .site-footer { min-height: 96px; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
  .tool-spinner { animation: none !important; }
}
