/* mouserank stylesheet. One layer: tokens, base, header, list head, board, pool, catalog, dialogs, toasts, responsive. */

/* ---------- Fonts (local) ---------- */
@font-face{font-family:'Barlow Condensed';font-style:normal;font-weight:600;font-display:swap;src:url(/fonts/font-0.ttf) format('truetype')}
@font-face{font-family:'Barlow Condensed';font-style:normal;font-weight:700;font-display:swap;src:url(/fonts/font-1.ttf) format('truetype')}
@font-face{font-family:'Barlow Condensed';font-style:normal;font-weight:800;font-display:swap;src:url(/fonts/font-2.ttf) format('truetype')}
@font-face{font-family:'DM Sans';font-style:normal;font-weight:400;font-display:swap;src:url(/fonts/font-3.ttf) format('truetype')}
@font-face{font-family:'DM Sans';font-style:normal;font-weight:500;font-display:swap;src:url(/fonts/font-4.ttf) format('truetype')}
@font-face{font-family:'DM Sans';font-style:normal;font-weight:600;font-display:swap;src:url(/fonts/font-5.ttf) format('truetype')}
@font-face{font-family:'DM Sans';font-style:normal;font-weight:700;font-display:swap;src:url(/fonts/font-6.ttf) format('truetype')}

/* ---------- Tokens ---------- */
:root{
  --ground:#f3f4f7;--surface:#fff;--surface-2:#eaecf1;--ink:#1c1e22;--muted:#6b7079;--line:#dfe2e8;--line-strong:#c9cdd5;
  --accent:#f2542d;--accent-hover:#e0481f;--on-accent:#fff;--toast:#1c1e22;--on-toast:#fff;
  --t0:#f2542d;--t1:#f2b05a;--t2:#e9cf6a;--t3:#b9c99a;--t4:#9fb6c4;--t5:#d6d8de;
  --on-t0:#fff;--on-rail:#1c1e22;
  --photo:#fff;--shadow:0 12px 40px rgba(20,22,26,.18);
  --display:'Barlow Condensed','Arial Narrow',Impact,sans-serif;
  --body:'DM Sans',system-ui,-apple-system,'Segoe UI',Helvetica,Arial,sans-serif;
  --ease-out:cubic-bezier(.22,1,.36,1);
  --spring:linear(0,.006,.025 2.8%,.101 6.1%,.539 18.9%,.721 25.3%,.849 31.5%,.937 38.1%,.968 41.8%,.991 45.7%,1.006 50.1%,1.015 55%,1.017 63.9%,1.001);
  --radius:10px;--radius-s:7px;
  color-scheme:light;
}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){
  --ground:#141518;--surface:#1d1f24;--surface-2:#26292f;--ink:#eceef2;--muted:#9a9fa8;--line:#2d3038;--line-strong:#3a3e48;
  --accent:#ff6a45;--accent-hover:#ff7d5c;--toast:#eceef2;--on-toast:#1c1e22;
  --t0:#f2542d;--t1:#c98a3a;--t2:#b8a24a;--t3:#8a9a70;--t4:#6f8898;--t5:#3a3d45;
  --on-rail:#eceef2;--photo:#f4f5f7;--shadow:0 12px 40px rgba(0,0,0,.5);
  color-scheme:dark;
}}
:root[data-theme="dark"]{
  --ground:#141518;--surface:#1d1f24;--surface-2:#26292f;--ink:#eceef2;--muted:#9a9fa8;--line:#2d3038;--line-strong:#3a3e48;
  --accent:#ff6a45;--accent-hover:#ff7d5c;--toast:#eceef2;--on-toast:#1c1e22;
  --t0:#f2542d;--t1:#c98a3a;--t2:#b8a24a;--t3:#8a9a70;--t4:#6f8898;--t5:#3a3d45;
  --on-rail:#eceef2;--photo:#f4f5f7;--shadow:0 12px 40px rgba(0,0,0,.5);
  color-scheme:dark;
}

/* ---------- Base ---------- */
*{box-sizing:border-box}
html{font-family:var(--body);color:var(--ink);background:var(--ground);font-synthesis:none;-webkit-text-size-adjust:100%}
body{margin:0;font-size:16px;line-height:1.5;background:var(--ground);color:var(--ink)}
h1,h2,h3,p,dl,dd,figure{margin:0}
h1,h2,h3{font-family:var(--display);line-height:1.05;font-weight:700;letter-spacing:-.01em}
h2{font-size:26px}
h3{font-size:20px}
button,input,select,textarea{font:inherit;color:inherit}
button,a,input,select,textarea{-webkit-tap-highlight-color:transparent}
button{border:0;background:none;padding:0;cursor:pointer}
button:disabled{cursor:default;opacity:.4}
a{color:inherit}
img{display:block;max-width:100%}
:where(button,a,input,select,textarea,[tabindex]):focus-visible{outline:2px solid var(--accent);outline-offset:3px}
[hidden]{display:none!important}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.muted{color:var(--muted)}
.small{font-size:14px}
.tabular{font-variant-numeric:tabular-nums}
input[type=text],input[type=search],input:not([type]),select,textarea{
  width:100%;background:var(--surface);border:1px solid var(--line-strong);border-radius:var(--radius-s);padding:9px 12px;color:var(--ink);min-height:40px;font-size:15px
}
select{appearance:none;-webkit-appearance:none;padding-right:34px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b7079' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center}
textarea{min-height:88px;resize:vertical}
input[type=search]::-webkit-search-cancel-button{-webkit-appearance:none}
input[type=checkbox]{accent-color:var(--accent);width:16px;height:16px;margin:0 8px 0 0;vertical-align:-3px}
kbd{font-family:var(--body);font-size:11px;font-weight:600;color:var(--muted);border:1px solid var(--line-strong);border-radius:5px;padding:1px 6px;line-height:1.4;background:var(--surface)}

/* Buttons */
.button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:40px;padding:0 16px;border-radius:var(--radius-s);font-size:14px;font-weight:600;line-height:1;white-space:nowrap;transition:background .15s,transform .12s var(--ease-out)}
.button:active{transform:scale(.97);transition-duration:.06s}
.button.primary{background:var(--accent);color:var(--on-accent)}
.button.primary:hover{background:var(--accent-hover)}
.button.secondary{background:var(--surface);color:var(--ink);box-shadow:inset 0 0 0 1px var(--line-strong)}
.button.secondary:hover{background:var(--surface-2)}
.button.wide{width:100%}
.text-button{font-size:14px;font-weight:500;color:var(--muted);padding:6px 2px;border-radius:4px;transition:color .15s}
.text-button:hover{color:var(--ink)}
.icon-button{width:40px;height:40px;display:inline-grid;place-items:center;border-radius:var(--radius-s);color:var(--muted);transition:background .15s,color .15s}
.icon-button:hover{background:var(--surface-2);color:var(--ink)}
.icon-button svg{width:20px;height:20px}
.ui-icon{width:16px;height:16px;flex:0 0 16px;vertical-align:-3px;pointer-events:none}
:is(.text-button,.nav,.editions-button,.detail-actions button,.toast-action,.rank-picker .unrank,.tier-chip.chip-plain){display:inline-flex;align-items:center;justify-content:center;gap:6px}
.editions-open .ui-icon{width:12px;height:12px;margin-right:4px}
.row-open .ui-icon{width:13px;height:13px;margin-left:6px;color:var(--muted)}
.edition>.ui-icon{margin-left:auto}
.catalog-more summary .ui-icon{margin-right:6px}
.th-sort>.ui-icon{width:13px;height:13px;flex-basis:13px;opacity:.6}
.banner button{display:grid;place-items:center}

