:root {
  color-scheme: dark;
  font: 16px/1.55 "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  --page: #141916; --surface: #1b221d; --edge: #354038; --text: #f0f2eb;
  --muted: #acb7ac; --accent: #d0ef8b; --accent-dark: #252e20; --warn: #ffd092;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; background: var(--page); color: var(--text); }
button, input { font: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button, summary { cursor: pointer; }
button:disabled { cursor: wait; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
[hidden] { display: none !important; }
.shell { width: min(1080px, calc(100% - 64px)); margin: 0 auto; }
.top { border-bottom: 1px solid var(--edge); }
.top-inner { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: flex; align-items: center; gap: 13px; font-size: 0.875rem; color: var(--muted); white-space: nowrap; }
.brand strong { display: block; color: var(--text); font-size: 1.06rem; line-height: 1.25; letter-spacing: .06em; }
.brand-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; gap: 3px; background: var(--accent); border-radius: 8px; }
.brand-icon i { display: block; height: 10px; width: 4px; transform: skew(-13deg); background: #202a19; }
.brand-icon i:nth-of-type(2) { height: 16px; }
.brand-icon i:nth-of-type(3) { height: 22px; }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 7px; padding: 8px 15px; border-radius: 7px; border: 1px solid transparent; font-size: .9rem; font-weight: 650; text-decoration: none; white-space: nowrap; }
.quiet { color: var(--text); border-color: var(--edge); background: var(--surface); }
.quiet:hover, .row-option:hover { border-color: var(--accent); }
.primary { background: var(--accent); color: #1a2514; }
.primary:hover { background: #e0f7ae; }
.primary:disabled { opacity: .56; }
.plus { color: var(--accent); font-size: 1.25rem; line-height: 1; }
main { padding: 43px 0 58px; }
.intro { margin-bottom: 25px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.9rem, 3.9vw, 3rem); line-height: 1.15; letter-spacing: -.035em; }
.intro p { margin-top: 9px; color: var(--muted); }
.workspace { display: grid; grid-template-columns: 1.65fr 1fr; gap: 16px; }
.upload-panel, .summary, .history, .review, .saved, dialog { background: var(--surface); border: 1px solid var(--edge); border-radius: 12px; }
.upload-panel { padding: 13px; }
.drop-zone { min-height: 220px; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  border: 1px dashed #708268; border-radius: 8px; padding: 21px 15px; background: #1d2820; color: var(--text); text-align: center; }
.drop-zone:hover:not(:disabled), .drop-zone.dragging { background: #26362b; border-color: var(--accent); }
.drop-zone:disabled { opacity: .75; }
.drop-zone strong { font-size: 1.15rem; }
.drop-zone > span:not(.upload-icon) { color: var(--muted); font-size: .9rem; }
.drop-zone .formats { margin-top: 4px; font-variant-numeric: tabular-nums; }
.upload-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 6px; border: 1px solid #607451; border-radius: 10px; color: var(--accent); }
.upload-icon i { position: relative; width: 19px; height: 15px; border: 1.5px solid currentColor; border-radius: 3px; overflow: hidden; }
.upload-icon i::before { content: ""; position: absolute; width: 14px; height: 14px; border: 1.5px solid currentColor; border-radius: 1px; transform: rotate(45deg); top: 7px; left: 4px; }
.upload-icon i::after { content: ""; position: absolute; width: 3px; height: 3px; background: currentColor; border-radius: 50%; top: 3px; left: 3px; }
.summary { padding: 19px 21px 15px; background: linear-gradient(148deg, #263122, #1c251e 85%); min-width: 0; }
.summary-top, .summary-bottom, .section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.summary-top, .summary-bottom { color: var(--muted); font-size: .9rem; }
.state { padding: 2px 8px; border-radius: 4px; background: #2e382b; border: 1px solid #56664c; color: #d4dbce; white-space: nowrap; }
.state.locked { color: var(--accent); }
.boss { margin: 4px 0 15px; font-size: 1.32rem; font-weight: 700; overflow-wrap: anywhere; line-height: 1.35; }
.value-block { display: grid; gap: 1px; border-top: 1px solid #485446; padding: 11px 0 10px; color: var(--muted); font-size: .9rem; }
.total { color: var(--accent); font-size: clamp(2.15rem, 4.7vw, 3.65rem); font-family: "Bahnschrift", "Arial", sans-serif; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1; letter-spacing: -.045em; overflow-wrap: anywhere; }
.summary-bottom { border-top: 1px solid #485446; padding-top: 10px; flex-wrap: wrap; }
.summary-bottom strong { color: var(--text); font-variant-numeric: tabular-nums; }
.notice { margin-top: 12px; margin-bottom: 24px; min-height: 24px; color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.notice[data-kind="error"], .form-message { color: var(--warn); }
.notice[data-kind="success"] { color: var(--accent); }
.history, .review { padding: 18px 21px; }
h2 { font-size: 1.15rem; line-height: 1.35; }
#history-count, .empty, .review p, .saved { color: var(--muted); }
#history-count, .record-info, .text-button, .saved { font-size: .9rem; }
.empty { display: grid; min-height: 109px; margin-top: 12px; border-top: 1px solid var(--edge); align-items: center; text-align: center; }
.record-list { list-style: none; margin: 12px 0 0; padding: 0; }
.record-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; min-height: 66px; border-top: 1px solid var(--edge); }
.record-info { color: var(--muted); overflow-wrap: anywhere; }
.record-number { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 700; font-size: 1.05rem; }
.record-actions { display: flex; gap: 4px; }
.text-button { border: 0; padding: 5px 7px; min-height: 40px; border-radius: 4px; background: transparent; color: var(--text); white-space: nowrap; }
.text-button:hover { background: #303b30; }
.review { margin-bottom: 16px; }
.review > p { margin-top: 8px; }
.review-rows { display: grid; gap: 7px; margin: 14px 0; }
.row-option { display: grid; align-items: center; grid-template-columns: minmax(0, 1fr) auto; text-align: left; gap: 10px; padding: 8px; min-height: 48px; border: 1px solid var(--edge); border-radius: 6px; background: var(--page); color: var(--text); }
.row-option[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-dark); }
.row-option img { display: block; width: min(100%, 365px); border-radius: 3px; }
.row-option span { font-variant-numeric: tabular-nums; }
.review-form { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; }
label { display: grid; gap: 4px; color: var(--muted); font-size: .9rem; }
input:not([type="file"]) { border: 1px solid #657464; border-radius: 6px; padding: 8px 9px; min-height: 44px; width: min(100%, 210px); color: var(--text); background: var(--page); font-size: 1rem; }
#review .form-message, #edit-form .form-message { margin-top: 8px; color: var(--warn); }
.saved { margin-top: 14px; padding: 12px 18px; }
.saved ul { margin: 9px 0 0; padding-left: 20px; }
.saved li { margin: 6px 0; }
.saved a { overflow-wrap: anywhere; }
dialog { color: var(--text); width: min(calc(100% - 36px), 375px); padding: 18px; }
dialog::backdrop { background: rgb(0 0 0 / .68); }
dialog label { margin-top: 12px; }
.dialog-actions { margin-top: 13px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 650px) {
  .shell { width: calc(100% - 30px); }
  .top-inner { min-height: 64px; }
  main { padding-top: 28px; }
  .intro { margin-bottom: 17px; }
  .intro p { font-size: .94rem; }
  .workspace { grid-template-columns: 1fr; gap: 11px; }
  .summary { grid-row: 1; padding: 13px 15px 11px; }
  .boss { margin-bottom: 9px; }
  .value-block { padding: 8px 0; }
  .summary-bottom { padding-top: 7px; }
  .drop-zone { min-height: 150px; gap: 3px; padding-block: 12px; }
  .upload-panel { padding: 9px; }
  .upload-icon { width: 38px; height: 38px; margin-bottom: 4px; }
  .history, .review { padding: 14px; }
  .record-list li { column-gap: 6px; }
  .record-actions { gap: 0; }
  .record-actions button { padding-inline: 5px; }
  .record-number { font-size: .97rem; }
  .notice { margin-bottom: 16px; }
  .row-option span { font-size: .85rem; }
  .review-form label { flex: 1 1 130px; }
}
@media (prefers-reduced-motion: no-preference) {
  button, .button { transition: background-color .15s, border-color .15s; }
}


.projects .section-head { margin-bottom: 12px; }
#project-count, .project-games, .project-state, .legacy-image { color: var(--muted); font-size: .9rem; }
.project-list { display: grid; gap: 9px; }
.project { border: 1px solid var(--edge); border-radius: 8px; background: #19211b; }
.project[data-active="true"] { border-color: #6d805e; }
.project > summary { display: grid; grid-template-columns: minmax(0,1fr) auto 12px; align-items: center; gap: 10px; list-style: none; padding: 12px 15px; }
.project > summary::-webkit-details-marker { display: none; }
.project > summary::after { content: ""; height: 6px; width: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); margin-bottom: 4px; }
.project[open] > summary::after { transform: rotate(225deg); margin-bottom: 0; }
.project-title { display: grid; gap: 1px; overflow-wrap: anywhere; }
.project-state { color: var(--accent); margin-left: 8px; }
.project-total { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.project-total small { display: block; color: var(--muted); font-size: .85rem; font-weight: 400; }
.project-content { border-top: 1px solid var(--edge); padding: 10px 14px 3px; }
.project-content .record-list { margin-top: 8px; }
.project-content .text-button:disabled { opacity: .55; }
.legacy-image { align-self: center; }
#image-view { width: min(calc(100% - 24px), 1060px); max-height: 94dvh; }
#record-image { display: block; width: 100%; height: auto; object-fit: contain; max-height: 78dvh; margin-top: 8px; }
@media (max-width: 650px) {
  .project > summary { gap: 6px; padding: 9px 10px; }
  .project-content { padding-inline: 9px; }
  .project-content .record-list li { grid-template-columns: minmax(0,1fr) auto; row-gap: 0; padding: 5px 0; }
  .project-content .record-actions { grid-column: 1 / -1; }
}


.local-note { margin: 12px 0 9px; color: var(--muted); font-size: .9rem; }
.toolbar, .form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar [aria-pressed="true"], .section-add { border-color: #647f56; color: var(--accent); }
.notice { margin: 7px 0 15px; }
.notice:empty { margin: 0 0 14px; min-height: 0; }
#active-rule { color: var(--muted); font-size: .9rem; margin: -9px 0 10px; overflow-wrap: anywhere; }
.fee-note { margin-top: 5px; color: var(--muted); overflow-wrap: anywhere; }
.fee-note strong { color: var(--warn); font-variant-numeric: tabular-nums; }
#rules, #rule-editor, #rule-empty { margin-bottom: 14px; }
.rule-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.rule-list li { background: var(--page); border: 1px solid var(--edge); border-radius: 8px; padding: 10px 13px; }
.rule-help, .record-rule { color: var(--muted); font-size: .9rem; }
.record-rule { margin-left: 2px; }
.rule-terms { margin-top: 4px; display: flex; gap: 6px 20px; flex-wrap: wrap; color: var(--muted); font-size: .9rem; }
.settlement-fields { display: flex; flex-wrap: wrap; gap: 8px 13px; align-items: flex-end; margin: 11px 0; }
.settlement-fields > label { flex: 1 1 160px; max-width: 310px; }
.settlement-fields input:not([type="file"]), .unit-field input:not([type="file"]) { width: 100%; }
.form-actions { margin-top: 12px; }
#rule-editor .rule-name { margin: 12px 0 0; }
#rule-form .rule-name input { width: min(100%, 370px); }
.unit-field, .ratio { display: flex; align-items: center; gap: 7px; min-width: 0; }
select { border: 1px solid #657464; border-radius: 6px; color: var(--text); background-color: var(--page); min-height: 44px; padding: 7px 31px 7px 10px; width: min(100%, 310px); font: inherit; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: right 17px center, right 12px center; background-size: 5px 5px; background-repeat: no-repeat; }
#review-rule-help { margin-top: 4px; }
#review-rule-field { margin-top: 9px; }
#rule-empty .rule-help { margin-top: 6px; }
#rule-error { margin-top: 8px; }
.project-controls { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
button.danger { background: #3d2725; color: #ffd4cc; border: 1px solid #83554d; }
button.danger:hover { background: #54312d; }
.delete-description { color: var(--warn); margin: 10px 0; overflow-wrap: anywhere; }
.project-content .settled-record { grid-template-columns: minmax(0,1fr) minmax(0,1fr); row-gap: 4px; align-items: start; padding: 11px 0; }
.record-money { text-align: right; overflow-wrap: anywhere; }
.record-money .negative { color: #ffb39f; }
.record-fee { color: var(--warn); font-size: .9rem; font-variant-numeric: tabular-nums; }
.record-original, .record-threshold { color: var(--muted); font-size: .9rem; }
.record-failed { color: var(--warn); }
.share-field { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 7px; }
.share-field .ratio { width: 94px; }
.share-field input:not([type="file"]) { width: 71px; }
.legacy-image { padding-inline: 5px; }
.project-content .record-actions { justify-self: end; }
@media (max-width: 650px) {
  .settlement-fields > label { flex-basis: 145px; }
  .project-content .record-actions { justify-self: start; }
  .project-content .record-list li.settled-record { grid-template-columns: minmax(0, 1fr); row-gap: 7px; }
  .record-money { display: flex; flex-wrap: wrap; text-align: left; align-items: baseline; gap: 2px 12px; }
  .record-money .record-fee { flex-basis: 100%; }
  .share-field { grid-column: 1 / -1; }
  .record-money .record-fee { font-size: .85rem; }
}

