:root {
    /* TRUE SUNFLOWER PALETTE 🌻 */
    --bg-color: #e8d595;          
    --card-bg: #161412;           
    --text-main: #fcf9f2;         
    --text-muted: #8c857b;        
    --accent-yellow: #ffc82c;     
    --accent-yellow-hover: #ffd75e;
    --border-color: #2e2a25;
    --danger: #e26d5c;
}

/* --- SILKY GLOBAL PAGE ENTRY --- */
html, body {
    width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center; 
    min-height: 100vh;
    box-sizing: border-box;
    padding: 16px; /* Symmetric outer yellow frame */
    animation: globalPageEnter 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes globalPageEnter {
    from { 
        opacity: 0; 
        transform: scale(0.98) translateY(6px); 
    }
    to { 
        opacity: 1; 
        transform: scale(1) translateY(0); 
    }
}

/* --- THE CARD BASE --- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 36px;
    width: 100%;
    max-width: 560px; 
    display: flex;
    flex-direction: column; 
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    box-sizing: border-box; /* Ensures padding never breaks width */
}

/* 📱 MOBILE VIEW: Perfectly symmetrical and locked to viewport */
@media (max-width: 768px) {
    .card {
        min-height: 88vh; 
        padding: 30px 20px; 
    }
}

/* 💻 DESKTOP VIEW */
@media (min-width: 769px) {
    .card {
        min-height: 55vh; 
        padding: 40px 35px; 
    }
}

/* --- TAB TRANSITION MAGIC --- */
.tab-content {
    animation: tabSlideGlide 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    flex-grow: 1; 
    display: flex;
    flex-direction: column;
}

@keyframes tabSlideGlide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

h2 {
    margin: 0 0 5px 0;
    font-size: 32px; 
    font-weight: 800;
    letter-spacing: -1.2px;
    color: var(--text-main);
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 25px;
}

/* --- TABS --- */
.nav-tabs {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 25px;
    padding-bottom: 2px;
    gap: 15px;
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

.tab-item {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 15px; 
    font-weight: 600;
    padding: 8px 4px;
    transition: color 0.2s;
}

.tab-item.active {
    color: var(--text-main);
    border-bottom: 2px solid var(--accent-yellow);
}

/* --- FORMS & INPUTS --- */
.input-group {
    margin-bottom: 18px;
    text-align: left;
}

label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

input[type="text"],
input[type="password"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 16px 18px; 
    background: #1f1c19; 
    border: 1px solid var(--border-color);
    border-radius: 14px; 
    color: var(--text-main);
    font-size: 16px; /* NO IPHONE AUTO-ZOOM */
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.25s ease;
}

textarea {
    min-height: 240px; 
    line-height: 1.6;
    resize: none;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-yellow);
    box-shadow: 0 0 0 4px rgba(255, 200, 44, 0.15);
}

/* --- BUTTONS --- */
button {
    background: var(--accent-yellow);
    color: #161412;
    border: none;
    width: 100%;
    padding: 16px; 
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s ease, background 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 14px rgba(255, 200, 44, 0.2);
    margin-top: 10px;
    box-sizing: border-box;
}

button:hover {
    background: var(--accent-yellow-hover);
    box-shadow: 0 6px 20px rgba(255, 200, 44, 0.3);
}

button:active {
    transform: scale(0.96); 
}

.link-btn {
    display: block;
    text-align: center;
    margin-top: auto; 
    padding-top: 25px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.link-btn:hover {
    color: var(--accent-yellow);
}

.error {
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 15px;
}

/* --- LETTER CARDS & INBOX --- */
.letter-card {
    border: 1px solid var(--border-color);
    padding: 18px; 
    border-radius: 16px;
    margin-bottom: 12px;
    background: #1f1c19; 
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    display: block; 
    text-decoration: none; 
    color: var(--text-main);
    box-sizing: border-box;
}

.letter-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    transform: translateY(-2px);
    border-color: #403a33;
}

.unread-dot {
    height: 9px;
    width: 9px;
    background-color: var(--accent-yellow); 
    border-radius: 50%;
    display: inline-block;
    margin-left: 8px;
    box-shadow: 0 0 8px rgba(255, 200, 44, 0.6);
}

.empty-state {
    color: var(--text-muted);
    font-size: 14px;
    font-style: italic;
    text-align: center;
    padding: 40px 0;
    margin: auto 0; 
}

/* --- FRIEND CODE BLOCK --- */
.code-reveal {
    background: #1f1c19;
    border: 1px dashed var(--border-color);
    padding: 20px;
    border-radius: 14px;
    text-align: center;
    font-family: monospace;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 6px;
    color: var(--accent-yellow);
    margin: 15px 0;
    box-sizing: border-box;
}

/* --- MICRO-INTERACTIONS --- */
a, button, select, input {
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}