/* Progress Knight of Shirania — Dark theme, branch-focused */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #1a1a2e;
    color: #e0e0e0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* === LAYOUT === */

#app {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    grid-template-rows: auto 1fr;
    gap: 12px;
    padding: 12px;
    height: 100vh;
    max-height: 100vh;
}

#header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #16213e;
    border-radius: 8px;
}

#header h1 {
    font-size: 20px;
    font-weight: 600;
    color: #e94560;
    letter-spacing: 1px;
}

#header .stats {
    display: flex;
    gap: 24px;
    font-size: 13px;
}

#header .stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

#header .stat-label {
    color: #888;
}

#header .stat-value {
    color: #fff;
    font-weight: 600;
}

/* === SIDEBAR (Left) === */

#sidebar {
    background: #16213e;
    border-radius: 8px;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    z-index: 101;
}

.sidebar-section {
    border-bottom: 1px solid #2a2a4a;
    padding-bottom: 12px;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-section h3 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #9aa;
    margin-bottom: 8px;
}

.sidebar-section .value {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
}

.sidebar-section .sub {
    font-size: 12px;
    color: #778;
}

/* Current task display */
.current-task {
    background: #1a1a3e;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
}

.current-task .task-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.current-task .task-name {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin: 2px 0;
}

.progress-bar {
    height: 6px;
    background: #2a2a4a;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.1s linear;
}

/* Active node bar pulses */
.node-row.active .progress-fill {
    animation: barPulse 2s ease-in-out infinite;
}

@keyframes barPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* === MAIN CONTENT (Center) === */

#main {
    background: #16213e;
    border-radius: 8px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Tab bar */
.tab-bar {
    display: flex;
    border-bottom: 1px solid #2a2a4a;
    padding: 0 8px;
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #2a2a4a transparent;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #ccc;
}

.tab-btn.active {
    color: #e94560;
    border-bottom-color: #e94560;
}

/* Tab content */
.tab-content {
    display: none;
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

.tab-content.active {
    display: block;
}

/* Branch category */
.branch-category {
    margin-bottom: 24px;
}

.branch-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #2a2a4a;
}

.branch-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.branch-name {
    font-size: 16px;
    font-weight: 600;
}

.branch-desc {
    font-size: 12px;
    color: #888;
    font-style: italic;
}

/* Node row */
.node-row {
    display: grid;
    grid-template-columns: 200px 60px 90px 80px 80px;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.node-row:hover {
    background: #1a1a3e;
}

.node-row.active {
    background: #1a1a3e;
    border-left: 3px solid #e94560;
}

.node-row.locked {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}
.node-row.locked .node-name {
    color: #666;
}

.node-name-cell {
    display: flex;
    flex-direction: column;
}

.node-name {
    font-weight: 500;
    font-size: 14px;
}

.node-progress {
    margin-top: 3px;
}

.node-level {
    font-size: 13px;
    color: #aaa;
}

.node-income {
    font-size: 13px;
    color: #55a630;
}

.node-xp-gain {
    font-size: 12px;
    color: #888;
}

.node-xp-left {
    font-size: 12px;
    color: #888;
}

/* Requirements row */
.req-row {
    padding: 4px 8px 4px 24px;
    font-size: 12px;
    color: #e94560;
    font-style: italic;
}

/* === LORE PANEL (Right) === */

#lore-panel {
    background: #16213e;
    border-radius: 8px;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#lore-panel h2 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #e94560;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.lore-entry {
    background: #1a1a2e;
    border-radius: 6px;
    padding: 14px;
    margin-bottom: 12px;
    border-left: 3px solid #2a2a4a;
    animation: loreAppear 0.5s ease-out;
}

.lore-entry.synapse {
    border-left-color: #e94560;
    background: #1e1a2e;
}

.lore-entry.decision {
    border-left-color: #e9c46a;
    background: #1e1e2a;
}

.lore-entry.age-event {
    border-left-color: #f4a261;
    background: #1e1a28;
}

.lore-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 6px;
}

.lore-source {
    font-size: 11px;
    color: #666;
    margin-bottom: 8px;
}