/* ---------- Header ---------- */
.topbar{display:flex;align-items:center;gap:36px;height:64px;padding:0 32px;background:var(--ground);border-bottom:1px solid var(--line)}
.brand{display:flex;align-items:center;gap:10px;text-decoration:none;font-weight:700;font-size:23px;letter-spacing:-.04em;color:var(--ink);line-height:1}
.brand>span{font-weight:400;color:var(--muted)}
.brand-word{display:flex}
.brandmark{width:28px;height:28px;color:var(--accent);flex-shrink:0}
.byline{font-size:13px;color:var(--muted);margin-left:-24px;white-space:nowrap;padding-top:4px}
.topbar nav{display:flex;align-self:stretch;gap:24px}
.nav{position:relative;font-size:15px;font-weight:500;color:var(--muted);padding:0 2px;white-space:nowrap;transition:color .15s}
.nav:hover{color:var(--ink)}
.nav.active{color:var(--ink)}
.nav.active::after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:2px;background:var(--accent)}
.topbar-actions{margin-left:auto;display:flex;align-items:center;gap:8px}
#theme-toggle .moon{display:none}
:root[data-theme="dark"] #theme-toggle .sun{display:none}
:root[data-theme="dark"] #theme-toggle .moon{display:block}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) #theme-toggle .sun{display:none}:root:not([data-theme="light"]) #theme-toggle .moon{display:block}}

/* ---------- Page ---------- */
main{max-width:1600px;margin:0 auto;padding:28px 32px 0}
.banner{display:flex;align-items:center;justify-content:space-between;gap:16px;background:var(--surface);border:1px solid var(--line);border-left:4px solid var(--accent);border-radius:var(--radius-s);padding:12px 16px;margin-bottom:22px;font-size:15px}
.banner button{font-size:22px;line-height:1;color:var(--muted);width:32px;height:32px;border-radius:6px}
.banner button:hover{background:var(--surface-2);color:var(--ink)}

/* List head: the editable title is the H1 */
.list-head{display:flex;align-items:flex-end;justify-content:space-between;gap:24px;margin-bottom:4px}
.list-title{flex:1;min-width:0;font-size:42px;font-weight:700;line-height:1.1}
.list-title input{font:inherit;letter-spacing:inherit;width:100%;background:transparent;border:0;border-bottom:2px solid transparent;border-radius:0;padding:2px 0;margin:0;color:var(--ink);min-height:0;text-overflow:ellipsis;transition:border-color .15s}
.list-title input:hover{border-bottom-color:var(--line)}
.list-title input:focus{border-bottom-color:var(--accent);outline:0}
.list-tools{display:flex;align-items:center;gap:20px;flex-wrap:wrap;margin-bottom:18px;font-size:14px;color:var(--muted)}
.list-tools .tool-group{display:flex;gap:18px;flex-wrap:wrap}

/* ---------- Workspace ---------- */
.workspace{display:grid;grid-template-columns:minmax(0,1fr) 400px;gap:24px;align-items:start}

/* ---------- Board ---------- */
.board{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);overflow:hidden}
.tier-row{display:flex;min-height:112px;border-bottom:1px solid var(--line);position:relative}
.tier-row:first-child{min-height:140px}
.tier-row:last-child{border-bottom:0}
.tier-rail{--letter:44px;--fit:160px;flex:0 0 88px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;padding:8px 6px;background:var(--rail);color:var(--on-rail);text-align:center;transition:filter .15s}
.tier-rail:hover{filter:brightness(1.05)}
.tier-row:first-child .tier-rail{--letter:52px;color:var(--on-t0)}
/* --label-len is the character count of the tier's label, set on the row by renderBoard(). A five-character
   rename shrinks to fit the rail rather than wrapping, which is what turned "SITUATIONAL" into "SITUATION AL". */
