:root {
    --bg-color: #d1c7b7;
    --paper-color: #f4f1ea;
    --ink-color: #333333;
    --accent-red: #a33b3b;
    --accent-blue: #3d5a80;
    --grain-opacity: 0.05;
}

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

body {
    background-color: var(--bg-color);
    color: var(--ink-color);
    font-family: 'Courier Prime', monospace;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Texture */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url("https://www.transparenttextures.com/patterns/paper-fibers.png");
    opacity: var(--grain-opacity);
    pointer-events: none;
    z-index: 9999;
}

.screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    transition: transform 0.4s ease-in-out, opacity 0.3s ease;
}

.hidden {
    display: none !important;
}

/* Auth Section */
#auth-section {
    align-items: center;
    justify-content: center;
}

.folder {
    width: 100%;
    max-width: 450px;
    background: #c2b5a3;
    position: relative;
    box-shadow: 10px 10px 20px rgba(0,0,0,0.2);
    border-radius: 4px;
}

.folder-tab {
    position: absolute;
    top: -30px;
    left: 0;
    background: #c2b5a3;
    padding: 5px 20px;
    font-family: 'Special Elite', cursive;
    font-size: 0.8rem;
    border-radius: 10px 10px 0 0;
    box-shadow: 0 -5px 10px rgba(0,0,0,0.1);
}

.paper-stack {
    padding: 40px;
    background: var(--paper-color);
    clip-path: polygon(0 0, 100% 0, 98% 100%, 2% 98%);
    margin: 10px;
}

.typewriter-title {
    font-family: 'Special Elite', cursive;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.subtitle {
    font-size: 0.9rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--ink-color);
    padding-bottom: 0.5rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-size: 0.7rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.input-group input {
    width: 100%;
    border: none;
    border-bottom: 2px solid var(--ink-color);
    background: transparent;
    font-family: 'Courier Prime', monospace;
    font-size: 1.1rem;
    padding: 5px 0;
    outline: none;
}

/* Buttons */
.retro-btn {
    background: var(--ink-color);
    color: var(--paper-color);
    border: none;
    padding: 10px 20px;
    font-family: 'Special Elite', cursive;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    text-transform: uppercase;
}

.retro-btn:active {
    transform: scale(0.95);
}

.retro-btn.primary {
    background: var(--accent-blue);
}

.retro-btn.danger {
    background: var(--accent-red);
}

.round-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 4px 4px 10px rgba(0,0,0,0.3);
}

.link-btn {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.8rem;
    text-decoration: underline;
    cursor: pointer;
    color: var(--ink-color);
}

/* Dashboard */
.desk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.main-title {
    font-family: 'Special Elite', cursive;
    font-size: 3rem;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.1);
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
}

.note-card {
    background: var(--paper-color);
    padding: 20px;
    height: 250px;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.note-card:hover {
    transform: rotate(2deg) translateY(-5px);
}

.note-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 10px;
    width: 20px;
    height: 100%;
    border-left: 1px solid rgba(255, 0, 0, 0.2);
}

.note-card h3 {
    font-family: 'Special Elite', cursive;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.note-card p {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
}

/* Editor */
.typewriter-paper {
    background: var(--paper-color);
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    min-height: 90vh;
    padding: 60px;
    box-shadow: 0 0 50px rgba(0,0,0,0.1);
    position: relative;
    display: flex;
    flex-direction: column;
}

.paper-margin {
    position: absolute;
    top: 0;
    left: 80px;
    width: 2px;
    height: 100%;
    background: rgba(255, 0, 0, 0.1);
}

.paper-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.title-input {
    font-family: 'Special Elite', cursive;
    font-size: 2.5rem;
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    margin-bottom: 2rem;
}

.body-input {
    font-size: 1.2rem;
    line-height: 1.8;
    flex-grow: 1;
    outline: none;
    min-height: 400px;
}

[contenteditable=true]:empty:before {
    content: attr(data-placeholder);
    color: #bbb;
}

.editor-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px dashed #ccc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#timestamp {
    font-size: 0.8rem;
    opacity: 0.6;
}

.editor-btns {
    display: flex;
    gap: 1rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ink-color);
    color: var(--paper-color);
    padding: 10px 20px;
    font-size: 0.8rem;
    z-index: 10000;
}

@media (max-width: 600px) {
    .screen {
        padding: 1rem;
    }
    .typewriter-paper {
        padding: 30px;
    }
    .paper-margin {
        left: 40px;
    }
    .main-title {
        font-size: 2rem;
    }
}