:root {
    color-scheme: light;
    --ink: #17221d;
    --muted: #68736d;
    --line: #dfe5e1;
    --paper: #ffffff;
    --canvas: #f3f6f3;
    --green: #176b4d;
    --green-dark: #0d5038;
    --green-soft: #e8f3ed;
    --amber: #c98526;
    font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, input { font: inherit; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar {
    width: 264px; padding: 28px 20px; color: #eef7f2;
    background: linear-gradient(165deg, #153c30 0%, #0c2b22 100%);
    position: fixed; inset: 0 auto 0 0; overflow-y: auto;
}
.main { flex: 1; min-width: 0; margin-left: 0; }
.app-shell:has(.sidebar:not([hidden])) .main { margin-left: 264px; }
.menu-label { margin: 4px 10px 12px; color: #87a89a; font-size: 11px; letter-spacing: .14em; }
.tool-nav { display: grid; gap: 7px; }
.tool-nav button { width: 100%; padding: 13px 14px; display: flex; align-items: center; gap: 11px; color: #bdd0c7; border: 0; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; transition: .18s ease; }
.tool-nav button::before { content: ""; width: 7px; height: 7px; border: 1px solid currentColor; border-radius: 50%; }
.tool-nav button:hover { color: white; background: rgba(255,255,255,.07); }
.tool-nav button.active { color: white; background: rgba(218,239,229,.14); }
.tool-nav button.active::before { border-color: #8be0b9; background: #8be0b9; box-shadow: 0 0 0 4px rgba(139,224,185,.12); }
.workspace, .state-card { width: min(1120px, calc(100% - 48px)); margin: 0 auto; }
.state-card { margin-top: 60px; padding: 36px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); text-align: center; color: var(--muted); }
.state-card.error { color: #a14335; border-color: #edc9c3; background: #fff8f7; }
.hero { padding: 54px 4px 34px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.eyebrow { margin: 0 0 9px; color: var(--green); font-size: 11px; font-weight: 700; letter-spacing: .18em; }
h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(32px, 4vw, 48px); font-weight: 600; letter-spacing: -.035em; }
.tool-title { margin: 10px 0 0; color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .85fr); gap: 20px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 16px; background: var(--paper); box-shadow: 0 8px 30px rgba(33,55,45,.04); }
.operation-panel, .info-panel, .results-panel { padding: 28px; }
.panel-heading { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.panel-heading > div { display: flex; align-items: center; gap: 11px; }
.panel-heading h2 { margin: 0; font-size: 18px; }
.panel-heading p { margin: 8px 0 0 41px; color: var(--muted); font-size: 12px; }
.step { width: 29px; height: 29px; display: grid; place-items: center; color: var(--green); border-radius: 8px; background: var(--green-soft); font-size: 11px; font-weight: 700; }
.file-fields { padding: 22px 0 8px; display: grid; gap: 12px; }
.file-field { padding: 16px; display: flex; justify-content: space-between; align-items: center; gap: 18px; border: 1px dashed #cbd5cf; border-radius: 12px; background: #fafcfb; }
.file-meta { min-width: 0; }
.file-meta strong, .file-meta small { display: block; }
.file-meta strong { overflow: hidden; text-overflow: ellipsis; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.file-meta small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.file-picker { flex: 0 0 auto; position: relative; overflow: hidden; }
.file-picker input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-picker span { padding: 8px 12px; display: block; color: var(--green); border: 1px solid #bcd4c8; border-radius: 8px; background: white; font-size: 12px; }
.file-field.selected { border-style: solid; border-color: #8dbba5; background: #f3faf6; }
.button { min-height: 42px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 9px; text-decoration: none; cursor: pointer; transition: transform .15s, background .15s; }
.button:hover { transform: translateY(-1px); }
.button-primary { width: 100%; margin-top: 15px; color: white; background: var(--green); font-weight: 600; }
.button-primary:hover { background: var(--green-dark); }
.button-primary:disabled { opacity: .58; cursor: wait; transform: none; }
.button-ghost { color: var(--green); border: 1px solid #b9ccc2; background: white; font-size: 13px; }
.form-message { margin-top: 12px; padding: 10px 12px; color: #a14335; border-radius: 8px; background: #fff0ed; font-size: 12px; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.description { padding: 22px 0; color: #46524c; font-size: 13px; line-height: 1.8; }
.description h1, .description h2, .description h3 { margin: 0 0 10px; font-family: inherit; font-size: 15px; letter-spacing: 0; }
.description p { margin: 0 0 10px; }
.description code { padding: 2px 5px; border-radius: 4px; background: #edf2ef; font-family: ui-monospace, Consolas, monospace; }
.sample-list-wrap h3 { margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.sample-list { display: grid; gap: 7px; }
.sample-list a { padding: 9px 10px; display: flex; justify-content: space-between; color: var(--ink); border-radius: 7px; background: var(--canvas); font-family: ui-monospace, Consolas, monospace; font-size: 11px; text-decoration: none; }
.sample-list a::after { content: "↓"; color: var(--green); font-family: sans-serif; }
.results-panel { margin: 20px 0 50px; }
.results-heading { display: flex; align-items: center; justify-content: space-between; }
.success-step { color: white; background: var(--green); font-size: 15px; }
.result-count { color: var(--muted); font-size: 12px; }
.results { padding-top: 18px; display: grid; gap: 10px; }
.result-item { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.result-bar { padding: 11px 13px; display: flex; justify-content: space-between; align-items: center; background: #f8faf8; }
.result-bar strong { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.result-actions { display: flex; gap: 12px; }
.result-actions button { padding: 0; color: var(--green); border: 0; background: transparent; font-size: 11px; cursor: pointer; }
.result-content { max-height: 320px; margin: 0; padding: 16px; overflow: auto; border-top: 1px solid var(--line); background: #fcfdfc; white-space: pre-wrap; font: 12px/1.7 ui-monospace, Consolas, monospace; }

@media (max-width: 850px) {
    .sidebar { width: 100%; height: auto; position: static; padding: 14px 18px; }
    .menu-label { display: none; }
    .tool-nav { display: flex; overflow-x: auto; }
    .tool-nav button { width: auto; white-space: nowrap; }
    .app-shell { display: block; }
    .app-shell:has(.sidebar:not([hidden])) .main { margin-left: 0; }
    .content-grid { grid-template-columns: 1fr; }
    .hero { padding-top: 36px; }
}

@media (max-width: 560px) {
    .workspace, .state-card { width: calc(100% - 28px); }
    .hero { align-items: flex-start; flex-direction: column; }
    .operation-panel, .info-panel, .results-panel { padding: 20px; }
    .file-field { align-items: flex-start; flex-direction: column; }
    .file-picker { width: 100%; text-align: center; }
}
