/* Prairie Home tag-chip styles, shared unchanged with conversational actions.
   Extracted from style.css's October 19 approved Home cascade. */
.tag-chip,.dialogue.plain-conversation .actions button.tag-chip{border:1px solid var(--line);border-radius:999px;padding:6px 10px;font:600 11.5px/1 var(--ui);color:var(--text);background:var(--frame);cursor:pointer}
.tag-chip:hover,.dialogue.plain-conversation .actions button.tag-chip:hover{border-color:var(--text)}
.tag-chip.active{background:var(--text);color:var(--page);border-color:var(--text)}
.tag-chip:focus-visible,.dialogue.plain-conversation .actions button.tag-chip:focus-visible{outline:2px solid var(--gold);outline-offset:2px}

@media(max-width:720px){.tag-chip{flex:0 0 auto}}

.library-activation-submit { display: none; }
#portal-activation { display: contents; }
.library-activation { margin: 0; min-width: 0; }
.library-activation form { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.library-activation .portal-code-row { display: flex; gap: .4rem; margin: 0; }
.library-activation #codeBox, .library-activation-submit {
  box-sizing: border-box; height: 2.25rem; border: 1px solid var(--line); border-radius: 6px;
  background: var(--frame); color: var(--text); font: 600 .875rem var(--ui); padding: .4rem .65rem; text-align: left; letter-spacing: normal; text-transform: none;
}
.library-activation #codeBox { width: min(11rem, 45vw); }
.library-activation .library-activation-submit { display: inline-block; cursor: pointer; }
.library-activation .portal-help, .library-activation .portal-help-text { display: none; }
.library-activation .portal-hint, .library-activation .portal-remember, .library-activation .portal-notice {
  color: var(--text); font: .8rem var(--ui); margin: 0;
}
.library-activation .portal-notice:empty { display: none; }
.library-activation .portal-notice { order: 1; flex-basis: 100%; }
.library-activation .portal-hint { order: -1; }
.library-activation #codeBox::placeholder { opacity: 1; }

/* Keep one activation form when moving between the portal and the Library. */
#home .library-activation .portal-hint { display: none; }
#home .library-activation:has(#codeBox[aria-invalid="true"]) .portal-notice { display: block; }
#home .library-activation .portal-code-row { align-items: center; min-width: 0; }
#home .library-activation form { justify-content: center; }
#home .lead-card { width: 100%; }

/* Library bar (Callahan, Nov 21 2026): one bar. Brand and account status on the left,
   code entry or simulation settings in the middle, store / feedback / theme / sound / sign out on the right.
   Credits sit fixed in the bottom-right corner (world-footer.js). Phones keep the same bar in up to three lines. */
#home .library-heading { min-height:0; padding:clamp(24px,3.5vw,48px) 0 16px; justify-content:flex-start; }
#home .lead-card { margin-bottom:clamp(32px,4vw,60px); }
#home .tag-filter { padding-bottom:18px; margin-bottom:clamp(28px,3.5vw,52px); }
#home .footer { padding-bottom:64px; }

#home .topbar {
  display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-start;
  column-gap:14px; row-gap:10px; min-height:76px; margin:0; padding:12px 0;
  border-bottom:1px solid var(--line);
}
#home .topbar [hidden] { display:none !important; }
#home .topbar .brand { order:1; display:flex; align-items:center; gap:8px; width:auto; flex:none; }
#home .topbar .prairie-window { display:block; width:44px; height:44px; }
#home .topbar .stamp { width:150px; }

/* Code connected light (style.css, Nov 21) and the code's remaining allowance. */
#home .library-account { order:2; display:flex; align-items:center; gap:8px; min-width:0; }
#home .library-account:has(> .access-status[hidden]) { display:none; }
#home .library-account .access-status { display:flex; padding:0 2px; }
#home .library-remaining:empty { display:none; }
#home .library-remaining > [data-prairie-remaining] {
  position:static !important; width:auto !important; height:auto !important; flex:none !important; z-index:auto !important;
}

