/* ========================================
   A Quiet Place to Post
   Brutalist-Literary Aesthetic
   ======================================== */

:root {
    --bg: #faf8f8;
    --text: #2a1818;
    --text-muted: #6a5757;
    --accent: #8b7355;
    --rule: #e8d4d4;
    --rule-dark: #b8a8a8;
    
    --font-mono: 'IBM Plex Mono', monospace;
    --font-serif: 'Cormorant Garamond', Georgia, serif;
    
    --max-width: 38rem;
    --spacing: 2rem;
    --spacing-lg: 4rem;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scrollbar-gutter: stable;
    overflow-y: scroll;
    background: var(--bg);
}

/* Ensure safe area matches background color and content can scroll behind it */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: env(safe-area-inset-top, 0);
    background: var(--bg);
    z-index: -1;
    pointer-events: none;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-serif);
    line-height: 1.7;
    min-height: 100vh;
    padding: 0;
    padding-left: var(--spacing);
    padding-right: var(--spacing);
    padding-bottom: calc(6rem + env(safe-area-inset-bottom)); /* Space for sticky panels + home indicator */
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z' fill='%23ff69b4'/%3E%3C/svg%3E") 0 0, auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

/* Hide main content when panel is in fullscreen mode */
body.panel-fullscreen-mode header,
body.panel-fullscreen-mode nav,
body.panel-fullscreen-mode main > *:not(.write-panel-fullscreen):not(.suggest-panel-fullscreen),
body.panel-fullscreen-mode footer {
    display: none !important;
}

body.panel-fullscreen-mode main {
    display: block !important;
}

/* Ensure panel is visible in fullscreen mode */
body.panel-fullscreen-mode .suggest-panel-fullscreen,
body.panel-fullscreen-mode .write-panel-fullscreen {
    display: flex !important;
}

/* Fullscreen mode - content hiding only (scroll prevention handled by JS) */
html.panel-fullscreen-mode {
    height: 100% !important;
    overscroll-behavior: none !important;
}

body.panel-fullscreen-mode {
    height: 100% !important;
    overscroll-behavior: none !important;
    background: rgba(255, 245, 250, 1) !important; /* Match panel pink background */
    /* Don't use position: fixed to avoid layout shifts */
    /* Overflow is controlled by JavaScript inline styles for reliable cleanup */
}

html.panel-fullscreen-mode {
    background: rgba(255, 245, 250, 1) !important; /* Match panel pink background */
}

/* Allow pointer events on the panel and its children */
.suggest-panel-fullscreen,
.write-panel-fullscreen {
    pointer-events: auto !important;
}

.suggest-panel-fullscreen *,
.write-panel-fullscreen * {
    pointer-events: auto !important;
}

/* Allow scrolling only in textareas */
body.panel-fullscreen-mode textarea {
    touch-action: pan-y !important;
}

/* Fullscreen overlay - pointer-events none so clicks pass through to panel */
.fullscreen-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 99998;
    pointer-events: none;
}

.fullscreen-overlay.active {
    display: block;
}

a, .status-link, .inbox-button {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z' fill='%23ff69b4'/%3E%3C/svg%3E") 0 0, pointer;
}

/* Cursor for text inputs - pencil */
input[type="text"],
input[type="password"],
textarea {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ctext x='12' y='18' font-size='20' fill='%23ff69b4' text-anchor='middle'%3E✎%3C/text%3E%3C/svg%3E") 12 12, text !important;
}

/* Cursor for buttons - flower */
button,
button:hover,
button:focus,
button:active {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ctext x='12' y='18' font-size='20' fill='%23ff69b4' text-anchor='middle'%3E❀%3C/text%3E%3C/svg%3E") 12 12, pointer !important;
}