.tier-rail .letter{font-family:var(--display);font-size:min(var(--letter),calc(var(--fit) / var(--label-len,1)));font-weight:800;line-height:1;max-width:100%;overflow-wrap:anywhere}
.tier-rail .desc{font-size:12px;font-weight:500;line-height:1.25;opacity:.85;overflow-wrap:anywhere}
.tier-cells{flex:1;min-width:0;display:flex;flex-wrap:wrap;gap:4px;padding:8px;align-content:flex-start;position:relative}
.tier-placeholder{position:absolute;inset:0;display:grid;place-items:center;color:var(--muted);font-size:14px;opacity:.7;pointer-events:none}

/* Mouse items. Cards in the pool have a faint ground; inside tiers they are borderless. */
.mouse-card{position:relative;width:112px;padding:8px 8px 9px;border-radius:8px;text-align:left;cursor:pointer;color:var(--ink);background:var(--surface);box-shadow:0 0 0 1px var(--line);user-select:none;-webkit-user-select:none;transition:transform .12s var(--ease-out),box-shadow .15s,background .15s;will-change:transform}
.mouse-card:hover{box-shadow:0 0 0 1px var(--line-strong)}
.mouse-card:active{transform:scale(.96);transition-duration:.06s}
.mouse-card .photo{height:62px;border-radius:6px;background:var(--photo);display:grid;place-items:center;overflow:hidden}
/* A card with no photo has nothing to light: a paper-white plate around empty space is the loudest thing
   on a dark board. Give the monogram the page's own surface instead. */
.no-photo{background:var(--surface-2)}
.mouse-card .photo img{width:100%;height:100%;min-width:0;min-height:0;object-fit:contain;pointer-events:none}
.monogram{font-family:var(--display);font-weight:700;font-size:16px;color:var(--muted);letter-spacing:.01em;padding:0 6px;text-align:center;overflow-wrap:anywhere}
.card-brand{display:block;font-size:11px;color:var(--muted);margin-top:7px;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.card-title{display:block;font-family:var(--display);font-size:16px;font-weight:700;line-height:1.05;letter-spacing:.005em;margin-top:2px;overflow-wrap:break-word}
.card-meta{display:block;font-size:12px;color:var(--muted);margin-top:4px;line-height:1.3;font-variant-numeric:tabular-nums}
/* Editions. The count is quiet type in the meta line; the control appears on hover, and only where there is
   a hover to speak of. On touch the same picker opens from the Editions chip. */
.card-editions{color:var(--muted);opacity:.85}
.editions-open{position:absolute;top:5px;right:5px;display:none;padding:2px 8px;border-radius:999px;font-size:11px;font-weight:600;line-height:1.6;color:var(--ink);background:var(--surface);box-shadow:0 0 0 1px var(--line-strong);cursor:pointer}
.editions-open:hover{background:var(--surface-2)}
@media (hover:hover){.mouse-card:hover .editions-open,.mouse-card:focus-visible .editions-open{display:block}}
.detail-editions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:-10px 0 20px}
.editions-button{min-height:34px;padding:0 12px;border-radius:8px;font-size:13px;font-weight:600;color:var(--ink);background:var(--surface-2);transition:background .15s}
.editions-button:hover{background:var(--line)}

.tier-cells .mouse-card{width:104px;background:transparent;box-shadow:none}
.tier-cells .mouse-card:hover{background:var(--surface-2)}
.tier-cells .mouse-card .photo{height:58px}
.tier-cells .card-meta{display:none}
.board-hint{margin-top:14px;font-size:14px;color:var(--muted)}

/* ---------- Pool ---------- */
.pool{position:sticky;top:16px;display:flex;flex-direction:column;max-height:calc(100vh - 32px);background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);min-width:0}
.pool-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:16px 16px 10px}
.pool-head h2{font-size:24px}
.search{position:relative;display:block;margin:0 16px 8px}
.search input{padding-right:40px}
.search kbd{position:absolute;right:10px;top:50%;transform:translateY(-50%)}
.filters{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:0 16px}
/* The ticks wrap into as many rows as the panel needs; Clear filters keeps the end of the first line. */
.pool-options{display:flex;align-items:flex-start;justify-content:space-between;gap:8px;padding:10px 16px;font-size:14px}
.pool-ticks{display:flex;flex-wrap:wrap;gap:4px 12px;min-width:0}
.pool-ticks label{display:inline-flex;align-items:center;color:var(--muted);cursor:pointer;white-space:nowrap;padding:2px 0}
.pool-ticks label:hover{color:var(--ink)}
.pool-ticks input[type=checkbox]{margin-right:6px}
.pool-options .text-button{flex:0 0 auto;padding:2px}
.mouse-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));align-content:start;align-items:start;gap:8px;padding:2px 16px 16px;overflow-y:auto;overscroll-behavior:contain;flex:1;min-height:200px}
.mouse-grid .mouse-card{width:auto}
.mouse-grid .mouse-card .photo{height:84px}
.empty-pool{grid-column:1/-1;padding:24px 8px;text-align:center;color:var(--muted);font-size:14px;line-height:1.5}
.empty-pool strong{display:block;color:var(--ink);font-weight:600;margin-bottom:4px}
.pool-bottom{padding:10px 16px 12px;border-top:1px solid var(--line);font-size:14px;color:var(--muted)}
.pool-bottom .text-button{color:var(--ink);padding:0}

