* {
    box-sizing: border-box;
}

:root {
    color-scheme: dark;
    --bg: #070a0f;
    --panel: #0e131d;
    --panel-2: #111926;
    --border: rgba(255,255,255,0.10);
    --text: #edf4ff;
    --muted: #8c9aae;
    --accent: #5bb7ff;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

button {
    font: inherit;
}

#auth-bar {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1000;

    display: flex;
    align-items: center;
    gap: 8px;

    padding: 8px 10px;

    background: rgba(10, 14, 22, 0.88);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    backdrop-filter: blur(8px);
}

#auth-user-label {
    margin-right: 6px;
    opacity: 0.85;
}

#auth-bar button,
.auth-modal-card button {
    cursor: pointer;
}

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;

    display: flex;
    justify-content: center;
    align-items: center;

    background: rgba(0, 0, 0, 0.65);
}

.auth-modal-card {
    position: relative;

    width: min(420px, calc(100vw - 40px));
    padding: 28px;

    background: #111823;
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 14px;

    box-shadow: 0 20px 60px rgba(0,0,0,0.55);
}

.auth-modal-card label {
    display: block;
    margin: 14px 0;
}

.auth-modal-card input {
    box-sizing: border-box;
    width: 100%;
    margin-top: 6px;
    padding: 10px;

    color: white;
    background: #0a0f17;

    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 7px;
}

.auth-close-btn {
    position: absolute;
    right: 12px;
    top: 8px;

    font-size: 28px;

    color: white;
    background: transparent;
    border: 0;
}

#auth-message {
    min-height: 20px;
    margin-top: 14px;
}

.hidden {
    display: none !important;
}

#topbar {
    height: 68px;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr) auto;
    gap: 20px;
    align-items: center;
    padding: 0 22px;
    border-bottom: 1px solid var(--border);
    background: rgba(7,10,15,0.96);
    position: relative;
    z-index: 20;
}

.brand {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
}

.brand-v {
    color: var(--accent);
}

.prototype-tag {
    margin-left: 8px;
    padding: 4px 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 1px;
    vertical-align: middle;
}

.topic-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #c9d5e5;
    font-size: 15px;
}

.legend {
    display: flex;
    gap: 15px;
    color: var(--muted);
    font-size: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.dot.agree { background: #45a9ff; }
.dot.neutral { background: #d7dde5; }
.dot.disagree { background: #ff805f; }

#app {
    width: 100%;
    height: calc(100% - 68px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 390px;
}

#graph-panel {
    min-width: 0;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 45%, rgba(36, 76, 120, 0.14), transparent 35%),
        radial-gradient(circle at 25% 20%, rgba(31, 112, 180, 0.05), transparent 25%),
        #05080d;
}

#scene-container {
    position: absolute;
    inset: 0;
}

#scene-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#help {
    position: absolute;
    left: 18px;
    bottom: 18px;
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(10, 15, 23, 0.76);
    backdrop-filter: blur(10px);
    color: var(--muted);
    font-size: 11px;
    pointer-events: auto;
}

#help strong {
    color: #e8eef8;
    margin-bottom: 3px;
}

#reset-view {
    margin-top: 7px;
    padding: 7px 9px;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 7px;
    background: rgba(255,255,255,0.06);
    color: #dfe7f2;
    cursor: pointer;
}

#reset-view:hover {
    background: rgba(255,255,255,0.11);
}

#hover-card {
    position: absolute;
    z-index: 10;
    width: 230px;
    padding: 11px 12px;
    border: 1px solid rgba(255,255,255,0.13);
    border-radius: 10px;
    background: rgba(10, 15, 23, 0.93);
    backdrop-filter: blur(8px);
    box-shadow: 0 14px 40px rgba(0,0,0,0.35);
    pointer-events: none;
}

#hover-card.hidden {
    display: none;
}

#hover-stance {
    margin-bottom: 4px;
    font-size: 9px;
    letter-spacing: 1.2px;
    color: var(--accent);
}

