.library-intro { display:flex; align-items:center; justify-content:space-between; gap:24px; padding:34px 0 27px; }
.library-intro h1 { font-size:34px; letter-spacing:-1.2px; }
.library-intro > div > p:last-child { margin-top:10px; color:var(--muted); font-size:15px; }
.library-training-link { display:flex; align-items:center; gap:20px; border:1px solid var(--line); border-radius:9px; padding:12px 15px; color:var(--gold); text-decoration:none; font-size:13px; white-space:nowrap; background:#e4cc9504; }
.library-training-link:hover { background:#e4cc950c; border-color:var(--gold); }
.library-training-actions { display:flex; flex-direction:column; align-items:flex-start; gap:10px; }
.library-continuation-link { color:var(--gold); font-size:13px; text-decoration:none; }
.library-continuation-link:hover { text-decoration:underline; }
.library-training-link > span:last-child { font-size:17px; }
.library-status { padding:25px; margin:0 0 24px; color:var(--muted); background:var(--surface); border:1px solid var(--line); border-radius:14px; font-size:15px; }
.library-status button { margin-left:14px; color:var(--green); background:transparent; text-decoration:underline; text-underline-offset:3px; }
.library-layout { display:grid; grid-template-columns:195px minmax(0,1fr); gap:20px; align-items:start; }
.catalog-sidebar { padding-top:10px; }
.catalog-heading { display:flex; justify-content:space-between; gap:12px; align-items:center; padding:0 11px 15px; font-size:11px; letter-spacing:1.3px; font-weight:600; color:var(--faint); }
.catalog-heading > span:last-child { letter-spacing:0; font-size:11px; font-weight:400; }
.section-buttons { display:flex; flex-direction:column; gap:5px; }
.section-button { display:flex; align-items:center; justify-content:space-between; gap:10px; width:100%; min-height:44px; text-align:left; background:transparent; border:1px solid transparent; border-radius:8px; color:var(--muted); padding:10px 11px; font-size:13px; line-height:1.4; }
.section-button:hover { background:var(--surface-high); color:var(--text); }
.section-button.is-active { color:var(--green-bright); background:var(--surface-high); border-color:var(--line-strong); }
.section-button > span:last-child { min-width:22px; text-align:center; padding:2px 5px; background:#ffffff06; border-radius:4px; font-size:11px; color:var(--faint); }
.section-button.is-active > span:last-child { color:var(--green); background:#ffffff08; }
.catalog-note { margin:28px 10px 0; padding-top:18px; border-top:1px solid var(--line); display:flex; align-items:flex-start; gap:9px; }
.catalog-note > span { font-size:18px; color:var(--gold); line-height:1.4; }
.catalog-note p { color:var(--faint); font-size:12px; line-height:1.7; }
.mobile-section-label, .mobile-section-select { display:none; }
.chart-panel { background:var(--surface); border:1px solid var(--line); border-radius:18px; overflow:hidden; box-shadow:0 10px 35px #0001; min-width:0; }
.chart-picker { border-bottom:1px solid var(--line); background:var(--surface-low); }
.chart-picker-row { display:flex; align-items:flex-start; gap:14px; padding:12px 22px; }
.chart-picker-row + .chart-picker-row { border-top:1px solid var(--line); }
.chart-picker-label { flex:0 0 48px; padding-top:11px; color:var(--muted); font-size:14px; line-height:20px; }
.chart-picker-control { flex:1; min-width:0; }
.chart-choice-buttons { display:flex; flex-wrap:wrap; gap:6px; }
.chart-choice-button { min-width:54px; min-height:42px; padding:9px 13px; background:transparent; border:1px solid var(--line-strong); border-radius:8px; color:var(--muted); font:inherit; font-size:14px; line-height:22px; font-weight:500; }
.chart-choice-button:hover { color:var(--text); background:var(--surface-high); border-color:var(--muted); }
.chart-choice-button.is-active { color:var(--gold); background:#d6c28e16; border-color:#d6c28e99; }
.chart-choice-button:focus-visible { outline:2px solid var(--gold); outline-offset:2px; }
.chart-stack-description { padding:11px 0; font-size:14px; line-height:20px; color:var(--muted); }
.library-select { appearance:none; -webkit-appearance:none; border:1px solid var(--line-strong); border-radius:8px; background-color:var(--surface-low); background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='m3 5 4 4 4-4' fill='none' stroke='%23b0b6bd' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 10px center; padding:9px 32px 9px 12px; color:var(--text); font:inherit; font-size:13px; min-width:0; cursor:pointer; }
.library-select:focus-visible { outline:2px solid var(--gold); outline-offset:3px; }
.chart-picker-control .library-select { display:block; width:100%; max-width:440px; min-height:42px; font-size:14px; }
.chart-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; padding:23px 24px 19px; }
.chart-heading .eyebrow { font-size:10px; letter-spacing:1.1px; margin-bottom:5px; }
.chart-heading h2 { font-size:24px; letter-spacing:-.7px; line-height:1.25; }
.chart-conditions { display:flex; align-items:center; flex-wrap:wrap; gap:6px; margin-top:9px; }
.chart-conditions > span { font-size:12px; line-height:1.5; color:var(--muted); background:var(--surface-high); border:1px solid var(--line); border-radius:5px; padding:3px 7px; }
.chart-counter { font-size:11px; color:var(--faint); white-space:nowrap; padding-top:5px; font-variant-numeric:tabular-nums; }
.library-mode-bar { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:0 24px; }
.library-mode-switch { display:flex; padding:3px; gap:3px; border:1px solid var(--line); background:var(--surface-low); border-radius:9px; }
.library-mode-switch button { display:flex; align-items:center; gap:7px; border-radius:6px; padding:7px 11px; background:transparent; font-size:12px; color:var(--muted); }
.library-mode-switch button > span { font-size:16px; line-height:1; }
.library-mode-switch button:hover { color:var(--text); }
.library-mode-switch button.is-active { background:#d6c28e; color:var(--bg); }
.reveal-range-button { background:transparent; color:var(--green); padding:5px 0; font-size:12px; text-decoration:underline; text-underline-offset:4px; }
.library-mode-description { color:var(--faint); font-size:12px; padding:10px 24px 16px; }
.chart-body { display:grid; grid-template-columns:minmax(0,1fr) 190px; gap:21px; padding:0 24px 23px; }
.matrix-column { min-width:0; }
.rfi-explanation { margin-bottom:11px; padding:9px 11px; border-left:2px solid #8fbd97; border-radius:0 5px 5px 0; background:var(--surface-low); color:var(--muted); font-size:12px; line-height:1.6; }
.library-matrix { display:grid; grid-template-columns:repeat(13,minmax(0,1fr)); gap:3px; }
.library-hand { aspect-ratio:1.1; display:grid; place-items:center; padding:0; min-width:0; border-radius:4px; background:var(--surface-high); color:var(--muted); border:1px solid var(--line); font-size:clamp(8px,.88vw,12px); font-weight:550; letter-spacing:-.1px; position:relative; }
.library-hand.is-pair:not(.is-revealed) { background:var(--surface-high); color:var(--text); }
.library-hand:hover { border-color:var(--green); filter:brightness(1.1); }
.library-hand.is-revealed { background:var(--cell-color,var(--surface-high)); color:#19271f; border-color:transparent; }
.library-hand.is-unmarked { background:var(--surface-low); color:var(--faint); border-color:var(--line); }
.library-hand.is-selected { outline:2px solid var(--gold); outline-offset:1px; z-index:1; box-shadow:0 0 0 3px var(--surface); }
.library-hand.is-selected:after { content:""; position:absolute; right:3px; top:3px; width:3px; height:3px; border-radius:50%; background:currentColor; }
.library-hand:focus-visible { z-index:2; outline-offset:1px; }
.matrix-axis-note { display:flex; flex-wrap:wrap; justify-content:space-between; gap:8px; font-size:10px; color:var(--faint); margin-top:11px; }
.matrix-axis-note strong { color:var(--muted); font-weight:500; }
.chart-inspector { display:flex; flex-direction:column; gap:17px; min-width:0; }
.hand-inspector { border:1px solid var(--line-strong); background:var(--surface-low); border-radius:11px; padding:16px; position:relative; }
.inspector-label { font-size:10px; letter-spacing:1.1px; font-weight:600; color:var(--muted); }
.hand-inspector h3 { font-size:39px; letter-spacing:-1.8px; line-height:1.1; margin-top:10px; font-weight:500; color:var(--gold); }
.selected-hand-type { font-size:11px; color:var(--muted); margin-top:5px; }
.hand-divider { height:1px; background:var(--line); margin:15px 0 12px; }
.selected-swatch { display:block; width:12px; height:5px; border-radius:2px; margin-bottom:8px; }
#selected-recommendation { font-size:14px; color:var(--text); line-height:1.55; font-weight:500; overflow-wrap:anywhere; }
.selected-note { color:var(--muted); font-size:11px; line-height:1.7; margin-top:10px; }
.chart-legend-section { padding:0 2px; }
.chart-legend { display:flex; flex-direction:column; gap:9px; margin-top:11px; }
.legend-item { display:flex; align-items:flex-start; gap:8px; font-size:12px; line-height:1.5; color:var(--muted); }
.legend-swatch { flex-shrink:0; margin-top:2px; width:11px; height:11px; border-radius:3px; background:var(--legend-color,var(--surface-high)); }
.legend-swatch.is-unmarked { border:1px solid var(--line-strong); }
.legend-glossary { margin-top:16px; border-top:1px solid var(--line); padding-top:11px; }
.legend-glossary summary { font-size:11px; color:var(--muted); cursor:pointer; }
.legend-glossary dl { margin:10px 0 0; font-size:11px; line-height:1.6; }
.legend-glossary dt { color:var(--gold); font-size:10px; margin-top:9px; }
.legend-glossary dd { color:var(--muted); margin:2px 0 0; }
.chart-source-row { display:flex; justify-content:space-between; align-items:flex-start; gap:20px; padding:16px 24px; border-top:1px solid var(--line); background:var(--surface-low); }
.chart-source-row > div { min-width:0; }
.chart-source-description { font-size:11px; line-height:1.6; color:var(--faint); }
.chart-notes { font-size:12px; color:var(--muted); line-height:1.7; margin-bottom:8px; white-space:pre-line; }
.chart-source-row a { display:flex; gap:7px; align-items:center; color:var(--gold); font-size:12px; white-space:nowrap; text-underline-offset:4px; }
.chart-source-row a > span { font-size:16px; }
.chart-panel > .library-status { margin:0 24px 24px; padding:18px; }

@media (min-width:1101px) {
  .library-page .app-header.site-header { min-height:66px; }
  .library-intro { padding-top:14px; padding-bottom:12px; }
  .library-intro .eyebrow { font-size:10px; margin-bottom:4px; }
  .library-intro h1 { font-size:27px; line-height:1.18; }
  .library-intro > div > p:last-child { display:none; }
  .library-training-link { padding-top:9px; padding-bottom:9px; }
  .chart-picker-row { padding-top:9px; padding-bottom:9px; }
  .chart-heading { padding-top:12px; padding-bottom:10px; }
  .chart-heading .eyebrow { display:none; }
  .chart-heading h2 { font-size:20px; }
  .chart-conditions { margin-top:5px; }
  .chart-conditions > span { font-size:11px; padding-top:2px; padding-bottom:2px; }
  .library-mode-switch button { padding-top:6px; padding-bottom:6px; }
  .library-mode-description { font-size:11px; padding-top:6px; padding-bottom:10px; }
  .chart-body { grid-template-columns:minmax(0,480px) minmax(0,1fr); gap:26px; }
  .chart-inspector { max-width:270px; }
  .library-hand { aspect-ratio:1.16; font-size:13px; }
  .rfi-explanation { font-size:11px; line-height:1.5; padding:6px 9px; margin-bottom:8px; }
}

@media (min-width:1101px) and (max-height:800px) {
  .chart-body { grid-template-columns:minmax(0,400px) minmax(0,1fr); }
  .library-hand { font-size:12px; }
}

@media (max-width:1100px) {
  .library-layout { grid-template-columns:170px minmax(0,1fr); gap:15px; }
  .section-button { font-size:12px; padding:9px; }
  .catalog-heading { padding-left:9px; padding-right:9px; }
  .catalog-heading > span:last-child { display:none; }
  .chart-body { grid-template-columns:minmax(0,1fr) 160px; gap:15px; padding-left:18px; padding-right:18px; }
  .chart-picker-row, .chart-heading, .chart-source-row { padding-left:18px; padding-right:18px; }
  .library-mode-bar { margin-left:18px; margin-right:18px; }
  .library-mode-description { padding-left:18px; padding-right:18px; }
  .hand-inspector { padding:13px; }
  .hand-inspector h3 { font-size:34px; }
  .chart-legend .legend-item { font-size:11px; }
  .library-matrix { gap:2px; }
  .library-hand { aspect-ratio:1; font-size:11px; border-radius:3px; }
  .matrix-axis-note { font-size:9px; gap:5px; }
  .matrix-axis-note > span:last-child { display:none; }
  .chart-source-row { flex-direction:column; gap:9px; }
  .library-training-link { font-size:12px; padding:10px 12px; gap:10px; }
}

@media (max-width:900px) {
  .library-layout { grid-template-columns:150px minmax(0,1fr); gap:12px; }
  .chart-body { display:block; }
  .chart-inspector { display:grid; grid-template-columns:1fr 1fr; margin-top:20px; gap:20px; }
  .library-hand { aspect-ratio:1.13; font-size:12px; }
  .catalog-note { margin-left:8px; margin-right:8px; }
  .library-intro h1 { font-size:29px; }
  .library-intro > div > p:last-child { font-size:13px; max-width:300px; }
}

@media (max-width:800px) {
  .library-shell { max-width:740px; }
  .library-intro { padding:27px 0 22px; align-items:flex-start; }
  .library-intro h1 { font-size:30px; }
  .library-intro > div > p:last-child { font-size:14px; }
  .library-training-link { margin-top:23px; font-size:11px; }
  .library-layout { display:block; }
  .catalog-sidebar { padding:0 0 14px; display:flex; align-items:center; gap:12px; }
  .catalog-heading, .section-buttons, .catalog-note { display:none; }
  .mobile-section-label { display:block; color:var(--muted); font-size:13px; }
  .mobile-section-select { display:block; flex:1; }
  .chart-body { display:grid; grid-template-columns:minmax(0,1fr) 160px; gap:18px; }
  .chart-inspector { display:flex; margin:0; gap:17px; }
  .library-hand { aspect-ratio:1; font-size:11px; }
  .chart-heading h2 { font-size:22px; }
  .library-mode-bar { flex-wrap:wrap; gap:8px; }
  .library-mode-description { font-size:11px; }
  .chart-source-row { flex-direction:row; gap:16px; }
}

@media (max-width:600px) {
  .library-intro { display:block; padding-top:26px; padding-bottom:20px; }
  .library-intro h1 { font-size:29px; }
  .library-intro > div > p:last-child { max-width:none; font-size:13px; }
  .library-training-link { width:max-content; margin-top:15px; padding:8px 10px; }
  .library-training-link > span:last-child { font-size:16px; }
  .chart-body { display:block; padding-left:14px; padding-right:14px; padding-bottom:18px; }
  .chart-inspector { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-top:19px; }
  .library-hand { aspect-ratio:1.08; font-size:12px; }
  .chart-picker-row { padding:12px 14px; gap:10px; }
  .chart-picker-label { flex-basis:40px; }
  .chart-choice-button { min-height:44px; min-width:48px; padding-left:11px; padding-right:11px; }
  .library-select { font-size:12px; }
  .chart-heading { padding:18px 15px 15px; }
  .chart-heading h2 { font-size:21px; }
  .chart-conditions { margin-top:8px; gap:5px; }
  .chart-conditions > span { font-size:11px; }
  .chart-counter { font-size:10px; }
  .library-mode-bar { margin-left:14px; margin-right:14px; }
  .library-mode-switch button { font-size:11px; padding:7px 10px; gap:5px; }
  .reveal-range-button { font-size:11px; padding:6px 0; }
  .library-mode-description { padding:9px 15px 13px; }
  .rfi-explanation { font-size:11px; padding:8px 9px; }
  .chart-source-row { flex-direction:column; gap:10px; padding:14px 15px; }
  .chart-source-description { font-size:10px; }
  .chart-notes { font-size:11px; }
  .chart-source-row a { font-size:11px; }
  .chart-panel { border-radius:14px; }
  .catalog-sidebar { padding-bottom:12px; }
  .mobile-section-label { font-size:12px; }
}

@media (max-width:380px) {
  .chart-body { padding-left:10px; padding-right:10px; }
  .library-hand { font-size:10px; aspect-ratio:.96; }
  .library-mode-switch button { padding-left:8px; padding-right:8px; }
  .library-intro h1 { font-size:27px; }
  .chart-inspector { gap:12px; }
  .hand-inspector { padding:11px; }
  .inspector-label { font-size:9px; letter-spacing:.8px; }
}

/* Keep all thirteen columns legible at the matrix's actual width. */
.library-matrix { container-type:inline-size; }
.library-matrix .library-hand {
  font-size:clamp(8px,3cqw,14px);
  line-height:1.1;
  white-space:nowrap;
}

@media (max-width:600px) {
  .chart-heading { flex-wrap:wrap; }
  .chart-counter { padding-top:0; }
  .library-mode-switch { flex-wrap:wrap; }
}
