/* =======================================
   한국어 Vault — matches the academic site
   (white / Penn State blue / gold accents)
======================================= */
:root {
    --psu-blue: #1e407c;
    --psu-navy: #001E44;
    --gold: #ffd100;
    --bg: #ffffff;
    --text: #1f2430;
    --muted: #5a6272;
    --border: #d8dde8;
    --card: #f6f8fb;
    --node-topic: #1e407c;
    --node-vocab: #6b93d6;
    --node-grammar: #d9a900;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Roboto', sans-serif;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    font-size: clamp(0.68rem, 1.8vh, 1rem);
}

@supports (height: 100dvh) {
    body {
        height: 100dvh;
    }
}

/* =======================================
   Top bar
======================================= */
.topbar {
    display: flex;
    align-items: center;
    gap: clamp(10px, 2vw, 20px);
    padding: clamp(8px, 1.4vh, 16px) clamp(14px, 2vw, 24px);
    border-bottom: 3px solid var(--psu-blue);
    flex-shrink: 0;
}

.back-btn {
    background-color: var(--psu-blue);
    color: white;
    text-decoration: none;
    padding: 0.45em 1em;
    font-family: 'Roboto Condensed', sans-serif;
    font-size: clamp(0.66rem, 1.6vh, 0.95rem);
    white-space: nowrap;
    flex-shrink: 0;
}

.back-btn:hover {
    background-color: var(--psu-navy);
    color: var(--gold);
}

.topbar h1 {
    font-family: 'Noto Sans KR', 'Roboto Condensed', sans-serif;
    font-weight: 700;
    font-size: clamp(1rem, 2.8vh, 1.5rem);
    margin: 0;
    color: var(--psu-blue);
}

.topbar .subtitle {
    color: var(--muted);
    font-size: clamp(0.62rem, 1.6vh, 0.9rem);
    margin: 0;
}

/* =======================================
   Main column
======================================= */
.main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: clamp(8px, 1.4vh, 16px) clamp(14px, 2vw, 24px) clamp(22px, 3.5vh, 40px);
    gap: clamp(6px, 1.2vh, 12px);
}

.placeholder-notice {
    border: 1px dashed var(--psu-blue);
    background-color: var(--card);
    color: var(--muted);
    padding: 0.5em 0.9em;
    font-size: clamp(0.6rem, 1.55vh, 0.85rem);
    flex-shrink: 0;
}

.placeholder-notice strong {
    color: var(--psu-blue);
}

/* =======================================
   Graph card fills remaining height
======================================= */
.graph-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    background-color: var(--bg);
}

.graph-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4em 0.9em;
    border-bottom: 1px solid var(--border);
    font-family: 'Roboto Condensed', sans-serif;
    font-size: clamp(0.6rem, 1.5vh, 0.85rem);
    color: var(--muted);
    flex-shrink: 0;
}

#graph-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
    cursor: grab;
    touch-action: none;
}

#graph-wrap:active {
    cursor: grabbing;
}

#graph-svg {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

.graph-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    font-family: 'Roboto Condensed', sans-serif;
    font-size: clamp(0.58rem, 1.4vh, 0.8rem);
    min-height: 0;
    flex-shrink: 0;
}

.graph-filters:empty {
    display: none;
}

.tag-chip {
    background: none;
    border: 1px solid var(--psu-blue);
    color: var(--psu-blue);
    padding: 2px 8px;
    border-radius: 12px;
    cursor: pointer;
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.55rem, 1.3vh, 0.75rem);
    transition: background 0.15s, color 0.15s;
}

.tag-chip:hover {
    background: rgba(30,64,124,0.1);
}

.tag-chip.active {
    background: var(--psu-blue);
    color: white;
}
    position: absolute;
    pointer-events: none;
    background: var(--psu-navy);
    color: white;
    font-family: 'Roboto', sans-serif;
    font-size: clamp(0.62rem, 1.5vh, 0.82rem);
    padding: 5px 10px;
    border-radius: 4px;
    transform: translate(-50%, -130%);
    opacity: 0;
    transition: opacity 0.12s ease;
    white-space: nowrap;
    z-index: 5;
}

