/* KoG Demo Analyzer -- web version, matching the desktop GUI's palette
   (see gui/app.py: _KOG_ORANGE / _CARD_COLOR / _CARD_BORDER). */
:root {
    --kog-orange: #ff5a1f;
    --kog-orange-hover: #e04a15;
    --card-color: #1b2333;
    --card-border: #3a2a1a;
    --bg-dark: #0d1220;
    --text-main: #e8e8e8;
    --text-dim: #999999;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Helvetica, Arial, sans-serif;
    color: var(--text-main);
    background: var(--bg-dark) url("kog_bg.png") center / cover no-repeat fixed;
    min-height: 100vh;
}

.overlay {
    min-height: 100vh;
    background: rgba(13, 18, 32, 0.72);
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--card-color);
    border-bottom: 1px solid var(--card-border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar h1 {
    font-size: 18px;
    margin: 0;
    color: var(--kog-orange);
}

a { color: var(--kog-orange); }

.card {
    background: var(--card-color);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 16px;
}

.btn {
    background: var(--kog-orange);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
}
.btn:hover { background: var(--kog-orange-hover); }
.btn:disabled { background: #555; cursor: not-allowed; }
.btn.secondary { background: #3a3a3a; }
.btn.secondary:hover { background: #4a4a4a; }

input[type=password], input[type=text] {
    background: #10162a;
    border: 1px solid var(--card-border);
    color: var(--text-main);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 14px;
}

.center-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    width: 320px;
    text-align: center;
}
.login-box h2 { color: var(--kog-orange); }
.login-box .error { color: #ff6b6b; font-size: 13px; margin-top: 8px; }

.upload-box {
    width: 420px;
    text-align: center;
}
.dropzone {
    border: 2px dashed var(--card-border);
    border-radius: 10px;
    padding: 30px;
    margin: 14px 0;
    cursor: pointer;
}
.dropzone.drag { border-color: var(--kog-orange); }

.layout {
    flex: 1;
    display: flex;
    gap: 12px;
    padding: 12px;
    min-height: 0;
}

.sidebar {
    width: 240px;
    overflow-y: auto;
    flex-shrink: 0;
}
.sidebar h3 { margin-top: 0; color: var(--kog-orange); font-size: 13px; }
.player-btn {
    display: block;
    width: 100%;
    text-align: left;
    background: var(--kog-orange);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 4px;
    font-size: 13px;
    cursor: pointer;
}
.player-btn:hover { background: var(--kog-orange-hover); }
.player-btn.active { outline: 2px solid white; }

/* .player-btn also appears standalone (e.g. copypasta.html's section-jump
   list) -- these overrides only apply inside the "mark as reviewed"
   checkbox row on the results page, not to .player-btn generally. */
.player-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.player-row .player-btn { flex: 1; min-width: 0; width: auto; margin-bottom: 0; }
.player-review-check { flex-shrink: 0; width: 15px; height: 15px; accent-color: var(--kog-orange); cursor: pointer; }

.main-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.tabs { display: flex; gap: 4px; margin-bottom: 4px; }
.tab-btn {
    background: #2a2a2a;
    color: var(--text-main);
    border: none;
    border-radius: 6px 6px 0 0;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
}
.tab-btn.active { background: var(--kog-orange); }

.tab-content { display: none; }
.tab-content.active { display: block; }

pre.mono {
    font-family: "Consolas", "Courier New", monospace;
    font-size: 12.5px;
    white-space: pre-wrap;
    word-break: break-word;
    background: #10162a;
    border-radius: 8px;
    padding: 12px;
    max-height: 320px;
    overflow-y: auto;
}

.score-bar-track {
    background: #333;
    border-radius: 8px;
    height: 22px;
    overflow: hidden;
    margin: 6px 0;
}
.score-bar-fill {
    height: 100%;
    background: var(--kog-orange);
    transition: width 0.3s ease;
}

.action-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.img-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}
.img-grid img, .img-card img {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    cursor: zoom-in;
}
.img-card { text-align: center; font-size: 12px; color: var(--text-dim); }

/* Click-to-zoom lightbox for any rendered image (trajectory / hook timing /
   compare) -- the compare grid especially renders images too small to read
   the axis labels/annotations at their inline thumbnail size. */
.lightbox-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    flex-direction: column;
}
.lightbox-backdrop.open { display: flex; }
.lightbox-backdrop img {
    max-width: 92vw;
    max-height: 85vh;
    border-radius: 6px;
    cursor: grab;
    transform-origin: center center;
}
.lightbox-backdrop img.grabbing { cursor: grabbing; }
.lightbox-hint {
    color: var(--text-dim);
    font-size: 12px;
    margin-top: 10px;
}
.pan-slider {
    accent-color: var(--kog-orange);
    cursor: pointer;
}
.pan-slider:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
#lightbox-slider {
    width: 60%;
    max-width: 520px;
    margin-top: 12px;
}
.panel-slider {
    position: absolute;
    bottom: 28px;
    left: 10px;
    right: 10px;
    width: auto;
    z-index: 2;
}
.lightbox-close {
    position: absolute;
    top: 18px; right: 24px;
    background: var(--card-color);
    color: white;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 13px;
}

/* Compare Hook Timings: up to 4 charts open large AT ONCE, each
   independently zoomable/pannable (not one-at-a-time through the single
   lightbox above) -- see openCompareLightbox() in app.js. */
.compare-lightbox-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.9);
    display: none;
    z-index: 110;
    padding: 60px 20px 20px;
}
.compare-lightbox-backdrop.open { display: flex; }
.compare-lightbox-grid {
    flex: 1;
    width: 100%;
    display: grid;
    gap: 12px;
}
.compare-panel {
    position: relative;
    overflow: hidden;
    background: #10162a;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
}
.compare-panel img {
    max-width: 100%;
    max-height: 100%;
    cursor: grab;
    transform-origin: center center;
}
.compare-panel img.grabbing { cursor: grabbing; }
.compare-panel .panel-label {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    text-align: center;
    color: #eee;
    font-size: 12.5px;
    background: rgba(0,0,0,0.55);
    padding: 4px 0;
}
.compare-lightbox-hint {
    text-align: center;
    color: var(--text-dim);
    font-size: 12px;
    padding: 6px 0 0;
}

