@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    --prog-sys: #60a5fa;
    --sb-bg: #161330;
    --sb-border: rgba(255,255,255,0.08);
    --sb-text: #c4b5fd;
    --sb-text-active: #fef3c7;
    --sb-hover: rgba(99,102,241,0.18);
    --sb-active-bg: rgba(99,102,241,0.28);
    background-color: #0d0b1e;
    color: #fef3c7;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', Verdana, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    color: #fcd34d;
    text-decoration: none;
    transition: opacity 0.15s ease;
}

a:hover {
    opacity: 0.75;
}

i {
    background-color: transparent;
    color: #f59e0b;
    transition: transform 0.15s ease, opacity 0.15s ease;
}
button i, input[type="submit"] i, input[type="button"] i { color: inherit; }

a:hover i {
    opacity: 0.75;
    transform: scale(1.1);
}

dialog {
    background-color: #1a1635;
    color: #fef3c7;
    border: 2px solid #f59e0b;
    border-radius: 16px;
    padding: 5px;
    position: fixed;
    top: 0;
    left: 0;
    margin: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

dialog::backdrop {
    background-color: rgba(109, 40, 217, 0.4);
    backdrop-filter: blur(4px);
}

header {
    display: flex;
    width: 100%;
    background-color: #221e4a;
    color: #fcd34d;
    padding-top: 5px;
    padding-left: 10px;
    padding-right: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-section {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.header-left { justify-content: flex-start; }
.header-center { justify-content: center; }
.header-right { justify-content: flex-end; }

main {
    flex: 1;
    width: 80%;
    margin: 0 auto;
    padding: 2rem;
    background-color: #1a1635;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 24px rgba(0, 0, 0, 0.4);
}
main.chat-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}
.chat-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chat-body-active {
    flex-direction: row;
}
.pg-sidebar {
    width: 230px;
    flex-shrink: 0;
    overflow-y: auto;
    padding: 1.25rem 0.85rem 1rem;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
}
.chat-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    min-height: 0;
}
.chat-content-querying {
    padding-top: 0;
}
.chat-input-area {
    flex-shrink: 0;
    background-color: #1a1635;
    padding: 0.6rem 2rem;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

footer {
    display: flex;
    width: 100%;
    background-color: #1a1635;
    padding: 0.25rem 1rem;
    justify-content: flex-end;
}

.footer-section { flex: 1; }
.footer-right { text-align: right; font-size: 0.8em; opacity: 0.5; }

h2 {
    color: #f59e0b;
    letter-spacing: 0.02em;
}
h3 {
    color: #f59e0b;
    letter-spacing: 0.02em;
    padding-top: 5px;
    padding-bottom: 10px;
}
h4 {
    color: #f59e0b;
    letter-spacing: 0.02em;
    padding-top: 5px;
    padding-bottom: 5px;
}
th {
    color: #f59e0b;
    font-size: 12pt;
    font-weight: 600;
}
.data-table {
    width: 100%;
    font-size: 10pt;
    border-collapse: collapse;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    overflow: hidden;
}
.data-table td,
.data-table th {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.data-table thead tr,
.data-table tr:first-child {
    background: rgba(255, 255, 255, 0.07);
}
.data-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}
.text-right { text-align: right; }
.text-center { text-align: center; }
.hr-thick {
    background-color: #fcd34d;
    border: 0;
    height: 2px;
    margin-bottom: 10px;
    margin-right: auto;
    width: 100%;
}
.hr-thin {
    background-color: #f59e0b;
    border: 0;
    height: 1px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}
iframe {
    border: none;
    display: block;
    margin-left: 5px;
    margin-right: auto;
    width: 98%;
}
.model-list {
    font-size: 10pt;
    margin-left: 0;
    padding-left: 1.25em;
}
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="text"] {
    background-color: #2d2a6b;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fef3c7;
    display: inline-block;
    padding: 5px 10px;
    font-size: 12px;
    font-family: 'Inter', Verdana, sans-serif;
    border-radius: 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
input[type="text"]:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}
::placeholder {
    text-align: center;
    color: rgba(254, 243, 199, 0.4);
}
#textArea::placeholder {
    color: rgba(254, 243, 199, 0.5);
    font-style: italic;
    text-align: left;
}
button,
input[type="submit"],
input[type="button"] {
    background-color: #c4b5fd;
    border: none;
    color: #1e1b4b;
    padding: 10px 14px;
    min-height: 40px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Inter', Verdana, sans-serif;
    margin: 2px 1px;
    cursor: pointer;
    border-radius: 8px;
    transition: opacity 0.15s ease, box-shadow 0.15s ease;
}
button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
    opacity: 0.85;
    box-shadow: 0 4px 12px rgba(196, 181, 253, 0.3);
}
.btn-sm {
    padding: 3px 9px;
    font-size: 11px;
}
button:disabled, input[type="submit"]:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    box-shadow: none;
}
input[type="radio"] {
    accent-color: #f59e0b;
}
input[type="checkbox"] {
    margin-left: 5px;
    margin-bottom: 5px;
    accent-color: #f59e0b;
}
input[type="number"] {
    margin-left: 5px;
    margin-bottom: 10px;
}
label {
    font-size: 12pt;
    font-weight: 500;
    color: #fcd34d;
}
.label-small {
    font-size: 10pt;
    padding-top: 3px;
    padding-bottom: 1px;
}
.rounded-input {
    border-radius: 15px;
    padding: 10px;
    border: 1px solid #f59e0b;
    font-size: 12px;
    font-family: 'Inter', Verdana, sans-serif;
}
textarea::placeholder {
    color: rgba(254, 243, 199, 0.5);
    font-style: italic;
}
textarea {
    border-radius: 12px;
    padding: 12px 14px;
    border: 1.5px solid #f59e0b;
    background-color: #1a1635;
    color: #fef3c7;
    font-family: 'Inter', Verdana, sans-serif;
    font-size: 11pt;
    min-height: 2lh;
    width: 100%;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea:focus {
    outline: none;
    border-color: #fbbf24;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}
.textarea-wrapper {
    position: relative;
    width: 100%;
}
.submit-hint {
    position: absolute;
    bottom: 10px;
    right: 12px;
    font-size: 1.25em;
    line-height: 1;
    color: #f59e0b;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    cursor: pointer;
    user-select: none;
}
.submit-hint.visible {
    opacity: 0.55;
    pointer-events: auto;
}
.submit-hint.visible:hover {
    opacity: 1;
}
textarea[readonly] {
    background-color: #111028;
    border-color: #6b5a1e;
    color: #c9a227;
    cursor: default;
    font-style: italic;
}
.readonly {
    color: #f59e0b;
    font-size: 11pt;
    font-style: italic;
}
details {
    color: #fef3c7;
    font-size: 10pt;
    padding: 2px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 4px;
    overflow: hidden;
}
summary {
    color: #f59e0b;
    cursor: pointer;
    font-size: 12pt;
    font-weight: 500;
    letter-spacing: 0.01em;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background-color 0.15s ease;
    list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary::before {
    content: '▸';
    display: inline-block;
    margin-right: 6px;
    transition: transform 0.2s ease;
    color: #f59e0b;
}
details[open] > summary::before {
    transform: rotate(90deg);
}
summary:hover {
    background-color: rgba(255, 255, 255, 0.05);
}
details > div {
    padding-top: 6px;
}
details.compact {
    border: none;
    margin-bottom: 1px;
    padding: 0;
}
details.compact > summary {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 10pt;
    padding: 2px 8px;
}
details.compact > summary a,
details.compact > summary > i {
    flex-shrink: 0;
}
.summary-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
}
.title {
    color: #fef3c7;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.05em;
    text-align: center;
}
.signin-div {
    background-color: #221e4a;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    padding-top: 10px;
    padding-bottom: 10px;
    width: 60%;
    border-radius: 12px;
}
.pw-field {
    position: relative;
    display: inline-block;
}
.pw-field input[type=password],
.pw-field input[type=text] {
    padding-right: 2.2em;
}
.pw-toggle {
    position: absolute;
    right: 0.5em;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.65;
    padding: 0.2em 0.3em;
    font-size: 1em;
    line-height: 1;
}
.pw-toggle:hover { opacity: 1; }
.centered-centered-div {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    padding-top: 5px;
    padding-bottom: 5px;
    padding-left: 10px;
}
.centered-left-div {
    margin-left: auto;
    margin-right: auto;
    text-align: left;
    padding-top: 5px;
    padding-bottom: 5px;
    padding-left: 10px;
}
.results-div {
    margin-left: auto;
    margin-right: auto;
    text-align: left;
    padding-top: 5px;
    padding-bottom: 5px;
    padding-left: 10px;
}
.span-12pt {
    font-size: 12pt;
    color: #fef3c7;
    padding-left: 20px;
    line-height: 1.7;
}
.span-10pt {
    font-size: 10pt;
    color: #fef3c7;
    padding-left: 30px;
    line-height: 1.6;
}
.span-trivia {
    color: #60a5fa;
    font-size: 11.5pt;
    font-style: italic;
    padding-top: 5px;
    padding-bottom: 15px;
    text-align: center;
}
@keyframes triviaShimmer {
    0%, 100% { opacity: 0.4; }
    50%       { opacity: 1;   }
}
.trivia-wave-char {
    display: inline-block;
    animation: triviaShimmer 2.4s ease-in-out infinite;
}
/* ── Follow-up suggestion pills ──────────────────── */
.followup-suggestions {
    margin: 1rem 0 0.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}
.followup-label {
    font-size: 0.82em;
    opacity: 0.55;
    font-style: italic;
    margin-right: 0.15rem;
    white-space: nowrap;
}
.followup-pill {
    font-size: 0.82em;
    padding: 0.28rem 0.8rem;
    border-radius: 20px;
    border: 1px solid #60a5fa;
    background: transparent;
    color: #60a5fa;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-align: left;
    line-height: 1.4;
}
.followup-pill:hover {
    background: #60a5fa;
    color: #111;
}
.followup-pill-selected {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
    font-weight: 600;
}
.followup-refresh {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.45em;
    line-height: 1;
    padding: 0 0.3rem;
    opacity: 0.45;
    color: inherit;
    transition: opacity 0.15s, transform 0.15s;
    vertical-align: middle;
}
.followup-refresh:hover { opacity: 0.9; }
.followup-refresh:disabled { opacity: 0.2; cursor: default; }
@keyframes fuSpin { to { transform: rotate(360deg); } }
.followup-refresh-spinning { animation: fuSpin 0.7s linear infinite; opacity: 0.7; }
/* ── Mode switcher ───────────────────────────────────── */
.mode-switcher {
    display: flex;
    justify-content: center;
    gap: 0.45rem;
    margin: 0.5rem 0 0.25rem;
}
.resp-switcher {
    display: inline-flex;
    gap: 0;
    margin-left: 0.5rem;
}
.resp-switcher .resp-pill {
    border-radius: 0;
    text-decoration: none;
}
.resp-switcher .resp-pill:first-child {
    border-radius: 11px 0 0 11px;
    border-right-width: 0;
}
.resp-switcher .resp-pill:last-child  { border-radius: 0 11px 11px 0; }
/* Quick-mode Rediscover dropdown menu */
.rerun-wrap { position: relative; display: inline-block; }
.rerun-menu {
    position: absolute;
    bottom: calc(100% + 4px);
    right: 0;
    min-width: 260px;
    background: #1a1733;
    border: 1.5px solid rgba(255,255,255,0.45);
    border-radius: 9px;
    padding: 0.35rem 0;
    z-index: 250;
    box-shadow: 0 6px 22px rgba(0,0,0,0.45);
}
.rerun-item {
    display: flex;
    align-items: center;
    gap: 0.55em;
    padding: 6px 12px;
    font-size: 9pt;
    color: #e2e0ff;
    text-decoration: none;
    cursor: pointer;
}
.rerun-item:hover { background: rgba(99,102,241,0.18); text-decoration: none; }
.rerun-item-active { background: rgba(99,102,241,0.12); font-weight: 700; }
.rerun-check { color: #818cf8; font-size: 0.85em; width: 0.9em; }
.rerun-check-spacer { display: inline-block; width: 0.9em; }
.rerun-item-name { flex: 1; }
.rerun-item-hint { font-size: 0.82em; opacity: 0.55; margin-left: 0.7em; }
/* Quick-mode model picker */
.qm-picker { display: inline-block; margin-left: 0.5rem; }
.qm-pill   { font-weight: 600; }
a.mode-sub-pill        { text-decoration: none; }
a.mode-sub-pill:hover  { text-decoration: none; }
.mode-sw-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    line-height: 1;
    font-size: 8.5pt;
    min-height: 40px;
    padding: 0 14px;
    box-sizing: border-box;
    border-radius: 11px;
    border: 1.5px solid rgba(255,255,255,0.45);
    background: transparent;
    cursor: pointer;
    color: inherit;
    opacity: 1;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}
.mode-sw-pill i { color: inherit; }
.mode-sw-lit {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
    font-weight: 700;
}
.mode-sw-pill:hover {
    border-color: rgba(255,255,255,0.75);
    background: rgba(255,255,255,0.06);
    box-shadow: none;
}
.mode-sw-lit:hover {
    background: #818cf8;
    border-color: #818cf8;
    color: #fff;
}
.mode-sw-pill[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 7px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15,15,25,0.93);
    color: #e2e8f0;
    font-size: 7.5pt;
    font-weight: 400;
    padding: 4px 9px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s;
    z-index: 200;
}
.mode-sw-pill[data-tooltip]:hover::after { opacity: 1; }
.mode-subrow {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
    margin: 0.1rem 0 0.35rem;
    padding: 0.3rem 0;
}
.mode-sub-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    line-height: 1;
    font-size: 8pt;
    padding: 4px 10px;
    border-radius: 10px;
    border: 1.5px solid rgba(255,255,255,0.45);
    background: transparent;
    cursor: pointer;
    color: inherit;
    opacity: 1;
    font-weight: 600;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.mode-sub-pill:hover {
    border-color: rgba(255,255,255,0.75);
    background: rgba(255,255,255,0.06);
    box-shadow: none;
}
.mode-sub-pill[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 7px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15,15,25,0.93);
    color: #e2e8f0;
    font-size: 7pt;
    font-weight: 400;
    padding: 3px 8px;
    border-radius: 5px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s;
    z-index: 200;
}
.mode-sub-pill[data-tooltip]:hover::after { opacity: 1; }
.mode-sub-active {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
    font-weight: 700;
}
.mode-sub-active:hover {
    background: #818cf8;
    border-color: #818cf8;
    color: #fff;
}
/* ── Generator picker modal ───────────────────────── */
.gen-picker-row { transition: border-color 0.15s, background 0.15s; }
.gen-picker-row.selected {
    border-color: #f59e0b !important;
    background: rgba(245,158,11,0.12) !important;
}
/* ── Question spacer ──────────────────────────────── */
.question-spacer    { margin-bottom: 1em; }
.question-spacer-sm { margin-bottom: 0.35em; }
/* ── Sticky progress header ───────────────────────── */
.pg-sticky {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #0d0b1e;
    padding: 0.75rem 0 0.6em;
    box-shadow: 0 4px 8px -2px rgba(0, 0, 0, 0.35);
}
.pg-cards { margin-top: 0.25em; }
/* ── Progress event cards ─────────────────────────── */
.pg-area { margin-top: 0.5em; }
.pg-event {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.35s ease, transform 0.35s ease;
    margin-bottom: 0.7em;
    font-family: 'Inter', Verdana, sans-serif;
    font-size: 10pt;
    line-height: 1.6;
}
.pg-event.pg-visible {
    opacity: 1;
    transform: translateY(0);
}
.pg-sys {
    color: #60a5fa;
    font-style: italic;
}
.pg-card {
    border-left: 2px solid rgba(96, 165, 250, 0.25);
    padding-left: 0.75em;
}
.pg-model-name {
    font-weight: 700;
    font-style: italic;
    color: #fef3c7;
}
.pg-count {
    font-size: 0.85em;
    opacity: 0.55;
    margin: 0 0.25em;
}
.pg-preview {
    opacity: 0.9;
}
.pg-scores {
    margin-top: 0.4em;
}
.scores-details {
    margin-top: 0.5em;
}
.scores-details > summary {
    cursor: pointer;
    user-select: none;
}
@keyframes pd-pulse {
    0%, 100% { opacity: 0.2; }
    50%       { opacity: 1;   }
}
.pd {
    display: inline-block;
    animation: pd-pulse 1.4s ease-in-out infinite;
    margin: 0 2px;
}
.pd:nth-child(2) { animation-delay: 0.2s; }
.pd:nth-child(3) { animation-delay: 0.4s; }
/* Disco-ball progress indicator — slow rock back and forth, with a subtle
   glimmer pulse to suggest light catching the mirrors. */
