:root{color-scheme:light;--bg:#ffffff;--surface:#fff;--ink:#182946;--muted:#59677b;--line:#dce2ec;--primary:#2857ce;--shadow:0 5px 16px -13px #24375a45;font-family:Inter,"Microsoft YaHei UI","Microsoft YaHei","PingFang SC",system-ui,sans-serif;color:var(--ink);font-size:16px}
*{box-sizing:border-box}body{margin:0;background:var(--bg)}button,input,select{font:inherit;color:inherit}button{cursor:pointer}button:focus-visible,summary:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #3971df;outline-offset:2px}button{transition:background .15s,box-shadow .15s,transform .15s}button:active{transform:translateY(1px)}
#shell{min-height:100vh;display:grid;grid-template-columns:222px minmax(0,1fr)}.sidebar{position:sticky;top:0;height:100vh;display:flex;flex-direction:column;background:#f5f6f8;border-right:1px solid #e0e4e9;padding:0 15px;z-index:4}.brand{display:flex;align-items:center;gap:11px;height:77px;padding:0 12px;font-weight:760;font-size:24px;letter-spacing:.06em}.brand>span{width:36px;height:36px;border-radius:10px;color:#ffffff;background:#284fae;display:grid;place-items:center}.sidebar nav{flex:1;overflow:auto;padding:24px 0}.nav-label{font-size:13px;color:#637086;padding:0 13px 10px;font-weight:600}.books-label{margin-top:30px}.nav-item{border:0;display:flex;align-items:center;text-align:left;width:100%;gap:12px;padding:11px 13px;margin:2px 0;background:transparent;color:#3b4b60;border-radius:7px;font-size:15px}.nav-item:hover,.icon-btn:hover{background:#e9edf4}.nav-item.active{background:#e2eafd;color:#204aa9;font-weight:650}.nav-dot{height:9px;width:9px;border-radius:3px;background:var(--accent);margin:0 5px}.add-nav{color:#59677b;font-size:14px}.sidebar-foot{display:flex;align-items:center;gap:11px;padding:21px 9px 23px;border-top:1px solid var(--line);font-size:14px;color:#44536a}.sidebar-foot small{display:block;margin-top:4px;font-size:12px;color:#59677b}.main{min-width:0}.topbar{height:66px;padding:0 clamp(22px,3.3vw,58px);display:flex;align-items:center;gap:13px;background:#ffffff;border-bottom:1px solid var(--line);font-size:14px}.crumb{display:flex;align-items:center;gap:8px;color:var(--muted)}.slash{color:#79869b}.topbar strong{font-weight:580}.local-status{margin-left:auto;font-size:13px;color:var(--muted);display:flex;align-items:center;gap:7px}.local-status i{width:7px;height:7px;background:#4164a4;border-radius:50%}main{padding:28px clamp(20px,3.3vw,58px) 52px;max-width:1680px;margin:auto}
h1,h2,h3,p{margin:0}h1{font-size:clamp(28px,3vw,43px);line-height:1.25;letter-spacing:-.045em}h2{font-size:20px;letter-spacing:-.035em}h3{font-size:17px}.hero{border-radius:15px;overflow:hidden;isolation:isolate;position:relative;background:linear-gradient(106deg,#f4f7ff,#e8efff 74%,#dbe6ff);border:1px solid #dbe4f5;color:#182e57;min-height:202px;display:flex;align-items:center;padding:32px clamp(23px,3vw,45px);box-shadow:var(--shadow)}.hero-copy{position:relative;z-index:2}.hero p{color:#465976;font-size:15px;margin:9px 0 22px}.button,.text-btn,.icon-btn,.cycle,.tag,.actions,.book-title,.card-bottom span,.mode-pair button,.panel-heading h2,.section-title h2,.rules summary{display:inline-flex;align-items:center}.button,.text-btn{gap:7px;justify-content:center}.button{border:1px solid #c4cfdf;border-radius:7px;background:white;padding:9px 14px;font-size:14px;font-weight:600;min-height:39px}.button:hover{background:#f0f4fb}.button.light{background:#2857ce;color:#ffffff;border:0;padding:10px 16px}.button.light:hover{background:#2049b0}.button.primary{background:var(--primary);color:white;border-color:var(--primary)}.button.primary:hover{background:#2049b0}.art{position:absolute;top:0;right:0;bottom:0;width:39%;overflow:hidden;pointer-events:none}.artgrid{position:absolute;inset:0;background-image:linear-gradient(#6083c72b 1px,transparent 1px),linear-gradient(90deg,#6083c72b 1px,transparent 1px);background-size:23px 23px;mask-image:linear-gradient(90deg,transparent,#000 55%)}.paper,.backbook{position:absolute;left:44%;top:18%;width:112px;height:153px;border-radius:4px 9px 9px 4px;transform:rotate(14deg) skewY(-3deg)}.backbook-a{background:#5578b8;transform:translate(24px,17px) rotate(23deg);box-shadow:4px 5px #a7bce2}.backbook-b{background:#8ca9d9;transform:translate(12px,9px) rotate(17deg);border-right:3px solid #7094cd}.paper{background:#fbfdff;box-shadow:3px 4px #b2c6e6,inset 12px 0 #aec6ed;padding:23px 13px 12px 25px}.paper i{width:7px;height:29px;background:#3868cd;position:absolute;right:15px;top:0;clip-path:polygon(0 0,100% 0,100% 100%,50% 82%,0 100%)}.paper-title{width:34px;height:5px;background:#5274b3;margin:2px 0 12px}.paper-rule{height:1px;background:#c1d1eb;margin-bottom:8px}.bars{height:53px;display:flex;gap:3px;align-items:end;padding:5px 2px}.bars b{width:7px;background:#668ac8;height:24%}.bars b:nth-child(2){height:41%}.bars b:nth-child(3){height:36%}.bars b:nth-child(4){height:64%}.bars b:nth-child(5){height:56%}.bars b:nth-child(6){height:84%}
.section-title{margin:27px 0 13px}.section-title h2,.panel-heading h2{gap:9px}.count{font:600 12px/21px Inter,Arial,sans-serif;background:#edf1f7;color:#51627b;border-radius:10px;min-width:24px;text-align:center;padding:0 7px;letter-spacing:0}.cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:15px}.teal{--tint:#e6edff;--accent:#3058ae}.amber{--tint:#e9eef6;--accent:#465e7f}.violet{--tint:#ecebfa;--accent:#56578d}.blue{--tint:#e5effb;--accent:#3d638d}.book-card{width:100%;text-align:left;border:1px solid var(--line);background:var(--surface);border-radius:12px;padding:18px 18px 0;box-shadow:var(--shadow)}.book-card:hover{border-color:var(--accent);box-shadow:0 6px 18px -12px var(--accent)}.card-top,.card-bottom,.section-title,.panel-heading,.detail-heading,.modal-head,.modal-foot,.expense-row{display:flex;align-items:center;justify-content:space-between}.book-icon{width:39px;height:39px;display:inline-grid;place-items:center;border-radius:10px;background:var(--tint);color:var(--accent);flex-shrink:0}.cycle{gap:5px;font-size:12px;color:#606e81}.book-card h3{margin:12px 0 5px;font-size:18px}.book-card p{font-size:13px;color:var(--muted)}.card-bottom{border-top:1px solid #e6eaf0;margin-top:16px;padding:10px 0;font-size:13px;color:var(--muted)}.card-bottom span{gap:6px}.card-go{color:var(--accent)}
.panel,.stat{border:1px solid var(--line);border-radius:12px;background:var(--surface);box-shadow:var(--shadow)}.panel{overflow:hidden}.recent,.rules{margin-top:24px}.panel-heading{padding:17px 20px;gap:10px}.scroll{overflow:auto}table{width:100%;border-collapse:collapse;font-size:14px;text-align:left;white-space:nowrap}th,td{padding:12px 16px}th:first-child,td:first-child{padding-left:20px}th:last-child,td:last-child{padding-right:20px}th{background:#f4f6fa;color:#506178;font-weight:580;font-size:13px}td{border-top:1px solid #e7ebf1}tbody tr:hover{background:#f8faff}.right{text-align:right}.digits,.formula,code{font-family:"IBM Plex Mono",Consolas,"Microsoft YaHei",monospace;font-variant-numeric:tabular-nums}.muted{color:var(--muted)}.gain{color:#17704b}.loss{color:#b12f45}.neutral{color:#58667a}.tag{background:var(--tint);color:var(--accent);font-size:12px;padding:4px 8px;border-radius:5px;font-weight:600}.icon-btn{justify-content:center;display:inline-flex;align-items:center;border:0;background:transparent;width:31px;height:31px;border-radius:6px;color:#52637a}.text-btn{border:0;background:transparent;color:var(--primary);font-weight:600;padding:7px 3px;font-size:14px}.text-btn:hover{text-decoration:underline}.empty,.hint{color:var(--muted);font-size:14px;line-height:1.65}.empty{padding:30px;text-align:center}
select,input{border:1px solid #c6d0de;background:white;border-radius:6px;padding:9px 10px;min-width:0;font-size:14px}select{appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23536379' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 9px center;padding-right:32px}.panel-heading select{max-width:62%}.detail-heading{margin:4px 0 24px;gap:15px}.book-title,.actions{gap:12px}.book-title .book-icon{width:53px;height:53px}.book-title h1{font-size:30px}.detail-kicker{font-size:13px;color:var(--muted);margin-bottom:4px}.stat-grid{display:grid;grid-template-columns:1.22fr 1fr 1fr;gap:15px;margin-bottom:24px}.stat{padding:18px 21px}.stat span{display:block;font-size:14px;color:var(--muted);margin-bottom:10px}.stat strong{font-size:24px}.stat .small-stat{font-size:17px}.stat small{font-size:14px}.stat.featured{background:#1e345d;color:#ffffff}.stat.featured span{color:#d8e4fc}.detail-table{min-width:100%}.rules summary{cursor:pointer;gap:8px;width:100%;padding:18px 20px;font-weight:600;list-style:none}.rules summary svg:last-child{margin-left:auto}.rules>div{padding:0 20px 15px}.rules p{display:flex;gap:12px;font-size:14px;margin:7px 0;flex-wrap:wrap}.rules code{color:var(--muted)}
dialog{color:var(--ink);padding:0;border:1px solid #ced7e4;border-radius:15px;max-height:90dvh;max-width:min(94vw,610px);width:610px;box-shadow:0 24px 75px #14264740}dialog.wide{width:720px;max-width:min(94vw,720px)}dialog[open]{display:flex;flex-direction:column}dialog::backdrop{background:#111e36a6}.modal-head,.modal-foot{padding:17px 23px;flex-shrink:0}.modal-head{border-bottom:1px solid var(--line)}.modal-foot{border-top:1px solid var(--line);justify-content:flex-end;gap:9px}.modal-body{padding:21px 23px;overflow:auto}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}.field{display:flex;flex-direction:column;gap:6px;font-size:14px}.field>span{font-weight:600}.field input,.field select{width:100%}.unit-input{position:relative}.unit-input:has(small) input{padding-right:42px}.unit-input small{position:absolute;right:11px;top:9px;color:var(--muted);pointer-events:none}.unit-input input[type=number]{appearance:textfield}.unit-input input::-webkit-inner-spin-button{appearance:none}.form-section,.preview{margin-top:21px;padding-top:17px;border-top:1px solid var(--line)}.form-section h3,.preview h3{margin-bottom:9px}.hint{margin-bottom:12px}.schema-row,.schema-rule{margin:8px 0;display:grid;align-items:center;gap:8px;grid-template-columns:30px minmax(0,1.5fr) minmax(100px,1fr) 30px}.schema-rule{grid-template-columns:30px minmax(0,.9fr) minmax(0,1.5fr) 30px}.schema-row code,.schema-rule code{font-weight:700;text-align:center;font-size:14px;color:#385683;background:#ecf1fa;border-radius:4px;padding:4px 0}.mode-pair{display:flex;gap:8px;margin:13px 0}.mode-pair button{gap:8px;border:1px solid var(--line);border-radius:6px;background:white;padding:9px 13px;font-size:14px}.mode-pair button.selected{background:#e8efff;border-color:#7193d9;color:var(--primary)}.output-field{margin:12px 0}.entry-context{display:flex;align-items:center;gap:9px;margin-bottom:16px}.entry-context .book-icon{width:30px;height:30px}.entry-context>span:last-child{font-size:13px;color:var(--muted)}.list-field{min-width:0;grid-column:1/-1;border:1px solid var(--line);border-radius:8px;font-size:14px;padding:10px 12px}.list-field legend{font-weight:600}.expense-row{gap:7px;margin:5px 0}.expense-row input:first-child{flex:2;width:45%}.expense-row input:nth-child(2){flex:1;width:30%}.expense-total{float:right;color:var(--muted);margin:8px 0}.preview{background:#f2f6fe;border-radius:8px;border:0;padding:15px 17px}.preview h3{font-size:15px}.preview #preview-values>div{display:flex;justify-content:space-between;gap:8px;font-size:14px;padding:5px 0}.result-line{border-top:1px solid #d2dcf0;font-weight:650}.error{margin:12px 0 0;color:#a63044;background:#fff2f4;padding:10px 13px;border-radius:6px;font-size:14px}#toast{position:fixed;bottom:22px;left:50%;transform:translateX(-50%);background:#203354;color:white;border-radius:8px;padding:10px 18px;font-size:14px;opacity:0;pointer-events:none;z-index:10}#toast.show{opacity:1}.mobile-menu{display:none}
@media(min-width:1500px){main{padding-top:35px}.hero{min-height:220px}}
@media(max-width:1050px){#shell{grid-template-columns:180px minmax(0,1fr)}.sidebar{padding:0 10px}.book-card{padding:14px 14px 0}.cards{gap:10px}.stat{padding:16px}.topbar{height:60px}}
@media(max-width:790px){#shell{display:block}.sidebar{display:none}.nav-open .sidebar{display:flex;position:fixed;left:0;top:57px;bottom:0;height:calc(100dvh - 57px);width:232px;background:#f5f6f8;box-shadow:10px 10px 32px #26364e33}.nav-open .sidebar .brand{display:none}.mobile-menu{display:inline-flex}.topbar{height:57px;padding:0 16px;gap:8px}.art{width:38%}.paper,.backbook{left:23%}main{padding:18px 16px 38px}.hero{min-height:176px;padding:24px}.card-top .book-icon{height:33px;width:33px}.detail-heading{align-items:start;flex-wrap:wrap}.stat-grid{gap:8px}.stat strong{font-size:19px}.stat .small-stat{font-size:15px}}
@media(max-width:570px){.cards{grid-template-columns:1fr}.book-card{display:grid;grid-template-columns:40px 1fr auto;align-items:center;gap:3px 10px;padding:13px}.card-top{display:contents}.card-top .book-icon{grid-column:1;grid-row:1/3}.card-top .cycle{grid-column:3;grid-row:1}.book-card h3{grid-row:1;grid-column:2;margin:0;font-size:16px}.book-card p{grid-column:2;font-size:12px}.card-bottom{grid-column:3;grid-row:2;border:0;margin:0;padding:0;font-size:12px}.card-go{display:none!important}.card-bottom svg{display:none}.hero{min-height:162px;padding:22px}.art{width:32%;opacity:.75}.paper,.backbook{width:76px;height:114px;left:23%;top:25%}.paper{padding:18px 8px 8px 16px}.bars{height:38px}.hero p{max-width:215px;font-size:14px}.section-title{margin:20px 0 10px}.recent{margin-top:18px}.panel-heading{padding:13px 14px}th,td{padding:10px 12px}.stat-grid{grid-template-columns:1fr 1fr}.stat-grid .stat:last-child{display:none}.form-grid{grid-template-columns:1fr}.schema-row,.schema-rule{gap:4px;grid-template-columns:22px minmax(0,1fr) minmax(77px,1fr) 25px}.schema-row input,.schema-rule input,.schema-row select{padding-left:6px}.modal-head,.modal-foot,.modal-body{padding:14px}.brand{height:62px}.entry-context{margin-bottom:12px}}

/* Weekly game ledger */
.week-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 22px 55px;
  margin-bottom: 20px;
  padding: 17px 22px;
  background: #f4f7fd;
  border: 1px solid #dbe4f4;
  border-radius: 10px;
}
.week-stats span, .week-stats strong {display: block}
.week-stats span {font-size: 14px; color: var(--muted)}
.week-stats strong {margin-top: 5px; font-size: 22px; color: #223c68}
.week-panel .panel-heading, .week-tools {gap: 12px; flex-wrap: wrap}
.week-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 18px 13px;
  color: var(--muted);
  font-size: 14px;
}
.week-tools > div {display: flex; gap: 18px}
.week-grid th, .week-grid td {padding: 7px 9px}
.week-grid .entry-head {color: #2e529e; background: #e8effc}
.week-grid .week-label {font-weight: 550}
.week-grid td.week-edit {padding: 3px; background: #f5f8ff}
.week-grid input {
  width: 100%; min-width: 80px; max-width: 125px;
  padding: 6px 7px;
  font: inherit; font-family: Consolas, monospace;
  color: #223f79; border: 1px solid #d8e1f2;
  border-radius: 4px; text-align: right;
}
.week-grid input::placeholder {color: #76849b; font-size: 13px}
.week-grid input:focus {outline: 2px solid #4373d1; outline-offset: -1px}
.week-grid input[aria-invalid=true] {border-color: #bd3851; color: #983046}
.week-grid .rate-cell {width: 72px; min-width: 64px}
.week-status {padding: 11px 17px; font-size: 14px; color: var(--muted); border-top: 1px solid var(--line)}
.week-error {color: #a52d43; background: #fff4f5}
.week-date {max-width: 280px; margin-top: 12px}
#week-tsv {
  width: 100%; padding: 9px 12px; resize: vertical;
  border: 1px solid #c6d0de; border-radius: 6px;
  font: 14px/1.5 Consolas, monospace; color: var(--ink);
}
#week-preview {margin-top: 14px; font-size: 14px}
#week-preview .scroll {margin-top: 8px; border: 1px solid var(--line); border-radius: 6px}
.week-replace {display: block; margin-top: 12px; color: #863c29}
.button:disabled {cursor: default; opacity: .5}
@media (max-width: 670px) {
  .detail-heading:has(+.week-stats) .actions {flex-wrap: wrap; gap: 6px}
  .week-stats {padding: 12px 15px; gap: 12px 25px}
  .week-tools {padding: 0 13px 9px}
}