#hover-user {
    display: block;
    font-size: 12px;
    margin-bottom: 4px;
}

#hover-title {
    color: #bcc8d8;
    font-size: 11px;
    line-height: 1.35;
}

#hover-score {
    margin-top: 7px;
    color: #8797aa;
    font-size: 10px;
}

#detail-panel {
    border-left: 1px solid var(--border);
    background: var(--panel);
    overflow-y: auto;
}

#video-placeholder {
    height: 220px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 9px;
    border-bottom: 1px solid var(--border);
    background:
        linear-gradient(145deg, rgba(46, 78, 118, 0.25), rgba(4, 7, 11, 0.90)),
        repeating-linear-gradient(
            45deg,
            rgba(255,255,255,0.015),
            rgba(255,255,255,0.015) 10px,
            transparent 10px,
            transparent 20px
        );
}

.play-button {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    padding-left: 4px;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    font-size: 20px;
}

.video-label {
    font-size: 9px;
    letter-spacing: 1.4px;
    color: #7f90a5;
}

.detail-content {
    padding: 22px;
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.4px;
}

#detail-title {
    margin: 0 0 11px;
    font-size: 22px;
    line-height: 1.18;
}

.byline {
    display: flex;
    gap: 10px;
    color: var(--muted);
    font-size: 11px;
}

#detail-description {
    color: #afbdce;
    font-size: 13px;
    line-height: 1.55;
}

.score-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 20px 0;
}

.score-box {
    padding: 13px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel-2);
}

.score-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
}

.score-label {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
}

.rating-breakdown {
    padding-top: 4px;
}

.breakdown-title {
    margin-bottom: 10px;
    color: #d8e1ed;
    font-size: 12px;
    font-weight: 700;
}

.bar-row {
    display: grid;
    grid-template-columns: 72px 1fr 34px;
    gap: 8px;
    align-items: center;
    margin: 8px 0;
    color: var(--muted);
    font-size: 10px;
}

.bar-track {
    height: 6px;
    overflow: hidden;
    border-radius: 99px;
    background: rgba(255,255,255,0.07);
}

.bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #4f9fe2, #80c8ff);
}

.actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 22px;
}

.actions button {
    padding: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    color: #dbe6f3;
    cursor: pointer;
}

.actions button:hover {
    background: rgba(255,255,255,0.09);
}

.actions .primary {
    grid-column: 1 / -1;
    border-color: rgba(75, 166, 238, 0.5);
    background: rgba(64, 155, 224, 0.15);
    color: #bfe6ff;
}

.prototype-note {
    margin-top: 12px;
    color: #647286;
    font-size: 9px;
    text-align: center;
}

@media (max-width: 900px) {
    #topbar {
        grid-template-columns: 1fr auto;
    }

    .topic-title {
        display: none;
    }

    #app {
        grid-template-columns: 1fr;
    }

    #detail-panel {
        display: none;
    }

    .legend {
        gap: 8px;
    }
}


/* -------------------------------------------------------------------------
   Prototype 0.2 additions
   ------------------------------------------------------------------------- */

#breadcrumb-panel {
    position: absolute;
    z-index: 8;
    left: 18px;
    right: 18px;
    top: 18px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(10, 15, 23, 0.72);
    backdrop-filter: blur(10px);
    pointer-events: auto;
}

.breadcrumb-caption {
    margin-bottom: 6px;
    color: #67788e;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 1.5px;
}

#breadcrumbs {
    display: flex;
    align-items: center;
    gap: 5px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.breadcrumb-button {
    flex: 0 0 auto;
    max-width: 180px;
    padding: 6px 9px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 7px;
    background: rgba(255,255,255,0.04);
    color: #aebccc;
    white-space: nowrap;
    text-overflow: ellipsis;
    cursor: pointer;
    font-size: 10px;
}

.breadcrumb-button:hover {
    background: rgba(255,255,255,0.09);
    color: #eef5ff;
}

.breadcrumb-button.current {
    border-color: rgba(91,183,255,0.42);
    background: rgba(91,183,255,0.12);
    color: #d7efff;
}

