/* ============================= */
/* HEADER ROOT */
/* ============================= */
:root {
    --header-bg: #0B0E14;
    --header-accent: #5856D6;
    --header-border: #1e293b;
    --header-muted: #4b5563;
    --header-text: #e5e7eb;
}

/* ============================= */
/* HEADER CONTAINER */
/* ============================= */
.global-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);

    z-index: 9999;

    font-family: 'Inter', sans-serif;
}

/* ============================= */
/* BRANDING                                                               */
/* Positioned independently in the left gutter (fixed 24px from the      */
/* viewport edge) so it never pushes .gh-inner's content — that's what   */
/* keeps the Patient box's left edge locked to the page content's left    */
/* edge regardless of how wide "AtaxiaV 2.0 / CeMoQu V. 0.2" is.          */
/* ============================= */
.gh-brand {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);

    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
}

.gh-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}

.gh-title:hover {
    color: var(--header-accent);
}

.gh-subtitle {
    font-size: 13px;
    color: #60a5fa;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 0.5px;
    text-shadow: 0 0 6px rgba(96,165,250,0.4);
    white-space: nowrap;
}

/* ============================= */
/* INNER WRAPPER                                                          */
/* Mirrors the page content's .cq-shell (max-width:1080px, margin:0 auto, */
/* 24px side padding) so the header's Patient box lines up with the       */
/* cards below it at every viewport width, not just pinned to the left    */
/* edge of the screen.                                                    */
/* ============================= */
.gh-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 14px 24px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ============================= */
/* DATA PANEL                                                             */
/* Width is pinned to 3 of the 4 card columns below (75% of the shared    */
/* content column, minus half a card-grid gap) so its right edge lines    */
/* up with the "Line Drawing Test" card, the 3rd of 4 cards.              */
/* ============================= */
.gh-data-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;

    flex: 0 0 auto;
    width: calc(75% - 3.5px);
    min-width: 0; /* allow this flex item to actually shrink below content width */
}

/* ============================= */
/* DATA BAR (핵심 안정 구조) */
/* ============================= */
.data-bar {
    display: flex;
    align-items: center;
    gap: 10px;

    height: 34px;
    padding: 0 12px;
    min-width: 0;

    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 6px;

    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;

    overflow: hidden; /* 🔥 튐 방지 */
}

/* ============================= */
/* LABEL */
/* ============================= */
.data-bar label {
    color: #60a5fa;
    text-shadow: 0 0 6px rgba(96,165,250,0.4);

    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;

    flex-shrink: 0;
}

/* ============================= */
/* INPUT */
/* ============================= */
.gh-input {
    background: transparent;
    border: none;

    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;

    height: 34px;
    outline: none;

    min-width: 0; /* 🔥 중요 */
}

/* placeholder */
.gh-input::placeholder {
    color: #475569;
}

/* focus */
.gh-input:focus {
    color: #e5e7eb;
    border-bottom: 1px solid #3b82f6;
    box-shadow: 0 2px 6px rgba(59,130,246,0.4);
}

/* ============================= */
/* INPUT SIZING (핵심) */
/* ============================= */

/* 비율 기반: flex-basis를 목표 크기로 쓰고, min-width로 최소 가독폭만 보장.
   화면이 좁아지면 전부 같이 비례해서 줄어듦 (한쪽만 잘리지 않음). */
.inp-id   { flex: 1 1 70px;  min-width: 40px; }
.inp-age  { flex: 1 1 55px;  min-width: 32px; text-align: center; }
.inp-sex  { flex: 1 1 60px;  min-width: 32px; text-align: center; }
.inp-dob  { flex: 1 1 85px;  min-width: 48px; }

/* 유연하지만 제한 */
.inp-name {
    flex: 2 1 90px;
    min-width: 48px;
    max-width: 180px; /* 🔥 폭주 방지 */
}

.inp-op {
    flex: 2 1 90px;
    min-width: 48px;
    max-width: 180px;
}

.inp-sess { flex: 1 1 70px; min-width: 40px; }
.inp-date { flex: 1 1 95px; min-width: 58px; }

/* ============================= */
/* DIVIDER */
/* ============================= */
.divider {
    color: #334155;
    font-weight: 300;
    flex-shrink: 0;
}

/* ============================= */
/* NAV */
/* ============================= */
.gh-nav {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1.2vw, 15px);
    margin-left: clamp(10px, 2vw, 24px);
    flex-shrink: 0;
}

.nav-btn {
    text-decoration: none;
    color: #64748b;
    font-size: clamp(11px, 1vw, 13px);
    font-weight: 600;
    white-space: nowrap;
    transition: 0.2s;
}

.nav-btn:hover,
.nav-btn.active {
    color: #fff;
}

.nav-btn.active {
    background: var(--header-accent);
    padding: 5px 12px;
    border-radius: 4px;
}

/* ============================= */
/* NARROW VIEWPORT FALLBACK       */
/* Proportional shrinking above has a floor (min-widths for               */
/* readability). Below that, wrap onto multiple lines instead of          */
/* clipping. Header height becomes auto here — header.js measures the     */
/* real rendered height and updates --header-offset so body content       */
/* never overlaps it, at any width.                                       */
/* ============================= */
@media (max-width: 1300px) {
    .global-header {
        display: flex;
        flex-direction: column;
    }
    .gh-brand {
        position: static;
        transform: none;
        flex-direction: row;
        align-items: baseline;
        justify-content: flex-start;
        gap: 10px;
        padding: 10px 24px 0;
    }
    .gh-inner {
        flex-wrap: wrap;
        padding: 10px 24px;
        justify-content: flex-start;
        row-gap: 8px;
    }
    .gh-data-panel {
        flex-basis: 100%;
        width: 100%;
    }
    .gh-nav {
        flex-basis: 100%;
        margin-left: 0;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 460px) {
    .data-bar {
        flex-wrap: wrap;
        height: auto;
        padding: 6px 10px;
        row-gap: 4px;
    }
    .inp-id, .inp-age, .inp-sex, .inp-dob, .inp-name, .inp-op, .inp-sess, .inp-date {
        flex: 1 1 70px;
    }
}
