:root {
  font-family: "Inter", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: #172a32;
  background: #f3f5f3;
  --muted: #52666b;
  --line: #d2dcd8;
  --accent: #145951;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.topbar { background: #122a2c; color: #fff; }
.bar-inner, main { width: min(1120px, calc(100% - 48px)); margin: 0 auto; }
.bar-inner { display: flex; height: 62px; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 750; font-size: 20px; letter-spacing: -.04em; }
.brand i { width: 22px; height: 21px; background: linear-gradient(120deg, transparent 0 15%, #c1dea8 16% 38%, transparent 39% 50%, #c1dea8 51% 73%, transparent 74%); }
.topbar a { color: #d9e6df; text-decoration: none; font-size: 14px; }
.topbar a:hover { text-decoration: underline; }
main { padding: 0 0 48px; }
.intro { padding: 38px 0 24px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(30px, 4vw, 44px); letter-spacing: -.045em; line-height: 1.2; }
.intro p { margin-top: 12px; color: var(--muted); font-size: 15px; line-height: 1.7; }
h2 { font-size: 20px; line-height: 1.35; }
.workbench { display: grid; grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.panel { background: #fff; padding: 22px; border: 1px solid var(--line); border-radius: 10px; }
.actions, .form-footer, .source-actions, .history-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.actions { margin-top: 16px; }
button { color: #243f40; background: #fff; border: 1px solid #a3b6b0; border-radius: 5px; padding: 9px 14px; font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; }
button:hover:enabled { background: #eff5f1; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.primary:hover:enabled { background: #0b4842; }
button:disabled { color: #688079; background: #e3eae6; border-color: #d7dfda; cursor: default; }
:focus-visible { outline: 3px solid #d49538; outline-offset: 3px; }
.preview { margin-top: 15px; height: clamp(234px, 26vw, 316px); overflow: hidden; border-radius: 6px; background: #192e32; color: #e6f0e8; display: grid; place-items: center; }
.preview img, .preview video { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.empty-preview { display: grid; justify-items: center; gap: 8px; font-size: 13px; color: #acc4be; }
.empty-preview strong { font-size: 16px; color: #e1eee4; }
.frame-icon { width: 46px; height: 34px; margin-bottom: 8px;
  background: linear-gradient(#9abcae,#9abcae) 0 0, linear-gradient(#9abcae,#9abcae) 0 0,
    linear-gradient(#9abcae,#9abcae) 100% 0, linear-gradient(#9abcae,#9abcae) 100% 0,
    linear-gradient(#9abcae,#9abcae) 0 100%, linear-gradient(#9abcae,#9abcae) 0 100%,
    linear-gradient(#9abcae,#9abcae) 100% 100%, linear-gradient(#9abcae,#9abcae) 100% 100%;
  background-size: 12px 2px, 2px 10px; background-repeat: no-repeat; }
.source-actions, .form-footer, .history-head { justify-content: space-between; }
.source-actions { min-height: 37px; margin-top: 5px; }
.source-actions span, .form-footer span, .history-head span, .hint, .record-meta { font-size: 13px; color: var(--muted); line-height: 1.65; }
.text-button { border: 0; padding: 6px 4px; color: var(--accent); background: transparent; }
.share-actions { margin-top: 0; }
.form-panel { display: flex; flex-direction: column; }
.form-panel label { font-size: 14px; font-weight: 650; margin-top: 20px; }
.hint { margin-top: 4px; }
textarea { margin: 10px 0 14px; flex: 1; width: 100%; min-height: 165px; border: 1px solid #9caeaa; border-radius: 5px; background: #fafcfb; font: inherit; font-size: 15px; line-height: 1.7; padding: 11px; resize: vertical; }
.status { margin: 11px 2px 22px; color: var(--accent); font-size: 14px; line-height: 1.6; min-height: 1.6em; }
.status.error { color: #963f22; }
.history .hint { margin-top: 8px; }
.empty-history { margin-top: 16px; color: var(--muted); background: #f4f7f5; padding: 17px 14px; border-radius: 5px; font-size: 14px; }
#records { margin: 13px 0 0; padding: 0; list-style: none; }
#records:empty { margin: 0; }
#records li { display: grid; gap: 5px 20px; grid-template-columns: 1fr auto; padding: 15px 0; border-top: 1px solid var(--line); }
.record-names { min-width: 0; overflow-wrap: anywhere; font-size: 15px; }
.record-meta { grid-column: 1; }
.delete { grid-column: 2; grid-row: 1 / 3; align-self: center; }
.topbar nav, .filters, .draft-actions { display: flex; align-items: center; gap: 14px; }
.topbar nav a { padding: 9px 2px; }
.topbar nav a[aria-current="page"] { color: white; box-shadow: inset 0 -2px #bed8a7; }
.draft-actions { grid-column: 2; grid-row: 1 / 3; gap: 8px; }
.section-gap { margin-bottom: 16px; }
#draw-result:not(:empty), #receipt-result:not(:empty) { margin-top: 14px; }
#draw-result h3, #receipt-result h3 { margin: 0 0 9px; font-size: 16px; }
#simulation-collection summary, #receipt-panel summary, #monthly-report summary { cursor: pointer; font-weight: 650; }
#report-month, #report-year { max-width: 100%; padding: 7px 10px; border: 1px solid #9caeaa; border-radius: 5px; font: inherit; color: inherit; }
#report-result section { border-top: 1px solid var(--line); padding: 14px 0 3px; margin-top: 12px; }
#report-result h3 { margin: 0 0 6px; font-size: 16px; }
#report-result p, #report-result li { font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
#report-result ul { margin: 6px 0; padding-inline-start: 22px; }
.report-trend { width: 100%; margin-top: 16px; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.report-trend caption { text-align: left; font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.report-trend th, .report-trend td { padding: 6px 3px; text-align: right; border-bottom: 1px solid var(--line); }
.report-trend th:first-child { text-align: left; }
.report-trend th small { display: block; font-size: 12px; font-weight: normal; color: var(--muted); }
.report-trend tbody tr:nth-child(odd) { background: #f6f8f6; }
.report-trend .text-button { font-weight: 600; white-space: nowrap; }
#receipt-panel .hint { margin-top: 8px; }
#receipt-key { flex: 1 1 15em; min-width: 0; padding: 8px 10px; border: 1px solid #9caeaa; border-radius: 5px; font: inherit; }
.receipt-key { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 8px; }
.receipt-key code { overflow-wrap: anywhere; user-select: all; }
.code-box { margin-top: 16px; padding: 14px 16px; background: #f1f6ef; border-left: 3px solid var(--accent); }
.code-box code { font: 700 22px/1.4 ui-monospace, monospace; color: var(--accent); user-select: all; }
.code-box p { margin-top: 6px; font-size: 14px; line-height: 1.6; }
.stats-grid, .role-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 15px; }
.stat-block { background: #f3f6f3; border-radius: 5px; padding: 14px; }
.stat-block h3 { margin: 0 0 5px; font-size: 15px; }
.stat-block p { line-height: 1.7; font-size: 14px; }
.filters { margin-top: 16px; gap: 5px; border-bottom: 1px solid var(--line); }
.filters button { border: 0; background: transparent; border-radius: 0; padding: 9px 12px; }
.filters button[aria-pressed="true"] { box-shadow: inset 0 -2px var(--accent); color: var(--accent); }
.entries { margin: 0; padding: 0; list-style: none; }
.entries li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.entries li:last-child { border: 0; }
.entries li p { overflow-wrap: anywhere; }
.entries .actions { margin-top: 2px; }
.role-grid { margin-bottom: 18px; }
#screenshot-preview { display: block; max-width: 100%; max-height: 420px; margin: 12px 0; object-fit: contain; }
#screenshot-pool { width: min(100%, 26em); padding: 8px 10px; border: 1px solid #9caeaa; border-radius: 5px; font: inherit; }
#screenshot-notify-label { display: block; margin-bottom: 14px; }
.length-label, .role-field label { display: block; margin: 13px 0 5px; font-size: 14px; font-weight: 650; }
.role-field { min-width: 0; }
.role-field label { margin-top: 0; }
select { max-width: 100%; padding: 8px 10px; color: inherit; background: #fafcfb; border: 1px solid #9caeaa; border-radius: 5px; font: inherit; }
.role-field select { width: 100%; }
.planner-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.plan-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; min-width: 0; margin: 18px 0 0; padding: 12px 0 0; border: 0; border-top: 1px solid var(--line); }
.plan-fields legend { padding: 0 8px 0 0; font-weight: 650; color: var(--accent); }
.plan-fields label { display: grid; align-content: start; gap: 6px; font-size: 14px; }
.plan-fields select, .plan-fields input { width: 100%; min-width: 0; font: inherit; padding: 8px; border: 1px solid #9caeaa; border-radius: 5px; color: inherit; background: #fafcfb; }
.exchange-toggle { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; }
.plan-results { min-width: 0; overflow-wrap: anywhere; }
.plan-outcomes { display: grid; gap: 10px; margin: 16px 0; }
.plan-outcome { padding: 14px 18px; background: #eff5f1; border-left: 3px solid var(--accent); }
.plan-outcome span { display: block; font-size: 14px; }
.plan-outcome strong { display: block; margin-top: 4px; font-size: 30px; color: var(--accent); font-variant-numeric: tabular-nums; }
.plan-details { margin: 0; }
.plan-details div { display: grid; grid-template-columns: minmax(6em, .7fr) minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.plan-details dd { margin: 0; text-align: right; }
.training { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.training summary { cursor: pointer; font-weight: 650; }
.training .hint { margin: 8px 0; }
.training label { font-size: 14px; margin-right: 5px; }
#region-picker { display: block; width: 100%; height: auto; background: #192e32; cursor: crosshair; touch-action: manipulation; }
@media (max-width: 720px) {
  .bar-inner, main { width: min(100% - 28px, 580px); }
  .workbench { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .panel { padding: 16px; }
  .intro { padding: 26px 0 19px; }
  .preview { height: clamp(185px, 55vw, 300px); }
  .form-panel label { margin-top: 15px; }
  .bar-inner { height: 54px; }
  .draft-actions { grid-row: auto; grid-column: 1 / -1; }
  .stats-grid, .role-grid { grid-template-columns: minmax(0,1fr); }
  .planner-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 460px) {
  .bar-inner { height: auto; min-height: 54px; flex-wrap: wrap; gap: 2px 12px; padding-block: 6px; }
  .topbar nav { gap: 9px; flex-wrap: wrap; }
  .plan-fields { column-gap: 10px; }
}