.lore-text {
    font-size: 13px;
    color: #bbb;
    line-height: 1.6;
}

@keyframes loreAppear {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === DECISION MODAL === */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #16213e;
    border-radius: 12px;
    padding: 32px;
    max-width: 600px;
    width: 90%;
    border: 1px solid #2a2a4a;
}

.modal h2 {
    font-size: 18px;
    color: #e94560;
    margin-bottom: 16px;
}

.modal .prompt {
    font-size: 14px;
    color: #bbb;
    line-height: 1.6;
    margin-bottom: 24px;
}

.decision-option {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.decision-option:hover {
    border-color: #e94560;
    background: #1e1a3e;
}

.decision-option .option-label {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.decision-option .option-desc {
    font-size: 13px;
    color: #888;
}

/* === SYNAPSE NOTIFICATION === */

.synapse-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #1a1a2e, #2a1a3e);
    border: 1px solid #e94560;
    border-radius: 12px;
    padding: 20px 32px;
    z-index: 200;
    text-align: center;
    animation: synapseAppear 0.5s ease-out;
    max-width: 500px;
}

.synapse-notification h3 {
    color: #e94560;
    font-size: 16px;
    margin-bottom: 4px;
}

.synapse-notification p {
    color: #bbb;
    font-size: 13px;
}

@keyframes synapseAppear {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* === REBIRTH TAB === */

.rebirth-section {
    text-align: center;
    padding: 32px;
}

.rebirth-section h2 {
    font-size: 24px;
    color: #e94560;
    margin-bottom: 16px;
}

.rebirth-section p {
    color: #bbb;
    line-height: 1.6;
    margin-bottom: 16px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.rebirth-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin: 24px 0;
}

.rebirth-stat {
    text-align: center;
}

.rebirth-stat .label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
}

.rebirth-stat .value {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}

.btn {
    padding: 10px 24px;
    border: 1px solid #e94560;
    background: none;
    color: #e94560;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn:hover {
    background: #e94560;
    color: #fff;
}

.btn-danger {
    border-color: #ff4444;
    color: #ff4444;
}

.btn-danger:hover {
    background: #ff4444;
    color: #fff;
}

/* === LORE LOG TAB === */

.lore-log-entry {
    padding: 12px;
    border-bottom: 1px solid #2a2a4a;
}

.lore-log-entry:last-child {
    border-bottom: none;
}

/* === SPEED CONTROLS === */

.speed-controls {
    display: flex;
    gap: 4px;
}

.speed-btn {
    padding: 4px 10px;
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    color: #888;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}

.speed-btn:hover {
    border-color: #888;
    color: #ccc;
}

.speed-btn.active {
    border-color: #e94560;
    color: #e94560;
}

/* === SCROLLBAR === */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #2a2a4a;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a3a5a;
}

/* === PAUSE INDICATOR === */

.pause-indicator {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid #e94560;
    border-radius: 12px;
    padding: 24px 48px;
    z-index: 150;
    text-align: center;
    pointer-events: none;
    animation: pauseFade 0.3s ease-out;
}

.pause-indicator.active {
    display: block;
}

.pause-indicator h2 {
    color: #e94560;
    font-size: 24px;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.pause-indicator p {
    color: #888;
    font-size: 13px;
    margin-top: 6px;
}

@keyframes pauseFade {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* === TOOLTIP === */

.tooltip-wrap {
    position: relative;
}

.tooltip-wrap .tip {
    display: none;
    position: absolute;
    left: 105%;
    top: -5px;
    background: #0a0a1e;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    padding: 10px;
    width: 250px;
    z-index: 50;
    font-size: 12px;
    color: #bbb;
    line-height: 1.5;
}

.tooltip-wrap:hover .tip {
    display: block;
}

/* === SHOP === */

.shop-item {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
    transition: all 0.15s;
}

.shop-clickable {
    cursor: pointer;
}

.shop-item:hover {
    border-color: #3a3a5a;
}

.shop-active {
    border-color: #219ebc !important;
    background: #1a2030;
}

.shop-placed {
    border-color: #b56576 !important;
    background: #1e1a2a;
}

.shop-locked {
    opacity: 0.4;
}

.shop-targeted {
    border-color: #f4a261 !important;
    border-left-color: #f4a261 !important;
    background: #1e1a14;
    opacity: 1 !important;
}

.queue-btn {
    color: #666;
    border-color: #444;
}

.queue-btn.queue-active {
    color: #f4a261;
    border-color: #f4a261;
}

.shop-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.shop-item-name {
    font-weight: 600;
    font-size: 14px;
    color: #fff;
}

.shop-item-slots {
    font-size: 12px;
    color: #888;
    background: #2a2a4a;
    padding: 2px 8px;
    border-radius: 10px;
}

.shop-item-desc {
    font-size: 12px;
    color: #999;
    margin-bottom: 6px;
}

.shop-item-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    margin-bottom: 6px;
}

.shop-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.shop-item-actions .btn {
    font-size: 12px;
    padding: 4px 12px;
}

.shop-item-actions .btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.shop-item-actions .btn:disabled:hover {
    background: none;
    color: #e94560;
}

/* === FURNISHING ACCORDIONS === */

.furnish-accordion {
    margin-bottom: 4px;
}

.furnish-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid transparent;
    border-radius: 6px;
    transition: background 0.15s;
    user-select: none;
}

.furnish-accordion-header:hover {
    background: #1e1e3a;
}

.furnish-accordion-title {
    font-size: 15px;
    font-weight: 600;
}

.furnish-accordion-info {
    font-size: 12px;
    color: #888;
    display: flex;
    gap: 12px;
    align-items: center;
}

.furnish-accordion-arrow {
    font-size: 10px;
    color: #666;
    transition: transform 0.2s;
}

.furnish-accordion.open .furnish-accordion-arrow {
    transform: rotate(90deg);
}

.furnish-accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.furnish-accordion.open .furnish-accordion-body {
    max-height: 2000px;
}

/* === VISUAL SKILL TREE === */

.tree-scroll {
    overflow: auto;
    padding: 8px;
    min-height: 300px;
}

#tree-svg text {
    pointer-events: none;
    user-select: none;
}