/* Cursor for like button - heart */
.post-like,
.post-like:hover,
.post-like:focus,
.post-like:active {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ctext x='12' y='18' font-size='20' fill='%23ff69b4' text-anchor='middle'%3E♥%3C/text%3E%3C/svg%3E") 12 12, pointer !important;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* Layout */
header, main, footer {
    max-width: var(--max-width);
    margin: 0 auto;
}

/* Header & Nav */
header {
    margin-bottom: var(--spacing);
    padding-top: calc(var(--spacing) + env(safe-area-inset-top, 0));
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--rule-dark);
}

/* Tabs Navigation */
.tabs-nav {
    max-width: var(--max-width);
    margin: 0 auto;
    margin-bottom: var(--spacing);
    padding-bottom: 0;
    border-bottom: 1px solid var(--rule);
    display: flex;
    gap: 2rem;
    justify-content: flex-start;
    align-items: flex-end;
}

.tab-button {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    padding: 0.5rem 0;
    margin-bottom: -1px;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

.tab-button:hover {
    color: var(--text);
}

.tab-button.active {
    color: var(--text);
    font-weight: 500;
    border-bottom-color: #ff69b4;
    padding-bottom: calc(0.5rem - 1px);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.site-title {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 1.05rem;
    letter-spacing: 0.1em;
}

.status-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 300;
    letter-spacing: 0.05em;
}

.status-prefix {
    color: var(--text);
    text-transform: lowercase;
    font-weight: 400;
}

.status-link {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: 0.05em;
    color: var(--text);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    transition: opacity 0.2s ease;
}

.status-link:hover {
    opacity: 0.7;
}

.status-link.online {
    cursor: default;
}

.status-link.online:hover {
    opacity: 1;
}

.inbox-button {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: 0.05em;
    color: var(--text);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: 1rem;
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    transition: opacity 0.2s ease;
}

.inbox-button:hover {
    opacity: 0.7;
}

.status-dot {
    width: 8px;
    height: 8px;
    display: inline-block;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    border-radius: 50%;
}

.status-dot-offline {
    background: transparent;
    border: 1.25px solid rgba(255, 105, 180, 0.5);
    animation: glow-offline 2s ease-in-out infinite;
}

.status-dot-online {
    background: #ff69b4;
    border: none;
    animation: glow-online 1.5s ease-in-out infinite;
}

@keyframes glow-offline {
    0%, 100% {
        box-shadow: 0 0 3px rgba(255, 105, 180, 0.3);
        opacity: 0.7;
    }
    50% {
        box-shadow: 0 0 5px rgba(255, 105, 180, 0.4);
        opacity: 0.9;
    }
}

@keyframes glow-online {
    0%, 100% {
        box-shadow: 0 0 4px rgba(255, 105, 180, 0.6);
        opacity: 1;
    }
    50% {
        box-shadow: 0 0 8px rgba(255, 105, 180, 0.9);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(0.9);
    }
}

/* Auth Panel */
.auth-panel {
    margin-bottom: var(--spacing);
    padding-bottom: var(--spacing);
    border-bottom: 1px solid var(--rule);
}

.auth-form {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}


.auth-panel input {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 400;
    padding: 0.5rem 0;
    border: none;
    border-bottom: 1.5px solid #ff69b4;
    background: transparent;
    color: var(--text);
    width: 100%;
    outline: none;
    transition: border-color 0.2s ease;
    margin-bottom: 0.5rem;
}

.auth-panel input:last-of-type {
    margin-bottom: 0;
}

.auth-panel input:focus {
    border-bottom-color: #ff69b4;
    border-bottom-width: 2px;
}

.auth-panel input::placeholder {
    color: var(--text-muted);
}

.auth-panel button {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: 0.05em;
    color: var(--text);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: opacity 0.2s ease;
}

.auth-panel button:hover {
    opacity: 0.7;
}

.auth-form h3 {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: 0.05em;
    color: var(--text);
    margin-bottom: 1rem;
}

.auth-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 0.5rem;
}

.auth-form input {
    margin-bottom: 0.5rem;
    width: 100%;
}

.auth-form input:last-of-type {
    margin-bottom: 0;
}

/* Tab Content */
.tab-content {
    margin-bottom: var(--spacing-lg);
}