/* ---------- Catalog page ---------- */
.page-head{max-width:70ch;margin-bottom:24px}
.page-head h1{font-size:42px;font-weight:700}
.page-head p{margin-top:8px;color:var(--muted);line-height:1.55}
.status-badge{display:inline-block;font-size:12px;font-weight:600;padding:2px 8px;border-radius:999px;background:var(--surface-2);color:var(--ink);white-space:nowrap}
.status-badge.status-released{background:color-mix(in srgb,var(--t3) 45%,var(--surface))}
.status-badge.status-upcoming{background:color-mix(in srgb,var(--t4) 45%,var(--surface))}
.status-badge.status-unverified{background:color-mix(in srgb,var(--t2) 45%,var(--surface))}
.status-badge.status-legacy{background:var(--surface-2);color:var(--muted)}
.status-badge.status-custom{background:color-mix(in srgb,var(--accent) 18%,var(--surface))}
.about-catalog{max-width:70ch;margin-top:40px;padding-top:24px;border-top:1px solid var(--line)}
.about-catalog h2{font-size:26px;margin-bottom:8px}
.about-catalog p{color:var(--muted);line-height:1.6;margin-bottom:12px}
.about-catalog h3{font-size:18px;margin:20px 0 8px}
.reviewer-links{display:flex;flex-direction:column;gap:6px}
.reviewer-links a{display:flex;gap:10px;font-size:15px;text-decoration:none;padding:6px 0}
.reviewer-links a strong{font-weight:600;min-width:12ch}
.reviewer-links a span{color:var(--muted)}
.reviewer-links a:hover span{color:var(--ink)}
.simple-table{width:100%;border-collapse:collapse;font-size:14px;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);overflow:hidden}
.simple-table th{text-align:left;font-weight:500;color:var(--muted);padding:12px 14px;border-bottom:1px solid var(--line)}
.simple-table td{padding:12px 14px;border-bottom:1px solid var(--line);vertical-align:top}
.simple-table tr:last-child td{border-bottom:0}
.table-wrap{overflow-x:auto}

/* Catalog browser (catalog-view.js) */
.catalog-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-bottom:14px}
.catalog-search{position:relative;display:block;flex:1 1 260px;min-width:190px;max-width:340px}
.catalog-toolbar select{width:auto;max-width:200px}
.catalog-weight{display:flex;align-items:center;gap:8px;font-size:14px;color:var(--muted);white-space:nowrap}
.catalog-weight input[type=number]{width:76px;min-height:40px;padding:9px 10px;font-size:15px;color:var(--ink);background:var(--surface);border:1px solid var(--line-strong);border-radius:var(--radius-s);font-variant-numeric:tabular-nums;appearance:textfield;-moz-appearance:textfield}
.catalog-weight input[type=number]::-webkit-outer-spin-button,.catalog-weight input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.catalog-count{margin-bottom:10px;font-size:14px;color:var(--muted)}
#catalog-clear{margin-left:auto}

/* Table. Headers are buttons so the whole cell sorts; the chevron is drawn, never a glyph. */
.catalog-table{table-layout:auto}
.catalog-table th.sortable{padding:0}
.catalog-table .th-sort{display:flex;align-items:center;gap:6px;width:100%;padding:12px 14px;font-size:13px;font-weight:500;color:var(--muted);text-align:left;white-space:nowrap;transition:color .15s}
.catalog-table .th-sort:hover{color:var(--ink)}
.catalog-table .th-sort:focus-visible{outline-offset:-2px}
.catalog-table th.sorted .th-sort{color:var(--ink);font-weight:600}
.catalog-table th.sorted::after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:2px;background:var(--accent)}
.catalog-table th{position:relative}
.catalog-table .sort-mark{width:9px;height:9px;flex:none;opacity:0;transform-origin:50% 50%;transition:opacity .15s,transform .18s var(--ease-out)}
.catalog-table .sort-mark::before{content:"";display:block;width:6px;height:6px;margin:0 auto;border-right:1.6px solid currentColor;border-bottom:1.6px solid currentColor;transform:translateY(-2px) rotate(45deg)}
.catalog-table .th-sort:hover .sort-mark{opacity:.5}
.catalog-table th.sorted .sort-mark{opacity:1}
.catalog-table th.sorted-asc .sort-mark{transform:rotate(180deg)}
.catalog-table td{padding:7px 14px;vertical-align:middle}
.catalog-row{cursor:pointer;transition:background .12s}
.catalog-row:hover,.catalog-row:has(.row-open:focus-visible){background:var(--surface-2)}
.catalog-table .none{color:var(--muted)}
.catalog-table .col-photo{width:1%;padding:6px 4px 6px 12px}
.catalog-table .photo{display:grid;place-items:center;width:36px;height:36px;border-radius:6px;background:var(--photo);overflow:hidden}
.catalog-table .photo img{width:100%;height:100%;object-fit:contain}
.catalog-table .monogram{font-size:11px;font-weight:700;line-height:1;padding:0}
.catalog-table .col-brand{color:var(--muted);white-space:nowrap}
.catalog-table .col-model{min-width:170px}
.catalog-table .row-open{display:block;font-family:var(--display);font-size:17px;font-weight:700;line-height:1.15;color:var(--ink);text-align:left;transition:color .12s}
.catalog-row:hover .row-open{color:var(--accent)}
.catalog-table .row-open:focus-visible{outline-offset:2px}
.catalog-table .col-weight,.catalog-table .col-polling{font-variant-numeric:tabular-nums;white-space:nowrap;text-align:right}
.catalog-table th.col-weight .th-sort,.catalog-table th.col-polling .th-sort{justify-content:flex-end}
.catalog-table .col-released,.catalog-table .col-size,.catalog-table .col-shape,.catalog-table .col-status{white-space:nowrap}
.catalog-table .col-sensor,.catalog-table .col-mcu{min-width:120px}
.catalog-empty td{padding:32px 14px;text-align:center;color:var(--muted)}
@media (max-width:1100px){
  .catalog-toolbar select{max-width:170px}
  .catalog-table .row-open{font-size:16px}
}
@media (max-width:800px){
  .catalog-search{flex-basis:100%;max-width:none}
  .catalog-toolbar select{flex:1 1 calc(50% - 5px);min-width:0;max-width:none}
  .catalog-weight{flex:1 1 100%}
  .catalog-weight input[type=number]{flex:1 1 60px;width:auto;min-width:56px}
  .catalog-weight label{white-space:nowrap}
  #catalog-clear{margin-left:0}
  .catalog-table{min-width:800px}
  .catalog-table .col-model{min-width:150px}
}