@keyframes disco-rock {
    0%, 100% { transform: rotate(-22deg); }
    50%      { transform: rotate( 22deg); }
}
@keyframes disco-glimmer {
    0%, 100% { filter: drop-shadow(0 0 3px rgba(255,255,255,0.35)); }
    50%      { filter: drop-shadow(0 0 9px rgba(180,200,255,0.75)); }
}
.disco {
    display: inline-block;
    font-size: 1.8em;
    line-height: 1;
    transform-origin: 50% 18%;
    animation: disco-rock 2.6s ease-in-out infinite,
               disco-glimmer 1.6s ease-in-out infinite;
}
.prog-sys {
    color: #60a5fa;
}
.score-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: normal;
    margin: 0.3em 0 0.6em 0;
}
.score-table { border-collapse: collapse; }
.score-table th {
    text-align: left;
    font-size: 0.78em;
    font-weight: normal;
    color: #60a5fa;
    padding: 0 16px 5px 0;
    white-space: nowrap;
}
.score-table td {
    padding: 3px 16px 3px 0;
    vertical-align: middle;
    white-space: nowrap;
}
.score-table .num {
    text-align: center;
    padding: 3px 10px;
}
@media (max-width: 480px) {
    .score-table { font-size: 0.82em; }
    .score-table th, .score-table td { padding-right: 8px; }
    .score-table .num { padding: 3px 6px; }
}
/* ── Phase progress bar (vertical in sidebar) ───────────── */
.phase-bar {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.5rem 0;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.phase-step {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.phase-dot {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #4c4f9e;
    flex-shrink: 0;
    transition: background 0.45s ease, box-shadow 0.45s ease;
}
.phase-label {
    font-size: 8pt;
    color: #a5b4fc;
    font-weight: 600;
    white-space: nowrap;
    transition: color 0.45s ease;
    letter-spacing: 0.02em;
}
.phase-connector {
    width: 2px;
    height: 18px;
    background: #4c4f9e;
    margin-left: 5px;
    flex-shrink: 0;
    border-radius: 2px;
    transition: background 0.45s ease;
}
.phase-step.phase-active .phase-dot {
    background: #818cf8;
    animation: phase-pulse 1.6s ease-in-out infinite;
}
.phase-step.phase-active .phase-label {
    color: #c4b5fd;
    font-weight: 800;
}
.phase-step.phase-done .phase-dot {
    background: #34d399;
    box-shadow: none;
}
.phase-step.phase-done .phase-label { color: #34d399; font-weight: 700; }
.phase-connector.phase-done          { background: #34d399; }
@keyframes phase-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(129,140,248,0.35); }
    50%       { box-shadow: 0 0 0 8px rgba(129,140,248,0.15); }
}

/* ── Model card grid ─────────────────────────────────────── */
.mc-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.mc-card {
    position: relative;
    width: 148px;
    border: 2px solid #4c4f9e;
    border-radius: 10px;
    padding: 8px 10px;
    background: #1a1635;
    transition: border-color 0.4s ease, box-shadow 0.4s ease, opacity 0.35s ease;
}
.mc-idle      { opacity: 0.7; }
.mc-responded { opacity: 0.9; border-color: #6366f1; }
.mc-voted     { opacity: 1;   border-color: #818cf8; }
.mc-winner-card {
    border-color: #34d399;
    box-shadow: 0 0 0 4px rgba(52,211,153,0.3), 0 2px 10px rgba(52,211,153,0.15);
}
.mc-org {
    font-size: 6.5pt;
    font-weight: 700;
    color: #a78bfa;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1px;
}
.mc-name {
    font-size: 8.5pt;
    font-weight: 700;
    color: #fef3c7;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mc-status {
    font-size: 7.5pt;
    color: #9ca3af;
    min-height: 1.3em;
    margin-bottom: 3px;
}
.mc-responded-status { color: #34d399; font-weight: 600; }
.mc-voted-status     { color: #818cf8; font-weight: 600; }
.mc-bars {
    display: none;
    margin-top: 4px;
}
.mc-dim-row {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-bottom: 3px;
}
.mc-dim-lbl {
    font-size: 6.5pt;
    width: 8px;
    opacity: 0.8;
    flex-shrink: 0;
    font-weight: 600;
}
.mc-dim-track {
    flex: 1;
    height: 4px;
    background: #3730a3;
    border-radius: 2px;
    overflow: hidden;
}
.mc-dim-bar {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}
.mc-dim-acc   { background: #818cf8; }
.mc-dim-comp  { background: #60a5fa; }
.mc-dim-depth { background: #34d399; }
.mc-winner-card .mc-dim-acc   { background: #a78bfa; }
.mc-winner-card .mc-dim-comp  { background: #7dd3fc; }
.mc-winner-card .mc-dim-depth { background: #6ee7b7; }
.mc-dim-val {
    font-size: 7pt;
    width: 16px;
    text-align: right;
    opacity: 0.85;
    flex-shrink: 0;
    font-weight: 600;
}
.mc-score-line {
    display: none;
    font-size: 8pt;
    margin-top: 4px;
    color: #c4b5fd;
    font-weight: 700;
}
.mc-score-dim { opacity: 0.6; font-weight: 400; }
.mc-winner-badge {
    display: none;
    position: absolute;
    top: 5px;
    right: 6px;
    font-size: 5.5pt;
    padding: 2px 6px;
    border-radius: 5px;
    background: #34d399;
    color: #0d0b1e;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.mc-winner-card .mc-winner-badge { display: block; }
@keyframes mc-wait-pulse {
    0%, 100% { opacity: 0.35; }
    50%       { opacity: 0.8;  }
}
.mc-idle .mc-status { animation: mc-wait-pulse 1.4s ease-in-out infinite; }
.pg-winner { font-size: 10.5pt; }
/* ── Text progress log (below card grid) ──────────────── */
.pg-text-log {
    margin-top: 10px;
    border-top: 1px solid #2d2a6b;
    padding-top: 8px;
}
.pg-log-entry {
    opacity: 0;
    transform: translateY(3px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    margin-bottom: 0.45em;
    font-size: 9.5pt;
    line-height: 1.55;
}
.pg-log-entry.pg-visible {
    opacity: 1;
    transform: translateY(0);
}
.pg-log-sys {
    color: #60a5fa;
    font-size: 9pt;
}
.pg-log-consensus { opacity: 0.7; }
.pg-consensus-preview { font-style: italic; }
/* ── Typewriter best-answer preview ─────────────────────── */
.pg-answer-preview {
    margin-top: 14px;
    padding: 12px 16px;
    border: 1.5px solid #2d2a6b;
    border-radius: 10px;
    background: #110f2a;
    opacity: 0;
    transition: opacity 0.5s ease;
}
.pg-answer-label {
    font-size: 7.5pt;
    font-weight: 700;
    color: #818cf8;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.pg-answer-label-dim {
    font-weight: 700;
    text-transform: none;
    letter-spacing: normal;
}
.pg-answer-text {
    font-size: 10.5pt;
    line-height: 1.72;
    color: #e2e0ff;
    white-space: pre-wrap;
    word-break: break-word;
}
/* Markdown-rendered variant: block-level HTML elements need normal whitespace */
.pg-answer-text.pg-answer-md { white-space: normal; }
.pg-answer-md h1, .pg-answer-md h2, .pg-answer-md h3,
.pg-answer-md h4, .pg-answer-md h5, .pg-answer-md h6 {
    margin: 0.9em 0 0.35em; line-height: 1.3;
}
.pg-answer-md h1 { font-size: 1.35em; }
.pg-answer-md h2 { font-size: 1.2em;  }
.pg-answer-md h3 { font-size: 1.08em; }
.pg-answer-md p           { margin: 0.5em 0; }
.pg-answer-md ul,
.pg-answer-md ol          { margin: 0.4em 0 0.6em 1.4em; padding: 0; }
.pg-answer-md li          { margin: 0.15em 0; }
.pg-answer-md code        { background: rgba(255,255,255,0.08); padding: 1px 5px;
                            border-radius: 4px; font-size: 0.92em; }
.pg-answer-md pre         { background: rgba(0,0,0,0.35); padding: 0.7em 0.9em;
                            border-radius: 6px; overflow-x: auto; font-size: 0.9em;
                            line-height: 1.5; }
.pg-answer-md pre code    { background: transparent; padding: 0; }
.pg-answer-md blockquote  { border-left: 3px solid #6366f1; margin: 0.6em 0;
                            padding: 0.2em 0.9em; color: #c7c5e0; opacity: 0.85; }
.pg-answer-md table       { border-collapse: collapse; margin: 0.6em 0; }
.pg-answer-md th,
.pg-answer-md td          { border: 1px solid rgba(255,255,255,0.18);
                            padding: 3px 9px; }
.pg-answer-md th          { background: rgba(255,255,255,0.06); }
.pg-answer-md a           { color: #a5b4fc; }
/* ── Upload status ───────────────────────────────────────── */
.upload-status {
    font-size: 9pt;
    font-style: italic;
    color: #a5b4fc;
    padding: 5px 4px 2px 4px;
    animation: upload-pulse 1.1s ease-in-out infinite;
}
@keyframes upload-pulse {
    0%, 100% { opacity: 0.45; }
    50%       { opacity: 1;    }
}
/* ── Prompt example hint ─────────────────────────────────── */
.prompt-hint {
    font-size: 9.5pt;
    font-style: italic;
    color: #a5b4fc;
    padding: 6px 4px 8px 4px;
    cursor: pointer;
    user-select: none;
    line-height: 1.5;
}
.prompt-hint:hover { opacity: 0.75; }
#pg-trivia.prompt-hint { font-size: 11.5pt; cursor: default; }
.prompt-hint-label {
    font-style: normal;
    opacity: 0.65;
    margin-right: 3px;
}
.prompt-hint-text { }
@media (max-width: 480px) {
    .mc-card { width: calc(50% - 4px); }
    /* Sidebar stacks above content; hide model cards, keep phase bar as horizontal strip */
    .chat-body-active { flex-direction: column; }
    .pg-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        padding: 0.4rem 1rem 0.25rem;
    }
    .pg-sidebar .mc-grid { display: none; }
    .phase-bar {
        flex-direction: row;
        align-items: flex-start;
        justify-content: center;
        padding: 4px 0 6px;
    }
    .phase-step { flex-direction: column; align-items: center; gap: 4px; }
    .phase-connector {
        width: 20px; height: 2.5px;
        margin-left: 0; margin-top: 4px;
        min-width: 8px; max-width: 24px;
    }
}

/* Exploration chain navigation */
.chain-nav-bar {
    display: flex;
    align-items: center;
    gap: 0.35em;
    padding: 0.4em 0 0.6em 0;
}
.chain-nav-arrow {
    font-size: 1.3em;
    line-height: 1;
    color: #60a5fa;
    text-decoration: none;
    padding: 0 3px;
    user-select: none;
}
.chain-nav-arrow-dim { opacity: 0.25; }
.chain-step-pill {
    display: inline-block;
    min-width: 1.6em;
    text-align: center;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.78em;
    background: rgba(96,165,250,0.12);
    color: #60a5fa;
    text-decoration: none;
}
.chain-step-pill:hover { background: rgba(96,165,250,0.25); }
.chain-step-active {
    background: #60a5fa !important;
    color: #1a1635 !important;
    font-weight: bold;
}
.chain-badge {
    font-size: 0.78em;
    padding: 1px 6px;
    border-radius: 8px;
    background: rgba(96,165,250,0.12);
    color: #60a5fa;
    text-decoration: none;
    margin-left: 6px;
    white-space: nowrap;
}
.chain-badge:hover { background: rgba(96,165,250,0.25); }
.prefs-label {
    display: inline-block;
    width: 130px;
    font-size: 10.5pt;
    vertical-align: middle;
    margin-top: 0.4em;
}
.span-hint {
    color: #f59e0b;
    font-size: 10pt;
    font-style: italic;
    padding-top: 5px;
    padding-bottom: 5px;
    text-align: left;
}
/* Caution — secondary / cancel / back. Works on both <button> and <input type="submit">. */
.btn-caution {
    background-color: #374151;
    color: #d1d5db;
}
.btn-caution:hover {
    background-color: #4b5563;
    opacity: 1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
/* Danger — destructive actions (delete, revoke, logout). */
.btn-danger {
    background-color: #dc2626;
    color: #ffffff;
    opacity: 0.75;
}
.btn-danger:hover {
    opacity: 0.85;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
}
.details-body {
    width: 90%;
    margin-left: 22px;
}
.icon-danger { color: #f87171; }
.icon-active { color: #818cf8; }
.icon-info { color: #60a5fa; }
.text-warning {
    font-size: 10pt;
    color: #f87171;
}
.link-btn {
    background: none;
    border: none;
    padding: 8px 0;
    cursor: pointer;
    color: #f87171;
    font-size: 10pt;
    text-decoration: underline;
}
.form-inline {
    display: inline;
}
.form-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}
.form-row-centered {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}
.float-right {
    float: right;
}

/* =====================================================================
   Tags
   ===================================================================== */

.tag-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
    margin-bottom: 0.6rem;
    padding: 2px 0;
}
.tag-filter-label {
    font-size: 9pt;
    font-weight: 600;
    color: rgba(254, 243, 199, 0.5);
    flex-shrink: 0;
}
/* Pills displayed inline on each history entry */
.tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 12px;
    font-size: 8pt;
    font-weight: 600;
    border: 1.5px solid;
    background: transparent;
    line-height: 1.5;
    text-decoration: none;
    transition: opacity 0.15s;
    flex-shrink: 0;
    white-space: nowrap;
    margin: 1px 1px;
    cursor: default;
}
.tag-pill-cancelled {
    color: #f87171;
    border-color: #f87171;
}
.question-reask {
    cursor: pointer;
}
.question-reask:hover {
    opacity: 0.75;
}
.tag-pill-removable {
    cursor: pointer;
}
.tag-pill-removable:hover {
    opacity: 0.7;
}
/* Filter-bar submit buttons styled as pills */
input.tag-pill-btn {
    background-color: transparent;
    color: rgba(254, 243, 199, 0.6);
    border: 1.5px solid rgba(254, 243, 199, 0.25);
    border-radius: 12px;
    padding: 1px 8px;
    font-size: 8pt;
    font-weight: 600;
    line-height: 1.5;
    cursor: pointer;
    margin: 1px 1px;
    transition: opacity 0.15s, box-shadow 0.15s;
}
input.tag-pill-btn:hover {
    opacity: 0.8;
    box-shadow: none;
}
input.tag-pill-btn.tag-pill-active {
    box-shadow: 0 0 0 2px currentColor;
    background-color: transparent;
}
/* "All" clear-filter button */
input.tag-pill-all {
    background-color: transparent;
    color: #f59e0b;
    border: 1.5px solid #f59e0b;
    border-radius: 12px;
    padding: 1px 8px;
    font-size: 8pt;
    font-weight: 600;
    line-height: 1.5;
    cursor: pointer;
    margin: 1px 1px;
    transition: opacity 0.15s;
}
input.tag-pill-all:hover {
    opacity: 0.75;
    box-shadow: none;
}
/* Domain-strength pills on the models page */
.domain-strengths {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 4px;
}
/* Inline research mode toggle on the query page */
.attach-btn {
    position: absolute;
    top: 8px;
    right: 12px;
    cursor: pointer;
    opacity: 0.35;
    font-size: 0.95em;
    line-height: 1;
    transition: opacity 0.15s;
    z-index: 1;
}
.attach-btn:hover { opacity: 0.8; }
.attach-strip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 1px 2px;
    font-size: 7.5pt;
    opacity: 0.7;
}
.attach-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 260px;
}
.attach-active {
    opacity: 1;
    color: #a5b4fc;
    font-weight: 600;
}
.attach-strip-result {
    margin-top: 0.35em;
    opacity: 0.5;
    font-size: 7pt;
}
.image-pill {
    color: #6ee7b7;
    border-color: #6ee7b7;
}
input#image_toggle:checked + .image-pill {
    background: #6ee7b7;
    color: #0d0b1e;
    font-weight: 600;
}
.image-mode-label { color: #6ee7b7; }
.attach-clear {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95em;
    opacity: 0.5;
    padding: 0 2px;
    line-height: 1;
    color: inherit;
}
.attach-clear:hover { opacity: 1; }
.mode-toggle-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 0 2px;
}
.mode-toggle-row input[type=radio],
.mode-toggle-row input[type=checkbox] { display: none; }
.mode-pill {
    font-size: 7.5pt;
    padding: 2px 9px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.15);
    cursor: pointer;
    opacity: 0.5;
    color: inherit;
    user-select: none;
}
.modifier-row { padding-top: 1px; }
.mode-divider { opacity: 0.25; padding: 0 2px; font-size: 10pt; user-select: none; }
.synth-badge { color: #a5b4fc; font-weight: 600; }
.mode-toggle-row input[type=radio]:checked + .mode-pill,
.mode-toggle-row input[type=checkbox]:checked + .synth-pill {
    opacity: 1;
    background: rgba(99,102,241,0.2);
    border-color: #818cf8;
    color: #a5b4fc;
    font-weight: 600;
}

.ds-pill {
    display: inline-flex;
    align-items: center;
    padding: 0px 6px;
    border-radius: 10px;
    font-size: 7pt;
    font-weight: 600;
    border: 1.5px solid;
    white-space: nowrap;
    cursor: default;
    line-height: 1.6;
}
/* 5 — Expert (vivid emerald) */
.ds-5 { background: rgba(16,185,129,0.15); color: #10b981; border-color: #10b981; }
/* 4 — Strong (amber) */
.ds-4 { background: rgba(245,158,11,0.15); color: #f59e0b; border-color: #f59e0b; }
/* 3 — Capable (slate, brighter on dark bg) */
.ds-3 { background: rgba(148,163,184,0.12); color: #94a3b8; border-color: #94a3b8; }
/* Domain-strength key / legend */
.ds-key {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 8px 0 14px;
    font-size: 0.78em;
    color: rgba(254,243,199,0.55);
}
.ds-key-label {
    font-weight: 600;
    margin-right: 2px;
}
.ds-key-sep { opacity: 0.3; }
.cap-legend { font-size: 0.78em; }
/* ── Models page ───────────────────────────────────────────────────────────── */
.models-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.models-focus-row {
    display: flex;
    align-items: center;
    gap: 4px;
}
.focus-radio { display: none; }
.focus-pill {
    font-size: 8.5pt;
    padding: 3px 11px;
    border-radius: 11px;
    border: 1px solid rgba(255,255,255,0.15);
    cursor: pointer;
    opacity: 0.75;
    color: inherit;
    user-select: none;
}
.focus-radio:checked + .focus-pill {
    opacity: 1;
    background: rgba(99,102,241,0.2);
    border-color: #818cf8;
    color: #a5b4fc;
    font-weight: 600;
}
.models-focus-desc { margin: 4px 0 0; }
.domain-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin: 8px 0 0;
}
.dfilter-pill {
    font-size: 7.5pt;
    padding: 1px 8px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.15);
    opacity: 0.82;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.15s;
}
.dfilter-pill:hover { opacity: 1; }
.dfilter-active {
    opacity: 1;
    background: rgba(16,185,129,0.15);
    border-color: #34d399;
    color: #34d399;
    font-weight: 600;
}
.dfilter-clear {
    font-size: 8pt;
    opacity: 0.55;
    color: inherit;
    text-decoration: none;
    padding: 0 4px;
    cursor: pointer;
}
.dfilter-clear:hover { opacity: 0.9; }
.models-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
    margin-top: 6px;
}
.models-table thead th {
    text-align: left;
    font-size: 7.5pt;
    font-weight: 600;
    opacity: 0.75;
    padding: 4px 8px 4px 4px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
}
.provider-row .provider-cell {
    font-size: 8pt;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.8;
    padding: 10px 4px 3px;
}
.model-row td { padding: 5px 8px 5px 4px; border-bottom: 1px solid rgba(255,255,255,0.05); vertical-align: middle; }
.model-active { opacity: 1; }
.model-dim    { opacity: 0.55; }
.model-active-dot { color: #818cf8; font-size: 9pt; }
.col-check  { width: 24px; text-align: center; }
.col-model  { min-width: 140px; }
.col-type   { width: 90px; white-space: nowrap; }
.col-price  { width: 110px; white-space: nowrap; }
.col-caps   { width: 38px; white-space: nowrap; font-size: 11pt; letter-spacing: 2px; }
.col-domains { width: 160px; white-space: nowrap; }
.model-name-lbl {
    display: block;
    font-weight: 600;
    font-size: 9pt;
    cursor: default;
}
label.model-name-lbl { cursor: pointer; }
.model-summary-txt {
    display: block;
    font-size: 7.5pt;
    opacity: 0.78;
    margin-top: 1px;
}
.model-pricing { font-size: 7.5pt; opacity: 0.85; white-space: nowrap; }
/* Model type badges */
.model-type-badge {
    display: inline-block;
    font-size: 7pt;
    padding: 1px 7px;
    border-radius: 9px;
    border: 1px solid;
    font-weight: 600;
    white-space: nowrap;
}
.type-thinking   { background: rgba(129,140,248,0.15); color: #a5b4fc; border-color: #818cf8; }
.type-reasoning  { background: rgba(167,139,250,0.15); color: #c4b5fd; border-color: #a78bfa; }
.type-standard   { background: rgba(96,165,250,0.15);  color: #93c5fd; border-color: #60a5fa; }
.type-fast       { background: rgba(45,212,191,0.15);  color: #5eead4; border-color: #2dd4bf; }
.type-smart      { background: rgba(129,140,248,0.15); color: #a5b4fc; border-color: #818cf8; }
.type-balanced   { background: rgba(251,191,36,0.15);  color: #fbbf24; border-color: #f59e0b; }
.type-custom     { background: rgba(148,163,184,0.12); color: #94a3b8; border-color: #64748b; }
.custom-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
/* Tag icon in the summary line */
.icon-tag {
    color: rgba(254, 243, 199, 0.3);
    font-size: 8.5pt;
}
/* Wraps question text + tag pills so they act as one flex item */
.summary-body {
    flex: 1;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    overflow: hidden;
}
/* Action bar inside an expanded history entry */
.details-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 6px 0;
    font-size: 10pt;
    flex-wrap: wrap;
}
.details-actions a,
.details-actions span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
    min-height: 44px;
    color: inherit;
}
/* Permalink URL box */
.permalink-box {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.permalink-input {
    font-size: 7.5pt;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #4a4a6a;
    width: 190px;
    color: #aab;
    background: transparent;
    cursor: text;
}
.icon-link { color: #818cf8; }

/* ── Generated image display ──────────────────────── */
.gen-image-details summary { cursor: pointer; }
.gen-image-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1em 0 0.5em;
}
.gen-image {
    max-width: 100%;
    width: 512px;
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}
.gen-image-caption {
    margin-top: 0.6em;
    font-size: 0.78em;
    opacity: 0.55;
    max-width: 512px;
    text-align: center;
}

/* =====================================================================
   Responsive / Mobile
   ===================================================================== */

/* Tablet */
@media (max-width: 768px) {
    main {
        width: 95%;
        padding: 1.5rem;
    }
    .signin-div {
        width: 80%;
    }
    dialog::backdrop {
        backdrop-filter: none;
    }
}

/* Hide header title on screens where 3-column layout gets cramped */
@media (max-width: 600px) {
    .header-center {
        display: none;
    }
}

/* Mobile */
@media (max-width: 480px) {
    main {
        width: 95%;
        padding: 1rem;
    }
    header {
        padding: 3px 8px;
    }
    header img {
        height: 36px;
    }
    .header-section {
        gap: 0.5rem;
    }
    header a:has(i) {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
    }
    .signin-div {
        width: 90%;
    }
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="text"],
    textarea {
        font-size: 16px; /* Prevents iOS auto-zoom on focus */
    }
    footer {
        flex-wrap: nowrap;
        align-items: center;
    }
    .footer-section {
        flex: 1 1 auto;
        white-space: nowrap;
        overflow: hidden;
    }
    .footer-right {
        flex: 0 0 auto;
        white-space: nowrap;
        text-align: right;
    }
    .footer-hostname {
        display: none;
    }
    .models-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ── Discover toolbar (replaces footer; lives directly under the textarea) ── */
.ask-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75em;
    flex-wrap: wrap;
    padding: 0.4em 0.1em 0.1em;
    margin-top: 0.3em;
}
.ask-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.5em;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}
.ask-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.4em;
    font-size: 0.78em;
    opacity: 0.55;
    margin-left: auto;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}
.ask-tool-msg, .ask-tool-fm { line-height: 1.3; }
.ask-tool-sep { opacity: 0.45; }

/* Toolbar attach button — outline, sits inline with mode pills */
.ask-tool-attach {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #f59e0b;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.ask-tool-attach:hover {
    background: rgba(245, 158, 11, 0.16);
    border-color: rgba(245, 158, 11, 0.65);
}
.ask-tool-attach i { color: inherit; font-size: 0.95em; }

/* Override mode-switcher / subrow centering when nested inside the toolbar so they
   sit inline with the other action items instead of taking the full row width. */
.ask-toolbar .mode-switcher,
.ask-toolbar .mode-subrow {
    margin: 0;
    justify-content: flex-start;
}

/* Dismiss ✕ for cancelled-question display */
.question-dismiss {
    margin-left: 0.4em;
    padding: 0 0.4em;
    font-size: 0.95em;
    line-height: 1;
    color: inherit;
    opacity: 0.5;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 999px;
    text-decoration: none;
    vertical-align: middle;
}
.question-dismiss:hover { opacity: 1; border-color: rgba(248,113,113,0.6); color: #f87171; }

/* AiCE row on the models page (Custom focus only) */
.custom-aice-row {
    display: flex;
    align-items: center;
    gap: 0.6em;
    flex-wrap: wrap;
    margin: 0.6em 0 0.4em;
}
.custom-aice-label { font-size: 9pt; opacity: 0.85; }
.custom-aice-hint { font-size: 8.5pt; flex: 1; min-width: 200px; }

/* Icon-style pills in the toolbar (Text / Image / Calendar) */
.mode-sw-icon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 9px;
    min-width: 32px;
    justify-content: center;
}
.mode-sw-icon i { font-size: 0.95em; pointer-events: none; }
.mode-sw-icon span { pointer-events: none; }
.pill-range-label {
    font-size: 7.5pt;
    font-weight: 600;
    text-transform: lowercase;
}

/* ── Answer iframe action buttons (Open in New Tab / Print / PDF) ─────── */
.answer-action {
    margin-left: 6px;
    padding: 3px 9px;
    font-size: 10pt;
    vertical-align: middle;
}
.answer-action i { font-size: 0.85em; }
.pl-answer-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-bottom: 0.5em;
}
.pl-answer-actions .answer-action { margin-left: 0; }

/* ── Mobile toolbar tightening (≤600px) ────────────────────────────────── */
/* On desktop, the overflow wrapper is transparent — buttons flow inline. */
.ask-overflow { display: inline-flex; align-items: center; gap: 0.5em; }
.ask-secondary-actions { display: contents; }
.ask-more-toggle { display: none; }

@media (max-width: 600px) {
    /* Compact Fast/Thorough — show only the inactive pill as a "switch to" chip. */
    .resp-switcher .mode-sw-lit { display: none; }
    .resp-switcher .resp-pill {
        border-radius: 11px !important;
        border-right-width: 1.5px !important;
    }
    /* The picker chip already shows the current selection; drop the duplicate label. */
    .ask-toolbar-right { display: none; }
    /* Open all subrows UPWARD so they don't get clipped by the on-screen keyboard. */
    .ask-toolbar { position: relative; }
    .ask-toolbar .mode-subrow {
        position: absolute;
        bottom: calc(100% + 6px);
        left: 0;
        right: 0;
        margin: 0;
        padding: 0.5rem;
        background: #1a1733;
        border: 1.5px solid rgba(255,255,255,0.45);
        border-radius: 9px;
        z-index: 50;
        box-shadow: 0 6px 22px rgba(0,0,0,0.45);
        justify-content: flex-start;
    }
    /* Stack post-answer secondary actions (New / Rediscover / Format / Save) behind ⋯. */
    .ask-more-toggle { display: inline-flex; }
    .ask-overflow { position: relative; display: inline-block; }
    .ask-overflow .ask-secondary-actions {
        display: none;
        position: absolute;
        bottom: calc(100% + 6px);
        right: 0;
        flex-direction: column;
        gap: 6px;
        min-width: 180px;
        background: #1a1733;
        border: 1.5px solid rgba(255,255,255,0.45);
        border-radius: 9px;
        padding: 8px;
        z-index: 60;
        box-shadow: 0 6px 22px rgba(0,0,0,0.45);
    }
    .ask-overflow.menu-open .ask-secondary-actions { display: flex; }
    .ask-overflow .ask-secondary-actions .mode-sw-pill { width: 100%; justify-content: flex-start; }
    .ask-overflow .rerun-menu { right: auto; left: 0; }
}

@media (max-width: 768px) {
    /* Clear the fixed hamburger button so it doesn't cover the question text. */
    .pg-sticky { padding-left: 50px; }
}