.tab-content.hidden {
    display: none;
}

/* Write Panel */
.write-panel {
    position: relative;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing);
    padding-top: 1.5rem;
    border: 1px solid var(--rule);
    background: rgba(255, 250, 250, 0.6);
}

.write-panel-sticky,
.write-panel.write-panel-sticky {
    position: fixed !important;
    bottom: calc(1.5rem + env(safe-area-inset-bottom)) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: calc(100% - 4rem) !important;
    max-width: calc(var(--max-width) - 2rem) !important;
    margin: 0 !important;
    padding: 1rem !important;
    border: 1px solid var(--rule) !important;
    background: rgba(255, 245, 250, 0.95) !important;
    z-index: 100 !important;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05) !important;
    box-sizing: border-box !important;
    transition: none !important;
}

.write-panel-fullscreen,
.write-panel.write-panel-fullscreen {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding-top: calc(1rem + env(safe-area-inset-top, 0)) !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0)) !important;
    border: none !important;
    background: rgba(255, 245, 250, 1) !important;
    z-index: 99999 !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    transition: none !important;
    overflow: hidden !important;
    /* Height and top set dynamically by JS based on visual viewport */
    /* JS will override min-height with !important inline style */
    /* Ensure buttons are always visible */
    align-items: stretch !important;
    /* Ensure flex children don't overflow */
    justify-content: flex-start !important;
}

/* Extend pink background into safe area */
.write-panel-fullscreen::before,
.write-panel.write-panel-fullscreen::before {
    content: '';
    position: absolute;
    top: calc(-1 * env(safe-area-inset-top, 0));
    left: 0;
    right: 0;
    height: env(safe-area-inset-top, 0);
    background: rgba(255, 245, 250, 1);
    z-index: -1;
}

/* Extend pink background into bottom safe area (keyboard toolbar area) */
.write-panel-fullscreen::after,
.write-panel.write-panel-fullscreen::after {
    content: '';
    position: fixed;
    bottom: calc(-1 * env(safe-area-inset-bottom, 0));
    left: 0;
    right: 0;
    height: calc(env(safe-area-inset-bottom, 0) + 100px); /* Extra height to cover keyboard toolbar */
    background: rgba(255, 245, 250, 1);
    z-index: -1;
    pointer-events: none;
}

/* Explicitly hide ::before and ::after pseudo-elements when NOT in fullscreen */
.write-panel:not(.write-panel-fullscreen)::before,
.write-panel.write-panel-sticky::before,
.write-panel:not(.write-panel-fullscreen)::after,
.write-panel.write-panel-sticky::after {
    display: none !important;
    content: none !important;
}

.write-panel textarea {
    width: 100%;
    font-family: var(--font-serif);
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--text);
    background: transparent;
    border: none;
    resize: none;
    min-height: 6rem;
    outline: none;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

.write-panel-sticky textarea {
    min-height: 2rem;
    max-height: 3.5rem;
    margin-bottom: 0.4rem;
    font-size: 1.05rem;
    line-height: 1.6;
    padding: 0.2rem 0;
    overflow-y: auto;
}

.write-panel-fullscreen textarea {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    margin-bottom: 1rem !important;
    font-size: 1.2rem !important;
    line-height: 1.8 !important;
    padding: 0.5rem 0 !important;
    overflow-y: auto !important;
    touch-action: pan-y !important;
    overscroll-behavior: contain !important;
    /* Ensure textarea can shrink to make room for buttons */
    flex-basis: 0 !important;
}

.panel-close-button {
    display: none;
    position: relative;
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 300;
    line-height: 1;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
    width: 100%;
    text-align: right;
    align-items: center;
    justify-content: flex-end;
    transition: color 0.2s ease, opacity 0.2s ease;
    z-index: 1001;
    opacity: 0.7;
    pointer-events: auto;
    touch-action: manipulation;
}

.panel-close-button:hover {
    color: var(--text);
    opacity: 1;
}