#tree-svg g:hover rect:first-child {
    filter: brightness(1.3);
}

.synapse-curve {
    filter: drop-shadow(0 0 4px #e9456088);
}

/* === MAX LEVEL INDICATOR === */

.node-max {
    color: #e9c46a !important;
    font-weight: bold;
    text-shadow: 0 0 6px rgba(233, 196, 106, 0.3);
}

/* === ACHIEVEMENT NOTIFICATION === */

.achievement-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #1a2e1a, #1a2e2a);
    border: 1px solid #55a630;
    border-radius: 12px;
    padding: 20px 32px;
    z-index: 200;
    text-align: center;
    animation: achievementAppear 0.5s ease-out;
    max-width: 500px;
}

.achievement-notification.hidden-achievement {
    border-color: #e9c46a;
    background: linear-gradient(135deg, #2e2a1a, #2e1e1a);
}

.achievement-notification h3 {
    color: #55a630;
    font-size: 16px;
    margin-bottom: 4px;
}

.achievement-notification.hidden-achievement h3 {
    color: #e9c46a;
}

.achievement-notification p {
    color: #bbb;
    font-size: 13px;
}

@keyframes achievementAppear {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* === ACHIEVEMENT TAB === */

.achievement-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.achievement-card {
    background: #1a1a2e;
    border-radius: 6px;
    padding: 12px 14px;
}

/* === LORE ENTRY: ACHIEVEMENT TYPE === */

.lore-entry.achievement {
    border-left-color: #55a630;
    background: #1a2e1a;
}

/* === CONTENT CELEBRATION MODAL === */

#content-celebration-overlay .modal {
    border-color: #c77dff;
    box-shadow: 0 0 40px rgba(199, 125, 255, 0.15);
}

#content-celebration-overlay a:hover {
    opacity: 0.8;
    transition: opacity 0.15s;
}