/* ---------- Footer ---------- */
footer{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;margin-top:56px;padding:24px 0 32px;border-top:1px solid var(--line);font-size:14px;color:var(--muted)}
.footer-brand{font-weight:600;color:var(--ink)}
.footer-brand span{font-weight:400;color:var(--muted)}
footer .footer-links{display:flex;gap:18px}

/* ---------- Dialogs ---------- */
dialog{border:0;border-radius:14px;padding:28px;max-width:min(560px,calc(100vw - 32px));width:100%;background:var(--surface);color:var(--ink);box-shadow:var(--shadow);max-height:calc(100vh - 32px);overflow:auto}
dialog::backdrop{background:rgba(12,13,16,.45)}
dialog h2{font-size:28px;margin-bottom:6px}
dialog>p{color:var(--muted);font-size:15px;margin-bottom:16px}
.close-dialog{position:absolute;top:14px;right:14px;width:36px;height:36px;border-radius:8px;font-size:24px;line-height:1;color:var(--muted);display:grid;place-items:center}
.close-dialog:hover{background:var(--surface-2);color:var(--ink)}
.field{display:block;font-size:14px;font-weight:500;margin-bottom:14px}
.field input,.field textarea{margin-top:6px}
.dialog-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:8px}
#share-dialog .button{margin-top:10px}
/* Share thumbnail. export.js sets an aspect-ratio on the block while it renders so the dialog holds its height. */
.share-preview{display:grid;place-items:center;margin:0 0 16px;border:1px solid var(--line);border-radius:var(--radius-s);overflow:hidden;background:var(--ground)}
.share-preview img,.share-preview canvas{display:block;width:100%;height:auto}
.share-preview p{margin:0;padding:18px 16px;font-size:14px;color:var(--muted);text-align:center}

/* Export frame (export.js). Built off-screen, captured, removed. It lives in the live document so it picks up
   the current theme, the real fonts, and the loaded photos; the overrides below pin the cloned board to its
   desktop metrics so a phone and a desktop produce the same picture. */
.export-frame{position:fixed;left:-10000px;top:0;width:1200px;padding:32px;background:var(--ground);color:var(--ink);font-family:var(--body);font-size:16px;line-height:1.5;pointer-events:none;z-index:-1}
.export-title{font-family:var(--display);font-size:42px;font-weight:700;line-height:1.1;letter-spacing:-.01em;margin:0 0 16px;overflow-wrap:anywhere}
.export-foot{display:flex;align-items:baseline;justify-content:space-between;gap:24px;margin:16px 0 0;font-size:14px;color:var(--muted);font-variant-numeric:tabular-nums}
.export-frame *,.export-frame *::before,.export-frame *::after{transition:none!important;animation:none!important}
.export-frame .tier-row{min-height:112px}
.export-frame .tier-row:first-child{min-height:140px}
.export-frame .tier-rail{--letter:44px;--fit:160px;flex:0 0 88px;padding:8px 6px}
.export-frame .tier-row:first-child .tier-rail{--letter:52px}
.export-frame .tier-rail .desc{font-size:12px}
.export-frame .tier-cells{padding:8px;gap:4px}
.export-frame .tier-cells .mouse-card{width:104px;padding:8px 8px 9px;transform:none;box-shadow:none}
.export-frame .tier-cells .mouse-card .photo{height:58px}
.export-frame .tier-cells .card-brand{font-size:11px}
.export-frame .tier-cells .card-title{font-size:16px}

/* Detail view */
#detail-dialog{max-width:min(720px,calc(100vw - 32px));padding:0}
.detail{display:grid;grid-template-columns:260px 1fr;align-items:start}
/* A plate the size of the product, not a slab the height of the dialog. The image cap has to be a length:
   a percentage height does not resolve against a content-sized grid row, so the photo would overrun the plate. */