.write-panel-fullscreen .panel-close-button,
.suggest-panel-fullscreen .panel-close-button {
    display: flex !important;
}

.write-panel textarea::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.write-actions {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    min-width: 0;
}

.write-actions #post-submit {
    margin-left: auto;
}

.write-panel-sticky .write-actions {
    margin-top: 0;
}

.write-panel-sticky .write-actions button {
    font-size: 0.7rem;
    padding: 0.15rem 0;
}

.write-panel-fullscreen .write-actions {
    margin-top: auto !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 10 !important;
    width: 100% !important;
    min-height: 2rem !important;
    padding-top: 0.5rem !important;
}

.write-panel-fullscreen .write-actions button {
    font-size: 0.75rem !important;
    padding: 0.25rem 0 !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
}

.write-actions button {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: 0.05em;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0;
    transition: all 0.2s ease;
}

#post-submit {
    color: #ff69b4;
    border-bottom: 1.5px solid #ff69b4;
    padding-bottom: 0.25rem;
}

#post-submit:hover {
    color: #ff8cc8;
    border-bottom-color: #ff8cc8;
}

.password-change-link,
.password-reset-link {
    color: var(--text-muted);
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
}

.password-change-link:hover,
.password-reset-link:hover {
    color: var(--text);
    opacity: 0.8;
}

/* Suggest Panel */
.suggest-panel {
    position: relative;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing);
    padding-top: 1.5rem;
    border: 1px solid var(--rule);
    background: rgba(255, 250, 250, 0.4);
}

.suggest-panel-sticky,
.suggest-panel.suggest-panel-sticky {
    position: fixed !important;
    bottom: calc(1.5rem + env(safe-area-inset-bottom)) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: calc(100% - 4rem) !important;
    max-width: calc(var(--max-width) - 2rem) !important;
    margin: 0 !important;
    padding: 1rem !important;
    border: 1px solid var(--rule) !important;
    background: rgba(255, 245, 250, 0.95) !important;
    z-index: 100 !important;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05) !important;
    box-sizing: border-box !important;
    transition: none !important;
}

.suggest-panel-fullscreen,
.suggest-panel.suggest-panel-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding-top: calc(1rem + env(safe-area-inset-top, 0)) !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0)) !important;
    border: none !important;
    background: rgba(255, 245, 250, 1) !important;
    z-index: 99999 !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    transition: none !important;
    overflow: hidden !important;
    overscroll-behavior: none !important;
    pointer-events: auto !important;
    /* Height set dynamically by JS based on visual viewport */
    /* JS will override min-height with !important inline style */
    /* Ensure buttons are always visible */
    align-items: stretch !important;
    /* Ensure flex children don't overflow */
    justify-content: flex-start !important;
}

/* Extend pink background into safe area - ONLY when in fullscreen */
.suggest-panel-fullscreen::before,
.suggest-panel.suggest-panel-fullscreen::before {
    content: '';
    position: absolute;
    top: calc(-1 * env(safe-area-inset-top, 0));
    left: 0;
    right: 0;
    height: env(safe-area-inset-top, 0);
    background: rgba(255, 245, 250, 1);
    z-index: -1;
}

/* Extend pink background into bottom safe area (keyboard toolbar area) */
.suggest-panel-fullscreen::after,
.suggest-panel.suggest-panel-fullscreen::after {
    content: '';
    position: fixed;
    bottom: calc(-1 * env(safe-area-inset-bottom, 0));
    left: 0;
    right: 0;
    height: calc(env(safe-area-inset-bottom, 0) + 100px); /* Extra height to cover keyboard toolbar */
    background: rgba(255, 245, 250, 1);
    z-index: -1;
    pointer-events: none;
}

/* Explicitly hide ::before and ::after pseudo-elements when NOT in fullscreen */
.suggest-panel:not(.suggest-panel-fullscreen)::before,
.suggest-panel.suggest-panel-sticky::before,
.suggest-panel:not(.suggest-panel-fullscreen)::after,
.suggest-panel.suggest-panel-sticky::after {
    display: none !important;
    content: none !important;
}

