:root{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif;color:#273341;background:#f6f7f9;line-height:1.6;font-size:14px;--red:#cd3158;--line:#e3e7ee;--muted:#728092}
*{box-sizing:border-box}body{margin:0}button,input,textarea,select{font:inherit}button{cursor:pointer;white-space:nowrap;border:1px solid #d7dde7;border-radius:8px;background:white;color:#354357;padding:8px 13px;transition:.15s}button:hover{background:#f3f5f8;border-color:#aeb8c8}button:disabled{cursor:wait;opacity:.5}button.primary{background:var(--red);color:white;border-color:var(--red)}button.primary:hover{background:#b72449}button.danger{color:#b52d4c}button.small{font-size:12px;padding:4px 9px}input,textarea,select{border:1px solid #d7dde7;border-radius:7px;padding:9px 10px;background:white;color:#273341;min-width:0;width:100%}input:focus,textarea:focus,select:focus{outline:2px solid #efbdca;outline-offset:1px;border-color:var(--red)}input[type=checkbox]{width:auto;accent-color:var(--red)}textarea{resize:vertical;min-height:80px}h1,h2,h3,p{margin:0}h1{font-size:25px;letter-spacing:.03em}h2{font-size:18px}h3{font-size:15px}a{color:var(--red)}.muted,.help{color:var(--muted);font-size:13px}.help{margin-top:5px}.header{background:white;border-bottom:1px solid var(--line);padding:15px max(24px,calc((100% - 1220px)/2));display:flex;align-items:center;justify-content:space-between;gap:14px}.brand{display:flex;align-items:center;gap:10px;letter-spacing:.06em;font-weight:650;font-size:16px}.brand-mark{display:grid;place-items:center;background:#fbeaf0;color:var(--red);width:32px;height:32px;border-radius:10px}.account{display:flex;align-items:center;gap:9px;flex-wrap:wrap}.layout{max-width:1268px;margin:auto;padding:27px 24px 110px}.intro{display:flex;justify-content:space-between;align-items:end;gap:18px;margin-bottom:22px}.intro p{margin-top:5px}.nav{display:flex;gap:5px;border-bottom:1px solid var(--line);margin-bottom:24px;overflow:auto;padding-bottom:10px}.nav button{border:0;background:transparent;font-weight:600}.nav button.active{color:var(--red);background:#fbeaf0}.card{background:white;border:1px solid var(--line);border-radius:12px;margin:16px 0;padding:22px}.card-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}.fields{display:grid;grid-template-columns:1fr 2fr;gap:18px}.field{display:flex;flex-direction:column;gap:6px}.field>span{font-size:13px;color:#5c697a}.notice{border:1px solid #ead7b1;background:#fffbf1;color:#89651d;border-radius:10px;padding:13px 16px;margin:15px 0}.notice.ok{border-color:#cfe3da;background:#f1faf6;color:#3f725d}.tag{display:inline-flex;border-radius:20px;background:#edf1f6;color:#5b6a80;font-size:12px;padding:2px 10px}.tag.red{background:#fbeaf0;color:var(--red)}.subnav{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px}.subnav button.active{color:var(--red);background:#fff1f5;border-color:#efb5c5}.list-table{width:100%;border-collapse:separate;border-spacing:0 8px;table-layout:fixed}.list-table th{text-align:left;color:#788699;font-weight:500;font-size:12px;padding:0 7px}.list-table td{padding:6px;background:#fafbfd;border-top:1px solid #e9edf3;border-bottom:1px solid #e9edf3;vertical-align:top}.list-table td:first-child{border-left:1px solid #e9edf3;border-radius:8px 0 0 8px}.list-table td:last-child{border-right:1px solid #e9edf3;border-radius:0 8px 8px 0}.list-table input,.list-table textarea{font-size:13px;padding:8px;min-height:37px}.list-table textarea{min-height:70px}.list-table .ops{width:65px;text-align:center}.actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.role{margin:20px 0}.role-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.char-row{display:grid;grid-template-columns:32px minmax(130px,1.4fr) minmax(140px,1fr) auto;gap:10px;align-items:center;padding:10px 0;border-top:1px solid #eef1f5}.rank{font-size:12px;color:#929db0;text-align:center}.char-row .actions{gap:4px}.char-row .actions button{padding:5px 9px}.footer-save{position:fixed;bottom:0;left:0;right:0;background:#ffffffed;backdrop-filter:blur(10px);border-top:1px solid var(--line);padding:13px 24px;display:flex;justify-content:center;z-index:5}.save-inner{width:1220px;display:flex;align-items:center;justify-content:space-between;gap:18px}.save-meta{display:flex;flex-direction:column;gap:5px}.save-right{display:flex;align-items:center;gap:10px}.save-right input{max-width:260px}.check{display:flex;align-items:center;gap:7px;font-size:13px}.dirty{font-size:12px;color:#ad6b19}.empty{padding:22px;text-align:center;color:var(--muted);background:#fafbfd;border-radius:8px}.catalog{margin-top:22px}.catalog summary{cursor:pointer;font-weight:600;padding:13px 0;list-style-position:inside}.catalog .card{margin:10px 0}.history-row{padding:16px 0;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;gap:16px}.history-main p{margin:4px 0}.user-row{display:flex;align-items:center;gap:15px;justify-content:space-between;padding:16px 0;border-bottom:1px solid var(--line)}.user-scopes{display:flex;gap:10px}.login-wrap{max-width:420px;margin:10vh auto;padding:25px}.login-card{padding:30px;background:white;border:1px solid var(--line);border-radius:16px;box-shadow:0 8px 40px #27334106}.login-card .brand{margin-bottom:24px}.login-card h1{font-size:22px}.login-card p{margin:7px 0 24px}.login-card .field{margin:16px 0}.login-card button[type=submit]{width:100%;margin-top:10px}.login-footer{text-align:center;margin-top:20px;color:#8c97a6;font-size:12px}.loading{padding:60px;text-align:center;color:var(--muted)}#notice{position:fixed;top:18px;left:50%;transform:translateX(-50%);z-index:100;max-width:min(90vw,650px);background:#273341;color:white;border-radius:10px;padding:12px 20px;box-shadow:0 6px 28px #15213626;display:none}#notice.show{display:block}#notice.error{background:#a72d48}dialog{border:1px solid var(--line);border-radius:14px;padding:26px;width:min(620px,92vw);max-height:85vh;color:#273341;box-shadow:0 18px 80px #16283d2e}dialog::backdrop{background:#1f2d4059}dialog h2{margin-bottom:12px}dialog .field{margin:16px 0}dialog .actions{justify-content:flex-end;margin-top:22px}.preview{background:#f6f8fa;border-radius:9px;padding:15px;margin:14px 0;max-height:40vh;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere}.copy-link{overflow-wrap:anywhere;white-space:pre-wrap;user-select:all;font-size:12px}.diff-list{padding-left:23px;font-size:13px;max-height:35vh;overflow:auto}.error-inline{color:#af2948;margin-top:12px;font-size:13px}.split{display:grid;grid-template-columns:1fr 1fr;gap:16px}.pill-line{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
@media(max-width:760px){.header{padding:12px 16px}.brand{font-size:14px}.account .muted{display:none}.layout{padding:20px 14px 175px}.intro{align-items:start}.intro h1{font-size:22px}.intro>.muted{display:none}.card{padding:16px}.fields,.split{grid-template-columns:1fr}.footer-save{padding:12px 14px}.save-inner{flex-direction:column;gap:9px;align-items:stretch}.save-right{justify-content:space-between}.save-right input{max-width:none;flex:1;min-width:80px}.save-meta>.muted{display:none}.list-table,.list-table tbody,.list-table tr,.list-table td{display:block;width:100%}.list-table thead{display:none}.list-table tr{border:1px solid var(--line);border-radius:10px;padding:8px;margin-bottom:12px;background:#fafbfd}.list-table td,.list-table td:first-child,.list-table td:last-child{border:0;border-radius:0;padding:4px 3px}.list-table td:before{content:attr(data-label);display:block;font-size:12px;color:#788699;margin-bottom:3px}.list-table .ops{width:100%;text-align:right}.list-table .ops:before{display:none}.char-row{grid-template-columns:22px 1fr auto;gap:8px}.char-row .alias-input{grid-column:2/4}.char-row .actions{grid-column:3;grid-row:1}.history-row{flex-direction:column}.user-row{flex-wrap:wrap}.login-wrap{margin:5vh auto;padding:18px}.login-card{padding:24px}.card-head{align-items:start}dialog{padding:20px}.check{font-size:12px}}

/* Record editors are transactional sheets: cancelling never changes the page draft. */
body:has(dialog[open]){overflow:hidden}
dialog.editor-sheet{padding:0;width:min(620px,calc(100% - 24px));max-height:min(90dvh,calc(var(--sheet-available,100dvh) - 16px));overflow:hidden}
dialog.editor-sheet[open]{display:flex;flex-direction:column}
.sheet-heading{display:flex;justify-content:space-between;gap:14px;padding:20px 22px 15px;border-bottom:1px solid var(--line);flex:none}
.sheet-heading h2{margin:0;font-size:18px}
.sheet-heading .help{margin-top:4px;font-size:12px}
.sheet-x{border:0;background:#f1f3f6;font-size:22px;width:38px;height:38px;padding:0;flex:none;line-height:1}
.sheet-body{padding:6px 22px 18px;overflow:auto;overscroll-behavior:contain;min-height:0}
.sheet-body>.field{margin:15px 0}
.sheet-body input,.sheet-body select,.sheet-body textarea{font-size:16px;min-height:44px}
.sheet-body textarea{min-height:100px}
.sheet-actions{display:flex;justify-content:flex-end;gap:9px;padding:13px 22px;border-top:1px solid var(--line);flex:none;background:white}
.sheet-actions button{min-height:44px}
.sheet-actions .sheet-remove{margin-right:auto;padding-inline:9px}
.choice-line{display:flex;gap:8px;align-items:start}
.choice-line>input,.choice-line>textarea{flex:1;width:0}
.choice-toggle{min-height:44px;color:var(--red);background:#fff7fa;padding-inline:12px}
.choice-panel{border:1px solid #e3e7ee;border-radius:9px;margin-top:8px;padding:8px;background:#f8f9fb}
.choice-panel[hidden]{display:none}
.choice-results{max-height:192px;overflow:auto;overscroll-behavior:contain;margin-top:5px}
.choice-option{display:block;white-space:normal;text-align:left;border:0;background:transparent;width:100%;min-height:44px;padding:9px;border-bottom:1px solid #e7eaf0;border-radius:0}
.choice-option:last-child{border-bottom:0}
.publish-preview{margin-top:16px;border:1px solid var(--line);border-radius:9px;padding:10px 12px}
.publish-preview summary{cursor:pointer;font-size:13px;color:#5b687a}
.publish-preview .preview{margin:10px 0 0;font-size:12px;max-height:220px}
.publish-check{align-items:flex-start;margin-top:20px;font-size:14px;line-height:1.65}
.publish-check input{min-height:0;margin-top:5px;flex:none}

@media(max-width:760px){
  .header{padding:9px 14px;min-height:53px;gap:10px}
  .header .account{flex-wrap:nowrap}
  .header .account button{min-height:36px;padding:5px 12px}
  .layout{padding:15px 12px calc(92px + env(safe-area-inset-bottom))}
  .intro{margin-bottom:9px}
  .intro h1{font-size:21px}
  .intro p{display:none}
  .nav{position:sticky;top:0;z-index:8;background:#f6f7f9;gap:0;padding:7px 0 9px;margin:0 0 13px;scrollbar-width:none}
  .nav::-webkit-scrollbar{display:none}
  .nav button{padding:9px 11px;font-size:13px;min-height:40px}
  .mobile-content{display:flex;flex-direction:column;gap:13px}
  .mobile-period,.mobile-info-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;width:100%;white-space:normal;text-align:left;background:white;border:1px solid var(--line);border-radius:10px;min-width:0}
  .mobile-period>div,.mobile-info-row>div{min-width:0}
  .mobile-period strong{display:block;font-size:14px;overflow-wrap:anywhere}
  .period-kicker{display:block;font-size:11px;color:#8a95a4;margin-bottom:2px}
  .mobile-period .tag{flex:none}
  .mobile-info-row strong{font-size:14px;display:block}
  .mobile-info-row .compact-meta{margin-top:3px}
  .mobile-segments{display:flex;flex-wrap:nowrap;gap:4px;padding:4px;margin:0;background:#e9edf3;border-radius:10px}
  .mobile-segments button{flex:1;min-width:0;min-height:38px;padding:7px 4px;font-size:13px;border:0;background:transparent;color:#718096;border-radius:7px}
  .mobile-segments button.active{background:white;color:var(--red);box-shadow:0 1px 4px #26364b0d}
  .mobile-group{padding:0;background:white;border:1px solid var(--line);border-radius:10px;overflow:hidden}
  .mobile-group-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px 7px}
  .mobile-group-head h3{font-size:14px}
  .mobile-group-head .tag{font-size:11px;padding:1px 8px}
  .compact-list{padding:0 12px}
  .compact-row{display:flex;justify-content:space-between;align-items:center;gap:10px;width:100%;min-width:0;min-height:72px;border:0;border-radius:0;border-bottom:1px solid #edf0f5;text-align:left;background:white;padding:10px 1px;white-space:normal}
  .compact-row:hover{background:#fcf8fa}
  .compact-row-main{flex:1;min-width:0;overflow:hidden}
  .compact-row-main strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:14px;font-weight:600}
  .compact-meta,.compact-sub{display:block;color:#7b8797;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;font-weight:400;line-height:1.65}
  .compact-meta{margin-top:2px}
  .compact-sub{color:#9a6e7b}
  .row-chevron{font-size:25px;color:#abb4c2;flex:none;padding-left:5px;line-height:1}
  .compact-add,.list-more{display:block;min-height:43px;width:100%;text-align:center;background:transparent;border:0;border-radius:0;font-size:12px;color:var(--red)}
  .list-more{color:#7d899b;border-bottom:1px solid var(--line)}
  .compact-empty{padding:13px 3px;font-size:12px;color:#8e99a9}
  .compact-search{display:block;margin:3px 12px 5px;width:calc(100% - 24px);min-height:40px;padding:8px 10px;font-size:14px;background:#f8f9fb;border-color:#e7ebf1}
  .compact-hint{font-size:11px;color:#8995a5;padding:0 14px 7px}
  .mobile-cage-group{display:flex;flex-direction:column;gap:7px}
  .mobile-cage-group>h2{font-size:14px;margin:2px 2px 0}
  .mobile-cage-group .mobile-group-head{padding:8px 14px 0}
  .mobile-cage-group .compact-row{min-height:54px;padding-top:7px;padding-bottom:7px}
  .mobile-cage-group .compact-add{min-height:34px;font-size:11px}
  .catalog-picker label>span,.mobile-boss-pickers label>span{font-size:12px}
  .catalog-picker select,.mobile-boss-pickers select,.mobile-team-picker select{min-height:44px;background:white;font-size:15px}
  .mobile-boss-pickers{display:grid;grid-template-columns:1fr 1fr;gap:10px}
  .mobile-team-picker{display:flex;gap:9px;align-items:end}
  .mobile-team-picker>.field{flex:1;min-width:0}
  .team-add{width:44px;min-height:44px;font-size:22px;padding:0;color:var(--red)}
  .role-segments button{font-size:12px;padding-inline:3px}
  .character-list{padding:0 9px}
  .compact-character{display:flex;gap:6px;align-items:center;border-top:1px solid #edf0f5;min-height:62px}
  .character-edit{display:flex;align-items:center;gap:9px;flex:1;min-width:0;border:0;background:white;padding:9px 2px;min-height:61px;border-radius:0;text-align:left}
  .character-edit .rank{width:20px;flex:none;font-size:11px}
  .priority-actions{display:flex;gap:3px;flex:none}
  .priority-button{width:36px;min-height:42px;padding:4px;font-size:15px;border-color:#e5e9f0;background:#fafbfd}
  .priority-button:disabled{cursor:default;opacity:.3}
  .mobile-footer{padding:10px 12px calc(10px + env(safe-area-inset-bottom));min-height:67px}
  .mobile-footer .save-inner{flex-direction:row;width:100%;align-items:center;gap:9px}
  .mobile-save-status{min-width:0;flex:1;line-height:1.4}
  .mobile-save-status .dirty{display:block;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .mobile-save-status small{display:block;font-size:10px;color:#99a3af;margin-top:3px}
  .mobile-footer button{min-height:44px;font-size:13px;padding:8px 13px}
  .mobile-footer .mobile-latest{font-size:12px;padding-inline:10px;background:transparent}
  dialog.editor-sheet{inset:auto 0 var(--keyboard-offset,0px);margin:0;width:100%;max-width:100%;max-height:min(92dvh,calc(var(--sheet-available,100dvh) - 12px));border:0;border-top:1px solid var(--line);border-radius:17px 17px 0 0}
  .sheet-heading{padding:17px 17px 13px}
  .sheet-heading h2{font-size:17px}
  .sheet-heading .help{font-size:11px;line-height:1.6;max-width:290px}
  .sheet-body{padding:0 17px 14px}
  .sheet-body>.field{margin:13px 0}
  .sheet-actions{padding:12px 17px calc(12px + env(safe-area-inset-bottom));gap:8px}
  .sheet-actions button{font-size:13px;padding-inline:12px}
  .sheet-actions .primary{min-width:98px}
  .sheet-body .mobile-group{margin:13px 0}
  .sheet-body>.help{margin-top:13px}
  .sheet-body .preview{font-size:12px}
  .publish-check{font-size:13px}
  .user-row{gap:10px}
  .user-scopes{margin-left:auto}
  .user-row>.actions{width:100%;justify-content:flex-end}
}