.breadcrumb-button.watched::before {
    content: "✓ ";
    color: #79d4a1;
}

.breadcrumb-separator {
    flex: 0 0 auto;
    color: #4f5c6d;
    font-size: 10px;
}

#video-area {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-bottom: 1px solid var(--border);
    background: #030507;
}

#debate-video {
    display: block;
    width: 100%;
    height: 100%;
    background: #030507;
    object-fit: contain;
}

.video-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 7px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 999px;
    background: rgba(5,8,13,0.78);
    color: #9ba9b9;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 1px;
    pointer-events: none;
}

.video-badge.watched {
    border-color: rgba(82,205,137,0.38);
    color: #7ee1a8;
}

.chain-gate {
    margin: 18px 0;
    padding: 12px;
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 10px;
    background: rgba(255,255,255,0.025);
}

.chain-gate.unlocked {
    border-color: rgba(82,205,137,0.27);
    background: rgba(82,205,137,0.045);
}

.chain-gate-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 10px;
}

.chain-gate-header strong {
    color: #dce6f2;
}

#chain-progress {
    color: #8191a4;
}

.chain-progress-track {
    height: 6px;
    overflow: hidden;
    border-radius: 99px;
    background: rgba(255,255,255,0.07);
}

#chain-progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #4e9dde, #73d4a1);
    transition: width 180ms ease;
}

#chain-message {
    margin-top: 8px;
    color: #8190a2;
    font-size: 9px;
    line-height: 1.4;
}

.actions button:disabled {
    opacity: 0.32;
    cursor: not-allowed;
}

.prototype-note.unlocked {
    color: #72c996;
}

@media (max-width: 1100px) {
    #app {
        grid-template-columns: minmax(0, 1fr) 350px;
    }
}


/* -------------------------------------------------------------------------
   Prototype 0.3 additions
   ------------------------------------------------------------------------- */

#visual-controls {
    position: absolute;
    z-index: 9;
    right: 18px;
    top: 92px;
    width: 155px;
    padding: 10px 11px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: rgba(10, 15, 23, 0.72);
    backdrop-filter: blur(10px);
    font-size: 10px;
}

.control-caption {
    margin-bottom: 8px;
    color: #687a90;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 1.3px;
}

.toggle-row {
    display: grid;
    grid-template-columns: 15px 10px 1fr;
    gap: 7px;
    align-items: center;
    padding: 4px 0;
    color: #aebdce;
    cursor: pointer;
    user-select: none;
}

.toggle-row input {
    margin: 0;
}

.marker {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.saved-marker {
    border: 1px solid #f1c861;
    box-shadow: 0 0 7px rgba(241,200,97,0.6);
}

.mine-marker {
    border: 1px solid #d8c5ff;
    box-shadow: 0 0 7px rgba(180,145,255,0.65);
}

.trending-marker {
    border: 1px solid #67e0ff;
    box-shadow: 0 0 9px rgba(103,224,255,0.75);
}

.chain-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
}

#save-chain-button {
    padding: 9px 11px;
    border: 1px solid rgba(241,200,97,0.28);
    border-radius: 8px;
    background: rgba(241,200,97,0.06);
    color: #e7cf8a;
    cursor: pointer;
}

#save-chain-button:hover {
    background: rgba(241,200,97,0.12);
}

#save-chain-button.saved {
    border-color: rgba(241,200,97,0.55);
    background: rgba(241,200,97,0.13);
    color: #ffe59c;
}

#save-chain-status {
    color: #76869a;
    font-size: 9px;
}

.contribution-panel {
    margin: 14px 0 4px;
    padding: 11px 12px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 9px;
    background: rgba(255,255,255,0.02);
}

.contribution-header {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 10px;
}

.contribution-header strong {
    color: #dbe6f2;
}

#contribution-count {
    color: #9eb0c4;
}

.contribution-rule {
    margin-top: 6px;
    color: #69798c;
    font-size: 9px;
    line-height: 1.35;
}