.suggest-panel textarea {
    width: 100%;
    font-family: var(--font-serif);
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--text);
    background: transparent;
    border: none;
    resize: none;
    min-height: 4rem;
    outline: none;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

.suggest-panel-sticky textarea {
    min-height: 1.5rem;
    max-height: 3rem;
    margin-bottom: 0.4rem;
    font-size: 1.05rem;
    line-height: 1.6;
    padding: 0.2rem 0;
    overflow-y: auto;
}

.suggest-panel-fullscreen textarea {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    margin-bottom: 1rem !important;
    font-size: 1.2rem !important;
    line-height: 1.8 !important;
    padding: 0.5rem 0 !important;
    overflow-y: auto !important;
    touch-action: pan-y !important;
    overscroll-behavior: contain !important;
    /* Ensure textarea can shrink to make room for buttons */
    flex-basis: 0 !important;
}

.suggest-panel textarea::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.suggest-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.suggest-panel-sticky .suggest-actions {
    margin-top: 0;
}

.suggest-panel-sticky .suggest-actions button {
    font-size: 0.7rem;
    padding: 0.15rem 0;
}

.suggest-panel-fullscreen .suggest-actions {
    margin-top: auto !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 10 !important;
    width: 100% !important;
    min-height: 2rem !important;
    padding-top: 0.5rem !important;
}

.suggest-panel-fullscreen .suggest-actions button {
    font-size: 0.75rem !important;
    padding: 0.25rem 0 !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
}

.suggest-actions button {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: 0.05em;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0;
    transition: all 0.2s ease;
}

#suggest-submit {
    color: #ff69b4;
    border-bottom: 1.5px solid #ff69b4;
    padding-bottom: 0.25rem;
}

#suggest-submit:hover {
    color: #ff8cc8;
    border-bottom-color: #ff8cc8;
}

.random-word-button {
    color: var(--text-muted);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.random-word-button:hover {
    color: var(--text);
}

/* Inbox Panel */
.inbox-panel {
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing);
    padding-top: 1.5rem;
    border: 1px solid var(--rule);
    background: rgba(255, 250, 250, 0.5);
}

.inbox-title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: 0.1em;
    color: var(--text);
    margin-bottom: var(--spacing);
}

/* Suggestions Panel (in tab) */
.suggestions-panel {
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing);
    padding-top: 1.5rem;
    border: 1px solid var(--rule);
    background: rgba(255, 250, 250, 0.5);
}

.suggestions-title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: 0.1em;
    color: var(--text);
    margin-bottom: var(--spacing);
}

/* Admin Panels */
.admin-panel {
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing);
    padding-top: 1.5rem;
    border: 1px solid var(--rule);
    background: rgba(255, 250, 250, 0.5);
}

.admin-panel-title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: 0.1em;
    color: var(--text);
    margin-bottom: var(--spacing);
}

.account-settings {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.inbox-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing);
}

.inbox-item {
    padding-bottom: var(--spacing);
    border-bottom: 1px solid var(--rule);
}

.inbox-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.inbox-content {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--text);
    white-space: pre-wrap;
    margin-bottom: 1rem;
}