.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
}
.modal-backdrop.open { display: flex; }
.modal {
    width: 90%;
    max-width: 900px;
    height: 80vh;
    display: flex;
    flex-direction: column;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.modal-body { flex: 1; display: flex; gap: 10px; min-height: 0; }
.modal-list { width: 220px; overflow-y: auto; flex-shrink: 0; }
.modal-detail { flex: 1; overflow-y: auto; }

.dim { color: var(--text-dim); font-size: 12.5px; }
.status-line { padding: 6px 16px; font-size: 13px; color: var(--text-dim); }
.checkbox-row { display: flex; align-items: center; gap: 6px; padding: 4px 0; }

.copypasta-section h3 { margin: 0 0 10px; color: var(--kog-orange); font-size: 14px; }
.copypasta-entry { margin-bottom: 14px; }
.copypasta-entry:last-child { margin-bottom: 0; }
.copypasta-entry-title { font-size: 13px; font-weight: bold; color: var(--text-main); margin-bottom: 4px; }
.copypasta-text { max-height: none; white-space: pre-wrap; word-break: break-word; margin: 0 0 6px; }
/* The page body itself scrolls (see base.html/.overlay -- min-height, not a
   bounded height, so .main-panel never gets its own independent scrollbar).
   Sticky keeps the section nav pinned in the viewport as that page scroll
   happens, instead of the sidebar disappearing off-screen along with it.
   align-self is required for sticky to work at all inside a flex row (flex
   items stretch to the row's full height by default, which defeats sticky). */
.copypasta-sidebar-sticky { position: sticky; top: 12px; align-self: flex-start; max-height: calc(100vh - 24px); overflow-y: auto; }

.copypasta-flash { animation: copypasta-flash-anim 1s ease-out; }
@keyframes copypasta-flash-anim {
    0% { background: var(--kog-orange); border-color: var(--kog-orange); }
    100% { background: var(--card-color); border-color: var(--card-border); }
}

.rulebook-rule { font-size: 13px; line-height: 1.5; color: var(--text-main); margin: 0 0 10px; }
.rulebook-rule:last-child { margin-bottom: 0; }
.rulebook-punishment { margin: 0 0 18px; padding-bottom: 16px; border-bottom: 1px solid var(--card-border); }
.rulebook-punishment:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.rulebook-table { border-collapse: collapse; margin-top: 6px; font-size: 12.5px; }
.rulebook-table th, .rulebook-table td { border: 1px solid var(--card-border); padding: 4px 12px; text-align: left; }
.rulebook-table th { color: var(--text-dim); font-weight: normal; }
.rulebook-table td { color: var(--text-main); }

.spinner {
    border: 4px solid #333;
    border-top: 4px solid var(--kog-orange);
    border-radius: 50%;
    width: 40px; height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
