:root {
  --ink: #202124;
  --muted: #8a8f96;
  --paper: #ffffff;
  --canvas: #f7f7f6;
  --line: #e5e6e4;
  --line-dark: #d8dad7;
  --amber: #d9932f;
  --amber-pale: #fff3df;
  --mint: #eef4f0;
  --green: #4f8370;
  --danger: #b7523f;
  --shadow: 0 18px 50px rgba(23, 32, 29, .05);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; color: var(--ink); background: var(--canvas); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button:not(:disabled), input:not(:disabled), select:not(:disabled), summary { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(217, 147, 47, .32); outline-offset: 3px; }
button:active:not(:disabled) { transform: scale(.975); }

.page-shell { min-height: 100vh; background: radial-gradient(circle at 100% 0, rgba(217,147,47,.08), transparent 22rem), var(--canvas); }
.site-header { display: flex; align-items: center; justify-content: space-between; max-width: 1480px; min-height: 76px; padding: 14px 32px; margin: 0 auto; }
.wordmark { display: inline-flex; align-items: center; color: var(--ink); text-decoration: none; }
.wordmark img { display: block; width: clamp(150px, 15vw, 218px); height: auto; }
.header-actions { display: flex; align-items: center; gap: 16px; }
.network-state { display: inline-flex; align-items: center; gap: 7px; color: #78817e; font-family: var(--mono); font-size: 10px; }
.network-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(79,131,112,.1); }
.network-state.is-offline i { background: var(--amber); }
.text-button { padding: 7px 0; color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid #8d9290; font-size: 11px; font-weight: 700; }
.text-button:hover { color: var(--amber); border-color: var(--amber); }
.is-hidden { display: none !important; }
.noscript-note { max-width: 1200px; padding: 16px; margin: 20px auto; color: var(--danger); background: #fff5f2; border: 1px solid #f0cbc2; }

#app { max-width: 1480px; padding: 0 32px 56px; margin: 0 auto; }
.intro-panel { display: flex; align-items: end; justify-content: space-between; gap: 36px; padding: 30px 0 34px; }
.intro-panel p, .workbench-intro p { margin: 0 0 12px; color: var(--amber); font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.intro-panel h1 { margin: 0 0 10px; font-size: clamp(29px, 3vw, 43px); letter-spacing: -.075em; }
.intro-panel > div:first-child > span { display: block; max-width: 720px; color: #6e7476; font-size: 13px; line-height: 1.8; }
.intro-score { min-width: 205px; padding: 12px 0 11px 22px; border-left: 1px solid var(--line-dark); }
.intro-score small { display: block; color: #888e90; font-size: 10px; }
.intro-score b { display: block; margin: 3px 0; font-family: var(--serif); font-size: 32px; letter-spacing: -.06em; }
.intro-score span { color: var(--amber); font-family: var(--mono); font-size: 9px; }

.selection-surface { padding: 36px; margin-bottom: 24px; background: var(--paper); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.role-title-row { display: flex; align-items: end; justify-content: space-between; gap: 24px; max-width: 650px; margin-bottom: 30px; }
.role-title-row label { display: grid; flex: 1; gap: 9px; color: #454a4c; font-size: 12px; font-weight: 700; }
.role-title-row label small { color: #92989a; font-weight: 400; }
.role-title-row input { width: min(100%, 500px); height: 48px; padding: 0 14px; color: var(--ink); background: #fff; border: 1px solid var(--line-dark); border-radius: 12px; outline: none; font-size: 14px; }
.role-title-row input:focus { border-color: var(--amber); box-shadow: 0 0 0 4px rgba(217,147,47,.11); }
.autosave-note { display: grid; flex: 0 0 auto; gap: 3px; margin: 0 0 4px; color: #969d9b; font-size: 10px; line-height: 1.4; white-space: nowrap; }
.autosave-note b { color: var(--green); font-size: 10px; }
.selection-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.picker-card { min-width: 0; padding: 28px 25px 24px; border: 1px solid var(--line); border-radius: 19px; background: linear-gradient(150deg, #fff, #fcfcfb); }
.picker-card header { display: flex; align-items: center; gap: 13px; margin-bottom: 25px; }
.dimension-pill { display: grid; width: 39px; height: 39px; place-items: center; color: #fff; background: #242527; border-radius: 10px; font-family: var(--mono); font-size: 11px; }
.picker-card header b { display: block; font-size: 18px; letter-spacing: -.035em; }
.picker-card header small { display: block; margin-top: 4px; color: #a0a4a3; font-family: var(--mono); font-size: 10px; }
.compact-factor-list { display: grid; gap: 17px; }
.compact-factor { display: grid; gap: 8px; }
.compact-factor > span { color: #505557; font-size: 12px; font-weight: 700; }
.compact-factor select { width: 100%; height: 48px; padding: 0 13px; color: #34383a; background: #fff; border: 1px solid #dedfdd; border-radius: 12px; outline: none; font-size: 14px; transition: border-color 160ms ease, box-shadow 160ms ease; }
.compact-factor select:focus { border-color: var(--amber); box-shadow: 0 0 0 4px rgba(217,147,47,.11); }

.coordinate-workbench { padding: 34px; background: linear-gradient(180deg, #fff, #fbfcfb); border: 1px solid var(--line); border-radius: 25px; box-shadow: var(--shadow); }
.workbench-intro { display: grid; grid-template-columns: minmax(0, .9fr) minmax(280px, 1fr); align-items: start; gap: 50px; padding-bottom: 27px; }
.workbench-intro h2 { margin: 0; font-size: clamp(25px, 2.4vw, 35px); letter-spacing: -.07em; }
.workbench-intro h2 em { color: var(--amber); font-style: normal; }
.workbench-intro > span { padding-top: 24px; color: #777d7f; font-size: 13px; line-height: 1.9; }
.coordinate-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.coordinate-card { min-width: 0; overflow: hidden; background: #fff; border: 1px solid #e5e7e4; border-radius: 4px; }
.coordinate-card-head { display: flex; align-items: end; justify-content: space-between; min-height: 87px; padding: 18px 20px 16px; border-bottom: 1px solid #e8e9e7; }
.coordinate-card-head > div:first-child > span { display: block; color: var(--amber); font-family: var(--mono); font-size: 9px; letter-spacing: .1em; }
.coordinate-card h3 { margin: 7px 0 0; color: #35393a; font-size: 17px; letter-spacing: -.04em; }
.code-readout { text-align: right; }
.code-readout small { display: block; color: var(--amber); font-size: 9px; }
.code-readout b { display: block; margin-top: 3px; font-family: var(--mono); font-size: 23px; letter-spacing: .03em; }
.coordinate-canvas { min-height: 296px; padding: 14px 8px 0; overflow: hidden; background: repeating-linear-gradient(0deg, transparent 0 40px, rgba(233,236,233,.34) 40px 41px), repeating-linear-gradient(90deg, transparent 0 40px, rgba(233,236,233,.34) 40px 41px); }
.coordinate-canvas svg { display: block; width: 100%; height: 270px; overflow: hidden; }
.axis-line { fill: none; stroke: #626966; stroke-width: 1.45; }
.axis-tick { fill: #fff; stroke: #69716e; stroke-width: 1.45; }
.plane-fill { stroke: #d2d9d4; stroke-width: 1; }
.plane-floor { fill: rgba(234, 240, 235, .62); }
.plane-wall { fill: rgba(245, 248, 245, .66); }
.plane-side { fill: rgba(249, 244, 235, .48); }
.projection-line { fill: none; stroke: #dde3df; stroke-width: .9; }
.depth-line { fill: none; stroke: #dce2de; stroke-width: .8; }
.two-d-frame { fill: rgba(250, 251, 249, .84); stroke: #cbd3ce; stroke-width: 1; }
.two-d-grid { fill: none; stroke: #dfe4e0; stroke-width: 1; }
.axis-label { fill: #4f5754; font-family: var(--sans); font-size: 9px; font-weight: 600; paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; }
.point-halo { fill: rgba(217,147,47,.14); stroke: rgba(217,147,47,.78); stroke-width: 2.2; }
.point-core { fill: #e3a037; stroke: #fff; stroke-width: 2.4; }
.point-leader { fill: none; stroke: #c8872b; stroke-width: 1.5; }
.code-tag { fill: #28292a; }
.code-tag-text { fill: #fff; font-family: var(--mono); font-size: 11px; font-weight: 700; }
.axis-summary { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid #e8eae7; }
.axis-summary.is-two-d { grid-template-columns: repeat(2, 1fr); }
.axis-summary div { display: grid; grid-template-columns: auto 1fr; align-items: end; gap: 2px 7px; min-width: 0; padding: 14px 12px; border-right: 1px solid #e8eae7; }
.axis-summary div:last-child { border-right: 0; }
.axis-summary span { grid-row: span 2; color: var(--amber); font-family: var(--mono); font-size: 11px; font-weight: 700; }
.axis-summary small { overflow: hidden; color: #848a8b; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.axis-summary b { color: #363a3b; font-family: var(--mono); font-size: 16px; }
.coordinate-note { min-height: 43px; padding: 11px 14px 12px; margin: 0; color: #929898; background: var(--mint); font-size: 9px; line-height: 1.55; }

.score-command { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 22px 26px; margin-top: 20px; background: #242526; border-radius: 17px; color: #fff; box-shadow: 0 15px 34px rgba(26,28,28,.14); }
.score-command > div:first-child { display: flex; align-items: baseline; gap: 11px; flex-wrap: wrap; }
.score-command > div:first-child span { color: rgba(255,255,255,.47); font-size: 10px; }
.score-command > div:first-child b { font-family: var(--mono); font-size: 15px; }
.score-command > div:first-child small { color: #efb65d; font-size: 10px; }
.balance-status { display: block; flex-basis: 100%; max-width: 690px; padding: 8px 10px; margin-top: 2px; border-left: 2px solid; background: rgba(255,255,255,.08); color: rgba(255,255,255,.68) !important; font-size: 10px !important; line-height: 1.55; }
.balance-status b { display: inline; margin-right: 7px; color: inherit; font-size: inherit; }
.balance-status.is-valid { border-color: #84bea0; }
.balance-status.is-valid b { color: #a8d6b7; }
.balance-status.is-invalid { border-color: #f0ae4c; background: rgba(240,174,76,.12); }
.balance-status.is-invalid b { color: #ffd084; }
.score-command.is-blocked { background: #352d24; }
.score-command .button-primary:disabled { cursor: not-allowed; color: rgba(255,255,255,.54); background: #6f665d; box-shadow: none; }
.score-command > div:last-child { display: flex; gap: 10px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 16px; border: 1px solid transparent; border-radius: 8px; font-size: 12px; font-weight: 800; transition: transform 160ms ease, background 160ms ease, border-color 160ms ease; }
.button-primary { color: #242526; background: #f0ae4c; box-shadow: 0 8px 15px rgba(0,0,0,.16); }
.button-primary:hover { background: #ffc56d; }
.button-secondary { color: #fff; background: transparent; border-color: rgba(255,255,255,.38); }
.button-secondary:hover { background: rgba(255,255,255,.1); }

.result-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(20,24,23,.57); backdrop-filter: blur(8px); }
.result-panel { width: min(690px, 100%); max-height: min(760px, 96vh); overflow: auto; background: #fff; border-radius: 18px; box-shadow: 0 30px 90px rgba(0,0,0,.3); }
.result-hero { position: relative; padding: 35px 38px 30px; color: #fff; background: #242526; }
.result-hero p { margin: 0; color: #f3b354; font-family: var(--mono); font-size: 10px; letter-spacing: .12em; }
.result-hero h2 { margin: 10px 0 18px; font-size: 30px; }
.result-hero > div { display: flex; align-items: end; gap: 12px; }
.result-hero > div b { color: #f1ad4c; font-family: var(--serif); font-size: 64px; line-height: .9; }
.result-hero > div span { padding-bottom: 7px; color: rgba(255,255,255,.68); font-size: 12px; }
.result-close { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; color: #fff; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); border-radius: 50%; font-size: 18px; }
.result-body { padding: 28px 38px 34px; }
.role-illustration { margin: 0 0 18px; overflow: hidden; background: #fbfaf6; border: 1px solid #e0e4df; border-radius: 12px; }
.role-art-frame { position: relative; min-height: 150px; overflow: hidden; background: color-mix(in srgb, var(--role-accent) 12%, #fff); }
.role-art-frame img { display: block; width: 100%; height: auto; aspect-ratio: 1.776 / 1; object-fit: cover; }
.role-art-fallback { display: none; align-items: center; justify-content: center; flex-direction: column; min-height: 220px; gap: 8px; color: #fff; background: var(--role-accent, #334); }
.role-art-frame.is-missing .role-art-fallback, .role-illustration.is-unmapped .role-art-fallback { display: flex; }
.role-art-fallback b { font-family: var(--mono); font-size: 58px; }
.role-art-fallback span { font-size: 13px; }
.role-art-caption { display: grid; gap: 3px; padding: 12px 16px 13px; border-left: 4px solid var(--role-accent); }
.role-art-caption span { color: var(--role-accent); font-family: var(--mono); font-size: 9px; letter-spacing: .08em; }
.role-art-caption b { color: #29312f; font-size: 16px; }
.role-art-caption small { color: #78817e; font-size: 11px; }
.characteristic-box { display: flex; align-items: start; gap: 14px; padding: 16px; background: var(--amber-pale); border-left: 3px solid var(--amber); }
.characteristic-box > span { display: grid; flex: 0 0 auto; width: 35px; height: 35px; place-items: center; color: var(--amber); background: #fff; border-radius: 50%; font-family: var(--mono); font-size: 12px; font-weight: 700; }
.characteristic-box small, .result-table span { display: block; color: #858b8b; font-size: 10px; }
.characteristic-box b { display: block; margin: 3px 0; font-size: 16px; }
.characteristic-box p { margin: 0; color: #646b6a; font-size: 11px; line-height: 1.65; }
.result-table { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 20px; overflow: hidden; background: var(--line); border: 1px solid var(--line); }
.result-table > div { padding: 14px; background: #fff; }
.result-table b { display: block; margin: 6px 0 3px; font-family: var(--mono); font-size: 17px; }
.result-table small { color: #737a79; font-size: 10px; }
.result-disclaimer { margin: 20px 0 0; color: #858b8b; font-size: 10px; line-height: 1.75; }
.result-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 23px; }
.result-actions .button-secondary { color: #3a3e3e; border-color: #d9dcd9; }
.result-actions .button-secondary:hover { background: #f5f6f4; }

.site-footer { display: flex; justify-content: space-between; max-width: 1480px; gap: 22px; padding: 0 32px 30px; margin: 0 auto; color: #888e8e; font-size: 10px; line-height: 1.6; }
.site-footer span:first-child { font-family: var(--mono); letter-spacing: .05em; }
.site-footer span:last-child { max-width: 520px; text-align: right; }

@media (max-width: 1080px) { .selection-grid, .coordinate-grid { grid-template-columns: 1fr; } .coordinate-grid { max-width: 640px; margin: 0 auto; } .picker-card { padding: 23px; } .compact-factor-list { grid-template-columns: repeat(3, 1fr); } .picker-card.picker-ps .compact-factor-list { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .site-header, #app, .site-footer { padding-left: 17px; padding-right: 17px; } .site-header { min-height: 66px; } .wordmark img { width: 142px; } .network-state { display: none; } .intro-panel, .role-title-row, .workbench-intro, .score-command { display: grid; grid-template-columns: 1fr; gap: 17px; } .intro-panel { padding: 21px 0 24px; } .intro-score { min-width: 0; padding: 11px 0 0; border-top: 1px solid var(--line-dark); border-left: 0; } .selection-surface, .coordinate-workbench { padding: 19px; border-radius: 17px; } .role-title-row { align-items: start; } .autosave-note { margin: 0; } .compact-factor-list, .picker-card.picker-ps .compact-factor-list { grid-template-columns: 1fr; } .workbench-intro > span { padding-top: 0; } .coordinate-canvas { min-height: 260px; padding: 10px 4px 0; } .coordinate-canvas svg { height: 242px; } .score-command > div:last-child { display: grid; grid-template-columns: 1fr 1.2fr; } .balance-status { margin-top: -5px; } .site-footer { display: grid; gap: 7px; } .site-footer span:last-child { text-align: left; } .result-hero, .result-body { padding-left: 22px; padding-right: 22px; } .result-table { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