.detail-photo{--plate:260px;--plate-pad:24px;background:var(--photo);display:grid;place-items:center;height:var(--plate);padding:var(--plate-pad);overflow:hidden}
.detail-photo img{width:100%;max-height:calc(var(--plate) - var(--plate-pad) * 2);object-fit:contain}
.detail-photo .monogram{font-size:28px}
.detail-body{padding:28px 28px 24px;min-width:0}
.detail-brand{font-size:14px;color:var(--muted)}
.detail-body h2{font-size:34px;margin:0 0 6px;padding-right:36px}
.detail-status{display:flex;align-items:center;gap:10px;flex-wrap:wrap;font-size:14px;color:var(--muted);margin-bottom:12px}
.detail-notes{font-size:15px;line-height:1.55;margin-bottom:18px}
.picker-label{display:block;font-size:13px;font-weight:600;margin-bottom:8px}
.rank-picker{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:20px}
.rank-picker button{min-width:42px;height:42px;border-radius:8px;font-family:var(--display);font-size:min(22px,calc(70px / var(--label-len,1)));font-weight:800;color:var(--on-rail);background:var(--rail);transition:transform .1s var(--ease-out),box-shadow .15s;overflow:hidden;padding:0 4px;overflow-wrap:anywhere;line-height:1}
.rank-picker button[data-pick="0"]{color:var(--on-t0)}
.rank-picker button:hover{transform:translateY(-1px)}
.rank-picker button:active{transform:scale(.94)}
.rank-picker button[aria-pressed="true"]{box-shadow:0 0 0 2px var(--surface),0 0 0 4px var(--ink)}
.rank-picker button.unrank{width:auto;padding:0 12px;font-family:var(--body);font-size:13px;font-weight:600;background:var(--surface-2);color:var(--ink)}
.spec-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:12px 16px;padding:16px 0;border-top:1px solid var(--line);border-bottom:1px solid var(--line);margin-bottom:16px}
.spec-grid dt{font-size:12px;color:var(--muted);margin-bottom:2px}
.spec-grid dd{font-size:15px;font-weight:500;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.spec-grid dd.none{color:var(--muted);font-weight:400}
.spec-grid dd small{display:block;font-size:12px;font-weight:400;color:var(--muted)}
.detail-links{display:flex;flex-wrap:wrap;gap:8px 18px;font-size:14px;margin-bottom:12px}
.detail-links a{color:var(--ink);text-decoration:underline;text-decoration-color:var(--line-strong);text-underline-offset:3px}
.detail-links a:hover{text-decoration-color:var(--ink)}
.detail-links a.review{font-weight:600;color:var(--accent);text-decoration-color:currentColor}
.detail-actions{display:flex;flex-wrap:wrap;gap:6px 16px}
.detail-actions button{font-size:14px;color:var(--muted);padding:4px 0}
.detail-actions button:hover{color:var(--ink)}
.detail-actions button.danger:hover{color:var(--accent)}
.detail-release-note{font-size:13px;color:var(--muted);margin-bottom:12px}

/* Rename tiers */
.tier-edit-row{display:grid;grid-template-columns:42px 90px 1fr;gap:10px;align-items:center;margin-bottom:10px}
.tier-edit-row>span{height:42px;border-radius:8px;display:grid;place-items:center;font-family:var(--display);font-size:22px;font-weight:800;background:var(--rail);color:var(--on-rail)}
.tier-edit-row[data-index="0"]>span{color:var(--on-t0)}
#tiers-form .button{margin-top:8px}

/* ---------- Toasts ---------- */
/* A deck anchored bottom right. Toasts overlap; toasts.js sets every transform, so nothing
   here animates on its own. The stack expands on hover or focus (.is-expanded). */
.toasts{position:fixed;right:18px;bottom:18px;z-index:60;width:min(368px,calc(100vw - 36px));pointer-events:none}
.toast{
  position:absolute;left:0;right:0;bottom:0;pointer-events:auto;touch-action:none;
  display:flex;align-items:center;gap:12px;
  background:var(--toast);color:var(--on-toast);
  padding:12px 14px 12px 16px;border-radius:var(--radius);
  font-size:14px;font-weight:500;line-height:1.35;
  box-shadow:0 10px 30px rgba(0,0,0,.28),0 1px 3px rgba(0,0,0,.2);
  transform-origin:bottom right;will-change:transform,opacity;
  -webkit-user-select:none;user-select:none
}
.toast-text{flex:1 1 auto;min-width:0;overflow-wrap:anywhere}
/* Bridges the gaps once the stack is open so crossing between toasts never collapses it. */
.toasts.is-expanded .toast::after{content:'';position:absolute;left:0;right:0;bottom:100%;height:12px}
.toast .toast-action{flex:0 0 auto;background:color-mix(in srgb,var(--on-toast) 14%,transparent);color:var(--on-toast);font-weight:600;font-size:13px;padding:6px 10px;border-radius:var(--radius-s);transition:background .15s}
.toast .toast-action:hover{background:color-mix(in srgb,var(--on-toast) 24%,transparent)}
@media (max-width:520px){
  .toasts{left:12px;right:12px;bottom:12px;width:auto}
  .toast{transform-origin:bottom center;padding:13px 14px 13px 15px}
}
@media (prefers-reduced-motion:reduce){
  .toast{will-change:opacity}
}

/* ---------- Sheets (sheet.js) ---------- */
/* Grab handles are pointer affordances; they appear only where a dialog becomes a bottom sheet. */
.sheet-grabber{display:none;width:100%;height:20px;padding:8px 0;place-items:center;flex:0 0 auto;background:none;touch-action:none;cursor:grab}
.sheet-grabber:active{cursor:grabbing}
.sheet-pill{display:block;width:38px;height:4px;border-radius:999px;background:var(--line-strong)}

/* Inline tier chips: one row inserted under the tapped card, in its own grid or tier row. */
.tier-chips{display:flex;flex-wrap:wrap;align-items:center;gap:5px;margin:2px 0 4px;padding:8px;border-radius:10px;background:var(--surface-2);box-shadow:inset 0 0 0 1px var(--line)}
.mouse-grid>.tier-chips{grid-column:1/-1}
.tier-cells>.tier-chips{flex:0 0 100%;width:100%}
.tier-chip{display:inline-flex;align-items:center;justify-content:center;min-width:40px;height:40px;padding:0 8px;border-radius:8px;font-family:var(--display);font-size:21px;font-weight:800;line-height:1;color:var(--on-rail);background:var(--rail);overflow:hidden;overflow-wrap:anywhere;transition:transform .1s var(--ease-out)}
.tier-chip.tier-chip-top{color:var(--on-t0)}
.tier-chip:active{transform:scale(.94);transition-duration:.06s}
.tier-chip[aria-pressed="true"]{box-shadow:0 0 0 2px var(--surface-2),0 0 0 4px var(--ink)}
.tier-chip.chip-plain{font-family:var(--body);font-size:14px;font-weight:600;background:var(--surface);color:var(--ink);box-shadow:inset 0 0 0 1px var(--line-strong)}

/* ---------- Editions picker (editions.js) ----------
   One list, two containers: a popover anchored to the card above 800 px, a bottom sheet below it. */
.editions-pop{position:fixed;left:0;top:0;z-index:60;width:min(272px,calc(100vw - 16px));max-height:min(60vh,420px);overflow-y:auto;overscroll-behavior:contain;padding:10px;border-radius:12px;background:var(--surface);color:var(--ink);box-shadow:var(--shadow),0 0 0 1px var(--line)}
.editions-head{font-size:12px;font-weight:600;color:var(--muted);padding:2px 4px 8px;line-height:1.35}
.editions-list{list-style:none;display:flex;flex-direction:column;gap:2px}
.edition{display:flex;align-items:center;gap:10px;width:100%;padding:6px;border-radius:8px;text-align:left;transition:background .12s}
.edition:hover{background:var(--surface-2)}
.edition[aria-pressed="true"]{background:var(--surface-2);box-shadow:inset 0 0 0 1px var(--line-strong)}
.edition-photo{flex:0 0 44px;height:44px;border-radius:6px;background:var(--photo);display:grid;place-items:center;overflow:hidden}
.edition-photo img{width:100%;height:100%;object-fit:contain;pointer-events:none}
.edition-photo .monogram{font-size:12px}
.edition-text{min-width:0}
.edition-brand{display:block;font-size:11px;color:var(--muted);line-height:1.2}
.edition-title{display:block;font-family:var(--display);font-size:16px;font-weight:700;line-height:1.1;overflow-wrap:anywhere}

/* The detail dialog's veil fades with it at every width. */
#detail-dialog[open]::backdrop{animation:sheet-veil-in .2s var(--ease-out)}
#detail-dialog.sheet-leaving::backdrop{animation:sheet-veil-out .15s var(--ease-out) both}
#detail-dialog.sheet-leaving{pointer-events:none}
@keyframes sheet-veil-in{from{opacity:0}to{opacity:1}}
@keyframes sheet-veil-out{from{opacity:1}to{opacity:0}}

@media (max-width:800px){
  .sheet-grabber{display:grid}
  /* The unranked pool moves into a non-modal sheet, so the board behind it stays usable.
     --sheet-over is slack below the viewport: the released drag springs past the full snap
     point without ever opening a gap at the bottom edge. */
  #pool-sheet{
    --sheet-over:48px;
    display:none;position:fixed;top:auto;left:0;right:0;bottom:calc(var(--sheet-over) * -1);
    width:auto;max-width:none;max-height:none;
    height:calc(92vh + var(--sheet-over));height:calc(92dvh + var(--sheet-over));
    margin:0;padding:0 0 calc(var(--sheet-over) + env(safe-area-inset-bottom,0px));
    border:0;border-radius:16px 16px 0 0;background:var(--surface);color:var(--ink);
    box-shadow:var(--shadow);overflow:hidden;z-index:50
  }
  #pool-sheet[open]{display:flex;flex-direction:column}
  #pool-sheet #pool-panel{flex:1 1 auto;min-height:0;position:static;max-height:none;border:0;border-radius:0;background:transparent}
  #pool-sheet .pool-head{padding:2px 16px 10px;touch-action:none;cursor:grab}
  #pool-sheet .mouse-grid{max-height:none}
  body.has-pool-sheet{padding-bottom:calc(76px + env(safe-area-inset-bottom,0px))}
  body.has-pool-sheet .toasts{bottom:calc(84px + env(safe-area-inset-bottom,0px))}

  /* The editions picker is the third sheet: it opens over the pool sheet, or over the detail sheet. */
  #editions-sheet{
    position:fixed;top:auto;left:0;right:0;bottom:0;width:auto;max-width:none;margin:0;
    max-height:72vh;max-height:72dvh;
    border-radius:16px 16px 0 0;padding:0 0 env(safe-area-inset-bottom,0px);z-index:60
  }
  #editions-sheet[open]{display:flex;flex-direction:column}
  .editions-body{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;padding:2px 14px 16px}
  .editions-head{font-size:14px;padding:2px 4px 10px}
  .edition{padding:8px 6px;gap:12px}
  .edition-photo{flex-basis:52px;height:52px}

  /* The mouse detail dialog becomes a bottom sheet that slides up from the bottom edge. */
  #detail-dialog{
    position:fixed;top:auto;left:0;right:0;bottom:0;width:auto;max-width:none;margin:0;
    max-height:92vh;max-height:92dvh;overflow:hidden;
    border-radius:16px 16px 0 0;padding:0 0 env(safe-area-inset-bottom,0px)
  }
  #detail-dialog[open]{display:flex;flex-direction:column}
  #detail-dialog .close-dialog{top:26px}
  #detail-content{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain}
}
@media (min-width:801px){#pool-sheet{display:none}}

/* ---------- Responsive ---------- */
@media (min-width:1400px){
  .workspace{grid-template-columns:minmax(0,1fr) 520px}
  .mouse-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
}
@media (max-width:1100px){
  .topbar{padding:0 20px;gap:24px}
  main{padding:22px 20px 0}
  .workspace{grid-template-columns:minmax(0,1fr) 340px;gap:16px}
  .mouse-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .list-title{font-size:36px}
  .tier-rail{flex-basis:76px;--letter:38px;--fit:135px}
  .tier-row:first-child .tier-rail{--letter:46px}
}
@media (max-width:800px){
  .topbar{height:58px;gap:16px}
  .topbar nav{gap:16px}
  .nav{font-size:14px}
  .byline{display:none}
  .workspace{grid-template-columns:1fr}
  .pool{position:static;max-height:none}
  .mouse-grid{grid-template-columns:repeat(4,minmax(0,1fr));max-height:520px}
  .list-head{display:block;margin-bottom:0}
  .list-title{font-size:32px}
  .list-tools{margin-top:6px}
  .detail{grid-template-columns:1fr}
  .detail-photo{--plate:200px;--plate-pad:16px}
  .detail-body{padding:20px}
  .page-head h1{font-size:34px}
}
@media (max-width:520px){
  .topbar{padding:0 14px;gap:12px}
  .brand{font-size:19px;gap:7px}
  .brandmark{width:24px;height:24px}
  .topbar nav{gap:10px}
  .nav{font-size:14px}
  .topbar-actions{gap:4px}
  .topbar-actions .button{padding:0 12px;min-height:36px}
  .icon-button{width:34px;height:34px}
  main{padding:18px 14px 0}
  .list-title{font-size:28px}
  .list-tools{gap:12px;font-size:13px}
  .list-tools .tool-group{gap:12px}
  .tier-row{min-height:96px}
  .tier-row:first-child{min-height:116px}
  .tier-rail{flex-basis:60px;padding:6px 4px;--letter:32px;--fit:110px}
  .tier-row:first-child .tier-rail{--letter:38px}
  .tier-rail .desc{font-size:10px}
  .tier-cells{padding:6px;gap:2px}
  .tier-cells .mouse-card{width:84px;padding:5px 4px}
  .tier-cells .mouse-card .photo{height:48px}
  .tier-cells .card-title{font-size:14px}
  .tier-cells .card-brand{font-size:10px}
  .mouse-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;padding:2px 12px 12px;max-height:60vh}
  .mouse-grid .mouse-card .photo{height:64px}
  .card-title{font-size:15px}
  .pool-head,.search,.filters,.pool-options,.pool-bottom{padding-left:12px;padding-right:12px}
  .search{margin-left:12px;margin-right:12px}
  /* Sort and Brand stay side by side even on a phone: both labels are short, and the sheet needs the height
     for cards more than the selects need the width. */
  footer{margin-top:36px;padding:18px 0 24px}
  dialog{padding:22px 18px}
  .rank-picker button{min-width:38px;height:38px;font-size:min(20px,calc(64px / var(--label-len,1)))}
  .spec-grid{grid-template-columns:1fr 1fr}
  .toasts{right:12px;bottom:12px;left:12px;align-items:stretch}
  .toast{max-width:none;justify-content:space-between}
}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{transition-duration:0s!important;animation-duration:0s!important;scroll-behavior:auto!important}
}