.graph-tooltip .kr {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 700;
    color: var(--gold);
    margin-right: 6px;
}

.chip-label {
    opacity: 0.6;
    font-size: 0.85em;
    margin-right: 4px;
}

.chip-sep {
    color: var(--border);
    margin: 0 4px;
}

.zoom-btns {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 4;
}

.zoom-btns button {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.92);
    color: var(--psu-blue);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
}

.zoom-btns button:hover {
    background: var(--psu-blue);
    color: white;
}

.dot-topic { background: var(--node-topic); }
.dot-vocab { background: var(--node-vocab); }
.dot-grammar { background: var(--node-grammar); }

/* =======================================
   Small screens
======================================= */
@media screen and (max-width: 640px) {
    .topbar {
        flex-wrap: wrap;
    }

    .topbar .subtitle {
        display: none;
    }
}

.placeholder-notice code {
    font-family: 'Roboto Condensed', monospace;
    background-color: #eceff5;
    padding: 0 0.3em;
    color: var(--psu-navy);
}

.graph-gear {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 5;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.92);
    color: var(--psu-blue);
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
}

.graph-gear:hover {
    background: var(--psu-blue);
    color: white;
}







/* ── Obsidian-style settings panel ── */
.graph-settings {
    position: absolute;
    top: 48px;
    right: 12px;
    z-index: 6;
    width: 250px;
    max-height: calc(100% - 60px);
    overflow-y: auto;
    background: rgba(255,255,255,0.98);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 0 12px 0;
    font-family: 'Roboto', sans-serif;
    font-size: 0.8rem;
    color: var(--text);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.gs-head {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    padding: 0 10px 4px 10px;
}

.gs-icon {
    border: none;
    background: none;
    color: var(--muted);
    font-size: 15px;
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    line-height: 1;
}

.gs-icon:hover { background: #eef1f7; color: var(--psu-blue); }

.gs-sec { border-top: 1px solid #eef0f5; }

.gs-sec-head {
    font-weight: 500;
    padding: 9px 14px;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.gs-sec-head::before {
    content: "▾";
    font-size: 0.7em;
    margin-right: 7px;
    color: var(--muted);
    display: inline-block;
}

.gs-sec.collapsed .gs-sec-head::before { content: "▸"; }
.gs-sec.collapsed .gs-sec-body { display: none; }

.gs-sec-body { padding: 0 14px 10px 14px; }

.gs-search input {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 9px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.78rem;
    font-family: 'Roboto', sans-serif;
    margin-bottom: 8px;
}

.gs-search input:focus { outline: 2px solid rgba(30,64,124,0.3); }

.gs-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    color: var(--text);
    cursor: pointer;
}

/* Obsidian-style toggle switch */
.gs-switch { position: relative; display: inline-block; width: 34px; height: 19px; }
.gs-switch input { opacity: 0; width: 0; height: 0; }
.gs-switch i {
    position: absolute; inset: 0;
    background: #cdd3de;
    border-radius: 10px;
    transition: background 0.15s;
}
.gs-switch i::after {
    content: "";
    position: absolute;
    width: 15px; height: 15px;
    left: 2px; top: 2px;
    background: white;
    border-radius: 50%;
    transition: transform 0.15s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.gs-switch input:checked + i { background: #2f6fed; }
.gs-switch input:checked + i::after { transform: translateX(15px); }

.gs-row {
    display: block;
    padding: 5px 0 2px 0;
    color: var(--text);
}

.gs-row input[type="range"] {
    width: 100%;
    display: block;
    margin-top: 3px;
    accent-color: #2f6fed;
}

.gs-btn {
    width: 100%;
    padding: 7px 0;
    margin-top: 6px;
    background: #2f6fed;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
}

.gs-btn:hover { background: #1e5bd4; }

.gs-group {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 5px 0;
}

.gs-group input[type="color"] {
    width: 26px; height: 24px;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px;
    cursor: pointer;
    flex-shrink: 0;
}

.gs-group input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: 4px 7px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 0.74rem;
}

.edge-dot {
    display: inline-block;
    width: 14px;
    height: 4px;
    border-radius: 2px;
    margin-right: 7px;
    vertical-align: middle;
}
