/* Templates-inspired palette */
:root {
    --tgh-blue-dark: rgb(9, 111, 154);
    --tgh-blue-mid: rgb(51, 100, 125);
    --tgh-blue-light: rgb(209, 225, 229);
    --tgh-blue-pale: rgb(232, 241, 244);
    --tgh-bg-outer: rgb(84, 84, 84);
    --tgh-bg-panel: rgb(165, 165, 165);
    --tgh-white: rgb(255, 255, 255);
    --tgh-text: rgb(17, 17, 17);
    --tgh-muted: rgb(102, 102, 102);
    --tgh-border: rgb(180, 200, 208);
    --tgh-accent-active: rgb(176, 212, 227);
    --sidebar-width: 320px;
}

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

html, body {
    height: 100%;
    font-family: "Lucida Grande", Verdana, sans-serif;
    font-size: 12px;
    color: var(--tgh-text);
    background: var(--tgh-bg-outer);
}

a {
    color: var(--tgh-blue-mid);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.adv-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

.adv-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: linear-gradient(180deg, var(--tgh-blue-light), rgb(195, 215, 222));
    border-bottom: 3px solid var(--tgh-blue-dark);
}

.adv-header h1 {
    font-size: 15px;
    font-weight: 700;
    color: var(--tgh-text);
}

.adv-header-meta {
    font-size: 11px;
    color: var(--tgh-blue-mid);
}

.adv-body {
    flex: 1;
    display: flex;
    min-height: 0;
}

.adv-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--tgh-bg-panel);
    border-right: 4px solid var(--tgh-white);
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.adv-box {
    background: inherit;
    border: none;
}

.adv-box h2 {
    background-color: var(--tgh-blue-light);
    color: var(--tgh-text);
    font-size: 13px;
    font-weight: bold;
    padding: 8px 10px;
    border: 1px solid var(--tgh-border);
    border-bottom: none;
}

.adv-box .adv-box-body {
    background: var(--tgh-white);
    padding: 10px;
    border: 1px solid var(--tgh-border);
}

.adv-field-label {
    font-size: 11px;
    font-weight: bold;
    color: var(--tgh-blue-mid);
    margin-bottom: 5px;
}

.adv-field-label + .adv-field-label,
.adv-stack-section {
    margin-top: 10px;
}

.adv-select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--tgh-border);
    border-radius: 3px;
    font-family: inherit;
    font-size: 12px;
}

.adv-select-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.adv-select-row .adv-select {
    flex: 1;
}

.adv-btn {
    padding: 6px 12px;
    cursor: pointer;
    border: 1px solid var(--tgh-border);
    border-radius: 3px;
    background: var(--tgh-blue-pale);
    color: var(--tgh-text);
    font-family: inherit;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
}

.adv-btn:hover:not(:disabled) {
    background: var(--tgh-blue-light);
}

.adv-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.adv-hint {
    font-size: 11px;
    color: var(--tgh-muted);
    margin-top: 5px;
    line-height: 1.35;
}

#route-display {
    font-weight: bold;
    color: var(--tgh-blue-mid);
    min-height: 36px;
    line-height: 1.4;
}

.node-info-placeholder {
    font-size: 12px;
    color: var(--tgh-muted);
    font-style: italic;
    margin-top: 6px;
}

.node-info-badge {
    font-size: 11px;
    color: var(--tgh-blue-mid);
    font-weight: bold;
    margin-bottom: 6px;
}

.adventure-notes-body strong,
.node-info-body strong { font-weight: 700; }

.adventure-notes-body em,
.node-info-body em { font-style: italic; }

.adventure-notes-body u,
.node-info-body u { text-decoration: underline; }

.adventure-notes-body s,
.node-info-body s { text-decoration: line-through; }

.adventure-notes-body {
    font-size: 12px;
    line-height: 1.5;
    padding: 8px;
    background: var(--tgh-blue-pale);
    border: 1px solid var(--tgh-border);
    border-radius: 3px;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 120px;
    overflow-y: auto;
}

.adventure-notes-placeholder {
    font-size: 12px;
    color: var(--tgh-muted);
    font-style: italic;
}

.node-info-body {
    font-size: 12px;
    line-height: 1.5;
    margin-top: 6px;
    padding: 8px;
    background: var(--tgh-blue-pale);
    border: 1px solid var(--tgh-border);
    border-radius: 3px;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 100px;
    overflow-y: auto;
}

.node-info-muted {
    color: var(--tgh-muted);
    font-style: italic;
}

.compass {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    max-width: 150px;
    margin: 0 auto;
}

.dir-btn {
    padding: 8px 4px;
    cursor: pointer;
    border: 1px solid var(--tgh-border);
    background: var(--tgh-blue-pale);
    font-weight: bold;
    font-size: 11px;
    font-family: inherit;
    border-radius: 2px;
}

.dir-btn:hover:not(:disabled) {
    background: var(--tgh-blue-light);
}

.dir-btn:disabled {
    background: rgb(245, 245, 245);
    color: rgb(180, 180, 180);
    cursor: not-allowed;
}

.dir-btn.active-dir {
    background: var(--tgh-accent-active);
    border-color: var(--tgh-blue-mid);
}

.adv-map-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--tgh-white);
    padding: 10px;
}

.adv-map-toolbar {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 10px;
}

.adv-zoom-controls {
    display: flex;
    gap: 5px;
    align-items: center;
}

.adv-zoom-btn,
.adv-zoom-label {
    padding: 5px 10px;
    background: var(--tgh-white);
    border: 1px solid var(--tgh-border);
    border-radius: 3px;
    font-weight: bold;
    font-size: 12px;
}

.adv-zoom-btn {
    cursor: pointer;
    font-family: inherit;
}

.adv-zoom-btn:hover {
    background: var(--tgh-blue-pale);
}

#canvas-container {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--tgh-border);
    background: var(--tgh-blue-pale);
    cursor: grab;
    position: relative;
}

#canvas-wrapper {
    width: 3000px;
    height: 3000px;
    position: relative;
}

#map-canvas {
    position: absolute;
    top: 0;
    left: 0;
    cursor: pointer;
}

@media (max-width: 900px) {
    .adv-body {
        flex-direction: column;
    }

    .adv-sidebar {
        width: 100%;
        max-height: 45vh;
        border-right: none;
        border-bottom: 4px solid var(--tgh-white);
    }

    #canvas-container {
        min-height: 300px;
    }
}
