/* Last Witness — one illustrated tabletop UI system.
   Active stylesheet: old experimental skins remain saved, but are not loaded. */
@font-face{font-family:Witness;src:url('/font.ttf') format('truetype');font-weight:300 700;font-display:block}
:root{--bg:#17191e;--surface:#23262c;--raised:#2b2f36;
  --ink:#f0e6d3;--muted:#b9b5ab;--line:#515254;--brass:#ba945d;
  --selected:#f0cf94;--lilac:#c6b1df;--danger:#e3aaa0;--success:#b4cfba;
  --nav:76px;--safe:env(safe-area-inset-bottom,0px);
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;font-size:16px;color:var(--ink);
}
*{box-sizing:border-box} [hidden]{display:none!important}
body{margin:0;min-height:100dvh;overflow-x:hidden}
button,input,textarea,select{font:inherit;color:inherit}
button{cursor:pointer;min-height:48px;border:0;background:none;touch-action:manipulation}
button:disabled{opacity:.55;cursor:default}
button:focus-visible,summary:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,.board-viewport:focus-visible{outline:2px solid var(--selected);outline-offset:3px}
button:hover:not(:disabled){filter:brightness(1.08)}
p{margin:0 0 16px;line-height:1.6}h1,h2,h3{margin:0;font-weight:600}
h1,h2,h3{font-family:Witness,Georgia,serif}h2{font-size:29px;line-height:1.15}h3{font-size:24px;line-height:1.2}
svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}
.icon-library{position:absolute;width:0;height:0;overflow:hidden}
.app{position:relative;width:100%;min-height:100dvh;isolation:isolate}
.eyebrow{font-size:11px;font-weight:650;letter-spacing:1.4px;color:var(--brass);line-height:1.4}
.small-label,.muted{font-size:14px;color:var(--muted)}
.body-copy{font-size:17px;line-height:1.6;white-space:pre-line;overflow-wrap:anywhere}
.topbar{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:14px;min-height:76px;padding:12px max(18px,env(safe-area-inset-left));padding-top:max(12px,env(safe-area-inset-top))}
.game-mark{display:grid;place-items:center}
.game-mark svg{width:30px;height:30px;stroke-width:1.1}
.phase-line{flex:1;min-width:0;display:flex;align-items:center}
.phase-line .eyebrow{grid-column:1/-1;font-size:10px;letter-spacing:1.7px}
.phase-line strong{font:600 27px/1.12 Witness,Georgia,serif}
.connection-error{position:sticky;z-index:22;padding:12px 18px;background:#452e2b;color:#ffe0d6;border-bottom:1px solid #b78b7d;font-size:14px;line-height:1.5}
.avatar{display:grid;place-items:center;flex:none;width:48px;border:1px solid var(--line);border-radius:12px 3px 12px 3px}
.demo-strip{position:absolute;top:20px;right:82px;z-index:21;display:flex;align-items:center;gap:8px;background:none;color:var(--muted);font-size:10px}
.demo-strip button{min-height:30px;font-size:12px;letter-spacing:0;color:#d0b78f;padding:0 4px}
.demo-tools{padding:20px;border-bottom:1px solid var(--line)}
.demo-tools p{font-size:14px;color:var(--muted);max-width:68ch}.chips{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.chips button{padding:10px 14px;font-size:14px;border:1px solid var(--line);border-radius:9px 2px 9px 2px}
.chips .selected{border-color:var(--brass);color:var(--selected)}
.board-shell{--board-height:clamp(350px,51dvh,600px);position:relative;background:#16181d;isolation:isolate}
.board-viewport{position:relative;width:100%;height:var(--board-height);overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#8c7750 #17191e;}
.tableau{width:100%;height:100%;position:relative;isolation:isolate;overflow:hidden;background:url('/square.png') center/cover;transition:filter .9s ease}
.tableau::before{content:'';position:absolute;inset:0;pointer-events:none;background:radial-gradient(ellipse at center,#17191e00 35%,#17191e59 100%),linear-gradient(0deg,#17191ed9,transparent 25%,transparent 90%,#17191e33)}
.tableau::after{content:'';position:absolute;inset:0;pointer-events:none;box-shadow:inset 0 0 35px #0b0b1455}
.tableau-shade{position:absolute;inset:0;pointer-events:none;background:#18152000;transition:background 1.1s}
.night .tableau-shade{background:#18193680;mix-blend-mode:multiply}
.night .tableau{filter:saturate(.7)}
.board-ring{position:absolute;left:50%;top:50%;width:76%;height:80%;transform:translate(-50%,-50%);border:1px solid #efe1bc20;border-radius:50%;pointer-events:none}
.board-toolbar{position:absolute;left:14px;right:12px;top:8px;z-index:8;display:flex;align-items:center;justify-content:space-between;pointer-events:none;}
.board-toolbar>span{font:600 10px/1.3 -apple-system,BlinkMacSystemFont,sans-serif;letter-spacing:1.6px;color:#f0e6d3;text-shadow:0 1px 3px #000;}
.board-toolbar button{pointer-events:auto;min-height:40px;padding:7px 12px;background:#17191ee8;border:1px solid #777269;border-radius:10px 3px;color:var(--ink);font-size:12px;}
.board-viewport{overflow:hidden;}
.board-zoom-hint{position:absolute;bottom:7px;left:12px;right:12px;text-align:center;font-size:12px;line-height:1.35;color:var(--ink);background:#17191edb;border-radius:4px;padding:5px;margin:0;z-index:7;pointer-events:none;}
.players{position:absolute;inset:30px 10px 20px;z-index:2;}
body.game-skin .player{position:absolute;transform:translate(-50%,-50%);display:flex;align-items:center;flex-direction:column;gap:3px;width:88px;text-align:center;color:var(--ink);pointer-events:none;}
body.game-skin .players .illustrated-token{width:56px;height:56px;}
body.game-skin .players .player-number{display:grid;place-items:center;width:20px;height:20px;right:-1px;bottom:0;border-radius:50%;background:#25262c;border:1px solid #b5a585;color:var(--ink);font:600 11px/1 -apple-system,BlinkMacSystemFont,sans-serif;}
body.game-skin .players .player-label{max-width:88px;background:#17191ef0;color:var(--ink);padding:4px 7px;font-size:12px;font-weight:500;line-height:1.2;overflow-wrap:anywhere;border:1px solid #716859;border-radius:6px 2px;}
body.game-skin .player.own .illustrated-token{filter:drop-shadow(0 0 3px #c9aa68);}
body.game-skin .player.own .player-label{border-color:var(--selected);color:#ffe0a4;}
body.game-skin .player.dead .player-label{color:#d5c1e5;border-color:#8c769e;}
.board-center{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:3;text-align:center;display:grid;gap:4px;background:#17191ee8;border:1px solid #94826b;border-radius:14px 3px;color:var(--ink);}
.board-center span{font-size:12px;color:var(--muted)}.board-center strong{font:600 29px Witness,Georgia,serif;}
.board-center{max-width:44%;padding:12px;}.board-center strong{font-size:clamp(22px,5vw,29px);line-height:1.15;}
.board-public{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:min(40%,320px);z-index:6;background:#17191ef2;border:1px solid #a88a5a99;border-radius:15px 3px;box-shadow:0 4px 16px #0003;}
.board-public>summary{display:flex;align-items:center;flex-direction:column;gap:6px;text-align:center;cursor:pointer;padding:14px 9px;list-style:none;}
summary::-webkit-details-marker{display:none}
#board-status-title{font:600 23px/1.1 Witness,Georgia,serif;overflow-wrap:anywhere;}
#board-status-summary{font-size:12px;line-height:1.4;color:var(--ink);}
.board-more{font-size:11px;color:var(--muted);margin-top:3px;}
.board-public[open]{width:min(84%,540px);max-height:78%;overflow:auto;}
.board-public[open]>summary{border-bottom:1px solid #ba945d44;padding:12px;}
.board-public[open] .board-more span{display:inline-block;transform:rotate(180deg);}
.board-status{padding:4px 14px 16px;font-size:14px;}
.board-status h2{font-size:22px;margin:14px 0 8px;}.board-status p{font-size:14px;line-height:1.45;margin:10px 0;}
.board-status .night-hint{font-size:13px;color:var(--muted);}
.night-readiness{display:grid;gap:0;}
.night-readiness>div{display:flex;justify-content:space-between;gap:14px;padding:9px 0;border-bottom:1px solid #ffffff12;font-size:13px;}
.night-readiness>div span:last-child{text-align:right;color:var(--muted);}
.night-readiness .ready span:last-child{color:var(--success);}
.action-card{position:relative;max-width:880px;z-index:9;}
.action-meta{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:10px;}
.action-meta .small-label{font-size:12px;text-align:right;}
.action-card h2{font-size:28px;margin:0 0 10px;}
.action-card>.body-copy{font-size:16px;margin:0;}
.action-card>.body-copy:empty{display:none;}
.actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:17px;}
.actions button,.primary,.secondary{
  --button-line:#777367;--button-fill:#30343b;position:relative;isolation:isolate;display:inline-flex;
  align-items:center;justify-content:center;gap:7px;padding:13px 17px;
  background:none;font-weight:550;line-height:1.3;text-align:center;
  transition:filter .15s ease,transform .12s ease;
}
.actions button::before,.actions button::after,.primary::before,.primary::after,.secondary::before,.secondary::after{content:'';position:absolute;pointer-events:none;z-index:-1;clip-path:polygon(11px 0,100% 0,100% calc(100% - 11px),calc(100% - 11px) 100%,0 100%,0 11px);}
.actions button::before,.primary::before,.secondary::before{inset:0;background:var(--button-line);}
.actions button::after,.primary::after,.secondary::after{inset:1px;clip-path:polygon(10px 0,100% 0,100% calc(100% - 10px),calc(100% - 10px) 100%,0 100%,0 10px);}
.actions button:active:not(:disabled),.primary:active:not(:disabled),.secondary:active:not(:disabled){transform:translateY(1px);}
.actions button:only-child{grid-column:1/-1;}
.primary,.actions button[data-intent="primary"]{--button-fill:#55452e;--button-line:#d4b27a;}
.actions button[data-intent="caution"]{--button-fill:#3e344b;--button-line:#aa8ec1;}
.actions button[data-intent="danger"]{--button-fill:#46302f;--button-line:#b98c81;}
.actions button[data-intent="quiet"]{--button-fill:#25292f;--button-line:#626566;}
.actions button[aria-pressed="true"]{--button-line:#efd19b;--button-fill:#514634;}
.actions button[data-intent="choice"]{--button-fill:#30343b;--button-line:#777367;}
.feedback{margin:12px 0 0;font-size:14px;line-height:1.45;color:var(--success);}
.feedback:empty{display:none;}
.private-info,.room-form,.room-menu{max-width:880px;margin:0 auto;padding:0 22px;}
.private-info details,.room-menu{border-top:1px solid #51525477;}
.private-info summary{min-height:55px;display:flex;align-items:center;gap:10px;cursor:pointer;font-size:15px;}
.private-info summary svg{width:20px;height:20px;}
.private-info summary span{margin-left:auto;font-size:12px;color:var(--muted);}
.private-info .body-copy{padding:4px 0 20px;}
.room-form{padding-top:20px;padding-bottom:20px;}
.room-form label{display:block;font-size:16px;margin-bottom:10px;}
.room-form textarea{width:100%;min-height:100px;padding:14px;border:1px solid #777367;border-radius:11px 3px;font-size:17px;line-height:1.5;resize:vertical;}
.room-form .primary{margin-top:10px;}.room-form p{font-size:14px;margin-top:8px;}
.room-menu>summary{padding:18px 0;min-height:55px;cursor:pointer;font-size:15px;}
.room-menu .actions{margin-top:0;margin-bottom:20px;}
#game-ask-narrator{width:100%;margin:14px 0 22px;}
.seating-editor{max-width:880px;margin:0 auto;padding:18px 14px;color:#eed6af;background:#30201d}.seating-editor>p{font-size:15px;line-height:1.5}.seating-editor h2{margin:0 0 8px}.seating-editor ol{list-style:none;padding:0;margin:12px 0}.seating-editor li{display:flex;align-items:center;gap:8px;min-height:52px;padding:4px 8px;margin:4px 0;background:#493126;border:1px solid #9b784a;border-radius:8px;color:#ffe6b8}.seating-editor li.dragging{background:#6b4a2f;border-color:#f1cf83;box-shadow:0 3px 14px #0008}.seating-editor img{width:28px;height:28px;object-fit:contain}.seating-number{display:none}.seating-name{flex:1;min-width:0;overflow-wrap:anywhere;font-size:18px}.seating-editor .seating-place{width:76px;flex:none;min-height:44px;margin:0;padding:6px;font-size:16px;border-radius:6px}.seating-handle{touch-action:none;user-select:none;cursor:grab;min-width:44px;min-height:44px;font:26px Georgia,serif}.seating-handle:active{cursor:grabbing}.seating-footer{position:sticky;bottom:calc(var(--nav) + var(--safe) + 8px);background:#30201df5;padding:10px 0;border-top:1px solid #9b784a;z-index:3}.seating-footer p{margin:0 0 8px;font-size:14px;line-height:1.4}.seating-buttons{display:flex;gap:8px;flex-wrap:wrap}.seating-buttons button{flex:1;min-width:135px;min-height:44px;padding:10px;font-size:15px}.seating-buttons button:disabled{opacity:.45;cursor:default}
#chronicle,#reference,#guide,#error-panel{max-width:780px;margin:0 auto;padding:28px 22px 18px;}.page-title h2{font-size:36px;margin:7px 0 8px;}.page-title p{font-size:15px;color:var(--muted);}
.section-heading{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin:26px 0 16px;}
.reader-controls{padding:0 0 23px;border-bottom:1px solid #51525480;}
.reader-controls label{display:block;font-size:14px;color:var(--muted);margin-bottom:9px;}
.reader-buttons{display:flex;gap:9px;flex-wrap:wrap;}.reader-buttons button{flex:1;min-width:145px;font-size:15px;}
.reader-controls .muted{margin:12px 0 0;font-size:13px;}
.search,select{width:100%;min-height:50px;padding:13px 15px;border:1px solid #6d6e6b;border-radius:11px 3px;font-size:16px;margin-bottom:16px;}
.chapter-card{position:relative;margin:25px 0 20px;color:#28231d;isolation:isolate;}
.chapter-card::before{content:'';position:absolute;inset:0;background:url('/materials/paper-v1.png') center/320px;opacity:.12;border-radius:inherit;pointer-events:none;z-index:-1;}
.chapter-card .section-heading{margin:0 0 17px;align-items:center;}.chapter-card .eyebrow{color:#675034;}.chapter-card .small-label,.chapter-card .muted{color:#554b3e;}
.reading-progress{height:2px;background:#baad96;margin-bottom:20px;}.reading-progress span{height:100%;display:block;width:0;background:#665131;}
.story-copy,.story-copy p{font-family:Witness,Georgia,serif;font-size:22px;font-weight:500;line-height:1.55;letter-spacing:0;opacity:1;overflow-wrap:anywhere;}
.story-copy p{margin:0 0 18px;}.story-copy p:last-child{margin-bottom:0;}.chapter-card .text-button{color:#564126;min-height:48px;margin-top:8px;text-decoration:underline;text-underline-offset:4px;font-size:15px;}
.events{border-left:1px solid #86704d;padding-left:20px;}.events .muted{font-size:15px;}
.event{font-size:16px;line-height:1.6;white-space:pre-line;margin-bottom:20px;padding-bottom:18px;border-bottom:1px solid #51525460;overflow-wrap:anywhere;}
.sealed-card{max-width:470px;margin:0 auto;text-align:center;padding:17px 12px;}.sealed-card h3{font-size:28px;}.sealed-card p{font-size:15px;color:var(--muted);margin:12px 0 21px;}
.card-back-art{width:132px;height:182px;margin:0 auto 25px;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:18px;position:relative;border-radius:14px 3px 14px 3px;}
.card-back-art::before{content:'';position:absolute;inset:8px;border:1px solid #ba945d55;border-radius:9px 1px;}
.card-back-art svg{width:43px;height:43px;color:#c4a477;stroke-width:1;}.card-back-art span{font:600 12px/1.5 Witness,Georgia,serif;letter-spacing:1.6px;color:#d2b58a;}
.portrait-wrap{position:relative;width:min(100%,400px);margin-inline:auto;max-height:none;overflow:hidden;border-radius:15px 3px 15px 3px;background:var(--surface);}
.portrait-wrap img{display:block;width:100%;height:auto;object-fit:contain;object-position:center;}
.portrait-hide{display:block;position:static;width:100%;padding:10px 14px;min-height:44px;border:0;border-top:1px solid #b3a78b;border-radius:0;font-size:14px;}
.role-caption{padding:24px 0 15px;}.role-caption h2{font-size:36px;margin-top:5px;}.role-text{font-size:17px;line-height:1.65;}
.subtabs{display:flex;margin:0 0 20px;border-bottom:1px solid var(--line);}
.subtabs button{position:relative;padding:12px 2px;min-height:48px;}.subtabs .selected::after{content:'';position:absolute;bottom:-1px;left:0;right:0;}
.accordion details{border-bottom:1px solid #51525499;}.accordion summary{position:relative;cursor:pointer;min-height:58px;padding:18px 27px 18px 0;font-size:17px;font-weight:550;line-height:1.4;list-style:none;}
.accordion summary::after{content:'+';position:absolute;right:2px;top:15px;font-size:22px;font-weight:400;}.accordion details[open]>summary::after{content:'−';}
.accordion details p{font-size:17px;line-height:1.65;color:#dfdbd1;white-space:pre-line;padding:0 0 10px;overflow-wrap:anywhere;}
.not-connected{margin-top:30px;padding-top:23px;border-top:1px solid var(--line);}.not-connected h3{font-size:27px;}.not-connected p{font-size:15px;color:var(--muted);margin-top:12px;}
#question-history details{margin-top:16px;border-bottom:1px solid var(--line);}#question-history summary{cursor:pointer;padding:12px 0;font-size:16px;}#question-history p{white-space:pre-line;font-size:16px;color:var(--ink);}
.bottom-area{position:fixed;bottom:0;left:0;right:0;z-index:25;padding-top:7px;}
.tabbar{display:flex;justify-content:center;}
.tabbar button{position:relative;flex:1;max-width:190px;display:flex;align-items:center;justify-content:center;flex-direction:column;min-height:54px;font-size:12px;font-weight:500;}
.tabbar .nav-icon{width:34px;height:34px;stroke-width:1.5;padding:7px;overflow:visible;background:url('/materials/ui-v2/button-round.png') center/contain no-repeat;}.tabbar .active::before{content:'';position:absolute;top:-8px;width:28px;height:2px;background:var(--brass);}
.tab-dot{position:absolute;border-radius:50%;}
.pending-banner{display:flex;gap:10px;align-items:center;width:calc(100% - 28px);max-width:740px;margin:0 auto 8px;padding:4px 12px;min-height:36px;white-space:nowrap;border:1px solid #b69969;border-radius:11px 3px;box-shadow:0 3px 12px #0004;font-size:14px;}
.pending-banner span:nth-child(2){flex:1;min-width:0;text-align:left;overflow:hidden;text-overflow:ellipsis;}
.toast{position:fixed;z-index:40;left:50%;bottom:calc(var(--nav) + var(--safe) + 15px);transform:translateX(-50%);width:max-content;max-width:calc(100% - 32px);padding:14px 17px;border:1px solid #a18c67;border-radius:11px 3px;font-size:15px;line-height:1.45;box-shadow:0 4px 20px #0006;}
#error-panel{min-height:200px;}#error-panel h2{margin-bottom:16px;}
@media(min-width:760px){
  .topbar{padding-left:32px;padding-right:32px;}.phase-line{max-width:780px;margin:auto;}.game-mark{margin-right:auto;}.avatar{margin-left:auto;}
  .board-shell{--board-height:clamp(390px,51dvh,620px);}
  body.game-skin .player{width:112px;}body.game-skin .players .illustrated-token{width:68px;height:68px;}body.game-skin .players .player-label{font-size:14px;max-width:112px;}
  .board-public{width:min(32%,300px);}.board-public[open]{width:460px;}#board-status-title{font-size:27px;}#board-status-summary{font-size:14px;}.action-card>.body-copy{font-size:17px;}
  #chronicle,#reference,#guide{padding-top:38px;}.page-title h2{font-size:42px;}
  .chapter-card{padding:30px 37px;}.story-copy,.story-copy p{font-size:24px;}
}
@media(max-width:370px){
  .topbar{padding-left:13px;padding-right:13px;}.game-mark{width:25px;}.game-mark svg{width:25px;height:25px;}.phase-line .eyebrow{font-size:9px;letter-spacing:1.2px;}.connection{font-size:11px;}.avatar{width:44px;min-height:44px;}
  .board-shell{--board-height:330px;}.board-toolbar>span{font-size:9px;}.board-public{width:41%;}#board-status-title{font-size:21px;}.action-card h2{font-size:26px;}.actions button{padding:12px 11px;}
  #chronicle,#reference,#guide{padding-left:17px;padding-right:17px;}.chapter-card{padding:21px 20px;}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{transition:none!important;animation:none!important;scroll-behavior:auto!important;}}

/* Warm illustrated game furniture. The square remains an unchanged top block. */
:root{--bg:#30201d;--surface:#412b23;--raised:#51362a;--ink:#f7e6c5;--muted:#d0b794;--line:#93734e;--brass:#d6ac61;--selected:#ffdb91;--nav:104px;color-scheme:dark;background:var(--bg);}
body{background:#30201d;}
.app{background:linear-gradient(110deg,#221a18 0%,#38261f 50%,#221a18 100%);}
.topbar{background:#35231deF;border-bottom:2px solid #b98c4e;box-shadow:0 3px 10px #140d0a66;}
.game-mark{color:#e8bd70;}.avatar{background:#513328;border-color:#be965a;color:#f4d08d;}
.phase-line strong{color:#ffe6ae;}
.demo-tools{background:#39261f;border-color:#9a764b;}
.chips button{background:#51362a;color:#f7e6c5;border-color:#ad8751;}
.action-card{margin:0 auto;padding:23px 24px 25px;background:#eaddbc;color:#352419;border:1px solid #9d7548;border-top:3px solid #b88442;border-radius:3px 3px 20px 5px;box-shadow:0 7px 15px #140c0866;}
.action-card::before{content:'';position:absolute;top:0;left:16px;width:7px;height:35px;background:#864333;border-radius:0 0 3px 3px;pointer-events:none;}
.action-meta{padding-left:9px;}.action-meta .eyebrow{color:#704322;}.action-meta .small-label{color:#665039;}
.action-card h2{color:#352419;}.action-card>.body-copy{color:#493725;}.action-card .feedback{color:#37503c;}
.actions button,.primary,.secondary{--button-fill:#67432c;--button-line:#d1a367;color:#fff0d0;min-height:54px;font-family:Witness,Georgia,serif;font-size:20px;}
.actions button::after,.primary::after,.secondary::after{background:linear-gradient(180deg,#ffffff09,#0000001c),var(--button-fill);box-shadow:inset 0 0 0 2px #21150d33;}
.primary,.actions button[data-intent="primary"]{--button-fill:#78432c;--button-line:#e0b477;color:#fff0d0;}
.actions button[data-intent="choice"]{--button-fill:#67432c;--button-line:#d1a367;color:#fff0d0;}
.actions button[data-intent="quiet"]{--button-fill:#514031;--button-line:#ab8c63;color:#f5e3c3;}
.actions button[data-intent="caution"]{--button-fill:#623d61;--button-line:#c9a0c9;color:#ffedf9;}
.actions button[data-intent="danger"]{--button-fill:#803b32;--button-line:#d89a79;color:#fff0d0;}
.actions button[aria-pressed="true"]{--button-fill:#835d30;--button-line:#ffe1a5;color:#fff4dc;}
.private-info,.room-form,.room-menu{color:#eed6af;}
.private-info details,.room-menu{border-color:#99734b;}.private-info summary svg{color:#e2b167;}
.room-form textarea{background:#f0e3c5;color:#352419;border-color:#be955e;}
.room-menu>summary{color:#dab78a;}
#chronicle,#reference,#guide,#error-panel,.profile-panel{margin:20px auto 0;max-width:780px;padding:25px 24px 32px;background:var(--ui-paper);color:var(--ui-paper-ink);border:1px solid var(--ui-paper-border);border-radius:6px 19px 6px 19px;box-shadow:0 7px 22px #120a0755;--ink:#352419;--muted:#6d553d;--line:#b99c70;--brass:#77512c;--selected:#704322;}
.page-title{border-bottom:1px solid #b89b6f;padding-bottom:15px;margin-bottom:22px;}.page-title h2{color:#563323;}
.page-title h2::after{content:'';display:block;width:44px;height:3px;background:#9a5437;margin-top:12px;border-radius:2px;}
.page-title p,.reader-controls label,.not-connected p,.sealed-card p{color:#6d553d;}
.reader-controls{border-color:#b89b6f;}.reader-controls .muted{color:#6d553d;}
.search,select{background:#f6ecd4;color:#352419;border-color:#a78557;box-shadow:inset 0 2px 3px #76533212;}
.chapter-card{background:none;box-shadow:none;padding:0;margin-top:23px;border-radius:0;}.chapter-card::before{display:none;}
.story-copy,.story-copy p{color:#352419;}.event{border-color:#b89b6f;}.events{border-color:#a17243;}
.role-text,.accordion details p,#question-history p{color:#493725;}
.accordion details{border-color:#b89b6f;}.accordion summary{color:#493122;}.accordion summary::after{color:#8a5030;}
.accordion details[open]{background:#f6ecd466;}.accordion details[open]>summary{color:#793f29;}
.subtabs{border-color:#b89b6f;}.subtabs button{color:#715a3e;font-family:Witness,Georgia,serif;font-size:23px;}.subtabs .selected::after{height:3px;background:#9a5437;}
.not-connected{border-color:#b89b6f;}
.card-back-art{background:linear-gradient(135deg,#77472e,#3a261d);border:2px solid #bf9352;box-shadow:5px 5px 0 #513925,5px 5px 0 1px #aa814e;}.card-back-art::before{border-color:#cfab6d;}.card-back-art svg,.card-back-art span{color:#edcb8e;}
.portrait-hide{background:#3b261eeF;border-color:#d1a367;color:#fff0d0;}
.bottom-area{background:linear-gradient(0deg,#281b16 80%,transparent);}
.tabbar{background:linear-gradient(180deg,#523729,#332219);border-top:2px solid #ad8049;box-shadow:0 -3px 10px #100a0644;padding:2px 8px calc(5px + var(--safe));}
.tabbar button{color:#d9bd92;text-shadow:0 1px 2px #130c09;}
.tabbar .nav-icon{display:none;}.nav-object{display:block;width:61px;height:61px;object-fit:contain;filter:drop-shadow(0 3px 2px #130b0866);transition:transform .16s ease;}
.tabbar .active{color:#ffe1a2;}.tabbar .active::before{display:none;}.tabbar .active .nav-object{transform:translateY(-3px);filter:drop-shadow(0 3px 3px #160d08aa) brightness(1.13);}
#host{border-radius:9px 22px 12px 18px;}
#host .muted,#host-unavailable{color:#71583b;}
#host .page-title{padding-bottom:8px;margin-bottom:10px;}#host .page-title h2::after{margin-top:6px;}
#host>p{font-size:14px;line-height:1.45;margin:10px 0;}
#host-voice details{font-size:13px;color:#71583b;margin-top:10px;}#host-voice summary{cursor:pointer;}
#host-submit{width:100%;}

#chronicle-review>p{line-height:1.6;margin:12px 0;}#chronicle-review summary{font-size:17px;}
.debrief .debrief-phase{margin:12px 0;border:1px solid #b89b6f;border-radius:7px 15px 7px 15px;overflow:hidden;}
.debrief .debrief-phase>summary{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:16px 38px 16px 14px;}
.debrief .debrief-phase>summary::after{right:13px;}
.debrief-phase-title{font:600 22px/1.3 Witness,Georgia,serif;}
.debrief-phase-count{font-size:12px;font-weight:500;white-space:nowrap;color:#725337;}
.debrief .debrief-phase[data-period="night"]>summary{background:#57506a16;color:#493850;}
.debrief .debrief-phase[data-period="day"]>summary{background:#b67d3018;color:#694122;}
.debrief-events{list-style:none;counter-reset:debrief-event;margin:0;padding:0 15px 8px;}
.debrief-event{position:relative;counter-increment:debrief-event;padding:16px 0 14px 32px;border-top:1px solid #b89b6f66;}
.debrief-event::before{content:counter(debrief-event);position:absolute;top:17px;left:0;width:23px;height:23px;display:grid;place-items:center;background:#d7bc8b66;border-radius:50%;font:600 12px/1 system-ui;color:#714a2d;}
.debrief-event h4{font:600 16px/1.4 system-ui,sans-serif;color:#75452c;margin:0 0 6px;}
.debrief .debrief-event p{color:#493725;font-size:16px;line-height:1.65;padding:0;margin:0;white-space:pre-line;overflow-wrap:anywhere;}
.debrief-event[data-kind="death"] h4{color:#863f34;}
.role-metadata{display:inline;margin:0;padding:0;border:0;background:none;font:500 15px/1.5 system-ui,sans-serif;color:#624b35;vertical-align:baseline;white-space:normal;overflow-wrap:anywhere;}
.role-metadata[data-alignment="good"]{color:#2c5953;}.role-metadata[data-alignment="evil"]{color:#85382d;}
.role-caption h2{line-height:1.3;overflow-wrap:anywhere;}
#host-conversation{width:100%;margin:8px 0 20px;padding:12px;background:#f5eacf;color:#352419;border:1px solid #ad8652;border-radius:8px;font-size:16px;}
.host-message{padding:14px 16px;margin:12px 0;border-left:3px solid #9d7445;background:#f6ecd4;border-radius:4px 14px 14px 4px;overflow-wrap:anywhere;}
.host-message.host-player{margin-left:22px;background:#deccaa;border-color:#846044;}
.host-message strong{display:block;font-size:14px;color:#795332;}
#question-history{overflow:auto;scrollbar-gutter:stable;}
#host-voice .voice-controls{display:flex;flex-wrap:wrap;gap:8px;}
#host-voice .voice-controls:has(#host-submit){flex-wrap:nowrap;align-items:stretch;gap:10px;}
#host-voice .voice-controls>[data-voice-start],#host-voice .voice-controls>[data-voice-stop]{display:grid;place-items:center;flex:0 0 48px;min-width:48px;width:48px;height:54px;min-height:54px;padding:10px;border:1px solid #ad8451;border-radius:12px;background:#67432c;color:#ffe9bd;}
#host-voice .voice-controls>[data-voice-start]::before,#host-voice .voice-controls>[data-voice-start]::after,#host-voice .voice-controls>[data-voice-stop]::before,#host-voice .voice-controls>[data-voice-stop]::after{display:none;}
#host-voice .voice-controls>[data-voice-stop]{background:#813d32;border-color:#b97055;}
#host-voice .voice-controls>button svg{width:23px;height:23px;stroke-width:1.6;}
#host-voice .voice-controls>[data-voice-stop] svg{fill:currentColor;stroke:none;}
#host-voice .voice-controls>#host-submit{flex:1 1 auto;width:auto;min-width:0;margin:0;}
#host-voice [data-voice-status]{font-size:13px;line-height:1.4;color:#71583b;}
#question-history .host-message p{font-size:17px;line-height:1.6;color:#352419;margin:8px 0 0;}
#host .room-form{margin-top:16px;padding:16px;background:#e4d2af;border:1px solid #b38c56;border-radius:12px;}
#host textarea{min-height:100px;}
#host label,#host .voice-file,#host .voice-file input{color:#503922;}
#tab-host .nav-icon{display:block;width:58px;height:61px;stroke:currentColor;fill:none;background:none;}
#host-unread{position:absolute;top:0;right:0;font:11px/1.2 system-ui,sans-serif;background:#ffe0a1;color:#4a291c;padding:3px 5px;border-radius:5px;}
.tabbar button.has-answer{color:#ffe0a1;}
@media(max-width:420px){.tabbar button{font-size:14px;min-width:0;}.nav-object{width:51px;height:59px;}#host{margin:12px 8px 0;padding:18px 14px;}}
.tab-dot{top:9px;left:calc(50% + 24px);background:#f4ca78;border:1px solid #5a3724;width:8px;height:8px;}
.pending-banner{background:#713c2b;border-color:#dbac68;color:#fff0d0;}.toast{background:#51372a;color:#fff0d0;border-color:#d1a367;}
@media(min-width:760px){.action-card{padding:25px 30px;}.tabbar button{max-width:180px;}#chronicle,#reference,#guide{padding:30px 36px 38px;}}
@media(max-width:370px){.action-card{padding:20px 18px;}.tabbar button{font-size:16px;}.nav-object{width:55px;height:59px;}#chronicle,#reference,#guide{margin:12px 8px 0;padding:22px 18px;}.actions button{font-size:19px;}}
.settings-panel{position:fixed;z-index:32;overflow:auto;background:#eaddbc;color:#352419;border:2px solid #b18a52;border-radius:7px 17px;box-shadow:0 8px 28px #150c0b77;}
.settings-panel label{display:block;margin:18px 0;font-size:16px;line-height:1.5;}.settings-panel .muted{color:#6d553d;font-size:14px;margin-top:16px;}.settings-panel .secondary{width:100%;}
.avatar{font-size:30px;}.wide-action{grid-column:1/-1;}.actions>button:last-child:nth-child(odd){grid-column:1/-1;}
.subtabs{gap:10px;border:0;}.subtabs button{flex:1;border:1px solid #a78557;border-radius:8px 2px;background:#d8c59e;}.subtabs .selected{background:#71432e;color:#fff0d0;border-color:#71432e;}.subtabs .selected::after{display:none;}
.copy-block{margin:0 0 17px;}.copy-block h4{font:600 22px/1.2 Witness,Georgia,serif;color:#75452c;margin:0 0 7px;}.copy-block p{white-space:pre-line;margin:0 0 12px;line-height:1.65;}.accordion .copy-block{padding:0 10px;}.accordion .copy-block p{padding:0;}
#chapter-media{margin:22px 0;}#archive-video{display:block;width:100%;aspect-ratio:4/3;background:#241913;border:1px solid #9d7548;border-radius:8px;}
#archive-page{display:block;width:100%;height:auto;border:1px solid #9d7548;border-radius:4px;}.page-flipper{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:13px 0;}.page-flipper button{background:#67432c;color:#fff0d0;border:1px solid #d1a367;border-radius:8px;width:48px;font-size:24px;}
.story-invitation{display:flex;align-items:center;gap:12px;width:100%;padding:14px 16px;margin:0 0 16px;text-align:left;color:#ffe5ac;background:#483224;border:1px solid #c69e60;border-radius:12px;box-shadow:inset 0 0 22px #d99b2920;}
.story-invitation svg{width:30px;height:30px;fill:none;stroke:currentColor;stroke-width:1.4;flex:none;}.story-invitation span:nth-child(2){flex:1;}.story-invitation strong,.story-invitation small{display:block;}.story-invitation small{font-size:13px;margin-top:4px;color:#ead3b0;}
.tabbar button.story-live{color:#ffe1a1;}.tabbar button.story-live::after{content:'';position:absolute;top:4px;right:23%;width:9px;height:9px;background:#f4c76e;border-radius:50%;box-shadow:0 0 12px #f4c76e;animation:story-glow 2.4s ease-in-out infinite;}
@keyframes story-glow{50%{box-shadow:0 0 18px 4px #f4c76e66;}}
.page-enlarge{display:block;width:100%;padding:0;background:none;cursor:zoom-in;}.archive-hint,#video-mode{font-size:13px;line-height:1.5;color:#dfc7a5;margin:9px 0;}
.archive-pages{position:relative;display:flex;gap:10px;overflow-x:auto;margin:12px 0;padding:4px 3px 10px;scrollbar-color:#c09a60 #30251e;}.archive-pages button{flex:0 0 112px;min-height:44px;padding:0 0 7px;background:#30251e;border:2px solid #8d6d49;border-radius:6px;overflow:hidden;color:#f3dfbf;cursor:pointer;}.archive-pages button.selected{border-color:#ffdb8f;background:#624025;box-shadow:0 0 0 1px #d4a456;}.archive-pages button:focus-visible{outline:2px solid #ffe6b3;outline-offset:2px;}.archive-pages img{width:100%;aspect-ratio:4/3;object-fit:contain;display:block;}.archive-pages span{font-size:13px;display:block;margin-top:5px;}
body.viewing-art{overflow:hidden;}#art-viewer{width:min(1100px,100vw - 16px);height:min(95dvh,1000px);max-height:95dvh;padding:12px;background:#211914;color:#f4e3c5;border:1px solid #b69059;border-radius:12px;}#art-viewer[open]{display:flex;flex-direction:column;gap:8px;}#art-viewer::backdrop{background:#080605e8;}#art-viewer header{display:flex;align-items:center;gap:10px;}#art-title{flex:1;}#art-viewer button{min-width:44px;min-height:44px;border:1px solid #8e6d45;border-radius:6px;background:#483325;color:#ffe5b9;}#art-viewer p{font-size:12px;margin:0;color:#d0bda2;}.art-tools{display:flex;gap:6px;flex-wrap:wrap;}.art-tools #art-reset{flex:1;min-width:100px;}#art-viewport{flex:1;min-height:0;width:100%;overflow:hidden;touch-action:none;cursor:grab;}#art-viewport:active{cursor:grabbing;}#art-image{display:block;object-fit:contain;width:100%;height:100%;transform-origin:center;user-select:none;pointer-events:none;}
@media(prefers-reduced-motion:reduce){.tabbar button.story-live::after{animation:none;}}
.voice-controls{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0;}.voice-controls button{flex:1;min-width:130px;}.voice-file{display:block;width:100%;font-size:14px;text-decoration:underline;}.voice-file input{display:block;max-width:100%;font-size:13px;margin-top:7px;}[data-voice-status]{font-size:14px;line-height:1.45;}#connection{position:sticky;top:0;z-index:35;}
#art-viewer #viewer-turn-notice{flex:none;padding:10px 14px;background:#71422a;border:2px solid #e2b672;font-weight:600;}
.chronicle-sections{display:flex;gap:6px;margin:0 0 20px;position:sticky;top:0;z-index:8;background:#e7d9b6;padding:10px 0;border-bottom:1px solid #a38254;}.chronicle-sections button{padding:10px 7px;border:1px solid #a38254;border-radius:8px;background:#d9c59c;color:#432d1c;font-size:14px;line-height:1.25;}.chronicle-sections button[aria-pressed="true"]{background:#70452e;color:#fff0cc;border-color:#70452e;}
.journal-hint{font-size:14px;line-height:1.45;color:#66513a;margin:12px 0 20px;}.collapse-top{display:block;min-height:44px;margin:0 0 10px;}.events .event{border-bottom:1px solid #a88c6744;margin:0 0 15px;padding:0 0 15px;white-space:pre-line;}
#past-games details{margin:18px 0;border-bottom:1px solid #967047;padding:12px 0;}#past-games summary{cursor:pointer;font-weight:600;line-height:1.5;padding:10px 0;}.past-roles{margin:16px 0;padding:14px;border:1px solid #b99a6b;background:#e0cda4;}.past-roles p{margin:5px 0;}.revealed-role{line-height:1.5;margin:8px 0;}
.app>main{position:relative;z-index:1;}
.mechanism-drawing{position:fixed;z-index:0;left:-135px;top:95px;width:280px;height:550px;fill:none;stroke:#d2a563;stroke-width:1;stroke-linejoin:round;pointer-events:none;opacity:.32;}
.mechanism-drawing[data-side="1"]{left:auto;right:-150px;top:auto;bottom:80px;transform:scaleX(-1);}
.mechanism-guide{stroke:#b8915c;stroke-width:.7;opacity:.55;}.mechanism-wheel{stroke:#d4ac74;stroke-width:1.15;}
.private-info,.room-menu,.room-form{position:relative;background:#30201d;}
@media(min-width:1000px){.mechanism-drawing{left:calc((100vw - 920px)/2 - 235px);opacity:.42;}.mechanism-drawing[data-side="1"]{right:calc((100vw - 920px)/2 - 245px);}}
#mechanism-band{display:block;position:absolute;inset:0;height:auto;overflow:hidden;background:transparent;pointer-events:none;z-index:0;mask-image:linear-gradient(90deg,#000 0%,#0005 24%,#0002 50%,#0005 77%,#000 100%);}
.mechanism-drawing[data-side="2"]{position:absolute;left:50%;top:50%;bottom:auto;right:auto;width:550px;height:130px;transform:translate(-50%,-50%);opacity:.76;stroke-width:1.2;}
@media(max-width:480px){
  .mechanism-drawing{left:-120px;opacity:.48;}.mechanism-drawing[data-side="1"]{right:-130px;}
  #mechanism-band{height:auto;}
}
.topbar{isolation:isolate;overflow:hidden;}.topbar>:not(#mechanism-band){position:relative;z-index:1;}
#tab-host .nav-icon{padding:1px;filter:drop-shadow(0 3px 2px #130b0866);}
.game-mark{width:54px;flex:0 0 54px;}.game-mark svg.live-clock{width:54px;height:54px;fill:none;stroke:#d3aa68;stroke-width:1;}
.live-clock .clock-rim{fill:#4a3022;stroke-width:2;}.live-clock .clock-face{fill:#231b17;stroke:#8b673f;}
.live-clock .clock-numerals{font:9px Georgia,serif;fill:#f2d7a0;stroke:none;text-anchor:middle;}
.live-clock .hour-tick{stroke-width:1.7;}.live-clock .minute-tick{stroke-width:.7;}
#clock-hour{stroke:#ffe1a5;stroke-width:3.6;stroke-linecap:round;}#clock-minute{stroke:#ffe1a5;stroke-width:2.1;stroke-linecap:round;}#clock-second{stroke:#ba6b4c;stroke-width:1;}.live-clock .clock-pin{fill:#d8ad6c;stroke:#694928;}
#chronicle,#reference,#guide,#host{position:relative;isolation:isolate;overflow:clip;}
.panel-mechanism{position:absolute!important;top:60px!important;bottom:auto!important;right:-60px!important;left:auto!important;width:280px;height:550px;opacity:.30!important;stroke:#8c602f;z-index:-1;}
.panel-mechanism .mechanism-wheel,.panel-mechanism .mechanism-guide{stroke:#9b6e37;}
#question-pending{display:flex;align-items:center;gap:12px;padding:14px 12px;border:1px solid #b5905c;border-radius:8px;background:#f6e8c8;}
#question-pending small{display:block;margin-top:5px;color:#72583b;font-size:12px;line-height:1.4;}
.thinking-orbit{display:inline-flex;align-items:center;justify-content:center;gap:4px;flex:none;min-width:36px;height:32px;}
.thinking-orbit i{display:block;width:6px;height:6px;border-radius:50%;background:#88552f;animation:thinking-dot 1.35s ease-in-out infinite;}.thinking-orbit i:nth-child(2){animation-delay:.18s;}.thinking-orbit i:nth-child(3){animation-delay:.36s;}
@keyframes thinking-dot{0%,70%,100%{transform:translateY(0);opacity:.4;}35%{transform:translateY(-6px);opacity:1;}}
@media(max-width:370px){.topbar{gap:9px;}.game-mark,.game-mark svg.live-clock{width:48px;height:48px;}.game-mark{flex-basis:48px;}.phase-line strong{font-size:22px;}}
@media(prefers-reduced-motion:reduce){#clock-second{display:none;}.thinking-orbit i{animation:none;opacity:1;}}
@media(prefers-reduced-motion:reduce){.mechanism-wheel{animation:none;}}
body:has(#motion-off:checked) .mechanism-wheel{animation:none;}
.at-entrance .board-shell,.at-entrance .private-info{display:none;}
.at-entrance #game{padding:40px 14px 24px;}
.at-entrance .action-card{max-width:560px;margin:0 auto;border-radius:7px 21px 7px 21px;padding:30px 27px;}
.at-entrance .action-card h2{font-size:36px;}.at-entrance .room-form{max-width:560px;margin:18px auto;background:#eaddbc;color:#352419;border:1px solid #b18a52;border-radius:7px 17px;padding:23px;}
.at-entrance .room-form textarea{display:block;resize:vertical;}.at-entrance .actions{grid-template-columns:1fr;gap:14px;}
.board-public:not([open]){width:29%;max-width:200px;max-height:30%;overflow:hidden;background:#251c16e8;border-color:#ae8c57;}
.board-public:not([open])>summary{min-height:44px;padding:8px 6px;gap:4px;}
.board-public:not([open]) #board-status-title{font-size:clamp(14px,3.8vw,18px);display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;}
.board-public:not([open]) #board-status-summary{font-size:10px;line-height:1.3;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;}
.board-public:not([open]) .board-more{font-size:9px;margin:0;}
.board-shell.information-mode .board-public[open]{left:12px;right:12px;top:56px;bottom:12px;transform:none;width:auto;max-width:none;max-height:none;overflow:auto;background:#281d16dd;border-color:#bc965e;border-radius:12px 3px;scrollbar-color:#b19060 #281d16;}
.information-mode .board-public>summary{padding:12px 16px;cursor:default;gap:5px;}
.information-mode .board-more{display:none;}.information-mode #board-status-title{font-size:25px;}.information-mode #board-status-summary{font-size:15px;}
.information-mode .board-status{padding:3px 17px 18px;font-size:17px;}.information-mode .board-status h2{font-size:25px;}.information-mode .board-status p{font-size:16px;line-height:1.5;}.information-mode .night-readiness>div{font-size:15px;padding:10px 0;}
.demo-tools{position:relative;z-index:24;max-height:75dvh;overflow:auto;}.inspection-picker{margin-top:18px;border-top:1px solid #987346;padding-top:16px;}.inspection-picker label{display:block;margin:8px 0;font-size:15px;}.inspection-picker a{color:#ffe1a2;font-size:15px;}
.rules-resources{margin-bottom:23px;border-bottom:1px solid #b89b6f;padding-bottom:18px;}.rules-resources>a{display:inline-block;color:#75452c;font-size:17px;padding:12px 0;}.rules-resources>details>summary{cursor:pointer;padding:14px 0;color:#75452c;font-size:18px;}

/* Unread personal information: steady text, conspicuous slow amber pulse. */
.private-info details.has-private-information>summary{border-radius:10px;color:#fff0cc;background:#63401f;box-shadow:inset 0 0 0 2px #f3c56b,0 0 18px #d7913a66;animation:private-information-pulse 1.6s ease-in-out infinite;}
.private-info details.has-private-information .private-privacy{display:none;}
.private-info summary .private-unread-label{margin-left:auto;padding:4px 8px;border-radius:12px;background:#f8d78d;color:#382015;font-size:12px;font-weight:800;}
.tabbar button.private-unread{box-shadow:inset 0 0 0 2px #f3c56b,0 0 18px #d7913a66;animation:private-information-pulse 1.6s ease-in-out infinite;}
.private-information-dot{position:absolute;top:9px;left:calc(50% - 32px);width:10px;height:10px;border-radius:50%;background:#ffdb86;border:2px solid #67401e;}
@keyframes private-information-pulse{0%,100%{box-shadow:inset 0 0 0 2px #e4ac53,0 0 5px #d7913a44;background-color:#51351f;}50%{box-shadow:inset 0 0 0 2px #ffe4a2,0 0 24px #ffc15b99;background-color:#795026;}}
body:has(#motion-off:checked) .has-private-information>summary,body:has(#motion-off:checked) .tabbar button.private-unread{animation:none;}
.base-composition{margin:8px 0 12px;padding:9px 11px;background:rgb(40 29 23 / 42%);border:1px solid #b58b4c55;border-radius:10px 3px;color:#f4e3c5;}
.base-composition h3{margin:0 0 5px;font:600 16px/1.2 Witness,Georgia,serif;color:#ffe0a4;}
.composition-counts{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px;margin:0;}
.composition-counts div{min-width:0;text-align:center;border-top:1px solid #82b5a4;padding:4px 0 1px;}
.composition-counts div[data-team=evil]{border-color:#d99383;}
.composition-counts dt{font-size:12px;line-height:1.35;overflow-wrap:anywhere;color:#f4e3c5;}
.composition-counts dd{font:600 22px/1.15 Witness,Georgia,serif;margin:1px 0 0;color:#ffe0a4;}
.base-composition>p{margin:5px 0 0;font-size:12px;line-height:1.4;color:#ead3b0;}
.reader-follow-control{position:sticky;top:12px;z-index:3;display:flex;justify-content:flex-end;pointer-events:none;margin:0 0 12px;}
.reader-follow-control button{pointer-events:auto;min-height:44px;padding:8px 13px;border:1px solid #967446;border-radius:16px 5px;background:#f1e3c5;color:#493122;box-shadow:0 2px 7px #2d1e1933;font:600 13px/1.35 system-ui,sans-serif;}
.reader-follow-control button[aria-pressed=false]{background:#67432c;color:#fff0d0;border-color:#bd9860;}
.settings-panel{padding-top:26px;}.settings-panel h3{padding-right:38px;}
.settings-panel .settings-close{position:absolute;top:5px;right:5px;display:grid;place-items:center;width:44px;min-width:44px;height:44px;min-height:44px;padding:0;border:0;border-radius:50%;background:transparent;color:#593a27;font:30px/1 system-ui,sans-serif;}
body.game-skin .players .token-interactive{cursor:pointer;pointer-events:auto;}.players .token-interactive:focus-visible{outline:2px solid #ffdc8f;outline-offset:3px;border-radius:12px;}
.token-dialog{position:fixed;width:min(420px,calc(100vw - 32px));max-height:calc(100dvh - 40px);padding:28px 22px;color:#352419;border:1px solid #b18a52;border-radius:7px 20px;box-shadow:0 10px 50px #0008;}
.token-dialog::backdrop{background:#100b08bb;}.token-dialog h2{padding-right:30px;margin:0 0 22px;font:600 28px/1.2 Witness,Georgia,serif;overflow-wrap:anywhere;}
.token-dialog>button:not(.dialog-close){display:block;width:100%;min-height:48px;margin:12px 0;white-space:normal;}
.token-dialog>p{font:16px/1.6 system-ui,sans-serif;overflow-wrap:anywhere;}
.token-dialog .dialog-close{position:absolute;top:5px;right:5px;width:44px;height:44px;padding:0;border:0;background:transparent;color:#593a27;font-size:30px;}
#talk-notice{width:100%;height:100dvh;max-width:none;max-height:none;margin:0;border-radius:0;padding:calc(env(safe-area-inset-top,0px) + 28px) 24px calc(env(safe-area-inset-bottom,0px) + 28px);}
#talk-notice[open]{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:16px;}
#talk-notice h2,#talk-notice p,#talk-notice button{width:min(100%,480px);padding-right:0;}
#talk-notice p{font:500 25px/1.5 Witness,Georgia,serif;}
/* Mandatory decision limit; driven by persisted server deadlines. */
/* Personal achievements, intentionally separate from live role information. */
.chronicle-sections{flex-wrap:wrap}.chronicle-sections button{flex:1 1 95px}
.achievement-page-heading{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:15px}.achievement-page-heading .eyebrow{color:#755130}.achievement-summary{font-size:17px;color:#63462f}.achievement-filters{display:flex;gap:7px;flex-wrap:wrap;margin:18px 0}.achievement-filters button{min-height:42px;padding:9px 15px;border:1px solid #9d7a4c;color:#553a24;background:#e4d2ab}.achievement-filters button[aria-pressed=true]{background:#70452e;color:#fff0cc}.achievement-list{display:grid;gap:12px;margin-bottom:20px}.achievement-card{display:flex;gap:14px;padding:17px 14px;background:#e9dbbd;border:1px solid #a98b60;border-radius:14px 5px;box-shadow:0 3px 9px #5e3c1810;color:#493421}.achievement-card.is-unlocked{background:linear-gradient(125deg,#faedc9,#ead5a9);border-color:#9a702e}.achievement-medallion{flex:0 0 48px;width:48px;height:52px;display:grid;place-items:center;border:1px solid #b1a087;border-radius:50% 50% 42% 42%;color:#897a64;background:#d5c7ac}.achievement-medallion svg{width:28px;height:28px}.is-unlocked .achievement-medallion{color:#78501c;border-color:#a77a30;background:linear-gradient(135deg,#f7e5a8,#d5ac56);box-shadow:inset 0 0 0 3px #fff5d344}.achievement-content{flex:1;min-width:0}.achievement-category{font-size:11px;letter-spacing:.7px;text-transform:uppercase;color:#795f40}.achievement-heading{display:flex;align-items:baseline;gap:8px;justify-content:space-between;margin:3px 0 7px}.achievement-heading h4{font:600 19px/1.3 Witness,Georgia,serif;margin:0;color:#432c19}.achievement-state{font-size:12px;color:#715531;white-space:nowrap}.is-unlocked .achievement-state{color:#5b602f}.achievement-description{font-size:14px;line-height:1.5;margin:0 0 10px;color:#5b4734}.achievement-content progress{display:block;width:100%;height:6px;border:0;border-radius:4px;overflow:hidden;accent-color:#9c742e;background:#ccb995}.achievement-content progress::-webkit-progress-bar{background:#ccb995}.achievement-content progress::-webkit-progress-value{background:#997331}.achievement-footnote{font-size:12px!important;line-height:1.55!important;color:#78644b!important;margin-top:12px!important}.achievement-collection{font-size:13px;margin-top:12px;background:transparent;border:0;padding:0}.achievement-collection summary{color:#654726;padding:5px 0}.achievement-collection ul{list-style:none;padding:4px 0;margin:0;display:grid;gap:5px}.achievement-collection li{color:#877b68}.achievement-collection li.collected{color:#4c5a2c}.achievement-empty{padding:20px 0;color:#6f573d}.achievement-notice{position:fixed;z-index:45;right:max(12px,env(safe-area-inset-right));bottom:calc(var(--nav) + var(--safe) + 18px);display:flex;align-items:center;gap:12px;width:350px;max-width:calc(100vw - 24px);padding:16px;background:#25241f;color:#f8e9c6;border:1px solid #c5a260;border-radius:14px;box-shadow:0 10px 35px #0007;animation:achievement-arrival .3s ease-out}.achievement-notice[hidden]{display:none}.achievement-notice-icon{display:grid;place-items:center;flex:0 0 38px;color:#e1bd6d}.achievement-notice-icon svg{width:32px;height:32px}.achievement-notice-label{display:block;font-size:11px;color:#cfb57d;margin-bottom:4px}.achievement-notice strong{display:block;font-size:17px;line-height:1.35}.achievement-notice-open{font-size:12px;padding:4px 0;border:0;background:transparent;color:#e8c888;min-height:30px}.achievement-notice-close{margin-left:auto;align-self:flex-start;min-height:34px;font-size:11px;background:transparent;border:0;color:#c6bba5;padding:4px}.achievement-notice>div{min-width:0}@keyframes achievement-arrival{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
@media(min-width:700px){.achievement-list{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:360px){.achievement-card{gap:9px;padding:14px 10px}.achievement-medallion{flex-basis:38px;width:38px;height:44px}.achievement-heading{align-items:flex-start;flex-direction:column;gap:3px}}

.achievement-category-filter{display:flex;align-items:center;gap:10px;margin:0 0 18px;color:#6d5033;font-size:13px}.achievement-category-filter select{flex:1;min-width:0;min-height:42px;padding:8px 12px;background:#e8d8b6;color:#4e3520;border:1px solid #a88a5a;border-radius:6px}

.tableau .city-background{position:absolute;inset:0;width:100%;height:100%;z-index:0;pointer-events:none}.tableau.has-city-background{background-image:none!important}.tableau.has-city-background .tableau-shade,.tableau.has-city-background .board-ring{display:none}.tableau.has-city-background .players,.tableau.has-city-background .board-center{z-index:2}.city-label{padding:8px 18px;margin:0;color:#634629;background:#e6d5b0;font-size:14px}.city-scene-copy{padding:14px 18px;margin:0;background:#e7d8b9;color:#493421;font:17px/1.5 Witness,Georgia,serif;border-top:1px solid #aa8a54}#media-recovery{padding:10px 16px;background:#e2cfaa;display:flex;flex-wrap:wrap;gap:8px}#media-recovery[hidden]{display:none}#media-recovery button{font-size:13px;min-height:40px}#media-recovery-note{font-size:12px;color:#674b31;margin:0;width:100%}

.profile-panel {
  width: calc(100% - 24px);
  max-width: 36rem;
  margin-inline: auto;
}
.profile-panel .room-form, #reference .private-info {
  padding-inline: 0;
  background: transparent;
  color: var(--ui-paper-ink);
}
.profile-panel .text-button { color: var(--ui-paper-ink); }
#chronicle .panel-mechanism { display: none; }
#reference .private-info { margin-top: 16px; }
.profile-panel [hidden] {
  display: none;
}

/* The profile uses separate paper surfaces over the shared town shell. */
#profile {
  padding: 0;
  margin-top: 12px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #f7e6c5;
}
#profile > .page-title {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
}
#profile-home { display: grid; gap: 12px; }
.profile-paper, #profile-role-panel {
  border: 1px solid #bb945b;
  border-radius: 5px 14px;
  background: linear-gradient(120deg, #f5e8cb, var(--ui-paper) 60%, #f2e1bb);
  color: var(--ui-paper-ink);
  box-shadow: inset 0 0 0 2px #fff3d3, inset 0 0 0 3px #bc945f85, 0 3px 7px #150e0a80;
}
.profile-identity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(10px, 4vw, 19px);
  min-height: 104px;
}
.profile-name-line { display: flex; align-items: center; gap: 4px; }
.profile-identity h3 { min-width: 0; overflow-wrap: anywhere; font-size: clamp(29px, 9vw, 42px); }
.profile-avatar, .profile-edit { display: grid; place-items: center; }
.profile-avatar {
  width: clamp(66px, 21vw, 94px);
  aspect-ratio: 1;
  border-radius: 50%;
  color: #f5d99e;
}
.profile-avatar svg { fill: currentColor; stroke: none; }
.profile-edit { min-height: 44px; color: #563323; }
.profile-edit svg { width: 19px; height: 19px; }
#profile-since { margin: 0; color: #664e32; font: italic 600 19px/1.15 Witness, Georgia, serif; }
.profile-card {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 11px 14px;
  text-align: start;
}
.profile-card:active { transform: translateY(1px); }
.profile-card-copy { display: grid; flex: 1; min-width: 0; gap: 2px; }
.profile-card-title { font: 700 23px/1.1 Witness, Georgia, serif; }
.profile-card-subtitle { color: #634e33; font: italic 600 17px/1.15 Witness, Georgia, serif; }
.profile-chevron { flex: none; color: #5e3b24; font: 23px/1 system-ui, sans-serif; }
.profile-art { width: clamp(30px, 10vw, 48px); aspect-ratio: 1; object-fit: contain; }
.profile-history-art { width: clamp(52px, 17vw, 79px); }
#profile-stats { font: 700 34px/1.08 Witness, Georgia, serif; }
.profile-results { display: flex; flex-wrap: wrap; gap: 4px 11px; font-size: 13px; font-weight: 650; }
.profile-win { color: #32533a; }
.profile-loss { color: #783832; }
.profile-result-bar { display: block; height: 4px; margin-top: 4px; overflow: hidden; border-radius: 3px; background: #9e554b; }
.profile-result-bar > span { display: block; height: 100%; background: #50764f; }
.profile-collections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.profile-collections .profile-card { min-height: 68px; font-size: 14px; }
.profile-collections .profile-card-title { font-size: 20px; }
#profile-analytics { min-height: 66px; }
.profile-actions { display: grid; gap: 10px; margin: 0 7px; }
.profile-actions:has(#profile-join[hidden]):has(#profile-create[hidden]) { display: none; }
#profile-home .primary { font-size: 26px; }
#profile-create { width: 82%; justify-self: center; --button-fill: #4d3529; }
#profile-registration:empty, #profile-feedback:empty, #profile-name-feedback:empty { display: none; }
#profile-role-panel, .profile-analytics-panel { padding: 16px; }
.profile-analytics-panel h4 { margin-bottom: 5px; }
.profile-analytics-panel ul { padding-inline-start: 20px; }
.profile-recent-results { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
.profile-recent-results li { padding: 4px 7px; border: 1px solid currentColor; border-radius: 4px; }
#profile #profile-stats-retry { color: inherit; }
.tabbar:has(#tab-profile:not([hidden])) .active {
  border-radius: 7px 14px;
  background: #79533860;
  box-shadow: inset 0 0 0 1px #ae805a80;
}
@media (max-width: 359px) {
  .profile-collections .profile-card { gap: 4px; padding-inline: 9px; }
  .profile-collections .profile-card-title { font-size: 18px; }
  .profile-card { padding-inline: 11px; }
  #profile-stats { font-size: 31px; }
}
#profile-name-dialog {
  box-sizing: border-box;
  width: min(420px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 20px;
  border: 1px solid var(--ui-paper-border);
  border-radius: 6px 19px;
  background: var(--ui-paper);
  color: var(--ui-paper-ink);
}
#profile-name-dialog::backdrop { background: #221713b8; }
#profile-name-dialog h3 { margin-bottom: 12px; }
#profile-role-list { padding-inline-start: 24px; }
#profile-role-list li { padding-block: 7px; }
@media (max-width: 360px) {
  .profile-panel { padding-inline: 15px; }
}
/* Shared shell measurements include the safe area and any pending-action banner. */
:root {
  --ui-header-height: 86px;
  --ui-bottom-height: calc(var(--nav) + var(--safe));
  --ui-paper: #eaddbc;
  --ui-paper-ink: #352419;
  --ui-paper-border: #b18a52;
  --ui-focus: var(--selected);
  --ui-touch: 48px;
}
main { padding-bottom: calc(var(--ui-bottom-height) + 24px); }
.connection-error { top: var(--ui-header-height); }
.settings-panel {
  top: var(--ui-header-height);
}
#settings-profile, .tabbar button { min-height: var(--ui-touch); }
.tabbar button { min-width: 0; padding-inline: 0; }
.tabbar button:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: -4px; }
#tab-profile .nav-icon {
  display: block;
  width: 61px;
  height: 61px;
  background: none;
}
.game-phase {
  margin: 12px 14px 8px;
  color: var(--ink);
}
.journal-group { margin-block: 12px; }
.journal-group h3 { margin-bottom: 6px; }
@media (max-width: 370px) {
  .tabbar button { font-size: 13px; }
  .tabbar .nav-object, #tab-host .nav-icon, #tab-profile .nav-icon { width: 46px; }
}
/* Registration is a standalone form on the app background. */
.profile-panel:has(#profile-registration > form:not([hidden])) {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ui-paper-ink);
}
.profile-panel:has(#profile-registration > form:not([hidden])) .page-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
#profile-registration > form:not([hidden]) {
  padding: 20px;
  background: var(--ui-paper);
  border: 1px solid var(--ui-paper-border);
  border-radius: 6px 19px;
}
#profile-registration label {
  font: 700 30px/1.15 Witness, Georgia, serif;
}
#profile-name-hint, #profile-code-hint { font-size: 14px; }
#profile-registration #profile-name-submit { width: 100%; }
#profile-join-form:not([hidden]) {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--ui-paper-border);
  border-radius: 6px 19px;
  background: var(--ui-paper);
}
.profile-panel:has(#profile-registration > form:not([hidden])) #profile-feedback {
  margin-top: 12px;
  padding: 12px;
  background: var(--ui-paper);
  border-radius: 6px;
}
#profile-join-form:not([hidden]) { color: var(--ui-paper-ink); }
.phase-line { container-type:inline-size; }
.topbar .phase-line strong { font-size:clamp(16px, 14.2cqi, 25px); }
.phase-line strong span { display:block; white-space:nowrap; }
#startup-panel {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 60px 16px;
  color: #f2d6a1;
  font: 600 24px/1.2 Witness, Georgia, serif;
}
#startup-panel svg { width: 38px; height: 38px; color: #bd9157; }
#startup-panel p { margin: 0; }
/* Fine paper grain is generated once at a fixed scale and repeated. */
#profile {
  --profile-grain: url("/materials/profile-art-v1/grain.png");
  --profile-cut: 9px;
}
#profile .profile-paper { position: relative; }
.profile-paper {
  isolation: isolate;
  border: 1px solid #aa8050;
  border-radius: 0;
  background: #f1dfb7;
  background-image: var(--profile-grain), radial-gradient(ellipse at 47% 30%, #f8edcf 18%, #ecdaaf 84%);
  background-size: 144px 144px, auto;
  background-blend-mode: multiply, normal;
  clip-path: polygon(var(--profile-cut) 0,calc(100% - var(--profile-cut)) 0,100% var(--profile-cut),100% calc(100% - var(--profile-cut)),calc(100% - var(--profile-cut)) 100%,var(--profile-cut) 100%,0 calc(100% - var(--profile-cut)),0 var(--profile-cut));
  box-shadow: inset 0 0 0 1px #6c4829, inset 0 0 0 3px #d3ae72, inset 0 0 0 4px #fbebc4, inset 0 0 16px #95653245;
}
.profile-paper::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 1px;
  background:
    linear-gradient(135deg, transparent 6px, #8a623c 6px 7px, #ddba81 7px 9px, transparent 9px) top left,
    linear-gradient(225deg, transparent 6px, #8a623c 6px 7px, #ddba81 7px 9px, transparent 9px) top right,
    linear-gradient(315deg, transparent 6px, #8a623c 6px 7px, #ddba81 7px 9px, transparent 9px) bottom right,
    linear-gradient(45deg, transparent 6px, #8a623c 6px 7px, #ddba81 7px 9px, transparent 9px) bottom left;
  background-size: 15px 15px;
  background-repeat: no-repeat;
  pointer-events: none;
}
.profile-paper:focus-visible { outline-offset: -7px; }
.profile-identity { padding: 10px 14px; }
.profile-avatar {
  border: 0;
  background: none;
  box-shadow: none;
  filter: drop-shadow(0 2px 2px #472c2460);
}
.profile-avatar svg { width: 100%; height: 100%; fill: none; stroke: currentColor; }
.profile-person { min-width: 0; }
.profile-person::after {
  content: '';
  display: block;
  height: 5px;
  margin-top: 8px;
  background: radial-gradient(circle, #967043 0 2px, transparent 2.5px) center / 100% 100%,
    linear-gradient(90deg, transparent, #98744f 46%, transparent 46% 54%, #98744f 54%, transparent) center / 100% 1px no-repeat;
  max-width: 245px;
}
.profile-edit {
  flex: 0 0 44px;
  border-radius: 6px;
  background: radial-gradient(ellipse, #b98d4c45 38%, transparent 70%);
}
.profile-card .profile-art {
  flex: 0 0 auto;
  height: auto;
  filter: drop-shadow(0 2px 2px #3b211e55);
}
.profile-statistics-art { width: clamp(38px, 14vw, 66px); }
.profile-collections #profile-achievements { gap: 5px; }
#profile-achievements .profile-card-title { font-size: clamp(15px, 4.45vw, 21px); }
.profile-collections .profile-art { width: clamp(22px, 8vw, 42px); }
#tab-profile .nav-icon { padding: 5px; }
#profile-join {
  isolation: isolate;
  overflow: hidden;
  min-height: 61px;
  --button-fill: #743e27;
  --button-line: #e8ba74;
  letter-spacing: .15px;
}
#profile-join::after {
  background: radial-gradient(ellipse at 50% 24%, #a6613c 0%, #743e27 55%, #47271e 100%);
  box-shadow: inset 0 0 0 2px #59341f, inset 0 0 0 3px #bc8c56;
}
.profile-cta-copy { position: relative; z-index: 1; text-shadow: 0 2px 3px #432317; }
.profile-cta-gear {
  position: absolute;
  top: 50%;
  width: 66px;
  height: 66px;
  color: #e9b675;
  pointer-events: none;
  stroke-width: .65;
}
.profile-cta-gear-left { left: -14px; transform: translateY(-50%); }
.profile-cta-gear-right { right: -14px; transform: translateY(-50%); }
@media (max-width: 359px) {
  .profile-collections #profile-achievements { padding-inline: 7px; }
  #profile-achievements .profile-chevron { font-size: 19px; }
}
#startup-panel img { width: 34px; height: 34px; object-fit: contain; }
.profile-avatar img { display: block; width: 100%; height: 100%; object-fit: contain; }
.profile-cta-gear { opacity: .72; }
/* Compact text scale and controls shared by all Mini App screens. */
:root {
  --ui-serif: Witness, Georgia, serif;
  --ui-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ui-caption: 13px;
  --ui-body: 16px;
  --ui-subtitle: 22px;
  --ui-title: clamp(27px, 7vw, 34px);
  --ui-control: 48px;
  --ui-feature-control: 56px;
  --ui-gap: 12px;
}
body, button, input, textarea, select { font-family: var(--ui-sans); }
.page-title h2, #host .page-title h2, .game-phase, #action-title,
#profile-registration label, #error-panel h2 {
  font: 700 var(--ui-title)/1.15 var(--ui-serif);
}
.profile-card-title, .profile-collections .profile-card-title,
#profile-achievements .profile-card-title, .action-card h3, .section-heading h3,
#profile-role-title, #profile-analytics-title, .settings-panel h3 {
  font: 700 var(--ui-subtitle)/1.15 var(--ui-serif);
}
.profile-card-subtitle, #profile-since, .body-copy,
.room-form label, .settings-panel label, .accordion summary {
  font: 400 var(--ui-body)/1.45 var(--ui-sans);
}
.small-label, .muted, .profile-results, .journal-hint, .feedback,
#profile-name-hint, #profile-code-hint, .profile-collections .profile-card-copy > span:last-child {
  font-size: var(--ui-caption);
  line-height: 1.45;
}
.primary, .secondary, .actions button, #profile-home .primary,
.subtabs button, .chronicle-sections button, .reader-buttons button,
#profile-name-dialog button {
  min-height: var(--ui-control);
  padding-block: 9px;
  font: 600 var(--ui-body)/1.3 var(--ui-sans);
}
#profile-home .primary, #profile-registration #profile-name-submit {
  min-height: var(--ui-feature-control);
  font: 700 var(--ui-subtitle)/1.15 var(--ui-serif);
}
#profile-home, .profile-collections, .profile-actions, .actions,
.subtabs, .reader-buttons { gap: var(--ui-gap); }
.profile-collections .profile-card, #profile-analytics { min-height: 66px; }
input:not([type=checkbox]):not([type=file]), select, textarea {
  font-size: var(--ui-body);
  line-height: 1.35;
}
.tabbar button {
  height: 82px;
  gap: 3px;
  font: 600 var(--ui-caption)/1.15 var(--ui-sans);
}
.tabbar .nav-object { width: 49px; height: 49px; }
.tabbar .active {
  border-radius: 7px 14px;
  background: #79533860;
  box-shadow: inset 0 0 0 1px #ae805a80;
}
@media (max-width: 420px) {
  .profile-collections .profile-card-title, #profile-achievements .profile-card-title { font-size: 18px; }
}
@media (max-width: 359px) {
  .tabbar .nav-object { width: 43px; height: 43px; }
  #profile-achievements .profile-card-title { font-size: 15px; }
}
.settings-panel {
  --profile-grain: url("/materials/profile-art-v1/grain.png");
  --profile-cut: 9px;
  --settings-left: max(12px, env(safe-area-inset-left, 0px));
  --settings-right: max(12px, env(safe-area-inset-right, 0px));
  right: var(--settings-right);
  padding: 16px 16px 14px;
  margin-top: 6px;
  width: min(340px, calc(100% - var(--settings-left) - var(--settings-right)));
  max-height: min(70dvh, calc(100dvh - var(--ui-header-height) - var(--safe) - 12px));
  overscroll-behavior: contain;
}
.settings-panel h3 { margin: 0 0 12px; padding: 5px 44px 0 0; }
.settings-group { border-top: 1px solid #b18a5299; padding: 10px 0 4px; }
.settings-group + .settings-group { margin-top: 8px; }
.settings-group h4 { margin: 0 0 7px; color: #66492f; font: 700 15px/1.3 var(--ui-sans); }
.settings-panel .settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  margin: 0;
  cursor: pointer;
}
.settings-toggle strong { display: block; font-weight: 650; }
.settings-toggle small { display: block; color: #6d553d; font-size: var(--ui-caption); }
.settings-toggle input { flex: none; width: 20px; height: 20px; accent-color: #78432c; }
#settings-room > button { width: 100%; margin-block: 4px; }
#settings-panel .actions:empty { display: none; }
#settings-panel .muted { margin: 6px 0; }
#settings-replacement summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  font: 650 var(--ui-body)/1.3 var(--ui-sans);
  list-style: none;
  cursor: pointer;
}
#settings-replacement summary::-webkit-details-marker { display: none; }
#settings-replacement summary::after { content: '›'; font-size: 23px; color: #785132; }
#settings-replacement[open] summary::after { transform: rotate(90deg); }
#replacement-form label { margin: 0 0 6px; color: #6d553d; font-size: var(--ui-caption); }
#replacement-form button { width: 100%; margin-top: 8px; }
#replacement-feedback { margin: 6px 0 0; color: #813b31; }
#chronicle.history-screen {
  --profile-grain: url("/materials/profile-art-v1/grain.png");
  --profile-cut: 9px;
  max-width: 576px;
  width: calc(100% - 24px);
  margin: 12px auto 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #f7e6c5;
  overflow: visible;
}
.history-screen > .page-title { border: 0; margin-bottom: 12px; padding: 0; }
.history-screen .page-title h2, .history-screen #chronicle-back { color: #f7e6c5; }
.history-screen .page-title h2::after { background: #c49a55; }
#chronicle-back { min-height: 44px; }
.history-summary { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px; padding: 12px 16px; min-height: 96px; }
.history-summary img { width: clamp(52px, 17vw, 80px); aspect-ratio: 1; object-fit: contain; }
#history-total { display: block; font: 700 clamp(29px, 8vw, 38px)/1.15 var(--ui-serif); }
#history-ratio { height: 5px; margin-top: 8px; background: #b69b7360; }
#history-ratio.history-ratio-filled { background: #9e554b; }
.history-filters, .history-detail-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 12px 0; }
.history-filters button, .history-detail-tabs button { padding: 5px; }
.history-filters button[aria-pressed=true], .history-detail-tabs button[aria-pressed=true] { --button-fill: #875635; --button-line: #f0c682; }
#history-status { color: #e5cca0; font-size: 13px; text-align: center; margin: 6px 0; }
#history-status:empty { display: none; }
.history-games { display: grid; gap: 12px; margin-block: 12px; }
.history-row { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto; align-items: center; gap: 8px; text-align: start; padding: 10px 12px; min-height: 96px; }
.history-medal { width: clamp(43px, 14vw, 66px); height: auto; aspect-ratio: 1; object-fit: contain; }
.history-row-result, .history-row-role { display: grid; gap: 3px; font-size: 14px; overflow-wrap: anywhere; }
.history-row-role { border-left: 1px solid #b18a5277; padding-left: 8px; }
.history-row-result small { font-size: 11px; color: #694e36; }
.history-date { font: italic 700 18px/1.15 var(--ui-serif); }
.history-row:active { transform: translateY(1px); }
#history-detail { padding: 12px; }
.history-detail-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 0; }
#history-detail-content p { margin-bottom: 7px; }
#history-more, #history-refresh { width: 100%; margin-top: 5px; }
@media(max-width: 359px) {
  .history-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 8px; }
  .history-medal { grid-row: span 2; }
  .history-row-role { grid-column: 2; grid-row: 2; border: 0; padding-left: 0; }
  .history-row > .profile-chevron { grid-column: 3; grid-row: 1 / span 2; }
}
.history-screen .profile-paper { position: relative; }
.profile-played-role { display: flex; align-items: center; gap: 8px; }
.profile-played-role .history-medal { width: 44px; }
.history-legacy .history-summary, .history-legacy .history-filters { display: none; }
.settings-link {
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: var(--ui-control);
  padding: 5px 7px;
  text-align: start;
  font: 650 var(--ui-body)/1.3 var(--ui-sans);
  color: var(--ui-paper-ink);
}
.settings-link + .settings-link { border-top: 1px solid #b18a5255; }
.settings-link img { width: 27px; height: 27px; object-fit: contain; }
.settings-link span:last-child { color: #785132; font-size: 22px; }
.settings-link:hover { background: #d6ac611c; }
.settings-dialog {
  position: fixed;
  width: min(420px, calc(100% - 24px));
  max-height: calc(100dvh - max(24px, env(safe-area-inset-top, 0px)) - env(safe-area-inset-bottom, 0px));
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px;
  border: 1px solid var(--ui-paper-border);
  border-radius: 6px 19px;
  background: var(--ui-paper);
  color: var(--ui-paper-ink);
  --profile-cut: 8px;
  --profile-grain: url("/materials/profile-art-v1/grain.png");
  --selected: #704322;
}
.settings-dialog::backdrop { background: #221713b8; }
.settings-dialog h3 { margin-bottom: 10px; font: 700 var(--ui-title)/1.12 var(--ui-serif); }
.settings-avatar-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #b18a5288;
}
.settings-avatar-preview img { width: 38px; height: 38px; object-fit: contain; }
.settings-avatar-preview small { margin-left: auto; color: #6d553d; }
.settings-dialog fieldset { min-width: 0; margin: 0 0 8px; padding: 4px 10px; border: 1px solid #b18a5288; }
.settings-dialog legend { font-weight: 650; }
.settings-dialog fieldset label { display: flex; align-items: center; gap: 7px; min-height: 44px; }
.settings-dialog input[type=radio] { flex: 0 0 auto; width: 18px; height: 18px; accent-color: #78432c; }
.settings-dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#preferences-feedback:empty { display: none; }
#preferences-feedback { margin: 5px 0; color: #783832; }
.history-filters button, .history-detail-tabs button { font-size: var(--ui-body); }
@media (max-width: 359px) { .history-filters button, .history-detail-tabs button { font-size: 14px; } }
.match-report-phase { margin-top: 20px; padding-top: 16px; border-top: 1px solid #b18a5288; }
.match-report-phase h3 { margin-bottom: 12px; font: 700 var(--ui-subtitle)/1.2 var(--ui-serif); }
.match-report-phase h4 { margin: 14px 0 6px; font: 650 var(--ui-body)/1.35 var(--ui-sans); }
.match-report-phase ul { padding-left: 20px; margin: 0; }
.match-report-phase li { margin-bottom: 8px; overflow-wrap: anywhere; font: 400 var(--ui-body)/1.5 var(--ui-sans); }
.match-voting-list { margin: 0; padding-left: 20px; }
.match-voting-list > li { padding: 9px 0; border-bottom: 1px solid var(--period-soft-line, #b18a5255); }
.match-voting-list > li:last-child { border: 0; }
.match-voting-list p { font-size: var(--ui-body); line-height: 1.5; }
.match-outcome, .match-roster { margin-bottom: 16px; padding: 14px; border: 1px solid #b18a5288; border-radius: 5px 12px; background: #fff5df66; }
.match-outcome > h3, .match-roster > h3 { margin-bottom: 12px; font: 700 var(--ui-subtitle)/1.2 var(--ui-serif); }
.match-facts { display: grid; grid-template-columns: minmax(85px, 1fr) minmax(0, 1.2fr); gap: 6px 12px; margin: 0; font-size: 14px; }
.match-facts dt { color: #705439; }
.match-facts dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.match-finish-reason { margin-top: 12px; padding-top: 10px; border-top: 1px solid #b18a5277; }
.match-roster-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.match-roster-player {
  display:grid; grid-template-columns:32px minmax(0,1.35fr) 49px minmax(0,1fr);
  gap:8px; align-items:start; min-width:0; padding:10px 6px;
  border-bottom:1px solid #b18a5233; border-radius:3px;
  background:#fff5df33;
}
.match-roster-player .history-medal { grid-row:1; width:32px; height:38px; margin:0; }
.match-roster-player > div { display:grid; gap:3px; min-width:0; overflow-wrap:anywhere; }
.match-roster-player strong { font-size:15px; line-height:1.2; }
.match-roster-player span { font-size:13px; line-height:1.25; }
.match-roster-player small { font-size:12px; line-height:1.35; color:#74583c; }
.match-report-phase { padding: 12px; border: 1px solid #b18a5299; border-radius: 5px 12px; background: #fff1d680; }
.match-report-phase > h3 { margin: 0 0 10px; padding-bottom: 8px; border-bottom: 2px solid #b18a5266; }
.match-report-phase > summary, details.match-report-section > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; cursor: pointer; list-style: none; }
.match-report-phase > summary { font: 700 var(--ui-subtitle)/1.2 var(--ui-serif); }
.match-report-phase > summary::-webkit-details-marker, details.match-report-section > summary::-webkit-details-marker { display: none; }
.match-report-phase > summary::after, details.match-report-section > summary::after { content: '›'; color: var(--period-ink, #805232); font-size: 24px; }
.match-report-phase[open] > summary::after, details.match-report-section[open] > summary::after { transform: rotate(90deg); }
.match-report-section { margin-top: 10px; padding: 10px; background: var(--period-inset, #f8ebd080); border: 1px solid var(--period-soft-line, #b18a5266); border-radius: 4px; }
.match-report-section > h4 { margin: 0 0 8px; color: var(--period-ink, #66442c); }
.match-report-section > summary { font-weight: 650; }
details.match-report-section { padding-block: 0; }
details.match-report-section > ul, details.match-report-section > div { margin-bottom: 12px; }
.match-narrator { border-left: 3px solid #c99d58; }
.match-narrator p { white-space: pre-line; }
.match-report-note { padding: 8px; color: #705439; font-size: 13px; }
.history-detail-tabs button { font-size: 14px; min-height: 48px; }

#room-management { border:1px solid #a8804d; border-radius:7px 3px; margin:8px 0; }
#room-management > summary { cursor:pointer; padding:10px 12px; color:#513620; font-weight:650; }
#room-management-actions { padding:0 8px 8px; grid-template-columns:1fr; }

.match-roster-player .match-roster-team { justify-self:stretch; text-align:center; padding:2px 5px; border-radius:4px; font-size:12px; }
.match-roster-team[data-team="good"] { color:#294928; background:#d7e4ce; border:1px solid #819a68; }
.match-roster-team[data-team="evil"] { color:#792e2c; background:#ead0c5; border:1px solid #ac7162; }
.match-victory-explanation { border-top:1px solid #b18a5266; padding-top:10px; font-size:15px; line-height:1.45; }

@media(min-width:600px) {
  .match-roster-player { grid-template-columns:38px minmax(0,1.5fr) 65px minmax(0,1fr); gap:12px; }
  .match-roster-player .history-medal { width:38px; height:44px; }
}
@media(max-width:370px) {
  .match-roster { padding:10px 8px; }
  .match-roster-player { grid-template-columns:28px minmax(0,1.2fr) 43px minmax(0,1fr); gap:5px; padding-inline:3px; }
  .match-roster-player .history-medal { width:28px; height:34px; }
  .match-roster-player strong { font-size:14px; }
  .match-roster-player .match-roster-team { padding-inline:3px; font-size:11px; }
}

.match-roster-identity .role-faction { justify-self:start; padding:1px 4px; font-size:11px; line-height:1.3; }

/* Shared paper archive: phase colour is an accent, never a dark text panel. */
.match-report-phase {
  --period-ink: #76512e;
  --period-line: #b18a52;
  --period-soft-line: #b18a5277;
  --period-inset: #fff5df55;
  --period-paper-start: #f5e8cb;
  --period-paper-end: #ecdaaf;
  background-image: var(--profile-grain, url('/materials/profile-art-v1/grain.png')), linear-gradient(125deg,var(--period-paper-start),var(--period-paper-end));
  background-size: 144px 144px, auto;
  background-blend-mode: multiply, normal;
}
.match-period-night { --period-ink: #3e5364; --period-line: #7c909e; --period-soft-line: #7c909e77; --period-inset: #e7f0f355; --period-paper-start: #e3ebee; --period-paper-end: #d2dfe6; border-color: #83919a; }
.match-period-day { --period-ink: #805c24; --period-line: #b18b40; --period-soft-line: #b18b4077; --period-inset: #fff1ce55; --period-paper-start: #f5e3b9; --period-paper-end: #eddcb5; border-color: #bb984e; }
.match-report-phase > h3, .match-report-phase > summary { color: var(--period-ink); border-color: var(--period-line); }
.match-report-phase > h3 { display: flex; align-items: center; gap: 9px; }
.match-phase-symbol { flex: none; width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.match-period-night .match-phase-symbol { fill: #9daeba44; }
.match-period-day .match-phase-symbol { fill: #c6a34c33; }
.match-report-phase > summary { justify-content: flex-start; }
.match-report-phase > summary::after { margin-left: auto; }
.match-narrator { background: transparent; color: var(--ui-paper-ink); border: 0; padding: 4px 0; box-shadow: none; }
.match-narrator > h4 { color: var(--period-ink, #6d553d); font: 650 var(--ui-caption)/1.4 var(--ui-sans); margin: 0 0 4px; }
.match-narrator p { margin: 0; font: 400 var(--ui-body)/1.5 var(--ui-sans); }
.history-residents { color: #6d553d; }
/* Permanent collection reuses profile paper, emblems, buttons and type scale. */
#profile-role-panel { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: var(--ink); }
.role-collection-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.role-collection-heading > button { width: 44px; min-height: 44px; flex: none; padding: 0; font-size: 24px; }
.role-collection-heading h2 { color: #f7e6c5; margin: 0; font: 700 clamp(30px,8vw,40px)/1.1 var(--ui-serif); overflow-wrap: anywhere; }
.role-collection-summary { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 12px; padding: 16px; min-height: 120px; }
.role-collection-summary img { width: clamp(64px,19vw,90px); height: auto; object-fit: contain; }
.role-collection-summary h3 { margin: 0 0 7px; font: 700 clamp(24px,6.5vw,32px)/1.15 var(--ui-serif); }
.role-collection-summary p { margin: 0; font: 400 var(--ui-body)/1.4 var(--ui-sans); }
.role-mode-filter { display: grid; margin: 16px 0 10px; }
.role-mode-filter button { font: 650 clamp(20px,5.3vw,26px)/1.2 var(--ui-serif); }
.role-category-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.role-category-filter button { min-height: 44px; padding: 7px 10px; font: 500 14px/1.25 var(--ui-sans); }
.role-mode-filter button[aria-pressed=true], .role-category-filter button[aria-pressed=true] { --button-fill: #783c2d; --button-line: #edc783; color: #ffedc3; }
#profile-role-status:empty { display: none; }
#profile-role-list { display: grid; gap: 8px; padding: 0; }
.role-collection-row { position: relative; display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 12px; align-items: center; width: 100%; min-height: 104px; padding: 10px 14px; text-align: left; text-transform: none; }
.role-collection-row .history-medal { width: clamp(54px,17vw,72px); height: auto; }
.role-collection-copy { display: grid; gap: 3px; min-width: 0; font: 400 var(--ui-body)/1.35 var(--ui-sans); }
.role-collection-copy > strong { font: 700 clamp(24px,6.5vw,30px)/1.1 var(--ui-serif); overflow-wrap: anywhere; }
.role-personal-results { font-size: 13px; line-height: 1.4; }
.role-collection-row.is-unplayed .history-medal { filter: saturate(.55); }
.role-collection-row.is-unplayed { color: #604c35; }
.role-collection-row:active { filter: brightness(.95); }
#role-detail-view { display: grid; gap: 12px; }
.role-detail-hero { position: relative; }
.role-detail-hero .history-medal { width: 140px; height: 140px; }
.role-detail-hero p { font: 400 var(--ui-body)/1.4 var(--ui-sans); }
.role-detail-paper { position: relative; padding: 16px 18px; }
.role-detail-paper h3 { margin: 0 0 10px; font: 700 26px/1.2 var(--ui-serif); }
.role-detail-paper p { font: 400 var(--ui-body)/1.5 var(--ui-sans); overflow-wrap: anywhere; }
.role-detail-paper button { width: 100%; }
.role-detail-paper .role-detail-note { color: #705439; font-size: 13px; }
@media (max-width: 350px) {
  .role-collection-summary { padding: 12px; gap: 9px; }
  .role-collection-row { padding: 10px; gap: 8px; }
  .role-personal-results { font-size: 12px; }
}
#profile-role-title { color: #f7e6c5; font: 700 clamp(30px,8vw,40px)/1.1 var(--ui-serif); }
/* Compact role toolbar: two modes and a single category menu. */
.role-mode-filter { grid-template-columns: minmax(0,1fr) minmax(0,1fr) 44px; align-items: stretch; gap: 5px; margin-bottom: 14px; }
.role-mode-filter > button { padding-inline: 6px; font-size: clamp(18px,5vw,24px); }
.role-filter-menu { position: relative; z-index: 8; margin: 0; padding: 0; border: 0; background: transparent; }
.role-filter-menu > summary { display: grid; place-items: center; list-style: none; width: 44px; min-height: 48px; height: 100%; cursor: pointer; border: 1px solid #b9955d; border-radius: 5px; color: #f7e6c5; background: linear-gradient(#61412e,#3e291f); }
.role-filter-menu > summary::-webkit-details-marker { display: none; }
.role-filter-menu > summary::after { content: none; }
.role-filter-menu > summary svg { width: 24px; height: 24px; fill: #51362a; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.role-filter-menu[open] > summary, .role-filter-menu.has-filter > summary { background: #783c2d; border-color: #edc783; color: #ffdb91; }
.role-filter-menu > summary:focus-visible { outline: 2px solid #ffdb91; outline-offset: 2px; }
.role-filter-menu .role-category-filter { position: absolute; right: 0; top: calc(100% + 6px); display: grid; gap: 3px; width: min(270px,calc(100vw - 36px)); margin: 0; padding: 8px; border: 1px solid #b18a52; border-radius: 5px 12px; background: #eadfbe; box-shadow: 0 7px 20px #100a08a0; }
.role-filter-menu .role-category-filter button { min-height: 44px; width: 100%; text-align: left; --button-fill: #eadebd; --button-line: #c9ac7d; color: #352419; }
.role-filter-menu .role-category-filter button[aria-pressed=true] { --button-fill: #78503a; --button-line: #b48e57; color: #ffedc3; }
/* Same compact header height, portrait and personal results side by side. */
.role-detail-hero { display: grid; grid-template-columns: clamp(84px,27vw,112px) minmax(0,1fr); align-items: center; gap: 14px; padding: 14px; text-align: left; }
.role-collection-portrait { display: block; width: 100%; height: 168px; object-fit: cover; object-position: center 20%; border: 1px solid #98713d; border-radius: 3px 10px; box-shadow: 0 2px 5px #442c2440; }
.role-collection-portrait.is-fallback { object-fit: contain; }
.role-detail-compact-stats { min-width: 0; }
.role-detail-compact-stats h3 { margin: 7px 0; font: 700 21px/1.15 var(--ui-serif); }
.role-detail-hero .role-detail-category { margin: 0 0 6px; color: #6d553d; font-size: 13px; line-height: 1.4; }
.role-detail-games { display: block; font: 700 26px/1.15 var(--ui-serif); }
.role-detail-hero .role-detail-results { margin: 6px 0; font: 500 14px/1.45 var(--ui-sans); }
.role-detail-results > span { display: block; }
.role-detail-results > span { font-size: 14px; }
.role-detail-hero .role-detail-percent { margin: 6px 0 0; font-size: 13px; }
.role-detail-mechanics .copy-block + .copy-block { margin-top: 18px; padding-top: 14px; border-top: 1px solid #b18a5266; }
.role-detail-mechanics .copy-block h4 { margin: 0 0 8px; font: 700 23px/1.2 var(--ui-serif); }
.role-detail-mechanics .copy-block p { margin: 0; white-space: pre-line; }
@media (max-width: 350px) {
  .role-detail-hero { gap: 10px; padding: 12px; }
  .role-collection-portrait { height: 160px; }
  .role-detail-compact-stats h3 { font-size: 19px; }
  .role-detail-hero .role-detail-category { font-size: 12px; }
}
.role-collection-name { display: grid; justify-items: start; gap: 5px; }
.role-collection-name > strong { font: 700 clamp(24px,6.5vw,30px)/1.1 var(--ui-serif); overflow-wrap: anywhere; }
.role-faction { display: inline-block; max-width: 100%; padding: 3px 6px; border: 1px solid #ad8b5466; border-radius: 3px; color: #6a5033; background: #c9af7022; font: 500 12px/1.35 var(--ui-sans); overflow-wrap: anywhere; }
/* Factions always occupy their own line; colour denotes the canonical side. */

#profile-role-list .role-collection-row { min-height: 68px; gap: 9px; padding: 8px 10px; }
#profile-role-list .history-medal { width: clamp(42px,12vw,52px); }
#profile-role-list .role-collection-name { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 7px; }
#profile-role-list .role-collection-name > strong { font-size: clamp(19px,5.7vw,24px); }
#profile-role-list .role-faction { padding: 1px 4px; font-size: 11px; }
.role-paper-title { display: grid; grid-template-columns: clamp(93px,28.5vw,129px) minmax(0,1fr); align-items: center; gap: 12px; margin: 0 0 12px; padding-bottom: 12px; border-bottom: 1px solid #b18a5266; color: #39261c; font: 700 clamp(25px,7vw,35px)/1.1 var(--ui-serif); }
.role-paper-title .role-collection-portrait { height: auto; aspect-ratio: 2 / 3; }
.role-title-identity { display: grid; justify-items: start; gap: 5px; min-width: 0; overflow-wrap: anywhere; }
.role-title-identity small { color: #705439; font: 500 13px/1.35 var(--ui-sans); }
.role-performance-results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; padding: 8px 0; border-block: 1px solid #b18a5266; text-align: center; }
.role-performance-results > div { display: flex; flex-direction: column-reverse; gap: 3px; }
.role-performance-results > div + div { border-inline-start: 1px solid #b18a5266; }
.role-performance-results dt { font: 500 12px/1.3 var(--ui-sans); }
.role-performance-results dd { margin: 0; font: 700 29px/1 var(--ui-serif); font-variant-numeric: lining-nums tabular-nums; }
.role-performance-wins dd { color: #36593e; }
.role-performance-losses dd { color: #802f37; }
.role-performance-evidence { display: grid; gap: 10px; margin: 12px 0; }
.role-review h4 { margin: 0 0 5px; font: 650 20px/1.2 var(--ui-serif); }
.role-review p { margin: 0; }
.role-review ul { margin: 5px 0 0; padding-inline-start: 19px; }
.role-review li + li { margin-top: 4px; }
.role-review-outcomes { margin: 0; }
.role-review-outcomes > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid #b18a5255; }
.role-review-outcomes dd { margin: 0; color: var(--faction-color,#65462e); font: 700 25px/1 var(--ui-serif); }
.role-review-guide { margin-top: 10px; padding: 10px 12px; border-inline-start: 2px solid var(--faction-color,#65462e); background: #a8844919; }

/* Give consecutive paragraphs within a character's rule section room to breathe. */
:is(#role-text, #roles-list, #role-detail-view) .copy-block p + p {
  margin-block-start: .55em;
}

/* Profile statistics: shared paper surfaces, real responsive charts. */
#profile-analytics-panel { padding: 0; background: transparent; border: 0; box-shadow: none; color: #f7e6c5; }
.stats-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.stats-heading button { flex: none; padding: 7px 9px; font-size: 13px; }
#profile-analytics-title { margin: 0; color: #f7e6c5; font: 700 clamp(27px,7vw,36px)/1.15 var(--ui-serif); overflow-wrap: anywhere; }
#profile-analytics-results { display: grid; gap: 12px; }
.stats-paper { position: relative; padding: 16px; min-width: 0; }
.stats-paper h3 { margin: 0 0 12px; font: 700 clamp(24px,6.5vw,29px)/1.15 var(--ui-serif); }
.stats-paper p { font: 400 var(--ui-body)/1.5 var(--ui-sans); }
.stats-note { margin: 5px 0; font: 400 13px/1.5 var(--ui-sans); color: inherit; opacity: .84; overflow-wrap: anywhere; }
.stats-totals { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px 12px; }
.stats-totals > strong { font: 700 clamp(26px,8vw,38px)/1.2 var(--ui-serif); }
.stats-totals > span:nth-child(2) { grid-column: 1; font-size: 14px; }
.stats-win-rate { grid-column: 2; grid-row: 1; color: #3d5739; }
.stats-totals > span:last-child { grid-column: 2; grid-row: 2; font-size: 13px; }
.stats-link { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 84px; padding: 12px 15px; text-align: left; }
.stats-link > img { flex: none; width: 48px; height: 48px; object-fit: contain; }
.stats-link-copy { display: grid; gap: 4px; flex: 1; min-width: 0; }
.stats-link-copy > strong { font: 700 24px/1.1 var(--ui-serif); overflow-wrap: anywhere; }
.stats-link-copy > span { font: 400 13px/1.4 var(--ui-sans); color: #6d553d; }
.stats-link:active { filter: brightness(.96); }
.stats-link:disabled { opacity: 1; cursor: default; }
.stats-link:disabled .stats-link-copy > span { color: #79684f; }
.stats-paper .stats-link { margin-top: 8px; }
.stats-progress { display: block; height: 9px; margin: 8px 0; border-radius: 4px; overflow: hidden; background: #9c5149; min-width: 0; }
.stats-progress > span { display: block; height: 100%; background: #4f7047; }
.stats-line { display: block; width: 100%; height: auto; aspect-ratio: 320 / 190; max-height: 240px; overflow: visible; }
.stats-line text { fill: #59452f; font: 12px var(--ui-sans); }
.stats-grid-line { stroke: #9c81574d; stroke-width: 1; fill: none; }
.stats-chart-line { fill: none; stroke: #86443d; stroke-width: 2; }
.stats-chart-fill { fill: #8d4c4533; }
.stats-chart-point { fill: #f3e4c5; stroke: #86443d; stroke-width: 2; }
.stats-line a:focus { outline: none; }
.stats-line a:focus .stats-chart-point { stroke: #38251c; stroke-width: 4; }
.stats-data-table { margin-top: 10px; border-top: 1px solid #aa865455; }
.stats-data-table summary { min-height: 44px; padding-top: 12px; cursor: pointer; font-size: 14px; }
.stats-data-row { display: block; width: 100%; min-height: 44px; margin: 4px 0; padding: 8px; text-align: left; --button-fill: #e6d4ae; --button-line: #ad8e60; color: #352419; font-size: 14px; }
.stats-result-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.stats-result { width: 44px; min-height: 44px; padding: 0; font-size: 22px; }
.stats-result.is-win { --button-fill: #465d39; --button-line: #a1ad79; }
.stats-result.is-loss { --button-fill: #843f38; --button-line: #c49277; }
.stats-year { display: flex; align-items: center; gap: 12px; justify-content: flex-end; font-size: 14px; }
.stats-year select { width: 120px; min-height: 44px; background: #eadebd; color: #352419; }
.stats-month, .stats-distribution { display: block; width: 100%; min-height: 60px; padding: 10px; margin: 7px 0; --button-fill: #eddfbf; --button-line: #b18b56; color: #352419; text-align: left; }
.stats-month strong, .stats-distribution strong { display: block; font-size: 16px; }
.stats-month span, .stats-distribution span { font-size: 13px; }
.stats-calendar-scroll { overflow-x: auto; max-width: 100%; padding-bottom: 6px; }
.stats-calendar { display: grid; grid-template-columns: repeat(7,44px); gap: 3px; width: max-content; }
.stats-calendar > span { text-align: center; font-size: 12px; }
.stats-calendar-day { width: 44px; min-height: 44px; padding: 0; --button-fill: #dbd5ab; --button-line: #afa779; color: #3d452a; font-size: 13px; }
.stats-calendar-day:disabled { opacity: .7; }
.stats-calendar-day.has-games { --button-fill: #65774c; --button-line: #8c9b65; }
.stats-calendar-day.many-games { --button-fill: #3d5435; }
.stats-role-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 78px; padding: 10px; margin: 8px 0; --button-fill: #e9d8b5; --button-line: #b18a52; color: #352419; text-align: left; }
.stats-role-row img { flex: none; width: 52px; height: 52px; object-fit: contain; }
.stats-role-row span { font: 400 15px/1.4 var(--ui-sans); }
.stats-role-row span:last-child { margin-left: auto; font-size: 24px; }
#profile-analytics-results > .primary { width: 100%; }
@media (max-width: 350px) {
  .stats-paper { padding: 13px; }
  .stats-link { gap: 9px; padding: 11px; }
  .stats-link > img { width: 40px; height: 40px; }
  .stats-link-copy > strong { font-size: 21px; }
  .stats-heading { flex-wrap: wrap; }
}
.stats-progress-collection, .stats-progress[class*="stats-progress-category-"] { background: #bca37555; }
.stats-progress-collection > span { background: #8b503d; }
.stats-chart-fill, .stats-chart-hit, .stats-line text { stroke: none; }
.stats-result { border: 1px solid #a17e4a; border-radius: 5px; color: #ffefcc; }
.stats-result.is-win { background: #465d39; }
.stats-result.is-loss { background: #843f38; }
.stats-calendar-day { border: 1px solid #afa779; border-radius: 3px; background: #dbd5ab; }
.stats-calendar-day.has-games { background: #65774c; color: #fff0c9; }
.stats-calendar-day.many-games { background: #3d5435; }
/* Single back-button geometry, independent of font baselines and container. */
button.nav-back, .actions button.nav-back, .settings-dialog-actions button.nav-back,
.profile-panel button.nav-back, .settings-panel button.nav-back {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  max-width: 44px;
  flex: 0 0 44px;
  padding: 0;
  margin: 0;
  align-self: center;
  line-height: 1;
  color: #fff0d0;
  --button-fill: #67432c;
  --button-line: #d1a367;
}
button.nav-back svg { display: block; width: 24px; height: 24px; margin: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.page-title:has(> .nav-back) { display: flex; align-items: center; gap: 12px; }
.page-title:has(> .nav-back) h2 { min-width: 0; margin: 0; overflow-wrap: anywhere; }
/* Statistics are read-only summaries; only section navigation looks clickable. */
.stats-compact #profile-analytics-results { gap: 10px; }
.stats-compact .stats-paper { padding: 13px 15px; }
.stats-compact .stats-paper h3 { margin-bottom: 10px; font-size: 24px; }
.stats-compact .stats-link { min-height: 66px; gap: 10px; padding: 9px 13px; }
.stats-compact .stats-link > img { width: 44px; height: 44px; }
.stats-compact .stats-link-copy > strong { font-size: 22px; }
.stats-compact .stats-link-copy > span { font-size: 13px; }
.stats-compact-summary { display: flex; justify-content: space-between; gap: 16px; }
.stats-compact-summary > div { display: grid; gap: 4px; min-width: 0; }
.stats-compact-summary > div:last-child { text-align: right; }
.stats-compact-summary strong { font: 700 30px/1.15 var(--ui-serif); }
.stats-compact-summary span { font: 400 13px/1.4 var(--ui-sans); }
.stats-compact-summary > div:last-child strong { color: #45613c; }
.stats-streak-strip { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 12px; margin-top: 10px; padding-top: 8px; border-top: 1px solid #a6845455; font: 400 13px/1.35 var(--ui-sans); }
.stats-table { width: 100%; border-collapse: collapse; table-layout: fixed; color: #352419; font: 400 14px/1.4 var(--ui-sans); }
.stats-table th, .stats-table td { padding: 9px 4px; border-bottom: 1px solid #ac89524d; vertical-align: middle; overflow-wrap: anywhere; }
.stats-table thead th { color: #705335; font-size: 12px; font-weight: 600; text-align: right; }
.stats-table tbody th { font-weight: 500; text-align: left; }
.stats-table tr > :first-child { width: 50%; text-align: left; }
.stats-table tr > :not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.stats-table tr:last-child > * { border-bottom: 0; }
.stats-table thead tr > * { border-bottom: 1px solid #ac895288 !important; }
.stats-table:has(th:nth-child(4)) tr > :first-child { width: 34%; }
.stats-table td { font-weight: 600; }
.stats-metric-table tr > :first-child { width: 62%; }
.stats-compact .stats-paper .stats-note { margin: 5px 0 8px; font-size: 13px; }
.stats-month-reading { min-height: 0; margin: 10px 0; padding: 0; }
.stats-month-heading, .stats-category-reading > div:first-child { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 3px 10px; }
.stats-month-heading strong, .stats-category-reading strong { font: 600 15px/1.3 var(--ui-sans); }
.stats-month-heading > span, .stats-category-reading > div > span { font: 400 13px/1.35 var(--ui-sans); }
.stats-category-reading + .stats-category-reading { margin-top: 12px; }
.stats-reading { display: block; min-height: 36px; margin: 4px 0; color: #73513a; font: 400 13px/1.4 var(--ui-sans); }
.stats-frequent-reading { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 6px 0; border-bottom: 1px solid #ac895244; }
.stats-frequent-reading:last-child { border: 0; }
.stats-frequent-reading img { flex: none; width: 44px; height: 44px; object-fit: contain; }
.stats-frequent-reading > div { display: grid; gap: 3px; }
.stats-frequent-reading strong { font: 600 17px/1.25 var(--ui-sans); }
.stats-frequent-reading span { font: 400 13px/1.35 var(--ui-sans); }
.stats-definitions { position: relative; padding: 0 13px; }
.stats-definitions summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; color: #664a2e; font: 500 14px/1.4 var(--ui-sans); cursor: pointer; list-style: none; }
.stats-definitions summary::-webkit-details-marker { display: none; }
.stats-definitions summary::after { content: '+'; font-size: 20px; }
.stats-definitions[open] summary::after { content: '−'; }
.stats-definitions p { margin: 0 0 10px; font: 400 13px/1.5 var(--ui-sans); }
.stats-value-row { padding: 7px 0; margin: 0; border-bottom: 1px solid #ac895244; font-size: 13px !important; }
.stats-compact .stats-result { display: grid; place-items: center; }
@media (max-width: 350px) {
  .stats-compact .stats-paper { padding: 12px; }
  .stats-compact .stats-link { padding: 8px 11px; gap: 8px; }
  .stats-compact .stats-link > img { width: 40px; height: 40px; }
  .stats-compact .stats-link-copy > strong { font-size: 20px; }
  .stats-compact-summary strong { font-size: 27px; }
  .stats-table { font-size: 13px; }
  .stats-table th, .stats-table td { padding-inline: 3px; }
}
/* Statistics v3: shared paper surfaces, descriptive data, no rating. */
.stats-v3 { --stats-metal: var(--brass, #d6ac61); --stats-paper-ink: var(--ui-paper-ink, #352419); }
.stats-v3 .stats-v3-heading { display: flex; align-items: start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.stats-v3 .stats-v3-heading h3 { margin: 4px 0; min-width: 0; overflow-wrap: anywhere; font: 600 25px/1.15 var(--ui-serif); }
.stats-v3 .stats-paper { min-width: 0; animation: stats-arrive 240ms ease-out both; }
.stats-v3 .stats-paper .stats-note { line-height: 1.55; }
.stats-v3 .stats-method { flex: none; width: 44px; }
.stats-v3 .stats-method > summary { cursor: pointer; list-style: none; display: grid; place-items: center; min-width: 44px; min-height: 44px; border: 1px solid #9c784b88; border-radius: 50%; font: 500 22px/1 var(--ui-sans); color: #735131; }
.stats-v3 .stats-method > summary::-webkit-details-marker { display: none; }
.stats-v3 .stats-method[open] { width: auto; flex: 1; max-width: 100%; }
.stats-v3 .stats-method[open] > summary { margin-left: auto; width: 44px; }
.stats-v3 .stats-method > div { font: 400 13px/1.55 var(--ui-sans); overflow-wrap: anywhere; padding-top: 6px; }
.stats-v3 .stats-v3-heading:has(.stats-method[open]) { flex-wrap: wrap; }
.stats-v3 .stats-v3-heading .stats-method[open] { flex-basis: 100%; }
.stats-v3 .stats-style-frame { display: grid; justify-items: center; width: 100%; padding: 0 8px 14px; border: 0; background: transparent; box-shadow: none; color: var(--stats-paper-ink); text-align: center; clip-path: none; }
.stats-v3 button.stats-style-frame::before, .stats-v3 button.stats-style-frame::after { display: none; }
.stats-v3 .stats-style-frame svg { width: min(100%, 280px); height: auto; max-height: 170px; }
.stats-v3 .stats-style-frame strong { font: 500 17px/1.4 var(--ui-sans); max-width: 28ch; }
.stats-v3 .stats-instrument-ring { fill: #82573818; stroke: #9e743e; stroke-width: 4; }
.stats-v3 .stats-instrument-inner { fill: #f2e2bd77; stroke: #c39b5d; stroke-width: 1.5; }
.stats-v3 .stats-instrument-grid { fill: none; stroke: #a1855755; stroke-width: .8; }
.stats-v3 .stats-instrument-tick { fill: none; stroke: #684828; stroke-width: 1.2; }
.stats-v3 .stats-inline { width: 100%; min-height: 44px; }
.stats-v3 .stats-link > img { width: 46px; height: 46px; }
.stats-v3 .stats-link-copy > strong { font-size: 23px; }
.stats-v3 .stats-insight { display: block; width: 100%; background: transparent; border: 0; color: var(--stats-paper-ink); padding: 10px 0; text-align: left; font: 400 15px/1.5 var(--ui-sans); box-shadow: none; clip-path: none; }
.stats-v3 .stats-insight::before, .stats-v3 .stats-insight::after { display: none; }
.stats-v3 .stats-insight:hover { text-decoration: underline; }
.stats-v3 .stats-v3-segments { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.stats-v3 .stats-v3-segments button { flex: 1 1 70px; min-width: 0; min-height: 44px; padding: 8px; white-space: normal; font: 500 13px/1.3 var(--ui-sans); }
.stats-v3 .stats-v3-segments button[aria-pressed="true"] { --button-fill: #824832; --button-line: #ddb577; color: #ffedcc; box-shadow: inset 0 0 0 2px #e8c78c55; }
.stats-v3 .stats-peer-search { display: grid; gap: 6px; font: 500 14px/1.4 var(--ui-sans); margin: 14px 0; }
.stats-v3 .stats-peer-search input { width: 100%; min-width: 0; min-height: 48px; box-sizing: border-box; background: #f8edd2; color: var(--stats-paper-ink); border: 1px solid #a38150; border-radius: 5px; font: 400 16px/1.4 var(--ui-sans); padding: 10px; }
.stats-v3 .stats-peer-list .stats-link { margin: 8px 0; box-shadow: none; }
.stats-v3 .stats-peer-list .stats-link strong { font-family: var(--ui-sans); font-size: 17px; overflow-wrap: anywhere; }
.stats-v3 .stats-progress-team-good, .stats-v3 .stats-progress-team-evil { background: #bca37555; }
.stats-v3 .stats-progress-team-good > span { background: #637c88; }
.stats-v3 .stats-progress-team-evil > span { background: #8e5369; }
.stats-v3 button:focus-visible, .stats-v3 input:focus-visible, .stats-v3 summary:focus-visible { outline: 3px solid #916137; outline-offset: 3px; }
.stats-v3 .stats-category-reading { margin: 12px 0; }
@keyframes stats-arrive { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }
body:has(#motion-off:checked) .stats-v3 *, body:has(#motion-off:checked) .stats-v3 *::before, body:has(#motion-off:checked) .stats-v3 *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { .stats-v3 *, .stats-v3 *::before, .stats-v3 *::after { animation: none !important; transition: none !important; } }
@media (max-width: 350px) { .stats-v3 .stats-v3-heading h3 { font-size: 23px; } .stats-v3 .stats-link-copy > strong { font-size: 21px; } .stats-v3 .stats-style-frame svg { max-height: 145px; } }
.stats-v3 .stats-peer-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 10px 0 16px; }
.stats-v3 .stats-peer-pair figure { margin: 0; text-align: center; min-width: 0; }
.stats-v3 .stats-peer-pair img { display: block; width: 52px; height: 52px; object-fit: contain; margin: 0 auto 6px; }
.stats-v3 .stats-peer-pair figcaption { overflow-wrap: anywhere; font: 500 13px/1.35 var(--ui-sans); }
/* Statistics v4 — autonomous paper cards and one shared comparison route. */
.stats-v4 { --stats-good: #526d78; --stats-evil: #8e5369; }
.stats-v4 .profile-paper, .stats-bottom-sheet { background-image: linear-gradient(#f7e8c075,#f7e8c075),var(--profile-grain),radial-gradient(ellipse at 47% 30%,#f8edcf 18%,#ecdaaf 84%); background-size: auto,144px 144px,auto; background-blend-mode: normal,multiply,normal; }
.stats-v4 .stats-paper { animation: none; padding: 15px 17px; color: var(--ui-paper-ink,#352419); }
.stats-v4 .stats-v4-heading { display: flex; align-items: start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.stats-v4 .stats-v4-heading h3 { margin: 5px 0; font: 700 26px/1.1 var(--ui-serif); min-width: 0; overflow-wrap: anywhere; }
.stats-v4 .stats-info { flex: none; display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; padding: 10px; border: 0; background: transparent; color: #876137; box-shadow: none; clip-path: none; }
.stats-v4 .stats-info::before, .stats-v4 .stats-info::after { display: none; }
.stats-v4 .stats-info svg { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.stats-v4 .stats-v4-hero .stats-v4-heading h3 { font-size: 30px; }
.stats-v4 .stats-v4-instrument { display: grid; grid-template-areas: 'dial'; align-items: center; justify-items: center; width: min(100%,238px); aspect-ratio: 1; margin: 2px auto 8px; padding: 0; border: 0; background: transparent; box-shadow: none; clip-path: none; isolation: isolate; }
.stats-v4 .stats-v4-instrument::before, .stats-v4 .stats-v4-instrument::after { display: none; }
.stats-v4 .stats-v4-instrument .stats-bezel, .stats-v4 .stats-v4-instrument svg { grid-area: dial; display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.stats-v4 .stats-v4-instrument svg { width: 84%; height: 84%; z-index: -1; }
.stats-v4 .stats-instrument-grid { stroke: #986c3a66; stroke-width: .8; fill: none; }
.stats-v4 .stats-v4-hero > .stats-note { text-align: center; font-size: 13px; line-height: 1.4; }
.stats-v4 .stats-text-link { display: block; min-height: 44px; width: 100%; padding: 8px; color: #71502e; text-decoration: underline; text-underline-offset: 3px; border: 0; background: transparent; box-shadow: none; clip-path: none; font: 500 13px/1.35 var(--ui-sans); }
.stats-v4 .stats-text-link::before,.stats-v4 .stats-text-link::after { display: none; }
.stats-highlights { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.stats-v4 .stats-highlight { min-width: 0; min-height: 90px; padding: 10px; display: flex; align-items: center; gap: 6px; text-align: left; color: #352419; }
.stats-v4 .stats-highlight > img { width: 38px; height: 46px; flex: none; object-fit: contain; }
.stats-v4 .stats-highlight > span { display: grid; gap: 4px; min-width: 0; }
.stats-v4 .stats-highlight span span { font: 500 12px/1.25 var(--ui-sans); }
.stats-v4 .stats-highlight strong { font: 700 18px/1.15 var(--ui-serif); color: #733c30; overflow-wrap: anywhere; }
.stats-v4 .stats-highlight:only-child { grid-column: 1/-1; }
.stats-v4 .stats-link { min-height: 78px; padding: 12px 14px; gap: 12px; }
.stats-v4 .stats-link > img { width: 54px; height: 54px; }
.stats-v4 .stats-link-copy > strong { font-size: 25px; }
.stats-v4 .stats-link-copy > span { font-size: 12px; line-height: 1.35; }
.stats-v4 .stats-v4-results { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; margin: 12px 0; }
.stats-v4 .stats-outcome { display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; padding: 5px; border: 2px solid #c8a565; border-radius: 50%; clip-path: none; box-shadow: inset 0 0 0 2px #351e17aa,0 2px 3px #4d331b55; }
.stats-v4 .stats-outcome::before,.stats-v4 .stats-outcome::after { display: none; }
.stats-v4 .stats-outcome.is-win { background: #435835; color: #f1d28c; }
.stats-v4 .stats-outcome.is-loss { background: #7c3932; color: #f1d28c; }
.stats-v4 .stats-outcome.is-latest { outline: 2px solid #73512e; outline-offset: 2px; }
.stats-v4 .stats-outcome svg { width: 28px; height: 28px; fill: currentColor; stroke: currentColor; stroke-width: 1.6; }
.stats-v4 .stats-outcome svg path { fill: none; stroke-linecap: round; }
.stats-v4 .stats-small-label { margin: 4px 0; font: 400 12px/1.4 var(--ui-sans); text-align: center; color: #745a3c; }
.stats-streak-columns { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 4px 0 10px; }
.stats-streak-columns > div { position: relative; min-width: 0; display: grid; justify-items: center; gap: 4px; text-align: center; padding: 8px 4px; }
.stats-streak-columns > div + div { border-left: 1px solid #b5945d66; }
.stats-v4 .stats-streak-columns h4 { min-height: 36px; margin: 0; font: 600 19px/1.05 var(--ui-serif); }
.stats-streak-columns img { width: 74px; height: 74px; object-fit: contain; opacity: .8; }
.stats-streak-columns strong { margin-top: -67px; align-self: center; font: 700 38px/1 var(--ui-serif); color: #39271c; }
.stats-streak-columns span { margin-top: 4px; font: 500 13px/1.35 var(--ui-sans); }
.stats-month-chart { display: block; width: 100%; height: auto; max-height: 260px; }
.stats-month-chart text { fill: #59452f; font: 12px var(--ui-sans); }
.stats-month-column { fill: #738052; }
.stats-month-chart a:focus { outline: none; }
.stats-month-chart a:focus .stats-month-column { stroke: #673923; stroke-width: 3; }
.stats-team-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.stats-team-pair > div { min-width: 0; display: grid; align-content: start; justify-items: center; gap: 5px; text-align: center; }
.stats-team-pair img { width: clamp(72px,23vw,110px); height: clamp(72px,23vw,110px); object-fit: contain; }
.stats-v4 .stats-team-pair h4 { margin: 0; font: 700 24px/1.1 var(--ui-serif); }
.stats-team-pair strong { font: 700 30px/1.1 var(--ui-serif); }
.stats-team-pair span, .stats-team-pair small { font: 400 13px/1.45 var(--ui-sans); }
.stats-v4 .stats-progress-team-good, .stats-v4 .stats-progress-relations { height: 12px; background: #8c566b; }
.stats-v4 .stats-progress-team-good > span, .stats-v4 .stats-progress-relations > span { background: #5e7882; }
.stats-donut-layout { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stats-donut { display: block; flex: 1 1 130px; width: 140px; max-width: 180px; height: auto; margin: 0 auto; }
.stats-donut text { font: 700 32px var(--ui-serif); fill: #352419; }
.stats-donut text.stats-donut-caption { font: 400 13px var(--ui-sans); }
.stats-donut-legend { flex: 1 1 150px; min-width: 0; }
.stats-v4 .stats-legend-row { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 6px; padding: 4px 0; border: 0; background: transparent; clip-path: none; color: #352419; box-shadow: none; text-align: left; font: 400 12px/1.35 var(--ui-sans); }
.stats-v4 .stats-legend-row::before,.stats-v4 .stats-legend-row::after { display: none; }
.stats-legend-row i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.stats-legend-row span { flex: 1; }
.stats-legend-row strong { font-weight: 600; }
.stats-donut a:focus .stats-sector { stroke-width: 34; }
.stats-company-hero { display: flex; align-items: center; gap: 14px; }
.stats-company-hero > img { width: clamp(78px,26vw,130px); height: clamp(78px,26vw,130px); object-fit: contain; flex: none; }
.stats-company-hero > div { display: grid; gap: 6px; min-width: 0; }
.stats-company-hero strong { font: 700 44px/1 var(--ui-serif); color: #71352e; }
.stats-company-hero span { font: 500 14px/1.35 var(--ui-sans); }
.stats-company-hero p { margin: 0; font: 400 12px/1.5 var(--ui-sans); overflow-wrap: anywhere; }
.stats-company-controls { display: grid; grid-template-columns: minmax(0,1fr) 125px; gap: 10px; }
.stats-v4 .stats-company-controls .stats-peer-search { color: #f7e6c5; margin: 0; }
.stats-v4 .stats-company-controls input,.stats-v4 .stats-company-controls select { width: 100%; min-height: 46px; box-sizing: border-box; background: #eadbbc; color: #352419; border: 1px solid #b99c70; border-radius: 4px; padding: 8px; font: 400 16px var(--ui-sans); }
.stats-v4-peer-list { display: grid; gap: 12px; }
.stats-v4 .stats-peer-card { position: relative; width: 100%; min-height: 104px; display: flex; align-items: center; gap: 10px; padding: 13px; color: #352419; text-align: left; }
.stats-peer-card > img { width: 54px; height: 54px; flex: none; object-fit: contain; }
.stats-peer-copy { display: grid; gap: 5px; flex: 1; min-width: 0; }
.stats-peer-copy > strong { font: 700 24px/1.1 var(--ui-serif); overflow-wrap: anywhere; }
.stats-peer-copy > span, .stats-peer-copy > small { font: 400 12px/1.35 var(--ui-sans); }
.stats-peer-metrics { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.stats-peer-metrics > span { display: flex; align-items: center; gap: 5px; }
.stats-peer-metrics img { width: 20px; height: 20px; object-fit: contain; }
.stats-v4 .stats-peer-pair { margin: 8px 0 14px; }
.stats-v4 .stats-peer-pair img { width: 64px; height: 64px; }
.stats-pair-totals { display: flex; flex-wrap: wrap; gap: 8px 16px; font: 500 14px/1.4 var(--ui-sans); }
.stats-bottom-sheet { --profile-grain: url('/materials/profile-art-v1/grain.png'); --profile-cut: 10px; position: fixed; margin: auto auto 0; inset: auto 0 0; width: min(100%,560px); max-width: calc(100vw - 16px); max-height: min(76dvh,700px); padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); color: #352419; overflow-y: auto; box-sizing: border-box; }
.stats-bottom-sheet::backdrop { background: #160d09c7; }
.stats-sheet-heading { display: flex; gap: 12px; align-items: start; justify-content: space-between; }
.stats-sheet-heading h2 { font: 700 27px/1.1 var(--ui-serif,Georgia); margin: 4px 0 12px; overflow-wrap: anywhere; }
.stats-sheet-heading button { flex: none; min-height: 44px; padding: 8px 10px; font: 500 13px/1.3 var(--ui-sans,system-ui); }
.stats-sheet-copy p { font: 400 15px/1.6 var(--ui-sans,system-ui); margin: 8px 0; }
.stats-bottom-sheet:focus-visible { outline: 2px solid #f5d39a; outline-offset: -5px; }
.stats-v4 .stats-paper button:focus-visible,.stats-v4 button:focus-visible { outline: 3px solid #805022; outline-offset: -5px; }
@media(max-width:350px) { .stats-highlights { grid-template-columns: 1fr; } .stats-v4 .stats-highlight { min-height: 70px; padding: 10px 14px; gap: 12px; } .stats-v4 .stats-highlight strong { font-size: 21px; } .stats-v4 .stats-link-copy > strong { font-size: 23px; } .stats-v4 .stats-v4-heading h3 { font-size: 24px; } .stats-v4 .stats-v4-hero .stats-v4-heading h3 { font-size: 27px; } .stats-v4 .stats-v4-instrument { width: 180px; } .stats-v4 .stats-paper { padding: 13px; } .stats-company-controls { grid-template-columns: 1fr; } .stats-peer-card > img { width: 44px; height: 44px; } .stats-peer-copy > strong { font-size: 22px; } }
@media(max-height:650px) { .stats-v4 .stats-v4-hero .stats-v4-instrument { width: 166px; } }
.stats-v4 .stats-sector { stroke-linecap: butt; }
.stats-v4 .stats-company-controls label:has(.stats-search-icon) { position: relative; }
.stats-search-icon { position: absolute; bottom: 12px; left: 10px; width: 22px; height: 22px; fill: none; stroke: #86613b; stroke-width: 1.8; pointer-events: none; }
.stats-v4 .stats-company-controls label:has(.stats-search-icon) input { padding-left: 38px; }
.stats-v4 [data-section] { scroll-margin-top: calc(var(--ui-header-height, 86px) + 12px); }
/* Refined statistics: compact composition, natural artwork proportions. */
.stats-polish .stats-paper { padding: 12px 15px; }
.stats-polish .stats-v4-heading { position: relative; display: block; min-height: 28px; margin-bottom: 4px; }
.stats-polish .stats-v4-heading h3 { text-align: center; font-size: 26px; margin: 2px 0 7px; }
.stats-polish .stats-v4-hero .stats-v4-heading h3 { text-align: center; font-size: 30px; }
.stats-polish .stats-v4-instrument { width: min(100%,210px); margin: 0 auto 2px; }
.stats-polish .stats-v4-instrument svg { width: 100%; height: 100%; }
.stats-polish .stats-v4-hero { padding-block: 10px; }
.stats-polish .stats-v4-hero .stats-note { margin: 2px auto; max-width: 32ch; font-size: 12px; line-height: 1.3; }
.stats-polish .stats-text-link { padding: 4px 8px; min-height: 44px; }
.stats-polish img { object-fit: contain; aspect-ratio: 1; }
.stats-polish .stats-highlight > img { width: 42px; height: 42px; }
.stats-polish .stats-link > img { width: 56px; height: 56px; }
.stats-polish .stats-company-hero > img { width: 96px; height: 96px; }
.stats-polish .stats-company-hero { gap: 10px; }
.stats-polish .stats-company-total { display: flex; align-items: center; gap: 9px; }
.stats-polish .stats-company-total > strong { flex: none; }
.stats-polish .stats-company-total > span { font: 400 14px/1.35 var(--ui-sans); }
.stats-company-leader { display: flex; gap: 12px; align-items: center; margin-top: 4px; border-top: 1px solid #ac895244; padding-top: 6px; }
.stats-company-leader > div:first-child { display: grid; gap: 2px; flex: 1; min-width: 0; }
.stats-company-leader span { font: 400 12px/1.35 var(--ui-sans); }
.stats-company-leader > div > strong { font: 700 23px/1.1 var(--ui-serif); overflow-wrap: anywhere; }
.stats-company-leader small { font: 400 11px/1.3 var(--ui-sans); color: #715439; }
.stats-company-count { position: relative; display: grid; width: 86px; height: 86px; flex: none; place-items: center; }
.stats-company-count img { width: 86px; height: 86px; grid-area: 1/1; }
.stats-company-count strong { grid-area: 1/1; align-self: center; padding-bottom: 8px; font: 700 26px/1 var(--ui-serif) !important; }
.stats-company-count span { position: absolute; top: 48px; font: 500 11px/1 var(--ui-serif); }
.stats-polish .stats-company-controls { display: grid; gap: 8px; align-items: center; }
.stats-polish .stats-company-controls .stats-peer-search { margin: 0; }
.stats-polish .stats-company-controls input { height: 48px; padding-left: 38px; color: #f1dfb7; background-color: #493025; background-image: linear-gradient(#40291fce,#493025ce),var(--profile-grain); background-size: auto,144px; border: 1px solid #b99758; border-radius: 5px; box-shadow: inset 0 0 0 1px #2c1c16,inset 0 0 12px #1d100d55; }
.stats-polish .stats-company-controls input::placeholder { color: #d5bb91; opacity: 1; font-family: var(--ui-serif); font-size: 18px; font-style: italic; }
.stats-polish .stats-search-icon { bottom: 13px; stroke: #d8b675; }
.stats-compact-menu { position: relative; width: 44px; height: 44px; flex: none; }
.stats-compact-menu > summary { list-style: none; width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; color: #d9b77c; background: linear-gradient(130deg,#6a4830,#39251c); border: 1px solid #ad854a; border-radius: 5px; box-sizing: border-box; }
.stats-compact-menu > summary::-webkit-details-marker { display: none; }
.stats-compact-menu > summary svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.stats-compact-menu[open] { z-index: 30; }
.stats-menu-options { position: absolute; top: calc(100% + 6px); right: 0; min-width: 170px; padding: 6px; display: grid; gap: 5px; border: 1px solid #bd995c; border-radius: 5px; background: #40291f; box-shadow: 0 4px 14px #1a0d09aa; z-index: 30; }
.stats-polish .stats-menu-options button { min-height: 44px; padding: 9px; width: 100%; font: 500 14px/1.35 var(--ui-sans); text-align: left; }
.stats-polish .stats-menu-options button[aria-pressed=true] { --button-fill:#8b5635; color:#ffe4af; }
.stats-polish .stats-v4-heading:has(.stats-compact-menu) { min-height: 44px; }
.stats-polish .stats-v4-heading:has(.stats-compact-menu) h3 { margin-inline: 44px; padding-top: 8px; }
.stats-polish .stats-v4-heading > .stats-compact-menu { position: absolute; top: 0; right: 0; }
.stats-polish .stats-peer-card { align-items: flex-start; gap: 8px; padding: 12px; }
.stats-polish .stats-peer-card > img { width: 56px; height: 56px; align-self: center; }
.stats-polish .stats-peer-copy { gap: 7px; }
.stats-polish .stats-peer-copy > strong { font-size: 25px; }
.stats-polish .stats-peer-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.stats-polish .stats-peer-metrics > span { display: grid; justify-items: center; align-content: start; text-align: center; min-width: 0; }
.stats-polish .stats-peer-metrics > span + span { border-left: 1px solid #ac895244; padding-left: 5px; }
.stats-polish .stats-peer-metrics img { width: 23px; height: 23px; }
.stats-polish .stats-peer-metrics span span { font: 400 12px/1.2 var(--ui-sans); min-height: 30px; }
.stats-polish .stats-peer-metrics strong { font: 700 22px/1 var(--ui-serif); }
.stats-polish .stats-v4-results { position: relative; display: flex; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; max-width: 100%; padding: 5px 3px; margin: 6px 0 0; scrollbar-width: thin; scrollbar-color: #b9965d transparent; }
.stats-result-item { display: grid; flex: 0 0 44px; justify-items: center; gap: 4px; position: relative; }
.stats-result-item::before { content: ''; position: absolute; top: 22px; width: calc(100% + 8px); left: -4px; height: 1px; background: #a27c43; pointer-events: none; }
.stats-polish .stats-outcome { position: relative; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.stats-polish .stats-outcome > img { width: 44px; height: 44px; }
.stats-result-item time { color: #765c3d; opacity: .7; font: 400 10px/1.3 var(--ui-sans); }
.stats-polish .stats-streak-columns { margin: 0; gap: 8px; }
.stats-polish .stats-streak-columns > div { padding: 3px 0; gap: 3px; }
.stats-polish .stats-streak-columns h4 { font-size: 21px; min-height: 0; margin: 0; }
.stats-streak-emblem { position: relative; display: grid; width: min(100%,140px); aspect-ratio: 1; justify-items: center; margin-top: 2px; }
.stats-polish .stats-streak-emblem > img { grid-area: 1/1; width: 100%; height: 100%; opacity: 1; }
.stats-polish .stats-streak-emblem > strong { position: absolute; top: 32%; margin: 0; padding: 0; font: 700 38px/1 var(--ui-serif); color: #352419; text-shadow: 0 1px #fff0bf; }
.stats-polish .stats-streak-emblem > span { position: absolute; top: 76%; margin: 0; font: 600 17px/1 var(--ui-serif); color: #f8e7bd; text-shadow: 0 1px 1px #1b160dd9; }
.stats-polish .stats-line { width: 100%; height: auto; aspect-ratio: 360/150; max-height: 155px; margin-top: 4px; }
.stats-polish .stats-chart-line { stroke: #657b44; stroke-width: 2; }
.stats-polish .stats-chart-fill { fill: #7e935238; }
.stats-polish .stats-chart-point { fill: #f5e0a1; stroke: #5c703d; stroke-width: 1.8; }
.stats-polish .stats-grid-line { stroke: #ad956044; stroke-width: .7; }
.stats-polish .stats-reading { min-height: 0; margin: 5px 0 0; font-size: 12px; }
.stats-polish .stats-reading[hidden] { display: none; }
.stats-sr-data { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; clip-path: inset(50%) !important; white-space: nowrap !important; border: 0 !important; }
.stats-month-layout { display: flex; gap: 6px; align-items: center; }
.stats-month-layout > img { width: 65px; height: 65px; flex: none; }
.stats-month-layout > div { min-width: 0; flex: 1; }
.stats-polish .stats-month-chart { width: 100%; height: auto; aspect-ratio: 320/170; max-height: 170px; }
.stats-polish .stats-month-column { stroke: none; }
.stats-polish .stats-month-chart a:focus .stats-month-column { stroke: #596a3c; stroke-width: 1; }
.stats-polish .stats-month-value { font: 600 16px var(--ui-serif); fill: #526138; }
.stats-polish .stats-team-pair > div:nth-child(2) > img { transform: scaleX(-1); }
.stats-polish .stats-team-pair > div { gap: 3px; }
.stats-polish .stats-team-pair > div + div { border-left: 1px solid #ab89543b; }
.stats-team-meter { position: relative; display: flex; height: 25px; margin: 12px 0 3px; padding: 3px; background: linear-gradient(#f4d99d,#9a6d35,#e1bc76); border: 1px solid #8b602b; box-shadow: inset 0 0 0 1px #f8e3ae,0 2px 3px #48271533; clip-path: polygon(8px 0,calc(100% - 8px) 0,100% 50%,calc(100% - 8px) 100%,8px 100%,0 50%); }
.stats-team-meter > span { display: grid; place-items: center; min-width: 0; height: 100%; overflow: hidden; font: 600 18px/1 var(--ui-serif); }
.stats-team-meter .team-meter-good { color: #6b4827; background: repeating-linear-gradient(135deg,#f3e5c9,#f3e5c9 2px,#ead9b6 3px,#ead9b6 4px); }
.stats-team-meter .team-meter-evil { color: #fae7bf; background: repeating-linear-gradient(135deg,#893a3c,#893a3c 2px,#743334 3px,#743334 4px); }
.stats-polish .stats-donut { max-width: 170px; }
.stats-collection-main { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; }
.stats-collection-main > img { width: 72px; height: 72px; flex: none; }
.stats-collection-main > div { flex: 1; min-width: 0; }
.stats-collection-main strong { display: block; font: 700 23px/1.15 var(--ui-serif); }
.stats-polish .stats-collection-main .stats-progress { height: 20px; border: 2px solid #b89455; border-radius: 0; background: repeating-linear-gradient(90deg,#d9c69e 0,#d9c69e 13px,#b79c6966 14px,#b79c6966 15px); box-shadow: inset 0 0 0 1px #f5e5be,0 1px 2px #4b301f33; }
.stats-polish .stats-collection-main .stats-progress > span { background: linear-gradient(#8d4541,#71332e); box-shadow: inset 0 0 0 1px #e3c18b88; }
.stats-polish .stats-sparkline { max-height: 64px; aspect-ratio: 360/84; }
.stats-polish [data-section=collection] > .secondary { min-height: 44px; width: 100%; margin-top: 5px; }
.statistics-methods { padding: 12px 14px; margin: 12px 0; border: 1px solid #a68352; background:#eddfbf; color:#352419; }
.statistics-methods > summary { cursor:pointer; min-height:44px; font:600 22px/1.3 var(--ui-serif); }
.statistics-methods p { font:400 15px/1.6 var(--ui-sans); }
@media(max-width:350px) { .stats-polish .stats-v4-instrument { width:190px; } .stats-polish .stats-company-hero > img { width:80px; height:80px; } .stats-polish .stats-company-total > strong { font-size:34px; } .stats-polish .stats-company-total > span { font-size:13px; } .stats-polish .stats-company-controls { grid-template-columns:minmax(0,1fr) 44px; } .stats-polish .stats-peer-card > img { width:44px; height:44px; } .stats-polish .stats-peer-metrics { gap:3px; } .stats-polish .stats-peer-metrics > span + span { padding-left:3px; } .stats-polish .stats-peer-metrics span span { font-size:11px; min-height:39px; } .stats-polish .stats-peer-copy > strong { font-size:23px; } .stats-polish .stats-streak-emblem > span { font-size:15px; } .stats-polish .stats-streak-emblem > strong { font-size:34px; } .stats-month-layout > img { width:48px; height:48px; } }
.stats-polish .stats-v4-results { gap:3px; padding-inline:5px; scroll-padding-inline:5px; }
.stats-polish .stats-company-total > strong { font:700 46px/1 var(--ui-serif) !important; }
.stats-donut-instrument { position:relative; flex:1 1 130px; min-width:120px; max-width:170px; aspect-ratio:1; margin:auto; }
.stats-polish .stats-donut-instrument > .stats-donut { display:block; width:100%; height:100%; max-width:none; }
.stats-donut-bezel { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
.stats-polish .stats-company-controls { grid-template-columns:minmax(0,1fr) 48px; }
.stats-polish .stats-company-controls > .stats-compact-menu, .stats-polish .stats-company-controls > .stats-compact-menu > summary { width:48px; height:48px; }
/* Streak labels follow the engraved ribbon rather than floating above it. */
.stats-polish .stats-streak-overlay { position:absolute; inset:0; display:block; width:100%; height:100%; overflow:visible; pointer-events:none; }
.stats-streak-number { font-family:var(--ui-serif); font-weight:700; fill:#352619; font-variant-numeric:lining-nums tabular-nums; }
.stats-ribbon-label,.stats-ribbon-shadow { font-family:var(--ui-serif); font-size:28px; font-weight:600; letter-spacing:.2px; }
.stats-ribbon-shadow { fill:#20190ed9; stroke:#20190e99; stroke-width:.8px; }
.stats-ribbon-label { fill:#eddaa4; stroke:#41301e88; stroke-width:.6px; paint-order:stroke fill; }
.stats-polish .stats-peer-metrics > span { gap:5px; }
.stats-polish .stats-peer-metric-heading { display:block; min-height:30px; }
.stats-polish .stats-peer-metrics .stats-peer-figure { display:flex; flex-wrap:nowrap; justify-content:center; align-items:center; gap:4px; min-height:0; }
.stats-polish .stats-peer-figure img { width:32px; height:32px; flex:none; }
.stats-polish .stats-peer-figure strong { font:700 23px/1 var(--ui-serif); }
.stats-leader-names { min-width:0; }
.stats-leader-names summary { cursor:pointer; font:700 21px/1.2 var(--ui-serif); overflow-wrap:anywhere; }
.stats-leader-names p { font:500 15px/1.5 var(--ui-sans); }
.stats-role-segments { display:grid; width:100%; height:22px; padding:2px; gap:1px; margin:8px 0; border:2px solid #b89455; background:linear-gradient(#b99760,#e5cf9d); box-shadow:inset 0 0 0 1px #f7e8bd,0 1px 2px #54371d33; box-sizing:border-box; }
.stats-role-segments > span { min-width:0; height:100%; background:linear-gradient(#f2e4c5,#dfcca1); box-shadow:inset 0 0 0 .5px #98744366; }
.stats-role-segments > span.is-earned { background:linear-gradient(#98514a,#723831); box-shadow:inset 0 0 0 .5px #f5d99c66; }
.stats-date-range { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:8px; margin:8px 0; }
.stats-date-range label { min-width:0; display:grid; gap:4px; color:#6e5032; font:500 12px/1.3 var(--ui-sans); }
.stats-date-range input { min-width:0; width:100%; height:44px; padding:6px; box-sizing:border-box; color:#352419; background:#f2e5ca; border:1px solid #b3935c; border-radius:3px; font:400 14px var(--ui-sans); }
.stats-date-range button { grid-column:1/-1; min-height:44px; }
.stats-date-error { grid-column:1/-1; color:#8c3d32; font:500 13px/1.4 var(--ui-sans); margin:0; }
.stats-date-error:empty { display:none; }
@media(max-width:350px) { .stats-polish .stats-peer-metrics .stats-peer-figure { gap:2px; } .stats-polish .stats-peer-figure strong { font-size:19px; } .stats-polish .stats-peer-figure img { width:30px; height:30px; } }
/* Selection follows the actual annular sector; SVG focus never frames the square. */
.stats-polish .stats-donut .stats-sector-button { cursor:pointer; outline:none; -webkit-tap-highlight-color:transparent; }
.stats-polish .stats-donut .stats-sector-button:focus,.stats-polish .stats-donut .stats-sector-button:focus-visible { outline:none; }
.stats-polish .stats-sector-piece { stroke:none; stroke-width:0; transition:filter .15s ease; }
.stats-polish .stats-sector-button.is-selected > .stats-sector-piece,.stats-polish .stats-sector-button:focus-visible > .stats-sector-piece { stroke:#f8e3a7; stroke-width:2; filter:brightness(1.13); paint-order:fill stroke; }
.stats-polish .stats-outcome.is-latest { outline:none; }
.stats-polish .stats-month-layout > img { transform:scaleX(-1); }
.stats-polish .stats-company-count { display:grid; grid-template-columns:86px; grid-template-rows:86px auto; width:86px; height:auto; align-content:center; gap:3px; }
.stats-polish .stats-company-count > img { grid-column:1; grid-row:1; width:86px; height:86px; }
.stats-polish .stats-company-wreath-overlay { grid-column:1; grid-row:1; width:86px; height:86px; pointer-events:none; }
.stats-polish .stats-company-wreath-number { font:700 84px var(--ui-serif); font-variant-numeric:lining-nums tabular-nums; fill:#352619; }
.stats-polish .stats-company-count > span { position:static; top:auto; grid-column:1; grid-row:2; text-align:center; font:600 13px/1.2 var(--ui-serif); }
.stats-polish .stats-streak-number,.stats-polish .stats-company-wreath-number { font-variant-numeric:normal; }
.achievement-v5 { --profile-cut: 9px; }
.achievement-v5 [hidden] { display: none !important; }
.achievement-v5-controls { display: grid; gap: 9px; }
.achievement-v5-tabs { display: grid; }
.achievement-v5-controls button { min-height: 44px; padding: 7px 3px; }
.achievement-v5-controls button[aria-pressed="true"] { --button-fill: #8a4f36; }
.achievement-v5-card, .achievement-city-card {
  min-width: 0; margin: 0; border: 1px solid #aa8050; border-radius: 8px;
  background: url('/materials/profile-art-v1/grain.png') repeat, linear-gradient(130deg,#f6e8c5,#ead8ad);
  background-size: 144px 144px,auto; background-blend-mode: multiply,normal;
  box-shadow: inset 0 0 0 2px #f5e7bc; color: #493421;
}
.achievement-v5-row { align-items: center; list-style: none; min-height: 48px; cursor: pointer; }
.achievement-v5-row::-webkit-details-marker { display: none; }
.achievement-v5-row:focus-visible { outline: 2px solid #7d4d31; outline-offset: -4px; }
.achievement-v5-copy { display: grid; flex: 1; min-width: 0; gap: 4px; }
.achievement-v5-copy strong, .achievement-city-copy h4 { font: 700 22px/1.15 var(--ui-serif); overflow-wrap: anywhere; }
.achievement-chevron { font-size: 24px; }
.achievement-v5-card[open] .achievement-chevron { transform: rotate(90deg); }
.achievement-v5-detail { display: grid; gap: 10px; padding: 2px 12px 12px; }
.achievement-v5-detail progress { width: 100%; accent-color: #9c742e; }
.achievement-legacy ul { padding: 0 20px 10px 32px; }
.achievement-city-card { display: grid; grid-template-columns: 84px minmax(0,1fr); align-items: center; gap: 12px; padding: 8px; }
.achievement-city-card img, .achievement-city-placeholder { width: 84px; height: 60px; border-radius: 4px; object-fit: cover; }
.achievement-city-placeholder { display: grid; place-items: center; background: #674c36; color: #e8c788; }
.achievement-city-placeholder svg { width: 24px; height: 24px; }
.achievement-city-copy h4, .achievement-city-copy p { margin: 2px 0; }
.achievement-city-copy p { font-size: 13px; }
@media(prefers-reduced-motion:reduce) { .achievement-notice { animation:none; } }
#chronicle:has(> .achievement-v5:not([hidden])) {
  max-width: 576px; width: calc(100% - 24px); margin: 12px auto 0; padding: 0;
  border: 0; background: transparent; box-shadow: none; color: #f7e6c5;
}
#chronicle:has(> .achievement-v5:not([hidden])) > .page-title { border: 0; margin-bottom: 12px; padding: 0; }
#chronicle:has(> .achievement-v5:not([hidden])) > .page-title h2,
.achievement-v5 .achievement-summary, .achievement-v5 .achievement-empty { color: #f7e6c5; }
.achievement-v5 .achievement-page-heading { justify-content: flex-end; margin-bottom: 4px; }
.achievement-v5 .achievement-page-heading > div { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
.achievement-v5 .achievement-summary { margin-top: -36px; padding-right: 122px; }
.achievement-v5 .achievement-filters button { min-height: 44px; }

.rating-period { display: flex; gap: 6px; margin-bottom: 12px; }
.rating-period button { flex: 1; padding: 7px 9px; min-height: 40px; font-size: 13px; }
.rating-period button[aria-pressed="true"] { --button-fill: #78503a; --button-line: #b48e57; color: #ffedc3; }
.rating-history-chart { display: block; width: 100%; height: auto; overflow: visible; }
.rating-history-chart text { fill: #705439; font: 11px var(--ui-sans); }
.rating-neutral { stroke: #98734d; stroke-width: 1; stroke-dasharray: 4 4; }
.rating-profile-line { fill: none; stroke: #526948; stroke-width: 2.5; stroke-linejoin: round; }
.rating-profile-point { fill: #526948; stroke: #eadfbe; stroke-width: 1; }
.rating-match-point { fill: #93652d; stroke: #eadfbe; stroke-width: 1.5; }
.rating-match-point.is-provisional { fill: #eadfbe; stroke: #93652d; stroke-width: 2; }
.rating-history-chart [role="button"] { cursor: pointer; }
.rating-history-chart [aria-pressed="true"] .rating-match-point { stroke: #39261c; stroke-width: 2.5; }
.rating-history-chart [role="button"]:focus-visible { outline: 2px solid #78503a; }
.rating-legend { display: flex; flex-wrap: wrap; gap: 5px 13px; font: 500 12px/1.4 var(--ui-sans); }
.rating-legend-match { color: #795123; }
.rating-legend-profile { color: #435d40; }
.rating-legend small { flex-basis: 100%; font-size: 11px; color: #705439; }
.rating-selection { margin-top: 14px; padding-top: 12px; border-top: 1px solid #b18a5266; }
.rating-selection h4 { margin: 0 0 12px; font: 650 22px/1.2 var(--ui-serif); }
.rating-selected-values { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rating-selected-values > div { display: grid; align-content: start; gap: 3px; }
.rating-selected-values span, .rating-selected-values small { font: 500 12px/1.4 var(--ui-sans); color: #705439; }
.rating-selected-values strong { font: 700 38px/1 var(--ui-serif); color: #563320; }
.rating-selected-values > div + div { border-left: 1px solid #b18a5266; padding-left: 12px; }
.rating-causes { display: grid; gap: 9px; list-style: none; margin: 10px 0 14px; padding: 0; }
.rating-causes li { display: grid; gap: 3px; border-left: 2px solid #435d40; padding-left: 9px; }
.rating-causes [data-direction="negative"] { border-color: #803c44; }
.rating-causes small { color: #705439; font-size: 12px; line-height: 1.4; }
.rating-selection > button { width: 100%; }
.rating-match-list { margin-top: 14px; }
.rating-guide > summary, .rating-match-list > summary { cursor: pointer; padding: 6px 0; font: 500 14px/1.4 var(--ui-sans); }
.rating-history-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; margin-top: 5px; min-height: 44px; padding: 8px 10px; font-size: 14px; }
.rating-history-row[aria-pressed="true"] { outline: 2px solid #98734d; outline-offset: -2px; }

.rating-coaching { margin: 10px 0; }
.rating-coaching > h4 { margin: 0 0 6px; font: 650 19px/1.2 var(--ui-serif); }
.rating-coaching-card { margin-top: 5px; border-left: 2px solid #93652d; background: #a8844914; }
.rating-coaching-card[data-kind="keep"] { border-color: #526948; }
.rating-coaching-card > summary { display: grid; align-content: center; gap: 3px; position: relative; min-height: 44px; padding: 7px 26px 7px 10px; list-style: none; cursor: pointer; }
.rating-coaching-card > summary::-webkit-details-marker { display: none; }
.rating-coaching-card > summary::after { content: '›'; position: absolute; top: 50%; right: 10px; transform: translateY(-50%); color: #705439; font-size: 21px; }
.rating-coaching-card[open] > summary::after { transform: translateY(-50%) rotate(90deg); }
.rating-coaching-card > summary:focus-visible { outline: 2px solid #93652d; outline-offset: 2px; }
.rating-coaching-card small { color: #705439; font: 500 11px/1.3 var(--ui-sans); }
.rating-coaching-card strong { color: #39261c; font: 650 16px/1.25 var(--ui-serif); }
.rating-coaching-body { padding: 0 10px 8px; }
.rating-coaching-body p { margin: 4px 0; font: 400 13px/1.45 var(--ui-sans); overflow-wrap: anywhere; }
.rating-coaching-body .rating-coaching-basis { margin-top: 8px; color: #705439; }
.rating-key-decisions > summary { padding: 6px 0; cursor: pointer; font: 400 12px/1.4 var(--ui-sans); }

/* Achievement art v1: one parchment surface, individual engraved medals. */
.achievement-v5 {
  padding: 14px 10px 18px; border: 1px solid #a47b44; border-radius: 12px 5px;
  background: url('/materials/profile-art-v1/grain.png') repeat,linear-gradient(120deg,#f4e6c6,#e8d3a9);
  background-size:144px 144px,auto; background-blend-mode:multiply,normal;
  box-shadow:inset 0 0 0 3px #f3e5bf,0 6px 18px #160b0770;
}
.achievement-v5 .achievement-summary {
  display:flex;align-items:center;gap:12px;margin:12px 0 16px;padding:12px 8px;
  min-height:84px;color:#352419;border:1px solid #b89a66;border-radius:8px 3px;
  background:linear-gradient(120deg,#fff5db55,#ad7b3422);
}
.achievement-summary>img { width:64px;height:64px;object-fit:contain;flex:none; }
.achievement-summary-copy { display:grid;gap:8px;min-width:0; }
.achievement-summary-copy strong { font:700 24px/1.15 var(--ui-serif); }
.achievement-total-xp { font:600 14px/1.3 var(--ui-serif);color:#6f3525; }
.achievement-v5 .achievement-filters { display:grid; }
.achievement-v5 .achievement-filters button { padding:8px 3px;font-size:13px;min-width:0; }
.achievement-v5-card { position:relative;box-shadow:inset 0 0 0 2px #f5e7bc,0 3px 6px #4d2c2025; }
.achievement-v5-row { display:grid;grid-template-columns:76px minmax(0,1fr) auto;gap:10px;padding:16px 10px 12px;position:relative; }
.achievement-v5 .achievement-medallion {min-width:0;aspect-ratio:1;flex:none;border:0;border-radius:50%;background:transparent;box-shadow:none;
  grid-column:1;grid-row:1 / 3;filter:grayscale(1) saturate(0) opacity(.65);
}
.achievement-v5 .is-unlocked .achievement-medallion { filter:none; }
.achievement-v5 .achievement-medallion img { display:block;width:100%;height:100%;object-fit:contain; }
.achievement-v5 .achievement-medallion.art-unavailable { background:radial-gradient(circle,#b8aa91,#776d5a);box-shadow:inset 0 0 0 3px #b7a17b; }
.achievement-v5 .achievement-v5-copy { grid-column:2 / 4; }
.achievement-v5 .achievement-v5-copy strong { font:700 22px/1.08 var(--ui-serif); }
.achievement-condition { font:italic 15px/1.3 var(--ui-serif);color:#60472e; }
.achievement-v5 .achievement-state { white-space:normal;font:500 12px/1.35 var(--ui-sans,system-ui);color:#6b5c48; }
.achievement-v5 .is-unlocked .achievement-state { color:#51603a; }
.achievement-xp { grid-column:2;grid-row:2;justify-self:start;padding:3px 10px;border:1px solid #aa8248;background:#69432c;color:#f7e6c5;font:600 15px/1.25 var(--ui-serif);border-radius:3px; }
.achievement-v5 .achievement-chevron { grid-column:3;grid-row:2;color:#75502d; }
.achievement-ribbon {
  position:absolute;left:12px;top:0;width:12px;height:27px;background:#aaa393;
  border-left:1px solid #7e725e;border-right:1px solid #7e725e;
  clip-path:polygon(0 0,100% 0,100% 100%,50% 80%,0 100%);
}
.is-unlocked .achievement-ribbon { background:linear-gradient(90deg,#a77b3f 0 12%,#8b332b 12% 88%,#a77b3f 88%); }
.is-secret .achievement-state::before { content:'⌑ '; }
.achievement-v5 .achievement-footnote { color:#715636!important;font-size:12px!important; }
.achievement-v5 .achievement-empty { color:#60472e; }
.achievement-v5 .achievement-page-heading { margin:0;min-height:36px; }
@media(max-width:360px) {
  .achievement-v5 { padding-inline:8px; }
  .achievement-v5-row { grid-template-columns:62px minmax(0,1fr) auto;gap:8px;padding-inline:8px; }
  .achievement-summary>img { width:52px;height:52px; }
  .achievement-summary-copy strong { font-size:22px; }
}
.achievement-v5-tabs button { font:600 21px/1.15 var(--ui-serif); }
.achievement-v5-controls > button { font:600 17px/1.2 var(--ui-serif); }
.achievement-v5 .achievement-filters button { font:600 16px/1.15 var(--ui-serif); }
.achievement-v5 .achievement-refresh-quiet { display:block;margin:12px auto 0;min-height:44px;padding:8px 18px;background:transparent;border:1px solid #987544;color:#60472e;font:600 16px/1.2 var(--ui-serif); }
.achievement-notice-icon img { width:48px;height:48px;object-fit:contain; }
@media(max-width:360px) { .achievement-v5-tabs button { font-size:19px; }.achievement-v5 .achievement-filters button { font-size:15px; } }
/* Shared selection convention: light selected choice, dark alternatives. */
body.game-skin button[aria-pressed],body.game-skin button[aria-selected] {
  --button-fill:#523526!important;--button-line:#a17a46!important;
  color:#f7e6c5!important;background-color:#523526!important;border-color:#a17a46!important;
}
body.game-skin button[aria-pressed="true"],body.game-skin button[aria-selected="true"] {
  --button-fill:#eadbbc!important;--button-line:#c9a262!important;
  color:#352419!important;background-color:#eadbbc!important;border-color:#c9a262!important;
}
.achievement-v5-tabs { grid-template-columns:repeat(4,minmax(0,1fr));gap:3px; }
.achievement-v5 .achievement-filters { grid-template-columns:.65fr 1fr 1fr;gap:6px;margin:8px 0; }
.achievement-v5 .achievement-list { gap:8px; }
.achievement-v5 .achievement-v5-row {
  grid-template-columns:68px minmax(0,1fr) 58px;grid-template-rows:auto auto;
  min-height:92px;gap:5px 8px;padding:10px 8px;
}
.achievement-v5 .achievement-medallion { width:68px;height:68px;grid-row:1/3; }
.achievement-v5 .achievement-v5-copy { grid-column:2/4;grid-row:1;gap:3px; }
.achievement-v5 .achievement-v5-copy strong { font-size:21px;line-height:1.03; }
.achievement-v5 .achievement-condition { font-size:14px;line-height:1.15; }
.achievement-v5 .achievement-state { font-size:11px;line-height:1.2; }
.achievement-v5 .achievement-xp { grid-column:3;grid-row:2;justify-self:end;align-self:center;font-size:17px;padding:2px 7px;white-space:nowrap; }
.achievement-v5 .achievement-chevron { display:none; }
.achievement-v5 .achievement-ribbon {
  left:7px;top:-1px;border:0;clip-path:none;
  background: url('/materials/achievement-ribbon.webp') center top/contain no-repeat;
  filter:grayscale(1) brightness(.9);pointer-events:none;
}
.profile-xp { display:inline-block;margin:5px 0 0;padding:3px 10px;color:#683827;border:1px solid #ac874b;border-radius:4px;font:600 19px/1.1 var(--ui-serif); }
@media(max-width:360px) {
  .achievement-v5 .achievement-v5-tabs button { font-size:17px; }
  .achievement-v5 .achievement-v5-row { grid-template-columns:58px minmax(0,1fr) 54px;gap:4px 7px;min-height:88px; }
  .achievement-v5 .achievement-medallion { width:58px;height:58px; }
  .achievement-v5 .achievement-v5-copy strong { font-size:19px; }
  .achievement-v5 .achievement-condition { font-size:13px; }
}
body.game-skin button.selected { --button-fill:#eadbbc!important;--button-line:#c9a262!important;color:#352419!important;background-color:#eadbbc!important;border-color:#c9a262!important; }
body.game-skin .secondary[aria-pressed],body.game-skin .primary[aria-pressed],body.game-skin .actions button[aria-pressed] { background-color:transparent!important; }
.achievement-date { margin:0;font-size:12px;color:#715636; }
.achievement-v5.is-city-album .achievement-list { margin-top:14px; }
.achievement-v5 .achievement-city-card { grid-template-columns:96px minmax(0,1fr); }
.achievement-v5 .achievement-city-card img,.achievement-v5 .achievement-city-placeholder { width:96px;height:54px;object-fit:contain; }
.achievement-v5 .achievement-ribbon { width:20px;height:30px;filter:grayscale(1) brightness(2.8) contrast(.35);opacity:.7; }
.achievement-v5 .is-unlocked .achievement-ribbon { filter:none;opacity:1; }
/* Full audited conditions remain in expanded details; list cards stay compact. */
.achievement-v5 .achievement-condition { display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden; }
/* Shared-table player profiles use the existing paper and statistics kit. */
.stats-peer-identity{display:flex;align-items:center;gap:16px;min-width:0}
.stats-peer-identity>img{width:80px;height:96px;object-fit:contain;flex:none}
.stats-peer-identity strong{font:700 26px Witness,Georgia,serif}
.stats-peer-identity>div{min-width:0;overflow-wrap:anywhere}
.stats-peer-medallion{width:58px;height:58px;object-fit:contain;flex:none}
.stats-peer-portrait{object-fit:contain}
.stats-peer-award{display:grid;grid-template-columns:58px minmax(0,1fr) auto;gap:10px;align-items:center}
.stats-peer-award h4,.stats-peer-award p{margin:0 0 4px}
.stats-peer-award .is-locked{filter:grayscale(1);opacity:.6}
.stats-peer-xp{font:700 17px Witness,Georgia,serif;white-space:nowrap}
.stats-peer-shared-detail{grid-column:1/-1;margin:0;font-size:14px}
.stats-peer-award h4{overflow-wrap:anywhere}
@media(max-width:360px){.stats-peer-award{grid-template-columns:48px minmax(0,1fr)}.stats-peer-award .stats-peer-medallion{width:48px;height:48px}.stats-peer-xp{grid-column:2;text-align:right}}
.match-xp-result{padding:16px;margin:12px 0;color:var(--ui-paper-ink,#352419)}
.match-xp-result p{font:400 15px/1.45 var(--ui-sans,system-ui);margin:0 0 8px}
.match-xp-result h3{font:700 26px Witness,Georgia,serif}
.achievement-city-xp{font-weight:600}
/* Foreign profiles share the profile type scale, paper and 12px rhythm. */
#profile-analytics-panel[data-profile-mode="other"] {
  --foreign-gap: 12px;
  --foreign-caption: 13px;
  color: var(--ui-paper-ink, #352419);
}
#profile-analytics-panel[data-profile-mode="other"] .stats-heading { flex-wrap: nowrap; align-items: center; }
#profile-analytics-panel[data-profile-mode="other"] .stats-heading h2 { font-size: clamp(27px,7vw,36px); }
#profile-analytics-panel[data-profile-mode="other"] .stats-heading > button { flex: 0 0 44px; }
.foreign-page-context { margin: -7px 0 14px 56px; color: #d0b794; font: 400 13px/1.4 var(--ui-sans); overflow-wrap: anywhere; }
.foreign-identity { display: grid; grid-template-columns: 88px minmax(0,1fr); gap: 14px; align-items: center; padding: 0; border: 0; background: none; box-shadow: none; }
.stats-polish .foreign-avatar { width: 88px; height: 108px; aspect-ratio: auto; object-fit: contain; }
.foreign-identity h2 { margin: 0; font: 700 clamp(30px,8vw,40px)/1.08 var(--ui-serif); overflow-wrap: anywhere; }
.foreign-identity .foreign-context { margin: 6px 0; font: 400 14px/1.4 var(--ui-sans); }
.foreign-identity .profile-xp { display: inline-block; margin: 4px 0 0; }
.foreign-profile-link { width: 100%; min-height: 86px; margin: 0; padding: 12px 14px; display: flex; align-items: center; gap: 12px; text-align: start; }
.foreign-profile-link > img { width: 58px; height: 58px; aspect-ratio: 1; object-fit: contain; flex: none; }
.foreign-profile-link .profile-card-copy { display: grid; flex: 1; min-width: 0; gap: 5px; }
.foreign-profile-link .profile-card-title { font: 700 25px/1.08 var(--ui-serif); overflow-wrap: anywhere; }
.foreign-profile-link .profile-card-subtitle { font: 400 14px/1.4 var(--ui-sans); color: #6d553d; }
.foreign-profile-tiles { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.foreign-profile-tiles .foreign-profile-link { padding: 11px 10px; gap: 6px; min-height: 78px; }
.foreign-profile-tiles .profile-card-title { font-size: clamp(16px,4.8vw,21px); }
.foreign-profile-tiles .profile-card-subtitle { font-size: 13px; }
.foreign-profile-tiles img { width: 36px; height: 36px; }
.foreign-profile-tiles .profile-chevron { font-size: 18px; width: 10px; }
.foreign-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; text-align: center; }
.foreign-pair > div { min-width: 0; }
.foreign-pair > div + div { border-left: 1px solid #b18a5255; padding-left: 14px; }
.stats-polish .foreign-pair img { width: 82px; height: 98px; aspect-ratio: auto; object-fit: contain; }
.foreign-pair h3 { margin: 5px 0; font: 700 26px/1.1 var(--ui-serif); overflow-wrap: anywhere; }
.foreign-pair strong { font: 600 20px/1.2 var(--ui-serif); color: #683827; }
#profile-analytics-panel[data-profile-mode="other"] .stats-v3-segments { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; margin: 0; }
#profile-analytics-panel[data-profile-mode="other"] .stats-v3-segments button { min-height: 44px; padding: 7px 4px; font: 600 18px/1.15 var(--ui-serif); }
.foreign-comparison-row { display: grid; grid-template-columns: minmax(0,1.8fr) repeat(2,minmax(0,1fr)); gap: 6px 10px; padding: 10px 0; border-bottom: 1px solid #b18a5255; align-items: center; font: 400 14px/1.4 var(--ui-sans); }
.foreign-comparison-row:last-child { border-bottom: 0; }
.foreign-comparison-row strong { text-align: center; font: 700 26px/1.1 var(--ui-serif); overflow-wrap: anywhere; }
.foreign-comparison-row.is-column-heading { padding-block: 4px 8px; }
.foreign-comparison-row.is-column-heading strong { font: 600 14px/1.35 var(--ui-sans); }
.foreign-comparison-row small { grid-column: 1/-1; color: #6d553d; font-size: 12px; line-height: 1.45; }
.foreign-pair-totals { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.foreign-pair-totals > div { display: grid; gap: 5px; text-align: center; min-width: 0; }
.foreign-pair-totals > div:nth-child(2n) { border-left: 1px solid #b18a5255; }
.foreign-pair-totals strong { font: 700 36px/1 var(--ui-serif); }
.foreign-pair-totals span { font: 400 14px/1.35 var(--ui-sans); }
.foreign-shared-result { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-block: 7px; border-bottom: 1px solid #b18a5244; font: 400 14px/1.4 var(--ui-sans); }
.foreign-shared-result strong { flex: none; font: 700 23px/1.1 var(--ui-serif); }
.foreign-result-totals { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; padding: 6px 0; }
.foreign-result-totals > div { display: grid; gap: 4px; text-align: center; }
.foreign-result-totals > div + div { border-left: 1px solid #b18a5255; }
.foreign-result-totals strong { font: 700 34px/1.1 var(--ui-serif); }
.foreign-result-totals span { font: 400 14px/1.4 var(--ui-sans); }
#profile-analytics-panel .foreign-role-controls { display:block;width:44px;flex:0 0 44px;margin-left:auto; }
#profile-analytics-panel[data-profile-mode="other"] .stats-heading h2 { flex:1;min-width:0; }
#profile-analytics-panel .foreign-role-controls > .stats-v3-segments { display: contents; }
.foreign-role-controls h3 { margin:0;color:#f7e6c5;font:700 25px/1.15 var(--ui-serif); }
.foreign-role-controls .stats-compact-menu { margin: 0; }
.foreign-role-controls .stats-compact-menu > summary { height: 100%; min-height: 44px; }
.stats-polish .foreign-role-row { display: grid; grid-template-columns: 56px minmax(0,1fr) 16px; padding: 12px 14px; gap: 10px; min-height: 112px; }
.foreign-role-row .role-collection-copy { font-size: 15px; }
.foreign-role-row .role-collection-name > strong { font-size: 27px; }
.stats-polish .foreign-role-hero { display: grid; grid-template-columns: clamp(84px,27vw,112px) minmax(0,1fr); gap: 12px; padding: 14px; }
.stats-polish .foreign-role-hero .role-collection-portrait { width: 100%; height: 160px; aspect-ratio: auto; object-fit: cover; }
.foreign-role-hero .role-detail-compact-stats h3 { font-size: 20px; text-align: start; margin: 8px 0; }
.foreign-role-hero .role-personal-results { display: grid; gap: 4px; font-size: 14px; margin-top: 7px; }
#profile-analytics-panel .foreign-role-ability .copy-block h4 { font: 700 23px/1.2 var(--ui-serif); }
#profile-analytics-panel .foreign-role-ability .copy-block p { font: 400 16px/1.5 var(--ui-sans); }
#profile-analytics-panel[data-profile-mode="other"] .foreign-award-categories { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 3px; }
#profile-analytics-panel[data-profile-mode="other"] .foreign-award-filters { grid-template-columns: .65fr 1fr 1fr; }
.foreign-awards { display: grid; gap: 8px; min-width: 0; }
.foreign-awards .achievement-v5-card { margin: 0; }
.foreign-awards .achievement-medallion img { object-fit: contain; }
.foreign-awards .achievement-v5-detail { white-space: normal; }
.foreign-city-album { display: grid; gap: 12px; }
.foreign-city-card { display: grid; grid-template-columns: 96px minmax(0,1fr); align-items: center; gap: 12px; padding: 14px; min-height: 96px; }
.foreign-city-card > div { min-width: 0; }
.stats-polish .foreign-city-card > img, .foreign-city-placeholder { width: 96px; height: 64px; aspect-ratio: auto; object-fit: cover; border: 1px solid #a17a46; }
.foreign-city-placeholder { background: #c9b58d; opacity: .55; }
.foreign-city-card h3 { margin: 0 0 5px; font: 700 25px/1.1 var(--ui-serif); overflow-wrap: anywhere; }
.foreign-city-card p { margin: 0; font: 400 14px/1.4 var(--ui-sans); color: #6d553d; }
.stats-polish .foreign-history-row { display: grid; grid-template-columns: 54px minmax(0,1fr) 16px; gap: 8px 10px; padding: 13px; text-align: start; min-width: 0; max-width: 100%; }
.foreign-history-row > * { min-width: 0; }
.stats-polish .foreign-history-row > img { width: 54px; height: 54px; }
.foreign-history-copy { display: grid; gap: 4px; min-width: 0; }
.foreign-history-top { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 10px; font: 400 14px/1.35 var(--ui-sans); }
.foreign-outcome { font-weight: 650; }
.foreign-history-role { font: 700 24px/1.1 var(--ui-serif); overflow-wrap: anywhere; }
.foreign-history-meta { font: 400 14px/1.35 var(--ui-sans); }
.foreign-history-copy small { font: 400 12px/1.4 var(--ui-sans); color: #6d553d; }
.foreign-history-relation, .foreign-history-viewer { grid-column: 1/-1; display: flex; flex-wrap: wrap; gap: 3px 10px; padding-top: 7px; border-top: 1px solid #b18a5255; font: 400 14px/1.4 var(--ui-sans); overflow-wrap: anywhere; }
.foreign-history-relation strong { font-weight: 650; }
.foreign-history-viewer { display: grid; gap: 3px; padding-top: 0; border-top: 0; }
.foreign-match-roster { padding: 14px; margin: 0; color: var(--ui-paper-ink); }
.foreign-match-roster h3 { font: 700 26px/1.1 var(--ui-serif); }
.match-roster-open { width:100%; color:inherit; box-shadow:none; clip-path:none; text-align:start; cursor:pointer; }
.match-roster-open::before, .match-roster-open::after { display: none; }
.match-roster-open > div { min-width: 0; }
.match-roster-open:focus-visible { outline: 2px solid #805022; outline-offset: -2px; }
.match-roster-open:active { background: #b18a5222; }
.match-roster-link-item { list-style: none; min-width: 0; }
.foreign-match-report { color: var(--ui-paper-ink); min-width: 0; }
.foreign-match-report .match-report-phase { margin: 0 0 12px; color: var(--ui-paper-ink); }
.foreign-match-report .match-report-note { margin: 0 0 12px; padding: 12px 14px; background: var(--ui-paper); background-image: var(--profile-grain); background-size: 144px 144px; color: #6d553d; font: 400 14px/1.45 var(--ui-sans); }
@media(max-width:350px) {
  .foreign-profile-link .profile-card-title { font-size: 23px; }
  .foreign-profile-tiles .foreign-profile-link { padding: 10px 8px; }
  .foreign-profile-tiles img { width: 26px; height: 26px; }
  .foreign-profile-tiles .foreign-profile-link { display:grid;grid-template-columns:26px minmax(0,1fr) 10px;grid-template-rows:auto auto;gap:5px 6px; }
  .foreign-profile-tiles .profile-card-copy { display:contents; }
  .foreign-profile-tiles .profile-card-title { grid-column:1/-1;grid-row:1;font-size:20px; }
  .foreign-profile-tiles .profile-card-subtitle { grid-column:2;grid-row:2; }
  .foreign-profile-tiles img { grid-column:1;grid-row:2; }
  .foreign-profile-tiles .profile-chevron { grid-column:3;grid-row:2; }
  .foreign-comparison-row { grid-template-columns: minmax(0,1.6fr) repeat(2,minmax(0,1fr)); gap: 5px 7px; }
  #profile-analytics-panel[data-profile-mode="other"] .stats-v3-segments button { font-size: 17px; }
  #profile-analytics-panel[data-profile-mode="other"] .foreign-award-categories button { font-size: 17px; }
  .stats-polish .foreign-role-row { padding-inline: 12px; }
  .foreign-role-row .role-collection-name > strong { font-size: 25px; }
}
/* A chart key is part of the paper diagram, rather than a dark navigation bar. */
.stats-polish .stats-donut-legend .stats-legend-row[aria-pressed] {
  --button-fill:transparent!important;--button-line:transparent!important;
  background-color:transparent!important;color:#352419!important;border-color:transparent!important;
  border-bottom:1px solid #b18a5233!important;
}
.stats-polish .stats-donut-legend .stats-legend-row[aria-pressed="true"] {
  --button-fill:#fff1cf!important;background-color:#fff1cf!important;box-shadow:inset 3px 0 #98713d;
}
.stats-polish .stats-donut-legend .stats-legend-row span { min-width:0;overflow-wrap:anywhere; }
.stats-polish .stats-donut-legend .stats-legend-row strong { flex:none; }
/* Identical achievement controls in self and other profiles. */
.achievement-v5 .achievement-v5-tabs button, #profile-analytics-panel[data-profile-mode="other"] .foreign-award-categories button { padding:5px 1px;font-size:19px;min-height:40px;font-family:var(--ui-serif);font-weight:600;line-height:1.15; }
.achievement-v5 .achievement-filters button, #profile-analytics-panel[data-profile-mode="other"] .foreign-award-filters button { min-height:32px;padding:5px 4px;font-size:15px;line-height:1.1;font-family:var(--ui-serif);font-weight:600; }
@media(max-width:360px){.achievement-v5 .achievement-v5-tabs button,#profile-analytics-panel[data-profile-mode="other"] .foreign-award-categories button{font-size:17px;}}
/* A period menu may open above its card on a short phone. */
.stats-polish .stats-paper:has(.stats-compact-menu[open]) { clip-path:none;overflow:visible;z-index:40; }
.diagnostic-radar { display:block;width:min(100%,360px);height:auto;margin:0 auto; }
.diagnostic-radar-grid { stroke:#8d6b42;stroke-width:.75;fill:none;opacity:.57; }
.diagnostic-radar-label { font:400 11px/1 var(--ui-sans);fill:#503a28; }
.diagnostic-radar-value { font:500 16px/1 var(--ui-serif);fill:#68382a; }
/* Brass laurels frame the profile scores. */
.profile-identity:has(> .profile-metrics) { row-gap:8px; }
.profile-identity:has(> .profile-metrics) .profile-person::after { display:none; }
.profile-identity:has(> .profile-metrics) > :first-child { grid-row:1 / span 2; }
.profile-metrics {
  grid-column:2; display:flex; flex-wrap:wrap; justify-content:flex-start;
  gap:4px 7px; min-width:0; padding-top:7px;
  border-top:1px solid #9c773c66;
}
.profile-metrics:not(:has(.profile-metric:not([hidden]))) { display:none; }
.profile-metric { display:grid; justify-items:center; gap:2px; min-width:0; padding-inline:0; text-align:center; }
.profile-metric:not([hidden]) + .profile-metric { border-left:1px solid #9c773c77; padding-left:7px; }
.profile-metric-medal {
  position:relative; display:flex; align-items:center; justify-content:center; gap:4px;
  min-width:0; max-width:100%; min-height:29px; padding:1px 12px;
  color:#352419; font:500 clamp(20px,5.5vw,29px)/1.05 var(--ui-serif);
  font-variant-numeric:lining-nums tabular-nums; white-space:nowrap;
}
.profile-metric[data-metric="xp"] .profile-metric-medal { background:radial-gradient(ellipse,#bf9a4b42,transparent 75%); }
.profile-xp-label { font-size:.7em; }
.profile-metric-medal > svg:not(.profile-laurel) { width:16px;height:16px;flex:none;fill:#a97326;stroke:#7c4d18;stroke-width:.5; }
.profile-metric-medal .profile-laurel {
  position:absolute; top:0; width:10px; height:30px; fill:#a57835; stroke:#8b602c; stroke-width:.5;
  pointer-events:none;
}
.profile-laurel-left { left:0; transform:scaleX(-1); }
.profile-laurel-right { right:0; }
@media(max-width:375px) {
  .profile-identity:has(> .profile-metrics) > :first-child { grid-row:1; }
  .profile-metrics { grid-column:1/-1; justify-content:center; }
}
.stats-polish .diagnostic-radar-card .stats-v4-heading h3 { font-weight:600; }
.stats-polish .diagnostic-radar-card .diagnostic-radar-caption {
  margin:0 0 8px; text-align:center; font:400 13px/1.4 var(--ui-sans); color:#6d553d;
}
.diagnostic-rating-summary {
  display:flex; flex-wrap:wrap; align-items:baseline; gap:4px 9px; justify-content:center;
  padding:7px 0 2px; border-top:1px solid #b18a5255; color:#614932; font:400 13px/1.4 var(--ui-sans);
}
.diagnostic-rating-summary strong { color:#563320;font:600 23px/1.1 var(--ui-serif); }
.diagnostic-rating-list { margin:10px 0 0;padding:0;list-style:none;color:#503a28;font:400 14px/1.4 var(--ui-sans); }
.diagnostic-rating-list li { padding:6px 0;border-bottom:1px solid #b18a5244; }
.diagnostic-rating-list li:last-child { border:0; }
.diagnostic-radar text { stroke:none; font-synthesis:none; }
.diagnostic-radar-value,.diagnostic-rating-summary strong {
  font-variant-numeric:lining-nums tabular-nums;
}
.profile-metric [data-rating-status]:not([hidden]) {
  display: block;
  text-align: center;
  color: #6d553d;
  font-size: .75rem;
}
.diagnostic-radar-coverage {
  list-style: none;
  padding: 0;
  margin: .35rem 0 0;
  color: #6d553d;
  font-size: .8rem;
}
.profile-metrics { align-items: start; }
.profile-metric { align-content: start; }

/* The reference shares the profile's paper, metal and typography. */
#guide {
  --profile-grain: url("/materials/profile-art-v1/grain.png");
  --profile-cut: 9px;
  max-width: 780px;
  padding: 12px 14px 28px;
  margin: 0 auto;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: #f7e6c5;
}
#guide .page-title h2 { color: #f7e6c5; }
#guide .subtabs { gap: 7px; margin-bottom: 16px; }
#guide .subtabs button {
  min-width: 0;
  min-height: 44px;
  padding: 9px 6px;
  border: 1px solid #b18a52;
  color: #f7e6c5;
  font: 500 clamp(17px, 5vw, 23px)/1.15 Witness, Georgia, serif;
}
#guide .subtabs button.selected {
  color: #352419;
  box-shadow: inset 0 0 0 2px #d3ae72;
}
#guide [hidden] { display: none !important; }
#guide .reference-book {
  position: relative;
  padding: 14px 20px 20px;
  color: #352419;
}
#guide .reference-book .accordion { display: block; }
#guide .reference-book details,
#guide .reference-book details[open] {
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #a7804555;
  box-shadow: none;
}
#guide .reference-book details:last-child { border-bottom: 0; }
#guide .accordion summary {
  min-height: 48px;
  padding: 15px 23px 15px 0;
  color: #352419;
  font: 500 24px/1.2 Witness, Georgia, serif;
  overflow-wrap: anywhere;
}
#guide .reference-book details > div { padding: 0 0 17px; }
#guide .copy-block { background: transparent; padding: 0; border: 0; }
#guide .copy-block p {
  color: #352419;
  font-size: 16px;
  line-height: 1.65;
}
#guide .accordion > details.profile-paper {
  position: relative;
  margin-bottom: 12px;
  padding: 0 16px;
  color: #352419;
  background-color: #f1dfb7;
  background-image: var(--profile-grain), radial-gradient(ellipse at 47% 30%, #f8edcf 18%, #ecdaaf 84%);
  background-size: 144px 144px, auto;
  background-blend-mode: multiply, normal;
}
#guide .search {
  background: #eadbbc;
  color: #352419;
  border: 1px solid #b18a52;
  padding: 14px 16px;
}
#ref-application .application-help-title {
  margin: 3px 0 9px;
  font: 500 clamp(23px, 6vw, 30px)/1.15 Witness, Georgia, serif;
}
#ref-application .copy-block p { margin: 0 0 10px; }
#ref-application .copy-block p:last-child { margin-bottom: 0; }
#ref-application .copy-block ol { margin: 0; padding-inline-start: 1.35em; line-height: 1.55; }
#ref-application .copy-block li + li { margin-top: 6px; }
@media (max-width: 360px) {
  #guide .reference-book { padding: 10px 16px 16px; }
  #guide .accordion summary { font-size: 22px; }
}
/* Persistent host conversation uses the profile's paper components. */
#host {
  --profile-grain: url("/materials/profile-art-v1/grain.png");
  --profile-cut: 9px;
  margin: 0 auto;
  max-width: 780px;
  padding: 12px 14px 28px;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: #f7e6c5;
}
#host .page-title h2 { color: #f7e6c5; }
#host > .muted { color: #d0b794; font-size: 14px; line-height: 1.5; }
#question-history {
  display: grid;
  gap: 12px;
  max-height: 55dvh;
  min-height: 100px;
  overflow-y: auto;
  padding: 6px 0 14px;
  overscroll-behavior: contain;
}
#host .host-message {
  position: relative;
  padding: 15px 18px;
  margin: 0;
  min-width: 0;
  color: #352419;
  background-color: #f1dfb7;
  background-image: var(--profile-grain), radial-gradient(ellipse at 47% 30%, #f8edcf 18%, #ecdaaf 84%);
  background-size: 144px 144px, auto;
  background-blend-mode: multiply, normal;
}
#host .host-message strong { color: #6d553d; font: 500 21px/1.2 Witness, Georgia, serif; }
#host .host-message p { font-size: 16px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
#host .host-player { margin-left: 18px; }
#host .host-answer { margin-right: 18px; }
#host .host-empty { color: #d0b794; font-size: 15px; line-height: 1.5; }
#host #host-form { position: relative; color: #352419; margin-top: 14px; }
#host textarea { width: 100%; box-sizing: border-box; font-size: 16px; color: #352419; background: #fff4d8; }
#host #host-feedback { font-size: 14px; line-height: 1.5; color: #6d553d; }
body.host-chat-open { overflow: hidden; }
body.host-chat-open #host:not([hidden]) {
  position: fixed;
  top: var(--host-top, var(--ui-header-height));
  bottom: var(--host-bottom, var(--ui-bottom-height));
  left: max(0px, calc((100vw - 780px) / 2));
  right: max(0px, calc((100vw - 780px) / 2));
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding: 8px 14px 10px;
  box-sizing: border-box;
  width: auto;
  min-height: 0;
  overflow: hidden;
}
#host .page-title { flex: 0 0 auto; margin: 0 0 8px; padding: 0; }
#host .page-title h2 { margin: 0; font-size: 28px; line-height: 1.15; }
#host .page-title::after { display: none; }
#host #question-history {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  display: block;
  overflow-y: auto;
  padding: 8px 0 12px;
  scroll-padding: 8px 0;
}
#host #question-history .host-message { margin-bottom: 12px; }
#host #host-composer { flex: 0 0 auto; min-width: 0; }
#host #host-form {
  display: grid;
  margin: 0;
}
#host .host-input-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
#host #host-input {
  grid-column: 1;
  grid-row: 1;
  max-height: 100px;
  resize: none;
  margin: 0;
}
#host #host-voice { grid-column: 2; grid-row: 1; min-width: 0; }
#host #voice-question { margin: 0; padding: 0; border: 0; background: transparent; }
#host .voice-controls { display: flex; gap: 0; margin: 0; }
#host #host-voice .voice-controls > button, #host #host-submit {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 9px;
  margin: 0;
}
#host #host-submit { grid-column: 3; grid-row: 1; }
#host #host-submit svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 2; fill: none; }
#host [data-voice-status]:empty, #host #host-feedback:empty { display: none; }
#host #host-feedback { grid-column: 1 / -1; margin: 0; }
#host #question-pending { flex: 0 0 auto; margin: 4px 0; font-size: 14px; }
body.host-chat-open.host-keyboard-open .bottom-area { visibility: hidden; }
#host [hidden] { display: none !important; }
#host #host-voice .voice-controls > button { min-width: 42px; flex: none; }
#host .host-voice-status { grid-column: 1 / -1; margin: 0; font-size: 13px; color: #6d553d; }
#host .host-voice-status:empty { display: none; }
/* Composer controls share one geometry and optical alignment. */
#host #host-form {
  padding: 10px;
  gap: 8px;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) 42px 42px;
}
#host #host-input {
  box-sizing: border-box;
  min-height: 42px;
  height: 42px;
  padding: 10px 11px;
  border: 1px solid #b18a52;
  border-radius: 4px;
  line-height: 20px;
  box-shadow: inset 0 1px 3px #6d442315;
}
#host #host-voice,
#host #voice-question,
#host .voice-controls {
  height: 42px;
  min-height: 42px;
  display: flex;
  align-items: center;
}
#host #host-voice .voice-controls > button,
#host #host-submit {
  box-sizing: border-box;
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  margin: 0;
  padding: 10px;
  border: 1px solid #b18a52;
  border-radius: 4px;
  background: linear-gradient(#784b34, #573524);
  color: #f7e6c5;
  box-shadow: inset 0 0 0 1px #f7e6c512;
  clip-path: none;
}
#host #host-voice .voice-controls > button::before,
#host #host-voice .voice-controls > button::after,
#host #host-submit::before,
#host #host-submit::after { display: none; }
#host #host-voice .voice-controls > button svg,
#host #host-submit svg {
  display: block;
  width: 22px;
  height: 22px;
  margin: 0;
  stroke-width: 1.8;
}
#host #host-voice .voice-controls > button:active,
#host #host-submit:active { background: #412b23; }
#host #host-voice .voice-controls > button:focus-visible,
#host #host-submit:focus-visible { outline: 2px solid #ffdb91; outline-offset: 2px; }
#host .host-player {
  background-color: #e6cda0;
  background-image: var(--profile-grain), linear-gradient(120deg, #efdbb5, #e2c594);
  background-size: 144px 144px, auto;
  border-color: #a57542;
}
#host .host-answer {
  background-color: #f4e8cd;
  background-image: var(--profile-grain), linear-gradient(120deg, #faf1dc, #ecdfbf);
  background-size: 144px 144px, auto;
  border-color: #b79a68;
}
/* Invitation entry reuses the profile paper and its control scale. */
#profile #profile-join-form:not([hidden]) {
  --profile-grain: url("/materials/profile-art-v1/grain.png");
  --profile-cut: 9px;
  position: relative;
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 20px;
  border: 1px solid #aa8050;
  border-radius: 0;
  background-color: #f1dfb7;
  background-image: var(--profile-grain), radial-gradient(ellipse at 47% 30%, #f8edcf 18%, #ecdaaf 84%);
  background-size: 144px 144px, auto;
  background-blend-mode: multiply, normal;
  color: #352419;
  scroll-margin-top: calc(var(--ui-header-height) + 12px);
}
.profile-join-heading { display: flex; gap: 12px; align-items: center; }
#profile-join-title {
  font: 500 clamp(26px, 7vw, 34px)/1.1 var(--ui-serif);
  color: #352419;
  margin: 0;
}
#profile #profile-join-back {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
}
#profile-join-form label { color: #352419; font-size: 16px; margin: 0; }
#profile-join-form #profile-code-hint {
  color: #6d553d;
  font-size: 14px;
  line-height: 1.4;
  margin: -8px 0 0;
}
#profile #profile-room-code {
  box-sizing: border-box;
  width: 100%;
  min-height: 54px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #b18a52;
  border-radius: 4px;
  background: #fff3d6;
  color: #352419;
  font: 500 24px/1.2 var(--ui-sans);
  letter-spacing: .16em;
  text-align: center;
  text-transform: uppercase;
  box-shadow: inset 0 1px 4px #6d442318;
}
#profile #profile-join-submit {
  width: 100%;
  margin: 0;
  min-height: 54px;
  font: 500 25px/1.15 var(--ui-serif);
}
.game-page-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.game-page-heading .game-phase { margin: 0; min-width: 0; }
#lobby-cancel:not([hidden]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 8px 12px;
  flex: 0 0 auto;
  font: 500 16px/1.2 var(--ui-serif);
}
#lobby-cancel svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
#game:is(.is-lobby,.is-playing) {
  --profile-grain: url("/materials/profile-art-v1/grain.png");
  --profile-cut: 9px;
  padding-inline: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}
#game:is(.is-lobby,.is-playing)[hidden] { display: none; }
#game:is(.is-lobby,.is-playing) .lobby-surface {
  position: relative;
  padding: 18px 20px;
  margin: 0;
  border: 1px solid #aa8050;
  border-radius: 0;
  color: #352419;
  background-color: #f1dfb7;
  background-image: var(--profile-grain), radial-gradient(ellipse at 47% 30%, #f8edcf 18%, #ecdaaf 84%);
  background-size: 144px 144px, auto;
  background-blend-mode: multiply, normal;
}
#game:is(.is-lobby,.is-playing) .lobby-surface[hidden] { display: none; }
#game:is(.is-lobby,.is-playing) .lobby-surface h2 { font: 500 30px/1.15 var(--ui-serif); color: #352419; }
#game:is(.is-lobby,.is-playing) .lobby-surface p { color: #352419; font: 400 16px/1.55 var(--ui-sans); }
#game:is(.is-lobby,.is-playing) .action-card .action-meta:has(> [hidden]):not(:has(> :not([hidden]))) { display: none; }
#game:is(.is-lobby,.is-playing) .actions button,
#game:is(.is-lobby,.is-playing) #invite-copy {
  min-height: 48px;
  font: 500 21px/1.2 var(--ui-serif);
}
#game:is(.is-lobby,.is-playing) .board-shell { border: 1px solid #aa8050; margin: 0; }
#game:is(.is-lobby,.is-playing) .board-public { background: #eadbbc; color: #352419; }
#game:is(.is-lobby,.is-playing) .board-public summary,
#game:is(.is-lobby,.is-playing) .board-public p { color: #352419; }
@media(max-width:360px) {
  #game.is-lobby .game-page-heading { align-items: flex-start; flex-wrap: wrap; gap: 8px; }
  #game.is-lobby .lobby-surface { padding: 16px; }
}
/* Joining is its own view: keep the form above the software keyboard. */
#profile-home.is-joining > :not(#profile-join-form):not(#profile-feedback) { display: none !important; }
#profile-home.is-joining { min-height: 0; }
#profile-home.is-joining #profile-join-form { margin-top: 0; }

/* A server without local speech recognition keeps the text composer. */
html[data-voice-enabled="false"] [data-voice-start],
html[data-voice-enabled="false"] [data-voice-stop],
html[data-voice-enabled="false"] .voice-file { display:none!important; }
html[data-voice-enabled="false"] #host #host-voice { display:none; }
html[data-voice-enabled="false"] #host #host-form { grid-template-columns:minmax(0,1fr) 42px; }
html[data-voice-enabled="false"] #host #host-submit { grid-column:2; }

/* Canvas has a 16:9 drawing buffer. Preserve it instead of stretching into a portrait board. */
.tableau .city-background { object-fit: contain; object-position: center; }
#game.is-lobby .tableau {
  background-position: center;
  background-size: cover;
}
#game .board-toolbar button {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #bd965a;
  border-radius: 4px;
  color: #f7e6c5;
  background: linear-gradient(145deg,#67432c,#412b23);
  font: 500 17px/1.2 var(--ui-serif);
  box-shadow: inset 0 0 0 2px #d6ac6118;
}
#game.is-lobby .board-public {
  background-color: #eadbbc;
  background-image: var(--profile-grain), linear-gradient(#f4e5c7,#e6d1a5);
  background-size: 144px 144px, auto;
  border: 1px solid #b18a52;
  border-radius: 4px;
}
#game.is-lobby #board-status-title { font: 500 20px/1.15 var(--ui-serif); }
#game.is-lobby #board-status-summary { font: 400 12px/1.3 var(--ui-sans); }
#game.is-lobby .board-more { color: #6d553d; }
/* The board is not a nested scroll trap: swipes continue on the page. */
.board-viewport { overscroll-behavior: auto; touch-action: pan-y pinch-zoom; }
.board-public { overscroll-behavior: auto; }
/* Four hinged paving plates reveal the loaded city; player tokens remain above them. */
.lobby-reveal { position:absolute; inset:0; z-index:1; pointer-events:none; perspective:900px; overflow:hidden; }
.lobby-reveal-plate {
  position:absolute; inset:0;
  background:url('/materials/lobby-plaza-v1.webp') center/cover;
  backface-visibility:hidden;
  transition:transform 1.35s cubic-bezier(.45,.05,.2,1),opacity 1.35s ease;
}
.lobby-reveal-plate:nth-child(1) { clip-path:polygon(0 0,100% 0,50% 50%);transform-origin:50% 0; }
.lobby-reveal-plate:nth-child(2) { clip-path:polygon(100% 0,100% 100%,50% 50%);transform-origin:100% 50%; }
.lobby-reveal-plate:nth-child(3) { clip-path:polygon(100% 100%,0 100%,50% 50%);transform-origin:50% 100%; }
.lobby-reveal-plate:nth-child(4) { clip-path:polygon(0 100%,0 0,50% 50%);transform-origin:0 50%; }
.lobby-reveal.is-opening .lobby-reveal-plate:nth-child(1) { transform:rotateX(100deg);opacity:0; }
.lobby-reveal.is-opening .lobby-reveal-plate:nth-child(2) { transform:rotateY(100deg);opacity:0; }
.lobby-reveal.is-opening .lobby-reveal-plate:nth-child(3) { transform:rotateX(-100deg);opacity:0; }
.lobby-reveal.is-opening .lobby-reveal-plate:nth-child(4) { transform:rotateY(-100deg);opacity:0; }
@media(prefers-reduced-motion:reduce) { .lobby-reveal { display:none; } }
#game:is(.is-lobby,.is-playing) .lobby-surface { --ink:#352419; --muted:#6d553d; --line:#b18a52; }
#game:is(.is-lobby,.is-playing) .lobby-surface :is(h3,label,dt,dd),
#game.is-lobby #board-status-summary { color:#352419; }
#game.is-lobby .actions button { font-size:19px; }
#game:is(.is-lobby,.is-playing) .lobby-surface .actions button { color:#f7e6c5; }
/* The visible board, as well as its artwork, uses the authored landscape frame. */
#game .board-viewport {
  height: auto;
  aspect-ratio: 16 / 9;
}
#game .tableau { position:absolute; inset:0; }
#game.is-lobby .tableau { background-image:url('/materials/lobby-plaza-v1.webp'); }
#game.is-lobby .city-background { visibility:hidden; }
#game .board-public:not([open]) > summary { padding:5px; gap:2px; }
#game .board-public:not([open]) .board-more { display:none; }
/* Leave room for the labels above and below the landscape seating ring. */
#game .players { inset:42px 8px 40px; }
/* The toolbar overlays the artwork. Seats start below its touch targets. */
#game .board-toolbar {
  inset:0 0 auto;
  min-height:48px;
  padding:4px 10px;
  background:linear-gradient(#35231ee8, #35231e92 65%, transparent);
}
#game .board-stage { position:relative; overflow:hidden; }
#game .board-viewport.zoomed { overflow:auto; touch-action:pan-x pan-y pinch-zoom; }
#game .board-stage .tableau { inset:0 auto auto 0; transform-origin:top left; }
#game .board-stage .board-public {
  top:var(--board-center-y, 50%);
  width:108px;
  max-width:none;
  max-height:none;
}
#game .board-stage .board-public > summary {
  min-height:44px;
  padding:7px 4px;
  gap:4px;
  overflow-wrap:anywhere;
}
#game .board-stage .board-public[open] {
  inset:54px 12px 12px;
  width:auto;
  transform:none;
  overflow:auto;
}
#game .showing-status .players { visibility:hidden; }
#game .players.adaptive-seats { inset:0; }
body.game-skin #game .adaptive-seats .player {
  height:auto;
  gap:2px;
}
body.game-skin #game .adaptive-seats .illustrated-token {
  width:var(--seat-token); height:var(--seat-token); flex:0 0 var(--seat-token);
}
body.game-skin #game .adaptive-seats .player-label {
  box-sizing:border-box;
  padding:2px 3px;
  font-size:13px;
  line-height:15px;
  white-space:normal;
  overflow-wrap:anywhere;
  border-radius:3px;
}
body.game-skin #game .adaptive-seats .player-number {
  width:clamp(13px,calc(var(--seat-token) * .32),18px);
  height:clamp(13px,calc(var(--seat-token) * .32),18px); font-size:10px;
}
body.game-skin #game .adaptive-seats .nomination-state {
  max-width:100%; font-size:10px; line-height:14px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; padding:0 2px;
}
#game #room-invitation {
  margin:10px 0 0; padding:0; border:0; background:none; box-shadow:none;
}
#game #room-invitation[hidden] { display:none; }
#game #invite-copy { width:100%; min-height:48px; font:500 19px/1.2 var(--ui-serif); gap:9px; }
#game #invite-copy svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.6; flex:none; }
#game #invite-feedback:empty { display:none; }
#game #invite-feedback { margin:8px 0 0; font:400 14px/1.4 var(--ui-sans); }
#game #invite-manual { margin-top:10px; }
#game #invite-link { width:100%; box-sizing:border-box; }
#game .board-shell, #game .room-controls, #game #room-invitation { min-width:0; }
#game #invite-copy { white-space:normal; overflow-wrap:anywhere; }
#game .lobby-residents { margin:0; padding:8px 12px 8px 34px; }
#game .lobby-residents li { padding:4px 0; overflow-wrap:anywhere; }
#game .board-viewport { touch-action:pan-y; }
#game .board-viewport.zoomed { touch-action:pan-x pan-y; }
#game .board-scale {
  position:absolute; z-index:8; right:8px; bottom:8px;
  display:flex; border-radius:5px; color:#f7e6c5;
}
#game .board-scale button { font:500 21px/1 var(--ui-sans); }
#game .board-scale button + button { border-left:1px solid #bd965a80; }
#game .board-scale button:disabled { opacity:.4; }
#game .showing-status .board-scale { visibility:hidden; }
#game .showing-status .board-viewport { position:absolute; inset:0; pointer-events:none; }
#game .showing-status > .board-public[open] {
  position:relative; inset:auto; transform:none;
  width:auto; max-height:none;
  margin:0; padding:0; overflow:visible;
  color:#352419;
}
#game .showing-status { padding:52px 9px 10px; }
#game .showing-status .board-public :is(summary,p,h2,h3,span,li) { color:inherit; }
#game .showing-status .board-public > summary {
  min-height:44px; padding:7px 12px; gap:6px;
  flex-direction:row; flex-wrap:wrap; justify-content:center;
  border-bottom:1px solid #b18a5266;
}
#game .showing-status .board-more { display:none; }
#game .showing-status .board-status {
  max-height:none; overflow:visible; padding:8px 12px; overflow-wrap:anywhere;
}
#game .showing-status .board-status :is(.night-readiness,.day-readiness) {
  display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%, 220px),1fr));
  gap:3px 10px;
}
#game .room-editor-heading { display:flex; align-items:center; gap:10px; }
#game .room-editor-heading > div:empty { display:none; }
#game .room-editor-heading h2 { margin:0; min-width:0; }
#game .room-editor-heading button { margin:0; }
#game :is(#seating-title,#action-title,#game-phase) {
  scroll-margin-top:calc(var(--ui-header-height) + 12px);
}
#game[data-room-editor="seating"] > .action-card { display:none; }
#game #room-editor-context h2 { margin:0 0 6px; }
#game #room-editor-context p { margin:0; }
#game[data-room-editor="settings"] .actions:empty,
#game[data-room-editor="settings"] #prompt:empty { display:none; }
#game[data-room-editor="settings"] .actions button { padding:10px 8px; overflow-wrap:anywhere; }
#game[data-room-editor="settings"] #actions button:last-child:nth-child(odd) { grid-column:1 / -1; }
#game #seating-editor .seating-footer {
  background:#ecdbb5 url('/materials/profile-art-v1/grain.png') center / 144px;
  border-top:1px solid #b18a52; color:#352419; padding:10px 0 0;
  bottom:calc(var(--nav) + var(--safe));
}
#game #seating-editor .seating-buttons { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
#game #seating-editor .seating-buttons button {
  min-width:0; min-height:48px; color:#f7e6c5;
  font:500 19px/1.15 var(--ui-serif);
}
#game #seating-editor li {
  background:#f4e6c8; border-color:#ba965e; color:#352419;
}
#game #seating-editor li.dragging { background:#e6cda0; }
#game #seating-editor .seating-handle { color:#6d553d; }
body.game-skin #game .adaptive-seats .player {
  width:max-content; min-width:calc(var(--seat-token) + 6px); max-width:106px;
}
body.game-skin #game .adaptive-seats .player-label { width:auto; max-width:106px; }
#game.is-lobby .tableau, #game .lobby-reveal-plate {
  background-size:var(--plaza-background-width, cover);
  background-position:var(--plaza-background-position, center);
}
/* Room choices use the same paper, ink and cut-corner controls as profiles. */
#setup-form { display:grid; gap:14px; margin:0 0 16px; padding:0 0 16px; border-bottom:1px solid #b18a5266; }
#setup-form[hidden] { display:none; }
#setup-form .room-setting-field { display:grid; gap:6px; min-width:0; }
#setup-form label { color:#513620; font:500 20px/1.2 var(--ui-serif); }
#setup-form select { width:100%; min-width:0; min-height:46px; padding:10px 32px 10px 12px; border:1px solid #ad8652; border-radius:2px; color:#352419; background:#f5e7c8; font:400 16px/1.3 var(--ui-sans); }
#game #setup-form p { margin:0; color:#72583b; font:400 13px/1.45 var(--ui-sans); }
#setup-form #setup-feedback:empty { display:none; }
#game #setup-form .room-settings-note { font-size:12px; }
#game .room-settings-actions { grid-template-columns:1fr; gap:8px; }
#game .room-settings-actions button, #setup-form button { width:100%; min-height:48px; --button-fill:#4d3529; --button-line:#bd965a; color:#f7e6c5; font:500 18px/1.25 var(--ui-serif); }
#game .room-settings-actions .room-rehearsal-action[aria-pressed=true] { --button-line:#efd19b; box-shadow:inset 0 0 0 2px #bd965a55; }
body.game-skin #game .adaptive-seats.dense-ellipse .player { gap:1px; }
body.game-skin #game .adaptive-seats.dense-ellipse .player-label {
  padding:1px 3px;
  font-size:15px;
}
#game.is-lobby .game-page-heading { padding-top:10px; }
#game.is-lobby .board-shell { margin-inline:-6px; }
#game .board-toolbar #board-details {
  display:grid; place-items:center;
  min-width:76px; min-height:34px; padding:0;
  border:0; background:none; box-shadow:none;
  font-size:11px;
}
#game .board-toolbar #board-details span {
  display:grid; place-items:center;
  min-height:23px; padding:0 5px;
  border:1px solid #bd965a; border-radius:3px;
  background:linear-gradient(145deg,#67432c,#412b23);
}
#game .board-scale {
  border:0; background:none;
}
#game .board-scale button {
  display:grid; align-items:center; justify-items:end;
  min-height:32px; width:32px; padding:0; font-size:14px;
}
#game .board-scale button + button { justify-items:start; border:0; }
#game .board-scale button span {
  display:grid; place-items:center; width:22px; height:22px;
  border:1px solid #bd965a; border-radius:3px 0 0 3px;
  background:#35231eed;
}
#game .board-scale button + button span {
  border-left:0; border-radius:0 3px 3px 0;
}
body.game-skin #game .adaptive-seats.dense-ellipse .player-label {
  line-height:15px;
}
/* Give rare narrow layouts a clear frame when a corner control would cover a seat. */
#game .board-clear-controls:not(.showing-status) .board-toolbar {
  position:relative; min-height:42px;
  background:linear-gradient(#35231e, #35231e50);
}
#game .board-clear-controls:not(.showing-status) .board-scale {
  position:relative; inset:auto; width:max-content; margin:3px 8px 4px auto;
}
/* Expanded details are a full-width paper sheet with their own header. */
#game .board-shell.showing-status {
  padding:0;
  background:#eadbbc url('/materials/profile-art-v1/grain.png') center / 144px;
}
#game .showing-status .board-viewport { opacity:0; }
#game .showing-status #board-caption { color:#49321f; text-shadow:none; }
#game .showing-status > .board-public[open] {
  min-height:var(--board-overview-height, 230px);
  border:0; border-radius:0; background:none; box-shadow:none;
}
/* Code, title and close action share one header on the open paper sheet. */
#game .board-shell.showing-status .board-toolbar {
  position:absolute;
  inset:0 0 auto;
  height:56px;
  min-height:0;
  padding:0 10px;
  border:0;
  background:none;
}
#game .showing-status #board-caption {
  font-size:11px;
  letter-spacing:.035em;
}
#game .showing-status > .board-public[open] > summary {
  box-sizing:border-box;
  min-height:56px;
  padding:4px 78px;
  gap:2px;
  flex-direction:column;
  justify-content:center;
  border-bottom:1px solid #b18a5266;
}
#game .showing-status #board-status-title {
  font:500 clamp(20px, 5.5vw, 27px)/1.05 var(--ui-serif);
}
#game .showing-status #board-status-summary {
  color:#6d553d;
  font:400 13px/1.25 var(--ui-sans);
}
#game .showing-status :is(#board-caption,#board-details) { transform:translateY(-8px); }
#chronicle.journal-screen {
  --profile-grain:url('/materials/profile-art-v1/grain.png');
  --profile-cut:9px;
  width:calc(100% - 24px);
  max-width:576px;
  margin:12px auto 0;
  padding:0;
  border:0;
  background:transparent;
  box-shadow:none;
  overflow:visible;
}
.journal-screen > .page-title { border:0; margin:0 0 12px; padding:0; }
.journal-screen > .page-title h2 { color:#f7e6c5; }
.journal-screen #events {
  display:grid; gap:12px; padding:0; border:0;
}
.journal-screen :is(.journal-group,.journal-empty) {
  position:relative; margin:0; padding:14px 16px;
  color:#352419;
}
.journal-screen .journal-group[data-phase="night"] {
  background-color:#d9dfdf;
  background-image:var(--profile-grain),linear-gradient(145deg,#eef0e9,#d4ddde);
}
.journal-screen .journal-phase {
  display:flex; align-items:center; gap:9px;
  margin:0; padding:0 0 9px;
  border-bottom:1px solid #9e80565e;
  font:500 27px/1.1 var(--ui-serif);
}
.journal-screen .journal-phase::before {
  content:''; width:12px; height:12px; flex:none;
  border:1px solid #94652e; border-radius:50%;
  background:#d9aa59;
}
.journal-screen [data-phase="night"] .journal-phase::before {
  border-color:#506675;
  background:transparent;
  box-shadow:inset 4px -2px #506675;
}
.journal-screen [data-phase="finish"] .journal-phase::before { background:#864333; }
.journal-screen .journal-entries { margin:0; padding:0; list-style:none; }
.journal-screen .journal-event {
  padding:10px 0;
  border-bottom:1px solid #9e805648;
  font:400 16px/1.5 var(--ui-sans);
  white-space:pre-line;
  overflow-wrap:anywhere;
}
.journal-screen .journal-event:last-child { border:0; padding-bottom:1px; }
.journal-screen .journal-empty {
  display:flex; align-items:center; gap:14px;
  min-height:92px;
}
.journal-screen .journal-empty img { width:54px; height:54px; object-fit:contain; flex:none; }
.journal-screen .journal-empty p { margin:0; font:400 16px/1.45 var(--ui-sans); }
#game #base-composition { padding:10px 12px; }
#game #base-composition .composition-title {
  margin:0 0 6px; color:#352419;
  font:500 22px/1.1 var(--ui-serif);
}
#game #base-composition .composition-counts {
  gap:6px;
}
#game #base-composition .composition-counts > div {
  display:flex; flex-direction:column-reverse; gap:5px;
  padding:0; border:0;
}
#game #base-composition .composition-counts > div[data-faction="traveller"] {
  grid-column:1 / -1;
}
#game #base-composition .composition-counts dt {
  display:grid; place-items:center;
  min-height:25px; padding:3px 2px;
  color:#fff3d7; background:var(--faction-color,#655547);
  border-radius:3px; text-align:center;
  font:550 clamp(10px, 2.9vw, 13px)/1.15 var(--ui-sans);
}
#game #base-composition .composition-counts dd {
  color:#352419; margin:0;
  font:600 23px/1 var(--ui-sans);
  font-variant-numeric:lining-nums tabular-nums;
}
#game.is-playing .game-page-heading { padding-top:10px; }
#game.is-playing .lobby-surface { padding:14px 16px; }
#game.is-playing .lobby-surface h2 { font-size:26px; }
#game.is-playing .actions { gap:8px; margin-top:12px; }
#game.is-playing .actions button {
  min-height:44px; padding:8px 10px;
  font:500 18px/1.2 var(--ui-serif);
}
#game.is-playing .city-label {
  margin:0; padding:6px 10px;
  background:#493024; color:#f7e6c5; border:1px solid #93734e;
}
#game.is-playing .city-label[hidden] { display:none; }
#game.is-playing #life { color:#6d553d; }
#game:is(.is-lobby,.is-playing) .action-card::before { display:none; }
/* The waiting artwork fills the gap until the assigned city is drawn. */
#game .tableau { background-image:url('/materials/lobby-plaza-v1.webp'); }
#game .tableau:not(.has-city-background) .city-background { visibility:hidden; }

.final-room-actions { padding: 12px; gap: 8px; margin: 12px 0; }

#game .board-sound { left:8px; right:auto; }
#game .board-sound #room-sound {
  justify-items:start;
  background:transparent!important;
  border-color:transparent!important;
  color:#f7e6c5!important;
  box-shadow:none;
}
#game .board-sound #room-sound span {
  background:transparent;
  border:0;
  filter:drop-shadow(0 1px 2px #000);
}
#game .board-clear-controls:not(.showing-status) .board-sound {
  position:absolute; inset:auto auto 4px 8px; margin:0;
}
.room-sound svg { width:14px; height:14px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.room-sound[aria-pressed="true"] .sound-off { display:none; }
.game-film-controls #game-film-sound { display:none; }

#connect-screen:not([hidden]) { display:block; text-align:center; text-decoration:none; }

#game .board-shell #game-film:not([hidden]) {
  position:absolute; inset:0; z-index:7; margin:0; padding:0; border:0; background:#100d0b;
}
#game .board-shell #game-film-video { display:block; width:100%; height:100%; object-fit:contain; }
#game .board-shell #game-film .game-film-controls { position:absolute; inset:auto 8px 8px auto; }
#game .playing-film .board-viewport { position:relative; inset:auto; }
#game .playing-film .board-scale:not(.board-sound),#game .playing-film .board-toolbar { visibility:hidden; }
#game .playing-film .board-scale.board-sound { position:absolute; inset:auto auto 8px 8px; visibility:visible; margin:0; }

.current-ballot:not([hidden]) { display:grid; gap:4px; margin:10px 0 6px; }
.current-ballot:not([hidden]) + #prompt:empty { display:none; }
.current-ballot > div { display:grid; grid-template-columns:minmax(74px,auto) 1fr; gap:8px; align-items:baseline; }
.current-ballot dt { color:#62462e; font-size:14px; }
.current-ballot dd { margin:0; color:#38271b; font-weight:650; overflow-wrap:anywhere; }
#game .current-ballot-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
#game .current-ballot-actions > [data-ballot-vote] { grid-column:auto; }
#game .current-ballot-actions > [data-ballot-vote="for"] { background:#e1e5ce; color:#354626; border-color:#78885e; }
#game .current-ballot-actions > [data-ballot-vote="against"] { background:#ead9cc; color:#742f28; border-color:#9b6b5d; }
#game .current-ballot-actions > [data-ballot-vote][aria-pressed="true"] { box-shadow:inset 0 0 0 2px currentColor; }
:is([data-faction="townsfolk"],.cat-townsfolk,.stats-progress-category-townsfolk) { --faction-color:#435d40; }
:is([data-faction="outsider"],.cat-outsider,.stats-progress-category-outsider) { --faction-color:#735168; }
:is([data-faction="minion"],.cat-minion,.stats-progress-category-minion) { --faction-color:#895338; }
:is([data-faction="demon"],.cat-demon,.stats-progress-category-demon) { --faction-color:#803c44; }
:is([data-faction="traveller"],.cat-traveller,.stats-progress-category-traveller) { --faction-color:#526078; }

/* Inline category names keep the text flow; header badges remain unchanged. */
.category-text-run { min-width:0; }
.category-text-run, .faction-word { pointer-events:none; }
.faction-word { color:var(--faction-color); font-weight:600; }
.faction-word[data-faction="townsfolk"] { --faction-on-dark:#b5cda4; }
.faction-word[data-faction="outsider"] { --faction-on-dark:#d6b5ce; }
.faction-word[data-faction="minion"] { --faction-on-dark:#e5b48f; }
.faction-word[data-faction="demon"] { --faction-on-dark:#e9aeb8; }
.faction-word[data-faction="traveller"] { --faction-on-dark:#b9c9e1; }
:where(button,.toast,.notification,.board-public,.public-status,#public-status,.talk-notice) .faction-word { color:var(--faction-on-dark); }
:where(.profile-paper,.copy-block,#information-body,.room-form,#guide,.board-public:not([open])) .faction-word { color:var(--faction-color); }
button .faction-word { color:var(--faction-on-dark); }

/* Shared category palette for the profile, game and statistics. */
.role-faction[data-faction], #profile-role-title .role-faction[data-faction] {
  color:#fff3d7;
  background:var(--faction-color,#655547);
  border-color:var(--faction-color,#655547);
}
.stats-sector-piece { fill:var(--faction-color,#655547); }
.stats-legend-row i, .stats-progress[class*="stats-progress-category-"] > span {
  background:var(--faction-color,#655547);
}
#game .board-stage .board-public:not([open]) { background:#eadbbc; }
#game .board-public #board-status-title { color:#352419; }
#game .board-public #board-status-summary { color:#59412d; }
#game #game-private-slot .private-info {
  margin:12px 0 0; padding:0;
  border:1px solid #9f7949; border-radius:5px; background:#eedcb6;
  color:#352419;
}
#game #game-private-slot .private-info[hidden] { display:none; }
#game #information { border:0; }
#game #information summary {
  padding:9px 12px; color:#fff1d0; background:#59402c; border-radius:3px;
}
#game #information summary svg, #game #information summary .private-privacy { color:#f4dba4; }
#game #information-body { padding:10px 12px; color:#352419; }
#game #information.has-private-information > summary { animation:none; box-shadow:inset 0 0 0 2px #d6ac61; }
#reference {
  --profile-grain:url('/materials/profile-art-v1/grain.png');
  --profile-cut:9px;
  width:calc(100% - 24px); max-width:576px;
  margin:12px auto 0; padding:0; background:transparent; border:0; box-shadow:none;
}
#reference > .page-title { border:0; margin:0 0 12px; padding:0; }
#reference > .page-title h2 { color:#f7e6c5; }
#reference :is(#role-cover,#role-content), #guide #ref-roles {
  position:relative; padding:14px 16px; color:#352419;
}
#reference #role-cover h3 { color:#352419; }
#reference #role-cover p { color:#6d553d; }
#reference #role-content .role-text { color:#352419; }
.journal-speaker {
  display:block; margin-bottom:3px; color:#745030;
  font:600 12px/1.2 var(--ui-sans);
}
@media(prefers-reduced-motion:reduce) {
  .private-info details.has-private-information > summary,.tabbar button.private-unread { animation:none; }
}
#game-revealed-roles h3 { margin:8px 0 4px; font:500 24px/1.1 var(--ui-serif); }
#game-revealed-roles ol { list-style:none; margin:0 0 12px; padding:0; }
#game-revealed-roles li {
  display:flex; flex-wrap:wrap; justify-content:space-between; gap:4px 12px;
  padding:7px 0; border-bottom:1px solid #b18a5266;
}
#game-revealed-roles li span { color:#634629; }
#guide .subtabs button {
  background: var(--profile-grain), linear-gradient(155deg,#603e2b,#39251f);
  border-radius: 6px;
  font-size: clamp(16px,4.9vw,22px);
}
#guide .subtabs button.selected {
  background: var(--profile-grain), #eadbbc;
}
#guide .catalog-heading { margin-bottom:10px; }
#guide .catalog-heading h3 { margin:0; color:#352419; font:600 27px/1.12 var(--ui-serif); }
#guide #catalog-empty { margin:12px 0 0; }
#guide .catalog-heading p { margin:3px 0 0; color:#654b34; font:400 14px/1.35 var(--ui-sans); }
#guide .catalog-controls { display:grid; grid-template-columns:minmax(0,1fr) 48px; gap:7px; }
#guide .catalog-controls > * { width:100%; min-width:0; margin:0; box-sizing:border-box; }
#guide #catalog-filter-menu > summary { width:48px; height:48px; box-sizing:border-box; }
#guide #catalog-filter-menu:not([open]) .role-category-filter { display:none; }
#guide #roles-search {
  padding-inline:8px;
  min-height: 44px;
  background: #f4e8cc;
  color: #352419;
  border: 1px solid #b18a52;
  border-radius: 6px;
}
#guide #roles-list > details { margin: 8px 0 0; }
#guide #roles-list > details > summary {
  display: grid;
  grid-template-columns: 42px minmax(0,1fr);
  align-items: center;
  gap: 10px;
  min-height: 56px;
  position: relative;
  padding: 8px 36px 8px 12px;
  list-style: none;
}
#guide #roles-list > details > summary::-webkit-details-marker { display:none; }
#guide #roles-list > details > summary::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 16px;
  width: 7px;
  height: 7px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: translateY(-50%) rotate(45deg);
}
#guide #roles-list > details[open] > summary::after { transform:translateY(-25%) rotate(225deg); }
.catalog-role-title { font: 600 23px/1.05 var(--ui-serif); }
#guide #roles-list .history-medal { width:42px; height:42px; }
.catalog-role-copy { display:grid; justify-items:start; gap:3px; }
.catalog-role-category {
  padding:2px 5px; border-radius:3px; color:#fff3d7;
  background:var(--faction-color,#655547); font:500 12px/1.2 var(--ui-sans);
}
.token-dialog { background: url('/materials/profile-art-v1/grain.png'), #eaddbc; }
.token-dialog > button[hidden] { display:none; }
.private-info summary svg { fill:none; stroke:currentColor; stroke-width:1.5; }
dialog.room-chat[open] {
  position:fixed; inset:var(--chat-top,0) 0 auto; display:flex; flex-direction:column;
  width:min(100%,560px); max-width:100%; height:var(--chat-height,100dvh); max-height:none;
  box-sizing:border-box; padding:0; margin:0 auto; overflow:hidden;
  border:0; border-radius:0; background:url('/materials/profile-art-v1/grain.png'),#ecdfc3;
}
.room-chat [hidden] { display:none !important; }
.room-chat-header {
  display:flex; align-items:center; gap:8px; flex:none;
  padding:max(7px,env(safe-area-inset-top)) 12px 7px;
  background:linear-gradient(145deg,#503225,#30201c); border-bottom:2px solid #af8652;
  color:#f7e6c5;
}
.room-chat .room-chat-header h2 {
  flex:1; margin:0; padding:0; min-width:0; color:inherit;
  font:600 24px/1.1 var(--ui-serif); overflow-wrap:anywhere;
}
.room-chat .room-chat-header button { flex:none; width:44px; height:44px; }
.room-chat .room-chat-header .dialog-close { position:static; color:inherit; }
.room-chat-peers {
  flex:1; min-height:0; overflow:auto; margin:0; padding:4px 12px 12px; list-style:none;
}
.room-chat-peer {
  display:grid; grid-template-columns:42px minmax(0,1fr) auto; align-items:center; gap:10px;
  width:100%; min-height:65px; padding:8px 3px; background:none;
  color:#352419; border:0; border-bottom:1px solid #af86525c; text-align:left;
}
.room-chat-peer:active { background:#d7b58255; }
.room-chat-initial {
  display:grid; place-items:center; width:42px; aspect-ratio:1;
  color:#f7e6c5; background:#58392a; border:2px solid #b18a52; border-radius:50%;
  font:600 22px var(--ui-serif);
}
.room-chat-peer-copy { display:grid; gap:2px; min-width:0; }
.room-chat-peer-copy strong { font:600 19px/1.12 var(--ui-serif); overflow-wrap:anywhere; }
.room-chat-peer-copy small { color:#69513c; font:14px var(--ui-sans); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.room-chat time { color:#6a4d32; font:11px/1.15 var(--ui-sans); white-space:nowrap; }
.room-chat-thread { flex:1; min-height:0; display:flex; flex-direction:column; padding:6px 12px 0; }
.room-chat-thread > button { align-self:center; min-height:44px; }
.room-chat-messages {
  flex:1; display:flex; flex-direction:column; gap:6px; min-height:0;
  overflow:auto; overscroll-behavior:contain; padding:8px 0;
}
.room-chat-messages::before { content:''; margin-top:auto; }
.room-chat-message {
  align-self:flex-start; max-width:84%; flex:none; margin:0; padding:8px 11px;
  background:#f8ecd4; border:1px solid #b18a5270; border-radius:12px 12px 12px 3px;
  font:15px/1.42 var(--ui-sans); white-space:pre-wrap; overflow-wrap:anywhere;
}
.room-chat-message.is-mine { align-self:flex-end; background:#e5cca7; border-radius:12px 12px 3px 12px; }
.room-chat-message time { display:block; margin-top:3px; text-align:right; }
.room-chat > .room-chat-status { flex:none; margin:0; padding:0 12px; font-size:14px; }
.room-chat > .room-chat-status:not(:empty) { padding-block:8px; }
.room-chat form {
  display:grid; grid-template-columns:minmax(0,1fr) 44px; align-items:end; gap:7px;
  flex:none; padding:8px 12px max(8px,env(safe-area-inset-bottom)); border-top:1px solid #b18a5280;
  background:#e4d2ae;
}
.room-chat textarea {
  field-sizing:content; width:100%; min-width:0; min-height:44px; max-height:108px; resize:none; box-sizing:border-box;
  padding:10px; color:#352419; border:1px solid #b18a52; border-radius:13px;
  background:#f8eed9; font:16px/1.35 var(--ui-sans);
}
.room-chat form button { width:44px; min-height:44px; padding:0; display:grid; place-items:center; }
.room-chat form svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linejoin:round; }
.topbar > .header-icon-defs { position:absolute; pointer-events:none; }
.header-shortcuts { display:flex; flex:none; gap:6px; }
.header-shortcut {
  display:grid; place-items:center; flex:none; box-sizing:border-box;
  width:var(--ui-touch); height:var(--ui-touch); min-height:var(--ui-touch);
  padding:0; border:1px solid #bd9256; border-radius:8px 3px;
  background:linear-gradient(150deg,#654232,#36221e);
  box-shadow:inset 0 0 0 2px #27171175,0 2px 4px #1d100d70;
}
.header-shortcut[hidden] { display:none; }
.header-shortcut:active, .header-shortcut[aria-expanded="true"] { background:#774a32; }
.header-shortcut:focus-visible { outline:2px solid #ffdb91; outline-offset:2px; }
.header-shortcut svg { width:27px; height:27px; filter:drop-shadow(0 1px 1px #1e100d); }
.header-icon-metal { fill:url(#header-brass); stroke:#ffe0a16b; stroke-width:.7; stroke-linejoin:round; }
.header-icon-inlay { fill:#412820; stroke:#82562e; stroke-width:.85; }
.header-icon-etch { fill:none; stroke:#f3ce8c; stroke-width:1.45; stroke-linecap:round; }
.journal-screen .journal-event.journal-fact {
  margin:8px 0; padding:10px 12px; border:1px solid #ab855766;
  border-inline-start:3px solid #a97643; border-radius:5px;
  background:#fff1cd80;
}
.journal-screen .journal-group[data-phase="night"] .journal-fact {
  border-inline-start-color:#607189; background:#e7ecf276;
}
.journal-screen .journal-event.journal-narration { padding:8px 4px; color:#594735; font-size:14px; }
.journal-fact-label { display:block; color:#704727; font:650 12px/1.3 var(--ui-sans); }
.journal-vote-candidate { margin:4px 0; font:600 24px/1.1 var(--ui-serif); }
.journal-fact p { margin:4px 0; font-size:14px; }
.journal-vote-scores { display:flex; flex-wrap:wrap; gap:6px; margin-block:7px; }
.journal-vote-scores span { padding:3px 8px; border-radius:4px; background:#ddc69c; font-size:14px; }
.journal-ballot { border:0; margin:4px 0 0; padding:0; background:transparent; }
.journal-ballot summary { min-height:44px; padding:10px 0; cursor:pointer; color:#644026; font-weight:600; }
.journal-ballot-group { display:grid; grid-template-columns:minmax(78px,1fr) 2fr; gap:8px; padding:5px 0; font-size:14px; }
#reference .card-back-art {
  width:clamp(136px,45vw,174px); height:auto; aspect-ratio:5/7;
  gap:0; padding:12px; margin-bottom:20px;
  color:#e4bd75; border-color:#d4ac63; border-radius:8px;
  background:url('/materials/profile-art-v1/grain.png'), radial-gradient(ellipse at 50% 32%,#64352c,#2b1919 80%);
  box-shadow:3px 3px 0 #52352a,3px 3px 0 1px #b18a52,6px 6px 0 #33231e,6px 6px 0 1px #89683f;
}
#reference .card-back-art::before { inset:6px; border:3px double #d4ac6399; border-radius:4px; pointer-events:none; }
#reference .card-back-art svg { width:83%; height:auto; stroke:currentColor; stroke-width:1.2; }
#reference .card-back-art .deck-rays { opacity:.31; }
#reference .card-back-art .deck-tower { fill:#38221f; stroke-width:1.8; }
#reference .card-back-art .deck-hands { stroke-width:1.6; stroke-linecap:round; }
#reference .card-back-art .deck-drop { fill:#973d43; stroke:#e4bd75; }
#reference .card-back-art span {
  font:650 clamp(15px,4.2vw,18px)/1.05 var(--ui-serif);
  letter-spacing:.02em; text-transform:uppercase; color:#f5dbab;
}
.journal-screen .journal-execution-card {
  border-inline-start-color:#863d39; padding:12px; white-space:normal;
}
.journal-execution-heading { display:flex; justify-content:space-between; flex-wrap:wrap; gap:5px 10px; align-items:center; }
.journal-execution-heading .journal-fact-label { color:#743632; font:650 20px/1.15 var(--ui-serif); }
.journal-execution-count { padding:3px 7px; background:#e1cba5; border-radius:4px; font-size:13px; }
.journal-execution-participants { display:grid; grid-template-columns:auto 1fr; gap:2px 10px; margin:8px 0; font-size:14px; }
.journal-execution-participants dt { color:#634931; }
.journal-execution-participants dd { margin:0; font-weight:600; }
.journal-ballot-columns { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
.journal-ballot-columns .journal-ballot-group { display:block; background:#ddc89b55; padding:6px 8px; border-radius:4px; }
.journal-ballot-columns .journal-ballot-group:first-child { background:#adbc8355; }
.journal-ballot-group h5 { font:650 13px/1.3 var(--ui-sans); margin:0 0 4px; }
.journal-ballot-group ul { list-style:none; padding:0; margin:0; }
.journal-ballot-group li + li { border-top:1px solid #9e805633; }
.journal-execution-card .journal-execution-outcome { margin:8px 0 0; padding-top:6px; border-top:1px solid #ab855766; font-weight:650; }
.notification-stack {
  position:fixed; z-index:45; left:50%; transform:translateX(-50%);
  bottom:calc(var(--ui-bottom-height,var(--nav)) + 8px);
  width:min(calc(100% - 24px),460px); display:grid; gap:6px;
  max-height:min(54dvh,340px); overflow:auto; pointer-events:none;
}
.notification-stack > :is(.toast,.achievement-notice,.talk-notice) {
  box-sizing:border-box; position:relative; inset:auto; transform:none;
  width:100%; max-width:none; margin:0; padding:10px 52px 10px 13px;
  border:1px solid #ba9158; border-radius:10px 4px;
  color:#f9e5bf;
  background:url('/materials/profile-art-v1/grain.png'),linear-gradient(145deg,#503328,#2c1d1b);
  box-shadow:inset 0 0 0 2px #c8975233;
  overflow-wrap:anywhere; text-align:left; animation:none; pointer-events:auto;
}
.notification-stack > [hidden] { display:none; }
.notification-stack > [inert] { pointer-events:none; }
.notification-stack .achievement-notice { align-items:center; }
.notification-stack strong { font:600 19px/1.15 var(--ui-serif); padding:0; }
.notification-stack p { margin:2px 0; }
.notification-stack .notification-close {
  position:absolute; inset:2px 3px auto auto; width:44px; height:44px; min-height:44px;
  margin:0; padding:0; border:0; background:none; color:#f3d49d;
  font:22px/1 var(--ui-sans); display:grid; place-items:center;
}
.notification-stack :is(.notification-link,.achievement-notice-open,#talk-notice > button:first-of-type) {
  display:block; width:auto; min-height:44px; padding:2px 0; margin:0;
  border:0; background:none; box-shadow:none; color:#ffdc9a;
  font:600 14px var(--ui-sans); text-decoration:underline;
}
#toast:not([hidden]) {
  display:flex; align-items:center; gap:8px; padding:0 2px 0 12px;
  font-size:14px; line-height:1.25;
}
#toast-message { flex:1; min-width:0; }
#toast-open:not([hidden]) { flex:none; }
#toast-close { position:static; flex:0 0 44px; }
.notification-stack [hidden] { display:none; }
body:has(#game:not([hidden])):has(.notification-stack > :not([hidden])) main {
  padding-bottom:calc(var(--nav) + var(--safe) + 30px + var(--notification-height,0px));
}
#reference .role-caption { padding:12px 0; text-align:center; }
#reference .role-card-mark { display:inline-flex; align-items:center; gap:10px; max-width:100%; text-align:left; }
#reference .role-card-identity { min-width:0; }
#reference #role-emblem { width:42px; height:42px; flex:none; object-fit:contain; }
#reference .role-heading { margin:4px 0 2px; font-size:clamp(28px,8vw,36px); line-height:1.08; }
#reference .role-caption .role-metadata { font:500 13px/1.4 var(--ui-sans); }
#reference .role-text { padding-top:10px; border-top:1px solid #b18a5266; }
:is(#reference,#guide) .role-card-more { margin:10px 0 0; padding:0; background:transparent; border:0; border-top:1px solid #b18a5266; }
:is(#reference,#guide) .role-card-more > summary { min-height:44px; padding:10px 0; color:#74583d; cursor:pointer; font:400 13px/1.45 var(--ui-sans); }
#guide:has(#catalog-filter-menu[open]) { overflow:visible; }
#guide #ref-roles:has(#catalog-filter-menu[open]) { clip-path:none; }

:is(#reference,#guide) .role-card-more-link { display:block; width:100%; min-height:44px; padding:10px 0; margin-top:10px; border:0; border-top:1px solid #b18a5266; background:transparent; color:#74583d; text-align:left; text-decoration:underline; text-underline-offset:3px; font:400 13px/1.45 var(--ui-sans); }
.pending-banner.is-role-return { min-height:44px; background:#35251f; color:#f7e6c5; border-color:#b18a52; }

/* The radar uses the shared profile-paper texture and cut-corner brass frame. */
.stats-polish .diagnostic-radar-card { text-align:center; }
.game-style-caption { color:#69543f; margin:2px 0 3px; font:400 13px/1.3 var(--ui-sans); }
.diagnostic-radar-card .diagnostic-radar { width:min(100%,460px); }
.diagnostic-radar-card .diagnostic-radar-label { font:500 10.5px var(--ui-sans); fill:#443123; }
.diagnostic-radar-card .diagnostic-radar-value { font:500 11px var(--ui-sans); fill:#835b31; }
.game-style-details { margin:6px 0 0; padding:0; text-align:left; border:1px solid #b89566; border-radius:9px; background:transparent; }
.game-style-details > summary {
  display:flex; align-items:center; justify-content:space-between; list-style:none;
  cursor:pointer; padding:6px 12px; min-height:44px; color:#523822; font:500 14px var(--ui-sans);
}
.game-style-details > summary::-webkit-details-marker { display:none; }
.game-style-details > summary::after {
  content:''; width:7px; height:7px; border:solid currentColor; border-width:0 1.5px 1.5px 0;
  transform:rotate(45deg); margin-right:2px;
}
.game-style-details[open] > summary::after { transform:rotate(225deg); }
.diagnostic-radar-card .diagnostic-radar-grid { stroke-width:.55; opacity:.36; }
.game-style-explanation { margin:8px; padding:0; border-inline-start:3px solid var(--axis-color); background:#f4e7cd; }
.diagnostic-radar-card .game-style-details .game-style-intro { margin:8px 10px; color:#69543f; font:400 13px/1.4 var(--ui-sans); }
.game-style-explanation > summary { display:grid; grid-template-columns:minmax(0,1fr) auto 8px; gap:5px 8px; padding:10px; cursor:pointer; list-style:none; }
.game-style-explanation > summary::-webkit-details-marker { display:none; }
.game-style-explanation > summary::after { content:''; grid-column:3; grid-row:1; align-self:center; width:6px; height:6px; border:solid #69543f; border-width:0 1.5px 1.5px 0; transform:rotate(45deg); }
.game-style-explanation[open] > summary::after { transform:rotate(225deg); }
.game-style-explanation > summary:focus-visible { outline:2px solid #835b31; outline-offset:2px; }
.game-style-axis-name { color:#443123; font:600 14px/1.3 var(--ui-sans); }
.game-style-axis-score { color:#835b31; white-space:nowrap; font:500 13px/1.4 var(--ui-sans); }
.game-style-axis-meaning { grid-column:1/-1; color:#604b37; font:400 13px/1.4 var(--ui-sans); }
.game-style-axis-body { padding:0 10px 8px; }
.game-style-explanation .game-style-axis-body p { margin:0 0 8px; }
.game-style-explanation .game-style-personal-label { color:#69543f; font-weight:600; }
.game-style-explanation p { font:400 14px/1.4 var(--ui-sans); }
.game-style-chart { position:relative; width:min(100%,460px); margin-inline:auto; }
.game-style-fill { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
.game-style-fill.secondary-fill { opacity:.44; }
.game-style-chart .diagnostic-radar { position:relative; }
/* Personal Lorelei portraits: shared paper, type and the existing clock medallion. */
.portrait-medallion { position:relative; display:block; flex:none; width:208px; aspect-ratio:1; background:url('/media/token-living') center/contain no-repeat; }
.portrait-medallion > svg,.portrait-medallion > .portrait-image { position:absolute; inset:15%; display:block; width:70%; height:70%; border-radius:50%; background:var(--ui-paper,#eaddbc); object-fit:contain; }
.portrait-medallion.portrait-mini { width:72px; }
.portrait-medallion.portrait-standard { background:none; }
.portrait-standard > img,.portrait-medallion > .portrait-fallback { width:100%; height:100%; object-fit:contain; }
#profile-portrait { padding:0; min-height:0; }
#profile-portrait.portrait-medallion { background:url('/media/token-living') center/contain no-repeat; }
#profile-portrait .portrait-image { width:70%;height:70%; }
.stats-peer-card .stats-personal-avatar { width:64px;height:64px; }
.stats-peer-card .stats-personal-avatar > .portrait-image { width:70%;height:70%; }
.portrait-editor.settings-dialog { --profile-grain:url('/materials/profile-art-v1/grain.png'); --profile-cut:9px; box-sizing:border-box; inset:0; margin:auto; width:min(460px,calc(100% - 20px)); height:min(900px,calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom))); max-height:calc(100dvh - 24px); border-radius:0; padding:12px; overflow:hidden; background-color:var(--ui-paper,#eaddbc); background-size:144px 144px,auto; background-blend-mode:multiply,normal; box-shadow:inset 0 0 0 2px #d3ae72,inset 0 0 0 4px #fbebc4; border:1px solid var(--brass); }
.portrait-editor[open] { display:grid; grid-template-rows:auto auto auto auto minmax(80px,1fr) auto auto auto auto; gap:8px; }
.portrait-editor-heading { display:flex;align-items:center;gap:12px; }
.portrait-editor-heading h2 { margin:0;font:500 29px/1.1 var(--ui-serif); }
.portrait-preview { display:flex;justify-content:center;align-items:end;gap:8px; }
.portrait-modes,.portrait-tools,.portrait-footer { display:grid;grid-template-columns:1fr 1fr;gap:8px; }
.portrait-editor button { font:400 14px/1.25 var(--ui-sans); min-height:44px; padding:7px; }
.portrait-editor button[aria-pressed=true] { background:var(--ui-paper,#f1dfb7);color:var(--ui-paper-ink,#352419);box-shadow:inset 0 0 0 2px var(--brass); }
.portrait-category { width:100%;min-height:44px; padding:7px 10px; background:#493025;color:var(--ink,#f7e6c5);border:1px solid var(--brass);font:400 15px var(--ui-sans); }
.portrait-choices { overflow:auto;min-height:0;overscroll-behavior:contain; }
.portrait-variants { display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px; }
.portrait-variant { display:grid;place-items:center;aspect-ratio:1;border:1px solid #b18a52;background:#eadcbd;color:#49382c;min-width:0; }
.portrait-variant svg { width:100%;height:100%; }
.portrait-pages { display:flex;align-items:center;justify-content:space-between;gap:6px;margin-top:6px; }
.portrait-pages span { font:400 12px var(--ui-sans); }
.portrait-editor .portrait-palette { margin:8px 0 0;display:flex;flex-wrap:wrap;gap:5px;padding:6px;border:1px solid #ac8952; }
.portrait-palette legend { font:400 13px var(--ui-sans); }
.portrait-editor .portrait-swatch { background:var(--swatch)!important;width:36px;height:36px;min-height:36px;border:1px solid #97754f;padding:0;border-radius:50%;color:white!important;text-shadow:0 1px 2px #221713; }
.portrait-editor .portrait-swatch[aria-pressed=true] { outline:2px solid #65462c;outline-offset:1px; }
.portrait-feedback { margin:0;font:400 13px/1.3 var(--ui-sans); }
.portrait-feedback:empty { display:none; }
.portrait-more { font:400 13px var(--ui-sans); }
.portrait-more summary { cursor:pointer;min-height:28px;padding:5px 0; }
.portrait-extra-actions { display:grid;gap:5px;max-height:130px;overflow:auto; }
.portrait-footer { padding-bottom:env(safe-area-inset-bottom); }
@media(max-width:350px),(max-height:700px) { .portrait-preview .portrait-medallion { width:170px; }.portrait-preview .portrait-mini { width:60px; }.portrait-editor.settings-dialog { padding:9px; }.portrait-editor[open] { gap:5px; }.portrait-editor-heading h2 { font-size:25px; } }
.portrait-editor .portrait-swatch::before,.portrait-editor .portrait-swatch::after,
.portrait-editor .portrait-variant::before,.portrait-editor .portrait-variant::after { display:none; }
.portrait-editor .portrait-swatch { clip-path:none; }
.portrait-editor.settings-dialog { background-image:linear-gradient(#f7e8c075,#f7e8c075),var(--profile-grain),radial-gradient(ellipse at 47% 30%,#f8edcf,#ecdaaf);background-size:auto,144px 144px,auto;background-blend-mode:normal,multiply,normal; }
.portrait-confirm { z-index:10;max-width:360px; }
.portrait-confirm p { font:400 16px/1.5 var(--ui-sans); }
.portrait-confirm button { min-height:44px;font:400 14px/1.35 var(--ui-sans); }
/* Optical centre of the original clock dial; keep the hour marks uncovered. */
.portrait-medallion,#profile-portrait.portrait-medallion { background-image:url('/portrait/clock-empty.webp');isolation:isolate; }
.portrait-medallion > svg,.portrait-medallion > .portrait-image,
#profile-portrait .portrait-image,.stats-peer-card .stats-personal-avatar > .portrait-image,
.stats-polish .foreign-pair .portrait-image { inset:auto;left:24%;top:21%;width:52%;height:52%;background:transparent;mix-blend-mode:multiply;object-fit:contain; }
.stats-polish .foreign-avatar.portrait-medallion { width:92px;height:92px;aspect-ratio:1;align-self:center; }
.stats-polish .foreign-compare-avatar { width:92px;height:92px;margin-inline:auto; }
.portrait-editor .portrait-variant { background-color:#ecddbc;background-image:var(--profile-grain);background-size:144px 144px;background-blend-mode:multiply; }
.portrait-editor .portrait-variant svg { mix-blend-mode:multiply; }
/* Keep the artwork and actual swatch colors readable under shared selection rules. */
body.game-skin .portrait-editor button.portrait-variant[aria-pressed] { background-color:#ecddbc!important;color:#49382c!important;border-color:#a17a46!important; }
body.game-skin .portrait-editor button.portrait-variant[aria-pressed=true] { background-color:#f7e8c6!important;border-color:#d6ac61!important;box-shadow:inset 0 0 0 2px #b58c48; }
body.game-skin .portrait-editor button.portrait-swatch[aria-pressed] { background:var(--swatch)!important;color:#fff!important;border-color:#97754f!important; }
/* Compact identity copy makes room for a larger personal clock medallion. */
#profile-portrait { width:clamp(90px,28vw,120px);height:auto;aspect-ratio:1; }
#profile-home > .profile-identity { column-gap:clamp(8px,2.5vw,12px);padding-inline:12px; }
#profile-display-name { font-size:clamp(27px,7.8vw,36px);line-height:1.08; }
#profile-since { font-size:clamp(13px,3.6vw,15px);line-height:1.3; }
#profile-home .profile-metrics { column-gap:5px;padding-top:5px; }
#profile-home .profile-metric-medal { gap:3px;padding-inline:9px;font-size:clamp(18px,4.8vw,23px); }
#profile-home .profile-metric:not([hidden]) + .profile-metric { padding-left:5px; }
.progression-dialog[open]{display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:10px;width:min(calc(100% - 20px),430px);max-height:calc(100dvh - 28px);padding:14px}
.progression-dialog h2,.progression-dialog h3{margin:0;font-family:var(--witness-display,Georgia,serif)}
.progression-content{min-height:0;overflow:auto;display:flex;flex-direction:column}
.progression-card{display:grid;gap:7px;min-width:0;margin:0;padding:12px;border:1px solid #967446;border-radius:4px;background:#f5e7bc66}
.progression-card p,.progression-feedback{margin:0}
.progression-balance{color:#512e21}
.progression-card progress{width:100%;accent-color:#814131}
.progression-card input[type=range]{width:100%;margin:0;min-height:44px;accent-color:#824438}
.progression-card output{font-weight:600;min-height:2.4em}
.progression-endpoints{display:flex;justify-content:space-between;gap:6px;font-size:.84rem}
.progression-dialog button{min-height:44px}
.progression-locked{background:#ab92702a}
.progression-new{color:#7c2626;font-weight:700}
.progression-color{display:flex;align-items:center;gap:10px}
.progression-color img{width:44px;height:44px}
.portrait-slots{display:flex;gap:8px}
.portrait-slots button{flex:1;min-height:44px}
.portrait-slots .portrait-slot-locked{filter:grayscale(1);opacity:.72}
#profile-portrait[data-token-color=silver]{--token-tone:grayscale(.85) brightness(1.08)}
#profile-portrait[data-token-color=copper]{--token-tone:sepia(.3) saturate(1.35) hue-rotate(335deg)}
#profile-portrait[data-token-color=olive]{--token-tone:sepia(.3) saturate(.75) hue-rotate(25deg)}
#profile-portrait[data-token-color=plum]{--token-tone:sepia(.4) saturate(.7) hue-rotate(260deg)}
#profile-portrait[data-token-color]:not([data-token-color=default]):not(.portrait-medallion) img{filter:var(--token-tone)}
#profile-portrait.portrait-medallion[data-token-color]:not([data-token-color=default]){background-image:none}
#profile-portrait.portrait-medallion[data-token-color]:not([data-token-color=default])::before{content:'';position:absolute;inset:0;background:url('/portrait/clock-empty.webp') center/contain no-repeat;filter:var(--token-tone);z-index:-1}
.progression-dialog.settings-dialog{--profile-grain:url('/materials/profile-art-v1/grain.png');background-image:var(--profile-grain),radial-gradient(ellipse at 47% 30%,#f8edcf,#ecdaaf);background-size:144px 144px,auto;background-blend-mode:multiply,normal;max-height:calc(100dvh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
.progression-card h3{font-size:1.2rem;line-height:1.15}
.progression-content .progression-card button{justify-self:start}
.progression-dialog.settings-dialog[open] {
  position:fixed; inset:0; box-sizing:border-box; margin:auto;
  width:min(100%,540px); height:100dvh; max-height:100dvh; max-width:100%;
  padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  gap:0; border:0; border-radius:0; overflow:hidden;
  background:#30201d; box-shadow:0 0 40px #140a08b0; color:#f7e6c5;
}
.progression-heading {
  display:flex; align-items:center; gap:12px; padding:12px 14px;
  background:linear-gradient(160deg,#51362a,#34211c);
  border-bottom:1px solid #98744c;
}
.progression-heading h2 { font:500 clamp(24px,7vw,32px)/1.08 var(--ui-serif); }
.progression-content { padding:12px; }
.progression-content > * { flex:none; }
.progression-dialog .progression-card {
  background-color:#eaddbc; color:#352419;
  background-image:url('/materials/profile-art-v1/grain.png'),radial-gradient(ellipse at 45% 20%,#fbefce,#e5d1a5);
  background-size:144px 144px,auto; background-blend-mode:multiply,normal;
  border:1px solid #ab8453; border-radius:2px; box-shadow:inset 0 0 0 2px #f6e6bc,inset 0 0 0 3px #bc9b66;
  padding:13px; margin:0;
}
.progression-hero { grid-template-columns:clamp(50px,18vw,78px) 1fr; align-items:center; gap:12px; }
.progression-art { display:block; width:100%; aspect-ratio:1; object-fit:contain; }
.progression-caption { font-size:.82rem; color:#695134; }
.progression-balance { display:block; font:600 clamp(29px,8vw,38px)/1.12 var(--ui-serif); }
.progression-dialog .progression-next h3 { font:500 1.55rem/1.12 var(--ui-serif); }
.progression-next progress { height:10px; margin-block:4px; }
.progression-dialog .progression-group { display:block; padding:5px 12px; }
.progression-group summary { min-height:44px; align-content:center; cursor:pointer; font:500 1.22rem/1.25 var(--ui-serif); }
.progression-reward,.progression-source {
  display:grid; grid-template-columns:auto minmax(0,1fr) auto auto; align-items:center;
  gap:8px; min-height:47px; width:100%; padding:6px 0; border-top:1px solid #a882554a;
  background:none; color:inherit; text-align:left; font:inherit;
}
.progression-reward-copy { display:grid; }
.progression-reward-copy strong { font-weight:600; }
.progression-threshold { white-space:nowrap; font-size:.82rem; color:#664b32; }
.progression-reward-mark { display:grid; place-items:center; width:20px; color:#436235; font-weight:700; }
.progression-lock::before { content:''; width:9px; height:7px; border:1px solid #75583a; border-radius:2px; grid-area:1/1; transform:translateY(3px); }
.progression-lock::after { content:''; width:6px; height:6px; border:1px solid #75583a; border-bottom:0; border-radius:5px 5px 0 0; grid-area:1/1; transform:translateY(-4px); }
.progression-source { grid-template-columns:1fr auto; }
.progression-intro { margin:0; padding:4px 3px; }
.progression-feedback:not(:empty) { padding:6px 12px; }
.progression-feedback:empty { display:none; }
.progression-choice legend { padding:2px 8px; background:#ead9b3; border:1px solid #a88455; }
#profile-home .profile-metrics { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:stretch; }
#profile-home .profile-metrics:not(:has(.profile-metric:not([hidden]))) { display:none; }
#profile-home .profile-metrics:has(> [hidden]) { grid-template-columns:minmax(0,1fr); }
#profile-home .profile-metric { justify-items:stretch; }
#profile-xp .profile-xp-link, #profile-rating .profile-rating-link {
  appearance:none; border:0; box-shadow:none; color:inherit;
  min-height:40px; width:100%; align-self:stretch;
}
#profile-xp .profile-laurel,#profile-rating .profile-laurel { top:50%; translate:0 -50%; }
#profile-xp .profile-xp-link:focus-visible, #profile-rating .profile-rating-link:focus-visible { outline:2px solid #81572e; outline-offset:2px; }
.progression-choice { gap:4px; }
.progression-choice output { min-height:0; font-size:.92rem; }
.progression-scale { display:grid; grid-template-columns:repeat(11,minmax(0,1fr)); }
.progression-dialog .progression-scale .progression-step {
  min-width:0; border:0; font:600 clamp(9px,2.6vw,12px)/1 var(--ui-serif);
  color:#3e280e; background:none; position:relative; isolation:isolate;
}
.progression-step::before {
  content:''; position:absolute; inset:8px 0; z-index:-1;
}
.progression-step[aria-pressed=true]::before { border-color:#663029; }
.progression-scale-hint { font-size:.8rem; color:#654c32; }
.progression-content { gap:8px; }
.progression-dialog .progression-card { padding-block:9px; }
.progression-group .progression-reward-detail > summary {
  display:grid; list-style:none; font:inherit; min-height:44px;
}
.progression-reward-detail > summary::-webkit-details-marker { display:none; }
.progression-reward-detail .progression-chevron {
  width:7px; height:7px; margin-right:3px;
  border-right:1.5px solid; border-bottom:1.5px solid; transform:rotate(45deg);
}
.progression-reward-detail[open] .progression-chevron { transform:rotate(225deg); }
.progression-group .progression-reward-description {
  padding:0 11px 10px 28px; font-size:.9rem; line-height:1.35;
}
.progression-choice-heading {
  display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:2px 8px;
  padding-bottom:5px; border-bottom:1px solid #9d7b4e55;
}
.progression-dialog[data-page=preferences] .progression-choice {
  padding:11px 12px; gap:6px;
}
.progression-choice-heading output { color:#754130; font-weight:600; }
.progression-choice .progression-endpoints { color:#62492f; }
.progression-choice .search {
  min-height:44px; width:100%; color:#352419; background:#f6e8c6;
  border:1px solid #a48457;
}
.progression-dialog .progression-scale .progression-step { font-family:var(--ui-sans,system-ui); }
.progression-step::before { inset:7px 0; }
.progression-save { width:100%; }
#profile-rating .profile-metric-medal { align-self:stretch; min-height:40px; }
/* Discrete scale with a continuous rail and one selected marker. */
.progression-scale { position:relative; gap:0; }
.progression-scale::before {
  content:''; position:absolute; top:17px; left:4.55%; right:4.55%; height:3px;
  background:#a1937c; border-radius:3px;
}
.progression-dialog .progression-scale .progression-step {
  display:flex; align-items:flex-end; justify-content:center;
  min-height:48px; padding:0 0 3px; font-size:clamp(11px,3.3vw,14px);
  box-shadow:none;
}
.progression-step::before {
  inset:auto; top:11px; left:50%; width:14px; height:14px;
  transform:translateX(-50%); border-radius:50%; background:#e5bb70;
  border:1px solid #78532b;
}
.progression-step.locked::before { background:#d1c6b3; border-color:#928778; }
.progression-dialog .progression-scale .progression-step.locked { color:#756a5a; }
.progression-dialog .progression-scale .progression-step[aria-pressed=true] { color:#68372e; }
.progression-step[aria-pressed=true]::before {
  top:7px; width:22px; height:22px;
  background:radial-gradient(at 40% 25%,#935a45,#602d26);
  border:2px solid #d0a863; box-shadow:0 0 0 1px #70442a;
}
body.game-skin .progression-scale button.progression-step[aria-pressed] {
  background:transparent!important;
  border:0;
  color:#624023!important;
}
body.game-skin .progression-scale button.progression-step.locked[aria-pressed] { color:#635c50!important; }
body.game-skin .progression-scale button.progression-step[aria-pressed=true] { color:#68372e!important; }
.progression-step::before { box-sizing:border-box; }
.shop-dialog #shop-content {
  display:block; min-height:0; overflow-y:auto; overscroll-behavior:contain;
  padding:10px 12px 16px; scrollbar-gutter:stable;
}
.shop-dialog #shop-status { margin:0; font:400 14px/1.4 var(--ui-sans); }
.shop-dialog .shop-tabs {
  display:grid; grid-template-columns:1fr 1fr; gap:6px; margin:0 0 10px;
}
.shop-dialog .shop-tabs button { min-height:44px; font:500 17px/1.2 var(--ui-serif); }
.shop-pane { display:grid; gap:8px; }
.shop-dialog .progression-card {
  display:block; min-width:0; margin:0; padding:0; color:#352419;
  background-color:#eaddbc;
  background-image:url('/materials/profile-art-v1/grain.png'),radial-gradient(ellipse at 45% 20%,#fbefce,#e5d1a5);
  background-size:144px 144px,auto; background-blend-mode:multiply,normal;
  border:1px solid #ab8453; border-radius:2px;
  box-shadow:inset 0 0 0 2px #f6e6bc,inset 0 0 0 3px #bc9b66;
}
.shop-item-heading {
  display:grid; grid-template-columns:minmax(0,1fr) auto 10px; align-items:center;
  gap:8px; min-height:62px; padding:9px 13px; box-sizing:border-box; cursor:pointer;
}
.shop-dialog summary { list-style:none; }
.shop-dialog summary::-webkit-details-marker { display:none; }
.shop-item-copy { display:grid; min-width:0; gap:2px; }
.shop-item-copy strong { font:500 clamp(18px,5vw,21px)/1.12 var(--ui-serif); overflow-wrap:anywhere; }
.shop-item-copy small { font:400 12px/1.3 var(--ui-sans); color:#745b3f; }
.shop-price,.shop-quantity { white-space:nowrap; font:500 17px/1.2 var(--ui-serif); color:#6d4526; }
.shop-dialog .progression-chevron {
  width:6px; height:6px; justify-self:end;
  border-right:1px solid currentColor; border-bottom:1px solid currentColor;
  transform:rotate(45deg); transition:transform .15s ease;
}
.shop-item[open] .progression-chevron { transform:rotate(225deg); }
.shop-item-body { padding:0 13px 12px; }
.shop-dialog .shop-item-body p { margin:0 0 10px; font-size:14px; line-height:1.45; }
.shop-dialog .shop-item-body button { width:100%; min-height:44px; font-size:15px; }
.shop-caption { font:400 13px/1.4 var(--ui-sans); color:#cbb89a; }
.shop-dialog .progression-card .shop-caption { color:#705a3f; }
.shop-toolbar { display:grid; grid-template-columns:minmax(0,1fr) 44px; align-items:center; min-width:0; gap:8px; }
.shop-filter-toggle {
  display:grid; place-items:center; width:44px; height:44px; box-sizing:border-box;
  font:400 25px/1 var(--ui-sans); cursor:pointer;
}
.shop-filter-menu {
  display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); width:100%;
  gap:4px; padding:8px; box-sizing:border-box;
}
.shop-filter-menu[hidden] { display:none; }
.shop-filter-menu button { min-height:44px; width:100%; text-align:left; font-size:14px; }
.shop-history-heading { min-height:48px; padding:12px 13px; box-sizing:border-box; cursor:pointer; font:500 18px/1.25 var(--ui-serif); }
.shop-history-heading::after { content:'⌄'; float:right; font:400 18px/1 var(--ui-sans); }
.shop-history[open] > .shop-history-heading::after { content:'⌃'; }
.shop-history > p { margin:0; padding:0 13px 12px; }
.shop-order { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; align-items:center; padding:10px 13px; border-top:1px solid #ab84534a; }
.shop-order > div { display:grid; gap:2px; }
.shop-order strong { font:500 17px/1.2 var(--ui-serif); }
.shop-order small { color:#705a3f; font-size:12px; }
.shop-support-link { display:block; padding:12px 13px; color:#6b432a; font-size:13px; text-underline-offset:3px; }
.shop-dialog .shop-empty { padding:18px 13px; }
.shop-empty h3 { margin:0 0 7px; font:500 23px/1.1 var(--ui-serif); }
.shop-empty p { margin:0; color:#705a3f; font-size:14px; }
.shop-catalog-link { min-height:44px; }
.shop-tip-options { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:5px; padding:0 13px 10px; }
.shop-tip-options button { min-width:0; min-height:44px; padding:5px 2px; font-size:14px; }
.shop-tip-form { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; padding:0 13px 13px; }
.shop-tip-form input,.shop-item-body select { min-width:0; width:100%; min-height:44px; box-sizing:border-box; }
.shop-dialog summary:focus-visible { outline:2px solid #dfb66d; outline-offset:2px; }
@media (max-width: 370px) {
  .topbar.has-three-shortcuts { gap: 6px; padding-inline: max(8px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-right)); }
  .topbar.has-three-shortcuts .header-shortcuts { gap: 4px; }
}
.shop-confirm { box-sizing:border-box; width:min(420px,calc(100% - 24px)); padding:18px; }
.shop-confirm h2 { margin:0; font:500 26px/1.15 var(--ui-serif); }
.shop-confirm p { margin:10px 0; }
.shop-confirm .shop-caption { color:#705a3f; font-size:12px; }
.shop-confirm-price { font:500 26px/1.2 var(--ui-serif); }
.shop-purchase-terms { font-size:14px; }
.shop-purchase-terms summary { min-height:44px; align-content:center; cursor:pointer; }
.shop-purchase-terms a { color:#68432e; }
.shop-confirm-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:12px; }
.history-personal-decisions { border-top: 1px solid #a7804555; margin-top: 14px; padding-top: 10px; }
.history-personal-decisions h4 { margin: 0; color: inherit; }
.history-personal-decisions ul { padding-inline-start: 1.25em; margin: 5px 0 0; }
.history-personal-decisions li + li { margin-top: 5px; }
.game-film { padding: 10px; margin: 12px 0; }
.game-film video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #211710; object-fit: contain; }
.game-film-controls { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.game-film-controls button, #archive-video-sound { font-size: 14px; min-height: 36px; padding: 6px 12px; }