/* Compact catalog comparisons, with the same labeled fields on small screens. */
.catalog-toolbar{gap:10px;margin-bottom:12px}
.catalog-search{flex:1 1 280px;max-width:none}
.catalog-sort select{max-width:none}
.catalog-more{border-bottom:1px solid var(--line);padding:0 0 14px;margin-bottom:16px}
.catalog-more summary{width:max-content;cursor:pointer;font-size:14px;color:var(--muted);padding:4px 0}
.catalog-extra{display:flex;flex-wrap:wrap;align-items:center;gap:18px;padding-top:12px}
.catalog-extra select{width:auto}
.catalog-toggle{display:flex;align-items:center;gap:8px;font-size:14px}
.catalog-results{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:8px}
.catalog-results p{color:var(--muted);font-size:14px}
.catalog-table{width:100%;min-width:0}
.catalog-table th{padding:0}
.catalog-table td{padding:14px 12px;font-size:14px}
.catalog-table .th-sort{padding:12px;font-size:12px}
.catalog-table .col-model{min-width:235px;max-width:350px}
.catalog-product{display:flex;align-items:center;gap:14px}
.catalog-table .photo{width:58px;height:64px;flex:0 0 58px;background:#fff}
.catalog-brand,.catalog-edition{display:block;color:var(--muted);font-size:12px;line-height:1.5}
.catalog-table .row-open{font-size:19px;line-height:1.25;margin:2px 0}
.catalog-table .col-weight,.catalog-table .col-polling{white-space:nowrap;font-variant-numeric:tabular-nums;text-align:left}
.catalog-table .col-sensor{min-width:100px;max-width:175px;font-size:13px}
.catalog-table .col-position,.catalog-table .col-size{white-space:nowrap}
@media(max-width:1000px) and (min-width:801px){
 .catalog-table td{padding:12px 8px}.catalog-product{gap:8px}.catalog-table .col-model{min-width:190px}.catalog-table .photo{width:42px;flex-basis:42px}
}
@media(max-width:800px){
 .catalog-toolbar{display:grid;grid-template-columns:1fr 1fr}
 .catalog-search{grid-column:1/-1;min-width:0}
 .catalog-toolbar select,.catalog-sort{width:100%;max-width:none}
 .catalog-toolbar #catalog-position{grid-column:1/-1}
 .catalog-extra{gap:12px}.catalog-extra .catalog-weight{flex-basis:100%}
 .catalog-table,.catalog-table tbody{display:block;min-width:0;width:100%}
 .catalog-table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
 .catalog-table .catalog-row{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px 12px;padding:18px 0;border-bottom:1px solid var(--line)}
 .catalog-table td{display:block;padding:0;border:0;min-width:0;max-width:none;text-align:left!important;font-size:14px}
 .catalog-table .col-model{grid-column:1/-1;min-width:0;margin-bottom:2px}
 .catalog-table .col-sensor{min-width:0;white-space:normal;overflow-wrap:anywhere;font-size:13px}
 .catalog-table td[data-label]::before{content:attr(data-label);display:block;font-size:11px;line-height:1.5;color:var(--muted);margin-bottom:3px}
 .catalog-table .photo{width:52px;height:60px;flex-basis:52px}
 .catalog-table .row-open{font-size:20px}
 .catalog-table .catalog-empty{display:block;padding:30px 0}
 .catalog-table .col-position{white-space:normal}
}

/* Keep both navigation labels and all action icons readable on a phone. */
@media(max-width:600px){
 .topbar{display:grid;grid-template-columns:minmax(0,1fr) auto;height:auto;gap:0 12px;padding:0 14px}
 .topbar .brand{min-height:54px}
 .topbar-actions{grid-column:2;grid-row:1}
 .topbar nav{grid-column:1/-1;grid-row:2;gap:24px}
 .topbar .nav{min-height:40px;font-size:14px}
 .topbar-actions .button{padding:0 10px}
}

.detail-purchase{margin:18px 0 12px}
.purchase-buttons{display:flex;gap:8px;flex-wrap:wrap}
.purchase-buttons a{text-decoration:none}
.detail-purchase p{margin:8px 0 0}