#home .library-activation { order:3; flex:0 1 auto; }
#home .library-activation form { justify-content:flex-start; flex-wrap:nowrap; gap:8px 12px; }
#home .library-activation .portal-code-row { gap:6px; }
#home .library-activation .portal-remember { white-space:nowrap; min-height:36px; }

/* Model and voice: chosen here, applied in every simulation. */
#home .library-settings { order:4; display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-left:auto; min-width:0; }
#home .library-settings:not(:has(> :is(.home-model-control,#library-voice-mode):not([hidden]))) { display:none; }
#home .library-settings-label { color:var(--muted); font:600 11px/1 var(--ui); letter-spacing:.02em; }
#home .library-settings:not(:has(> .home-model-control:not([hidden]))) .library-settings-label { display:none; }
#home .library-settings .home-model-control {
  position:relative; display:flex; align-items:center; gap:6px; flex:none; max-width:none;
  top:auto; right:auto; z-index:auto; padding:0; border:0; color:var(--text); font:600 11px/1 var(--ui);
}
#home .library-settings #prairie-launch-model-bar > span:not([class]):not([id]) { display:none; }
#home .library-settings .model-options {
  display:flex; gap:2px; padding:3px; border:1px solid var(--line); border-radius:999px; background:var(--frame);
}
#home .library-settings .model-options button {
  min-width:0; min-height:32px; padding:0 12px; border:0; border-radius:999px;
  background:transparent; color:var(--muted); font:600 11.5px/1 var(--ui); text-shadow:none; white-space:nowrap;
}
#home .library-settings .model-options button[aria-checked=true] { color:var(--page); background:var(--text); }
#home .library-settings .model-options button:hover:not(:disabled):not([aria-checked=true]) { color:var(--text); background:var(--button); }
#home .library-settings .model-options button:focus-visible { outline:2px solid var(--gold); outline-offset:2px; }
#home .library-settings .fixed-model {
  display:inline-flex; align-items:center; min-height:40px; padding:0 14px; border:1px solid var(--line); border-radius:999px;
  background:var(--frame); color:var(--text); font:600 11.5px/1 var(--ui);
}
#home .library-settings .home-model-control > button:not([role]) {
  min-height:36px; padding:0 10px; border:1px solid var(--line); border-radius:999px; background:var(--button); color:var(--text); font:600 11px/1 var(--ui);
}
#home .library-settings #model-control-note {
  position:absolute; top:calc(100% + 6px); right:0; z-index:30; width:max-content; max-width:min(300px,calc(100vw - 32px)); height:auto;
  clip-path:none; overflow:visible; white-space:normal; padding:6px 9px; border:1px solid var(--line); border-radius:8px;
  background:var(--page); color:var(--text); font:500 11px/1.35 var(--ui); text-align:left; text-shadow:none; box-shadow:0 4px 14px #0002;
}
#home .library-settings #model-control-note:empty { display:none; }

#library-voice-mode {
  display:inline-flex; align-items:center; gap:7px; min-height:40px; padding:0 8px 0 12px;
  border:1px solid var(--line); border-radius:999px; background:var(--frame); color:var(--text);
  font:600 11.5px/1 var(--ui); white-space:nowrap; cursor:pointer;
}
#library-voice-mode svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
#library-voice-mode .voice-mode-state {
  display:inline-grid; place-items:center; min-width:34px; height:24px; padding:0 8px; border-radius:999px;
  background:var(--button); color:var(--muted); font-size:10.5px;
}
#library-voice-mode[aria-checked=true] .voice-mode-state { background:#22c55e; color:#06240f; }
#library-voice-mode:hover { border-color:var(--muted); }
#library-voice-mode:focus-visible { outline:2px solid var(--gold); outline-offset:2px; }