.inbox-actions {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.inbox-approve,
.inbox-delete {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: 0.05em;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.inbox-approve {
    color: #ff69b4;
}

.inbox-approve:hover {
    opacity: 0.7;
}

.inbox-delete {
    color: var(--text-muted);
}

.inbox-delete:hover {
    color: #a05050;
}

.inbox-empty {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: var(--spacing) 0;
}

/* Feed */
.feed {
    margin-bottom: var(--spacing-lg);
    padding-bottom: 2rem; /* Space for sticky write panel */
}

.posts-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

/* Individual Post */
.post {
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

.post:not(:last-child) {
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--rule);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

.post-date {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--accent);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.post-badge {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 300;
    color: #ff69b4;
    letter-spacing: 0.05em;
    text-transform: lowercase;
    opacity: 0.8;
}

.write-tag-section {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
    max-width: 100%;
    overflow: hidden;
    flex: 1 1 auto;
    min-width: 0;
}

.post-tag-input {
    flex: 0 0 auto;
    width: 2.5rem;
    min-width: 0;
    max-width: 12rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    padding: 0.2rem 0;
    border: none;
    background: transparent;
    color: var(--text);
    outline: none;
    transition: color 0.2s ease;
}

.post-tag-input:focus {
    color: #ff69b4;
}

.post-tag-input::placeholder {
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.6;
}

.write-panel-sticky .post-tag-input {
    font-size: 0.8rem;
    min-width: 0;
    max-width: 10rem;
    padding: 0.15rem 0;
    width: 2.2rem;
}

.tag-suggestions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
    flex: 0 0 auto;
    overflow: hidden;
    margin-left: 0.3rem;
}

.tag-chip {
    flex: 0 0 auto;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: transparent;
    border: none;
    padding: 0.15rem 0.4rem;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 8rem;
}

.tag-chip:hover {
    color: #ff69b4;
    text-decoration-color: #ff69b4;
}

.write-panel-sticky .tag-suggestions {
    gap: 0.3rem;
}

.write-panel-sticky .tag-chip {
    font-size: 0.6rem;
    padding: 0.1rem 0.3rem;
    max-width: 6rem;
}

.post-content {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 400;
    line-height: 1.85;
    white-space: pre-wrap;
    color: var(--text);
}

.post-content p {
    margin-bottom: 1em;
}

.post-content p:last-child {
    margin-bottom: 0;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.post-like {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    transition: color 0.2s ease;
}

.post-like:hover:not(.post-liked) {
    color: #ff69b4;
}

.post-liked {
    opacity: 0.6;
    cursor: default;
}

.post-liked:hover {
    color: var(--text-muted);
}

.like-hearts {
    font-size: 0.95rem;
    line-height: 1;
    letter-spacing: 0.1em;
}

.post-rating {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.rating-stars {
    font-size: 0.95rem;
    line-height: 1;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

/* Delete button (only visible when authenticated) */
.post-delete {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.post:hover .post-delete {
    opacity: 0.7;
}

.post-delete:hover {
    color: #a05050;
    opacity: 1;
}

/* Loading & Empty States */
.loading {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 300;
    color: var(--text-muted);
    letter-spacing: 0.2em;
}

.empty-state {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--text-muted);
    font-style: italic;
}

/* Playlist Section (in header) */
.playlist-section-header {
    display: flex;
    align-items: center;
}

.playlist-section-header.hidden {
    display: none;
}

.playlist-volume-toggle {
    background: none;
    border: none;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
    display: block !important;
    visibility: visible !important;
}

.playlist-volume-toggle:hover {
    opacity: 0.7;
}

.playlist-container {
    flex: 1;
    display: flex;
    justify-content: center;
}

.hidden-player {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.playlist-error {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.playlist-error-message {
    padding: 1rem;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.playlist-error-message p {
    margin: 0;
}

/* Playlist Settings (Admin) */
.playlist-settings {
    margin-bottom: 0;
    padding-bottom: 0;
}

.playlist-settings-title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: 0.1em;
    color: var(--text);
    margin-bottom: 1rem;
}

.playlist-type-select {
    width: 100%;
    padding: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    border: 1px solid var(--rule-dark);
    border-radius: 4px;
    margin-bottom: 0.75rem;
    background: #fff;
    color: var(--text);
    outline: none;
}

.playlist-type-select:focus {
    border-color: #ff69b4;
}

.playlist-url-input {
    width: 100%;
    padding: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    border: 1px solid var(--rule-dark);
    border-radius: 4px;
    margin-bottom: 0.75rem;
    background: #fff;
    color: var(--text);
    outline: none;
}

.playlist-url-input:focus {
    border-color: #ff69b4;
}

.playlist-url-input::placeholder {
    color: var(--text-muted);
}

.playlist-save-button {
    padding: 0.5rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: 0.05em;
    background: transparent;
    border: 1px solid var(--rule-dark);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text);
}

.playlist-save-button:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: #ff69b4;
    color: #ff69b4;
}

.playlist-save-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Letterboxd Settings (Admin) */
.letterboxd-settings {
    margin-bottom: 0;
    padding-bottom: 0;
}

.letterboxd-url-input {
    width: 100%;
    padding: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    border: 1px solid var(--rule-dark);
    border-radius: 4px;
    margin-bottom: 0.75rem;
    background: #fff;
    color: var(--text);
    outline: none;
}

.letterboxd-url-input:focus {
    border-color: #ff69b4;
}

.letterboxd-url-input::placeholder {
    color: var(--text-muted);
}

.letterboxd-fetch-button {
    padding: 0.5rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: 0.05em;
    background: transparent;
    border: 1px solid var(--rule-dark);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text);
    margin-bottom: 1.5rem;
}

.letterboxd-fetch-button:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: #ff69b4;
    color: #ff69b4;
}

.letterboxd-fetch-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.letterboxd-reviews-container {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
}

.letterboxd-reviews-title {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: 0.05em;
    color: var(--text);
    margin-bottom: 1rem;
}

.letterboxd-reviews-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.letterboxd-review-item {
    padding: 0.75rem;
    border: 1px solid var(--rule);
    border-radius: 4px;
    background: rgba(255, 250, 250, 0.5);
}

.letterboxd-review-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
}

.letterboxd-review-checkbox input[type="checkbox"] {
    margin-top: 0.2rem;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #ff69b4;
}

.letterboxd-review-content {
    flex: 1;
}

.letterboxd-review-title {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.letterboxd-review-rating {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: #ff69b4;
    margin-bottom: 0.25rem;
}

.letterboxd-review-preview {
    font-family: var(--font-serif);
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    font-style: italic;
}

.letterboxd-empty {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 1rem 0;
}

.letterboxd-save-button {
    padding: 0.5rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: 0.05em;
    background: transparent;
    border: 1px solid var(--rule-dark);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text);
}

.letterboxd-save-button:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: #ff69b4;
    color: #ff69b4;
}

.letterboxd-save-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Review Post Styling */
.post-review .post-content {
    font-style: italic;
    opacity: 0.95;
}

.post-review .post-badge {
    opacity: 0.9;
}

/* Footer */
footer {
    padding-top: var(--spacing);
    padding-bottom: calc(8rem + env(safe-area-inset-bottom)); /* Space to scroll above sticky panel */
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer-decoration {
    font-size: 1.25rem;
    color: #ff69b4;
    opacity: 0.3;
    transform: rotate(-15deg);
    display: inline-block;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.footer-decoration:hover {
    opacity: 0.6;
    transform: rotate(0deg);
}

/* App Status Info Display */
.app-status-info {
    max-width: var(--max-width);
    margin: 0 auto;
    margin-bottom: var(--spacing);
    padding: 0.75rem var(--spacing);
    border: 1px solid var(--rule);
    background: rgba(255, 245, 250, 0.9);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
}

.app-status-info.hidden {
    display: none;
}

.app-status-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.app-status-text {
    flex: 1;
    line-height: 1.5;
}

.app-status-info.error {
    border-color: #ff69b4;
    background: rgba(255, 245, 250, 0.95);
    color: var(--text);
}

.app-status-info.warning {
    border-color: var(--accent);
    background: rgba(255, 250, 245, 0.9);
}

.app-status-close {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 300;
    line-height: 1;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.app-status-close:hover {
    opacity: 1;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
    html {
        font-size: 18px;
    }
    
    :root {
        --spacing: 1.5rem;
        --spacing-lg: 2.5rem;
    }
    
    .auth-form {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .auth-panel input {
        width: 100%;
    }
}

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

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}