/* Prototype 0.4 */
#breadcrumb-panel { left:22px; right:22px; top:20px; padding:15px 17px; border-radius:14px; }
.breadcrumb-caption,.control-caption { font-size:11px; letter-spacing:1.6px; }
#breadcrumbs { gap:8px; }
.breadcrumb-button { max-width:245px; padding:9px 12px; font-size:13px; }
.breadcrumb-separator { font-size:15px; }
#visual-controls { top:112px; right:22px; width:205px; padding:15px 16px; font-size:13px; }
.control-subtitle { margin:-2px 0 9px; color:#78899c; font-size:10px; }
.toggle-row { grid-template-columns:18px 13px 1fr; gap:9px; padding:7px 0; font-size:13px; }
.marker { width:10px; height:10px; }
.focus-rating,.duplicate-panel { margin:16px 0; padding:13px; border:1px solid rgba(255,255,255,.09); border-radius:10px; background:rgba(255,255,255,.025); }
.focus-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:10px; }
.focus-actions button,#same-argument-button { padding:9px 10px; border:1px solid rgba(255,255,255,.12); border-radius:8px; background:rgba(255,255,255,.04); color:#b9c7d7; cursor:pointer; }
.focus-actions button:disabled,#same-argument-button:disabled { opacity:.32; cursor:not-allowed; }
.focus-result,#duplicate-status { margin-top:9px; color:#7f90a4; font-size:10px; }
.duplicate-panel strong { color:#dce7f3; font-size:11px; }
.duplicate-panel > div:first-child > div { margin:5px 0 10px; color:#78899d; font-size:9px; line-height:1.4; }
#duplicate-status { color:#d9ba67; }
.contribution-philosophy { margin-top:7px; color:#9eb2c7; font-size:9px; font-weight:600; }

/* Prototype 0.5 rating model */
.rating-model { margin:16px 0; padding:13px; border:1px solid rgba(255,255,255,.11); border-radius:10px; background:rgba(65,110,160,.055); }
.rating-explainer { margin:5px 0 13px; color:#7f93a9; font-size:9px; line-height:1.45; }
.rating-question { margin:12px 0 7px; color:#b8c7d8; font-size:10px; font-weight:700; }
.three-rating-actions { display:grid; grid-template-columns:repeat(3,1fr); gap:7px; }
.three-rating-actions button { padding:8px 4px; border:1px solid rgba(255,255,255,.12); border-radius:8px; background:rgba(255,255,255,.04); color:#b9c7d7; }
.three-rating-actions button:disabled { opacity:.32; }
.three-rating-actions button.selected,.focus-actions button.selected { border-color:rgba(132,191,255,.7); background:rgba(83,145,210,.18); color:#e7f3ff; }
.score-grid { display:grid; grid-template-columns:1fr 1fr 1fr; gap:6px; margin-top:13px; }
.score-grid div { padding:8px 6px; border-radius:7px; background:rgba(255,255,255,.035); text-align:center; }
.score-grid span { display:block; color:#718399; font-size:7px; text-transform:uppercase; letter-spacing:.5px; }
.score-grid strong { display:block; margin-top:4px; color:#d9e7f5; font-size:12px; }
#rating-model-status { min-height:13px; margin-top:8px; color:#91abc3; font-size:9px; }
.sibling-review { margin-top:9px; padding:8px 9px; border-left:2px solid rgba(118,169,216,.45); background:rgba(90,130,170,.045); color:#8296aa; font-size:9px; line-height:1.45; }

.focus-actions button.selected,
.three-rating-actions button.selected {
    border-color: rgba(132, 191, 255, 0.82);
    background: rgba(83, 145, 210, 0.28);
    color: #eef7ff;
    box-shadow: 0 0 0 1px rgba(132, 191, 255, 0.12) inset;
}
.root-topic-note {
    display: none;
    margin: 14px 0;
    padding: 10px 12px;
    border-left: 2px solid rgba(120, 170, 215, 0.55);
    background: rgba(80, 120, 160, 0.06);
    color: #8da3b8;
    font-size: 9px;
    line-height: 1.45;
}

/* 0.5.3: root topic identity */
.root-topic-note {
    border-left-color: rgba(88, 200, 120, 0.78);
}

/* 0.5.4 continuous rating controls */
.continuous-rating {
    margin: 5px 0 15px;
    padding: 9px 10px 8px;
    border-radius: 9px;
    background: rgba(255,255,255,.025);
}

.continuous-rating input[type="range"] {
    width: 100%;
    margin: 8px 0 2px;
    accent-color: #85bfff;
}

.continuous-rating input[type="range"]:disabled {
    opacity: .32;
}

.slider-scale {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
}

.slider-scale span {
    color: #788ca1;
    font-size: 8px;
    line-height: 1.25;
}

.slider-scale span:last-child {
    text-align: right;
}

.slider-scale span b {
    color: #a6b9cc;
    font-weight: 700;
}

.slider-scale strong {
    min-width: 42px;
    text-align: center;
    color: #edf6ff;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.score-grid {
    grid-template-columns: repeat(2, 1fr);
}

/* -------------------------------------------------------------------------
   Response video modal
   ------------------------------------------------------------------------- */

.modal-overlay {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(2, 5, 9, 0.78);
    backdrop-filter: blur(8px);
}

.modal-overlay.hidden {
    display: none;
}

.response-modal {
    width: min(560px, 100%);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 22px;
    border: 1px solid rgba(255,255,255,0.13);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: 0 24px 80px rgba(0,0,0,0.55);
}

.response-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.response-modal-header h2 {
    margin: 0;
    color: var(--text);
    font-size: 20px;
}

.modal-close {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    color: #aebdce;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(255,255,255,0.09);
    color: #ffffff;
}

.response-parent {
    margin-bottom: 20px;
    padding: 11px 12px;
    border-left: 2px solid rgba(91,183,255,0.65);
    border-radius: 0 8px 8px 0;
    background: rgba(91,183,255,0.055);
}

.response-parent span {
    display: block;
    margin-bottom: 5px;
    color: #70859b;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 1.2px;
}

.response-parent strong {
    display: block;
    color: #dce8f5;
    font-size: 12px;
    line-height: 1.4;
}

#response-parent-user {
    margin-top: 4px;
    color: #77899d;
    font-size: 9px;
}

.response-section {
    margin: 17px 0;
}

.response-section > label {
    display: block;
    margin-bottom: 7px;
    color: #bdcada;
    font-size: 10px;
    font-weight: 700;
}

.optional-label {
    margin-left: 5px;
    color: #66788d;
    font-size: 8px;
    font-weight: 400;
}

.response-section input[type="text"],
.response-section textarea {
    width: 100%;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    outline: none;
    background: rgba(255,255,255,0.035);
    color: var(--text);
    font: inherit;
}

.response-section input[type="text"] {
    height: 40px;
    padding: 0 11px;
}

.response-section textarea {
    min-height: 76px;
    padding: 10px 11px;
    resize: vertical;
    line-height: 1.4;
}

.response-section input[type="text"]:focus,
.response-section textarea:focus {
    border-color: rgba(91,183,255,0.55);
    box-shadow: 0 0 0 2px rgba(91,183,255,0.07);
}

.field-hint {
    margin-top: 6px;
    color: #66788d;
    font-size: 8px;
    line-height: 1.4;
}

.response-stance-control {
    padding: 10px;
    border-radius: 9px;
    background: rgba(255,255,255,0.025);
}

.response-stance-control input[type="range"] {
    width: 100%;
    margin: 10px 0 2px;
    accent-color: #85bfff;
}

.video-choose-button {
    padding: 10px 14px;
    border: 1px solid rgba(91,183,255,0.38);
    border-radius: 8px;
    background: rgba(91,183,255,0.09);
    color: #cceaff;
    cursor: pointer;
}

.video-choose-button:hover {
    background: rgba(91,183,255,0.15);
}

.video-choose-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.response-video-file {
    margin-top: 8px;
    overflow: hidden;
    color: #7f91a5;
    font-size: 9px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.upload-progress {
    margin-top: 12px;
}

.upload-progress.hidden {
    display: none;
}

.upload-progress-track {
    height: 7px;
    overflow: hidden;
    border-radius: 99px;
    background: rgba(255,255,255,0.07);
}

#response-upload-progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(
        90deg,
        #4e9dde,
        #73d4a1
    );
    transition: width 120ms linear;
}

#response-upload-progress-text {
    display: block;
    margin-top: 6px;
    color: #8295a9;
    font-size: 9px;
}

.processing-status {
    min-height: 15px;
    margin-top: 9px;
    color: #8fa6bd;
    font-size: 9px;
}

.processing-status.ready {
    color: #75d39b;
}

.processing-status.error {
    color: #ff957d;
}

.response-form-status {
    min-height: 16px;
    margin-top: 10px;
    color: #ff957d;
    font-size: 9px;
}

.response-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.response-modal-actions button {
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    color: #c4d1df;
    cursor: pointer;
}

.response-modal-actions button:hover:not(:disabled) {
    background: rgba(255,255,255,0.09);
}

.response-modal-actions .primary {
    border-color: rgba(75,166,238,0.5);
    background: rgba(64,155,224,0.15);
    color: #bfe6ff;
}

.response-modal-actions .primary:hover:not(:disabled) {
    background: rgba(64,155,224,0.24);
}

.response-modal-actions button:disabled {
    opacity: 0.32;
    cursor: not-allowed;
}

@media (max-width: 620px) {
    .modal-overlay {
        padding: 10px;
    }

    .response-modal {
        max-height: calc(100vh - 20px);
        padding: 17px;
    }
}
/* ==========================================================
   Mobile layout - Phase 1
   Restore scrolling and argument detail access
   ========================================================== */

@media (max-width: 900px) {

    html,
    body {
        height: auto;
        min-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
    }

    #app {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: auto;
        min-height: 0;
    }

    #graph-panel {
        flex: 0 0 auto;
        width: 100%;
        height: 55vh;
        height: 55dvh;
        min-height: 300px;
    }

    #detail-panel {
        display: block;
        flex: 0 0 auto;
        width: 100%;
        height: auto;
        min-height: 0;
        overflow: visible;
        border-left: none;
        border-top: 1px solid var(--border);
    }

    #scene-container {
        width: 100%;
        height: 100%;
    }
}
/* Mobile graph overlay improvements */
@media (max-width: 900px) {

    #visual-controls {
        top: auto;
        right: 10px;
        bottom: 10px;
        width: auto;
        min-width: 125px;
        max-width: calc(100% - 20px);
        padding: 0;
    }

    #visual-controls summary {
        display: block;
        padding: 12px 14px;
        margin: 0;
        color: #d8e8f8;
        font-size: 11px;
        cursor: pointer;
        list-style: none;
        touch-action: manipulation;
    }

    #visual-controls summary::-webkit-details-marker {
        display: none;
    }

    #visual-controls summary::after {
        content: " ▾";
        color: var(--accent);
    }

    #visual-controls[open] summary::after {
        content: " ▴";
    }

    #visual-controls .visual-controls-content {
        padding: 0 12px 10px;
    }

    #visual-controls .toggle-row {
        min-height: 36px;
        font-size: 12px;
    }

    #help {
        display: none;
    }

    #breadcrumb-panel {
        left: 10px;
        right: 10px;
        top: 10px;
        padding: 8px 10px;
    }
}
/* Mobile Reset View button */
@media (max-width: 900px) {
    #help {
        display: block;
        position: absolute;
        left: 10px;
        bottom: 10px;
        top: auto;
        width: auto;
        padding: 0;
        border: none;
        background: transparent;
        backdrop-filter: none;
    }

    #help > strong,
    #help > span {
        display: none;
    }

    #reset-view {
        display: block;
        margin: 0;
        min-height: 44px;
        padding: 10px 14px;
        border: 1px solid rgba(255,255,255,0.2);
        border-radius: 9px;
        background: rgba(10,15,23,0.88);
        color: #edf4ff;
        font-size: 12px;
        cursor: pointer;
        touch-action: manipulation;
    }
}
/* Keep argument hover cards within narrow graph panels. */
#hover-card {
    max-width: calc(100% - 16px);
    overflow-wrap: anywhere;
}