/* Right-hand controls. */
#home .topbar .access { order:5; display:flex; flex-wrap:nowrap; align-items:center; gap:4px; width:auto; margin:0 0 0 auto; }
#home .library-settings:not([hidden]) ~ .access { margin-left:0; }
#home .topbar .access > prairie-world-footer { order:8; display:inline-flex; }
#home .topbar .access > #logout { order:9; }
#home .access .topbar-feedback {
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  min-height:40px; padding:0 13px; margin-inline:2px; border:1px solid var(--line); border-radius:999px;
  color:var(--text); background:var(--button); font:600 12px/1.15 var(--ui);
  white-space:nowrap; text-decoration:none;
}
#home .access .topbar-feedback:hover { border-color:var(--muted); text-decoration:none; }
#home .access .library-store {
  display:inline-grid; place-items:center; width:40px; height:40px; padding:0;
  color:var(--text); background:transparent; border:0; box-shadow:none;
}
.library-store svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.65; stroke-linecap:round; stroke-linejoin:round; }
.topbar-feedback svg { width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linejoin:round;stroke-linecap:round; }
#home #theme-toggle { width:40px; height:40px; min-height:40px; padding:0; background:transparent; color:var(--text); border-radius:50%; }
#home #theme-toggle:hover { background:var(--button); }
#home #logout { min-height:40px; padding:0 10px; border-radius:999px; color:var(--muted); font:500 12px/1 var(--ui); }
#home #logout:hover { color:var(--text); background:var(--button); }
#home #voice-upgrade:not([hidden]) {
  display:inline-flex; align-items:center; gap:4px; min-height:40px; margin-right:6px; color:var(--text);
  font:600 12px/1.3 var(--ui); white-space:nowrap; text-decoration:underline;
  text-decoration-color:var(--line); text-underline-offset:3px;
}
#home #voice-upgrade:hover { text-decoration-color:currentColor; }
#home #voice-upgrade:focus-visible { outline:2px solid currentColor; outline-offset:2px; }

/* Tablets and small laptops: code entry or settings take the bar's second line. */
@media(max-width:1100px) {
  #home .library-activation, #home .library-settings { order:6; flex:1 0 100%; margin-left:0; }
  #home .library-settings:not([hidden]) ~ .access { margin-left:auto; }
}

/* Phones: brand and icons on the first line, code entry or settings on the second,
   account links on the third. */
@media(max-width:620px) {
  #home .topbar { column-gap:0; row-gap:8px; min-height:0; padding:10px 0 12px; }
  #home .topbar .brand { flex:1 1 auto; min-width:0; gap:7px; }
  #home .topbar .prairie-window { width:30px; height:30px; }
  #home .topbar .stamp { width:104px; min-width:0; }
  #home .topbar .access { display:contents; }
  #home .access .library-store { order:2; width:38px; height:40px; }
  #home .access .topbar-feedback { order:2; width:44px; min-width:44px; height:34px; min-height:34px; padding:0; margin-inline:2px; }
  #home .topbar-feedback span { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
  #home #theme-toggle { order:2; width:38px; }
  #home .topbar .access > prairie-world-footer { order:2; }
  #home .library-activation, #home .library-activation form { display:contents; }
  #home .library-activation .portal-code-row { order:10; flex:1 0 100%; display:flex; }
  #home .library-activation #codeBox { flex:1; width:auto; min-width:0; }
  #home .library-activation .portal-remember { order:21; justify-content:flex-start; min-height:36px; margin:0; }
  #home .library-activation .portal-notice { order:24; flex:1 0 100%; }
  #home .library-settings { order:10; flex:1 0 100%; gap:6px; }
  #home .library-settings .model-options button { padding:0 10px; }
  #library-voice-mode { gap:5px; padding:0 5px 0 10px; }
  #library-voice-mode .voice-mode-state { min-width:30px; padding:0 6px; }
  #home .library-account { order:20; }
  #home #voice-upgrade:not([hidden]) { order:22; margin:0 0 0 auto; min-height:36px; }
  #home .topbar .access > #logout { order:23; margin-left:auto; min-height:36px; padding:0 4px 0 10px; }
  #home .topbar .access > #voice-upgrade:not([hidden]) ~ #logout { margin-left:8px; }
}
@media(max-width:360px) {
  #home .topbar .stamp { width:86px; }
  #home .topbar .prairie-window { width:26px; height:26px; }
  #home .topbar .brand { gap:6px; }
  #home .library-settings-label { display:none !important; }
  #home .library-settings .model-options button { padding:0 8px; font-size:11px; }
}
