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

html, body {
    height: 100%;
    background: #000;
    color: #fff;
    font-family: 'Courier New', Courier, monospace;
    font-size: 16px;
    overflow: hidden;
}

#hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 28px;
    background: #000;
    border-bottom: 1px solid #333;
    font-size: 12px;
    color: #666;
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 100;
}

.hud-sep {
    margin: 0 12px;
    color: #444;
}

.hud-dropdown {
    position: relative;
    cursor: pointer;
    user-select: none;
}

.hud-dropdown:hover {
    color: #00ff41;
}

.hud-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 280px;
    background: #0a0a0a;
    border: 1px solid #333;
    padding: 10px 0;
    z-index: 110;
    font-size: 12px;
    line-height: 1.8;
    max-height: 400px;
    overflow-y: auto;
}

.hud-dropdown:hover .hud-dropdown-content {
    display: block;
}

.kt-node {
    padding: 4px 14px;
    color: #00ff41;
    font-weight: bold;
    letter-spacing: 1px;
}

.kt-block {
    padding: 2px 14px 2px 28px;
    color: #888;
    cursor: pointer;
}

.kt-block:hover {
    background: #111;
    color: #ccc;
}

.kt-block.locked {
    color: #444;
    cursor: default;
}

.kt-block.locked:hover {
    background: transparent;
    color: #444;
}

.kt-skill {
    padding: 1px 14px 1px 42px;
    font-size: 11px;
}

.kt-skill.unlocked {
    color: #00ff41;
}

.kt-skill.locked {
    color: #333;
}

#terminal {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    padding-top: 40px;
}

#output {
    flex: 1;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
    scrollbar-width: none;
}

#output::-webkit-scrollbar {
    display: none;
}

#input-line {
    display: flex;
    align-items: center;
    padding-top: 4px;
}

#prompt {
    color: #fff;
    margin-right: 8px;
    user-select: none;
    white-space: nowrap;
}

#input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-family: inherit;
    font-size: inherit;
    caret-color: #fff;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

#cursor {
    display: inline-block;
    width: 10px;
    height: 18px;
    background: #fff;
    animation: blink 1s step-end infinite;
    vertical-align: text-bottom;
}

#input:focus ~ #cursor {
    display: none;
}

/* Line types */
.line-user {
    color: #888;
}

.line-system {
    color: #00ff41;
}

.line-error {
    color: #ff3333;
}

/* Knowledge Panel */
#panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

#panel-overlay.panel-hidden {
    display: none;
}

#panel {
    width: 680px;
    max-width: 95vw;
    max-height: 90vh;
    background: #000;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#panel-progress {
    height: 3px;
    background: #222;
    flex-shrink: 0;
}

#panel-progress .bar {
    height: 100%;
    background: #00ff41;
    transition: width 0.3s ease;
}

#panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 15px;
    color: #ccc;
    line-height: 1.6;
    scrollbar-width: none;
}

#panel-content::-webkit-scrollbar {
    display: none;
}

#panel-content .panel-title {
    color: #00ff41;
    font-size: 14px;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

#panel-content .panel-shell {
    color: #666;
    font-style: italic;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #222;
}

#panel-content .block-label {
    color: #00ff41;
    font-size: 12px;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

#panel-content .block-text {
    color: #ccc;
    margin-bottom: 16px;
}

#panel-content .block-example {
    background: #0a0a0a;
    border-left: 2px solid #333;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 13px;
}

#panel-content .block-example .ex-label {
    color: #666;
    font-size: 11px;
}

#panel-content .block-example .ex-text {
    color: #aaa;
    margin-top: 4px;
}

#panel-content .quiz-question {
    color: #fff;
    margin-bottom: 12px;
    margin-top: 20px;
}

#panel-content .quiz-question:first-child {
    margin-top: 0;
}

#panel-content .quiz-answers {
    list-style: none;
    margin-bottom: 8px;
}

#panel-content .quiz-answers li {
    margin-bottom: 6px;
}

#panel-content .quiz-answers label {
    cursor: pointer;
    color: #999;
    display: block;
    padding: 6px 10px;
    border: 1px solid #222;
    transition: border-color 0.15s;
}

#panel-content .quiz-answers label:hover {
    border-color: #444;
}

#panel-content .quiz-answers input[type="radio"] {
    display: none;
}

#panel-content .quiz-answers input[type="radio"]:checked + span {
    color: #fff;
}

#panel-content .quiz-answers li.selected label {
    border-color: #00ff41;
}

#panel-content .quiz-result {
    margin-top: 20px;
    padding: 14px;
    border: 1px solid #333;
    text-align: center;
}

#panel-content .quiz-result.pass {
    color: #00ff41;
    border-color: #00ff41;
}

#panel-content .quiz-result.fail {
    color: #ff3333;
    border-color: #ff3333;
}

#panel-nav {
    padding: 12px 32px;
    border-top: 1px solid #222;
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
}

#panel-btn {
    background: none;
    border: 1px solid #444;
    color: #ccc;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    padding: 6px 20px;
    cursor: pointer;
    letter-spacing: 1px;
}

#panel-btn:hover {
    border-color: #00ff41;
    color: #00ff41;
}

#panel-btn:disabled {
    opacity: 0.3;
    cursor: default;
    border-color: #333;
    color: #666;
}

/* Tool result step in panel */
.tool-input-label,
.tool-result-label {
    color: #666;
    font-size: 11px;
    letter-spacing: 1px;
    margin-top: 16px;
    margin-bottom: 4px;
}

.tool-input-text {
    color: #fff;
    font-size: 16px;
    padding: 8px 12px;
    background: #0a0a0a;
    border-left: 2px solid #00ff41;
    margin-bottom: 8px;
}

.tool-tokens {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.token-chip {
    display: inline-block;
    background: #0a1a0a;
    border: 1px solid #00ff41;
    color: #00ff41;
    padding: 4px 10px;
    font-size: 14px;
    white-space: pre;
}

.tool-encoding {
    color: #444;
    font-size: 11px;
    margin-top: 8px;
}

/* Auth & Config screens */
#auth-screen,
#config-screen {
    position: fixed;
    inset: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.screen-hidden {
    display: none !important;
}

#auth-box,
#config-box {
    text-align: center;
    max-width: 420px;
    width: 90vw;
}

.auth-title {
    color: #00ff41;
    font-size: 14px;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.auth-separator {
    color: #333;
    margin-bottom: 16px;
    font-size: 12px;
}

.auth-subtitle {
    color: #888;
    font-size: 13px;
    margin-bottom: 24px;
}

.auth-status {
    color: #444;
    font-size: 11px;
    margin-top: 16px;
}

#auth-google-btn,
#config-submit-btn {
    background: transparent;
    border: 1px solid #00ff41;
    color: #00ff41;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    padding: 10px 32px;
    cursor: pointer;
    letter-spacing: 1px;
}

#auth-google-btn:hover,
#config-submit-btn:hover {
    background: #001a00;
}

.config-desc {
    color: #888;
    font-size: 13px;
    margin-bottom: 12px;
}

#config-key-input {
    display: block;
    width: 100%;
    background: #0a0a0a;
    border: 1px solid #333;
    color: #fff;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    padding: 10px 12px;
    margin-bottom: 16px;
    outline: none;
}

#config-key-input:focus {
    border-color: #00ff41;
}

.config-error {
    color: #ff3333;
    font-size: 12px;
    margin-top: 12px;
    min-height: 16px;
}