/* 2D Argument Explorer */
#app { position: relative; }
#argument-explorer {
    position: absolute;
    z-index: 12;
    left: 14px;
    top: 96px;
    width: min(360px, calc(100% - 430px));
    max-height: calc(100% - 115px);
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: rgba(10,15,23,.94);
    box-shadow: 0 10px 32px rgba(0,0,0,.25);
}
#argument-explorer > summary {
    padding: 12px 14px;
    cursor: pointer;
    color: #dceaff;
    font-weight: bold;
    font-size: 13px;
}
#explorer-count { color: var(--muted); font-weight: normal; }
#argument-explorer-tree { padding: 4px 7px 12px; overflow-x: auto; }
.explorer-children { margin-left: 17px; border-left: 1px solid rgba(255,255,255,.12); padding-left: 5px; }
.explorer-children[hidden] { display: none; }
.explorer-row { display: flex; align-items: flex-start; border-radius: 6px; }
.explorer-row.selected { background: rgba(91,183,255,.16); }
.explorer-toggle, .explorer-toggle-spacer { flex: 0 0 24px; width: 24px; }
.explorer-toggle { background: transparent; border: 0; color: #c5d4e5; cursor: pointer; min-height: 34px; }
.explorer-title { display: flex; align-items: flex-start; gap: 7px; min-width: 0; flex: 1; text-align: left; padding: 8px 4px; border: 0; border-radius: 5px; background: transparent; color: #dce5ef; cursor: pointer; font-size: 12px; line-height: 1.35; }
.explorer-title:hover { background: rgba(255,255,255,.07); }
.explorer-title-text { flex: 1; overflow-wrap: anywhere; }
.explorer-stance { width: 8px; height: 8px; flex: 0 0 8px; margin-top: 4px; border-radius: 50%; }
.explorer-stance.root { background: #58c878; }
.explorer-stance.agree { background: #45a9ff; }
.explorer-stance.disagree { background: #ff805f; }
.explorer-stance.neutral { background: #d7dde5; }
.explorer-watched { color: #79d4a1; display: none; }
.explorer-row.watched .explorer-watched { display: inline; }
@media (max-width: 900px) {
    #argument-explorer {
        position: static;
        width: 100%;
        max-height: none;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        box-shadow: none;
    }
    #argument-explorer[open] #argument-explorer-tree { max-height: 48dvh; overflow-y: auto; }
    .explorer-title { font-size: 14px; min-height: 44px; }
    .explorer-toggle { min-height: 44px; }
}

/* Mobile Argument Explorer — normal document flow */
@media (max-width: 900px) {

    #app {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 0;
    }

    #argument-explorer {
        position: static;
        display: block;
        flex: 0 0 auto;
        order: 0;

        width: 100%;
        height: auto;
        max-height: none;
        min-height: 0;

        margin: 0;
        overflow: visible;
        z-index: auto;

        border-radius: 0;
        box-shadow: none;
    }

    #graph-panel {
        flex: 0 0 auto;
        order: -1;
    }

    #detail-panel {
        position: relative;
        flex: 0 0 auto;
        order: 1;
        z-index: auto;
    }

    #argument-explorer[open] #argument-explorer-tree {
        display: block;
        max-height: 48dvh;
        overflow-y: auto;
        overflow-x: auto;
    }
}

/* Mobile: authentication belongs in normal page flow, not fixed over content. */
@media (max-width: 900px) {
    #auth-bar {
        position: relative;
        top: auto;
        right: auto;
        left: auto;
        bottom: auto;
        width: 100%;
        z-index: auto;
        border-radius: 0;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
}
