/* Rose Pine Moon - Mobile First */
:root {
    --bg: #232136;
    --surface: #2a273f;
    --overlay: #393552;
    --muted: #6e6a86;
    --text: #e0def4;
    --love: #eb6f92;
    --gold: #f6c177;
    --rose: #ea9a97;
    --pine: #31748f;
    --foam: #9ccfd8;
    --iris: #c4a7e7;
    --highlight: #908caa;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Cascadia Code', ui-monospace, monospace;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Mobile-first: base styles for small screens */
#terminal {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 12px;
}

#output {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 80px;
    -webkit-overflow-scrolling: touch;
}

#output div {
    white-space: pre-wrap;
    word-break: break-word;
}

/* Input area - fixed at bottom on mobile */
#input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg);
    border-top: 1px solid var(--overlay);
    padding: 12px;
    z-index: 100;
}

#input-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

#prompt {
    color: var(--foam);
    font-weight: bold;
    flex-shrink: 0;
}

#input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: inherit;
    font-size: 16px; /* Prevent zoom on iOS */
    outline: none;
    caret-color: var(--foam);
    min-width: 0;
}

/* Editor mode */
#editor {
    display: none;
    flex-direction: column;
    gap: 12px;
}

#editor.active {
    display: flex;
}

#editor textarea {
    width: 100%;
    min-height: 120px;
    background: var(--surface);
    border: 1px solid var(--overlay);
    border-radius: 6px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    padding: 10px;
    resize: vertical;
    outline: none;
}

#editor textarea:focus {
    border-color: var(--foam);
}

#editor-buttons {
    display: flex;
    gap: 8px;
}

#editor-buttons button {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
}

#editor-buttons button:active {
    transform: scale(0.98);
}

#btn-save {
    background: var(--pine);
    color: var(--text);
}

#btn-cancel {
    background: var(--overlay);
    color: var(--muted);
}

/* Note display */
.note-view {
    padding: 12px 0;
}

.note-view .note-header {
    margin-bottom: 8px;
}

.note-view .note-meta {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

.note-view .note-content {
    margin-top: 12px;
    white-space: pre-wrap;
    line-height: 1.6;
}

/* Note list */
.note-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--overlay);
}

.note-item:last-child {
    border-bottom: none;
}

.note-item .note-title {
    color: var(--text);
}

.note-item .note-info {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

/* Color utilities */
.love { color: var(--love); }
.gold { color: var(--gold); }
.rose { color: var(--rose); }
.pine { color: var(--pine); }
.foam { color: var(--foam); }
.iris { color: var(--iris); }
.muted { color: var(--muted); }
.text { color: var(--text); }

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--overlay);
    border-radius: 3px;
}

/* Selection */
::selection {
    background: var(--iris);
    color: var(--bg);
}

/* Touch-friendly tap highlight */
@media (hover: none) {
    button:active {
        opacity: 0.8;
    }
}

/* Tablet and up */
@media (min-width: 768px) {
    #terminal {
        max-width: 700px;
        margin: 0 auto;
        padding: 20px;
    }

    #output {
        padding-bottom: 20px;
    }

    #input-area {
        position: static;
        border-top: none;
        padding: 12px 0;
    }

    #input {
        font-size: 14px;
    }

    #editor textarea {
        min-height: 200px;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    body {
        font-size: 15px;
    }

    #terminal {
        padding: 40px;
    }
}
