/* Office – Calm Office Design System */
:root {
    /* Background gradient */
    --color-bg-start: #f8f9fb;
    --color-bg-end: #f0f1f5;
    /* Surface */
    --color-surface: #fff;
    --color-surface-border: #e5e7eb;
    --color-surface-alpha: rgba(255, 255, 255, 0.8);
    /* Text */
    --color-text: #111827;
    --color-muted: #6b7280;
    /* Primary */
    --color-primary: #2563eb;
    --color-primary-light: #dbeafe;
    --color-primary-hover: #1d4ed8;
    /* Error */
    --color-error: #dc2626;
    --color-error-bg: #fef2f2;
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.04), 0 10px 15px rgba(0, 0, 0, 0.06);
    --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.15);
    /* Radius */
    --radius: 8px;
    --radius-lg: 12px;
    /* Transition */
    --transition: 200ms ease;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg-start: #0c0c0f;
        --color-bg-end: #111118;
        --color-surface: #1c1c24;
        --color-surface-border: #2a2a35;
        --color-surface-alpha: rgba(28, 28, 36, 0.8);
        --color-text: #f3f4f6;
        --color-muted: #9ca3af;
        --color-primary: #60a5fa;
        --color-primary-light: #1e3a5f;
        --color-primary-hover: #93bbfd;
        --color-error: #f87171;
        --color-error-bg: #1c1517;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.2), 0 10px 15px rgba(0, 0, 0, 0.3);
        --shadow-glow: 0 0 20px rgba(96, 165, 250, 0.1);
    }
}

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

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, var(--color-bg-start), var(--color-bg-end));
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--color-primary); text-decoration: none; transition: color var(--transition); }
a:hover { text-decoration: underline; }

/* Login */
.login-container {
    max-width: 360px;
    margin: 15vh auto;
    padding: 2rem;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-surface-border);
    border-top: 3px solid var(--color-primary);
    box-shadow: var(--shadow-md);
}

.login-container h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

label { display: block; margin-top: 1rem; font-size: 0.875rem; color: var(--color-muted); }
input {
    width: 100%; padding: 0.5rem; min-height: 44px; margin-top: 0.25rem;
    border: 1px solid var(--color-surface-border); border-radius: var(--radius);
    font-size: 1rem; background: var(--color-surface); color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-light); }

button {
    padding: 0.625rem; min-height: 44px;
    background: var(--color-primary); color: #fff; border: none;
    border-radius: var(--radius); font-size: 1rem; cursor: pointer;
    transition: background var(--transition), opacity var(--transition);
}
.login-container button { width: 100%; margin-top: 1.5rem; }
button:hover { background: var(--color-primary-hover); }

.error {
    color: var(--color-error); background: var(--color-error-bg);
    border: 1px solid var(--color-error); padding: 0.5rem;
    border-radius: var(--radius); font-size: 0.875rem; text-align: center;
}

/* Shared header (dashboard + tools) */
.dashboard-header,
.tool-header {
    position: sticky; top: 0; z-index: 10;
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 2rem;
    background: var(--color-surface-alpha);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-surface-border);
}

.dashboard-header h1,
.tool-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.dashboard-header .header-subtitle {
    font-size: 0.8rem;
    color: var(--color-muted);
    font-weight: 400;
}

.dashboard-header .logout-link,
.tool-header nav a {
    color: var(--color-muted); text-decoration: none; font-size: 0.875rem;
    min-height: 44px; display: inline-flex; align-items: center;
    padding: 0.25rem 0.75rem; border: 1px solid var(--color-surface-border);
    border-radius: var(--radius);
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.dashboard-header .logout-link:hover,
.tool-header nav a:hover {
    color: var(--color-text); border-color: var(--color-muted);
    background: var(--color-surface); text-decoration: none;
}
.tool-header nav { display: flex; gap: 0.5rem; }

/* Dashboard Tiles */
.tile-grid {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 1.5rem; padding: 3rem 2rem;
    max-width: 640px; margin: 0 auto;
}

.tile {
    width: 160px; min-height: 140px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 1.5rem 1rem; text-decoration: none; color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.tile:hover, .tile:focus {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
    border-color: var(--color-primary-light);
    text-decoration: none;
}
.tile-icon { font-size: 2.5rem; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; }
.tile-name { margin-top: 0.75rem; font-size: 0.875rem; font-weight: 500; }

.dashboard .empty {
    text-align: center; padding: 4rem 2rem;
}
.dashboard .empty .empty-icon { font-size: 3rem; display: block; margin-bottom: 1rem; }
.dashboard .empty .empty-text { font-size: 0.95rem; }

/* Blog */
.blog { max-width: 720px; margin: 0 auto; }
.blog #blog-content { padding: 1.5rem 2rem; }
.blog-actions button {
    padding: 0.5rem 1rem; font-size: 0.875rem;
}
.blog-actions button:hover { background: var(--color-primary-hover); }

.post-list { list-style: none; }
.post-list li {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.75rem 0; border-bottom: 1px solid var(--color-surface-border);
}
.post-list a {
    color: var(--color-text); text-decoration: none; font-weight: 500;
    min-height: 44px; display: inline-flex; align-items: center;
    transition: color var(--transition);
}
.post-list a:hover { color: var(--color-primary); text-decoration: none; }
.post-list time { color: var(--color-muted); font-size: 0.8rem; }

.blog form label { display: block; margin-top: 1rem; font-size: 0.875rem; color: var(--color-muted); }
textarea {
    width: 100%; padding: 0.5rem; min-height: 44px; margin-top: 0.25rem;
    border: 1px solid var(--color-surface-border); border-radius: var(--radius);
    font-size: 1rem; font-family: inherit; resize: vertical;
    background: var(--color-surface); color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition);
}
textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-light); }

.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }
.form-actions button {
    padding: 0.5rem 1rem; font-size: 0.875rem;
}
.form-actions button[type="button"] {
    background: var(--color-surface); color: var(--color-muted);
    border: 1px solid var(--color-surface-border);
    transition: border-color var(--transition), color var(--transition);
}
.form-actions button[type="button"]:hover { border-color: var(--color-muted); color: var(--color-text); }

.blog-post { padding: 1.5rem 2rem; }
.blog-post h2 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.blog-post time { color: var(--color-muted); font-size: 0.8rem; }
.blog-post .post-content { margin-top: 1.5rem; line-height: 1.7; white-space: pre-wrap; }

.empty { color: var(--color-muted); }
.blog .empty { font-style: italic; }

/* Loading / htmx indicators */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-request button[type="submit"] { opacity: 0.6; pointer-events: none; }

.spinner {
    display: inline-block; width: 1rem; height: 1rem;
    border: 2px solid var(--color-surface-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle; margin-left: 0.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Error Page */
.error-page { text-align: center; padding: 4rem 2rem; }
.error-page .error-icon { font-size: 3rem; display: block; margin-bottom: 1rem; }
.error-page h1 { margin-bottom: 0.5rem; font-size: 1.5rem; }
.error-page p { color: var(--color-muted); margin-bottom: 1.5rem; }
.error-page a {
    color: var(--color-primary); min-height: 44px; display: inline-flex; align-items: center;
    padding: 0.5rem 1rem; border: 1px solid var(--color-primary-light);
    border-radius: var(--radius);
    transition: background var(--transition), border-color var(--transition);
}
.error-page a:hover { background: var(--color-primary-light); text-decoration: none; }

/* Header Actions */
.header-actions { display: flex; align-items: center; gap: 1rem; }

/* Theme Picker */
.theme-picker { display: flex; gap: 0.5rem; align-items: center; }
.theme-dot {
    width: 24px; height: 24px; min-height: auto; margin: 0; padding: 0;
    border-radius: 50%; border: 2px solid transparent;
    background: var(--dot-color); cursor: pointer;
    transition: border-color var(--transition), transform var(--transition);
}
.theme-dot:hover { transform: scale(1.15); background: var(--dot-color); }
.theme-dot.active { border-color: var(--color-text); box-shadow: 0 0 0 2px var(--color-surface); }

/* Mobile */
@media (max-width: 480px) {
    .dashboard-header,
    .tool-header { padding: 0.75rem 1rem; }
    .tile-grid { padding: 2rem 1rem; gap: 1rem; }
    .tile { width: 140px; min-height: 120px; padding: 1.25rem 0.75rem; }
    .blog #blog-content { padding: 1rem; }
    .login-container { margin: 10vh 1rem; }
    .error-page { padding: 3rem 1rem; }
}

/* ============================
   LCARS Theme — Star Trek Konsole auf Steroiden
   ============================ */
[data-theme="lcars"] {
    --color-bg-start: #0a0a1a;
    --color-bg-end: #0a0a1a;
    --color-surface: #1a1a2e;
    --color-surface-border: #ff9900;
    --color-surface-alpha: rgba(26, 26, 46, 0.95);
    --color-text: #ff9900;
    --color-muted: #cc8800;
    --color-primary: #9999ff;
    --color-primary-light: #2a2a4e;
    --color-primary-hover: #ff9900;
    --color-error: #ff4444;
    --color-error-bg: #2e1a1a;
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-glow: 0 0 15px rgba(153, 153, 255, 0.4);
    --radius: 0 24px 24px 0;
    --radius-lg: 0 24px 24px 0;
}
[data-theme="lcars"] h1,
[data-theme="lcars"] h2,
[data-theme="lcars"] .tile-name {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: "Century Gothic", "Futura", system-ui, sans-serif;
}
/* LCARS Header Elbow — L-shaped panel frame */
[data-theme="lcars"] .dashboard-header,
[data-theme="lcars"] .tool-header {
    border-bottom: none;
    position: relative;
}
[data-theme="lcars"] .dashboard-header::before {
    content: "";
    position: absolute; left: 0; top: 0; right: 0;
    height: 40px;
    background: #9999ff;
    border-radius: 0 0 24px 0;
}
[data-theme="lcars"] .dashboard-header::after {
    content: "";
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 40px;
    background: #9999ff;
}
[data-theme="lcars"] .dashboard-header {
    padding: 52px 2rem 1rem 56px;
    min-height: 80px;
}
[data-theme="lcars"] .tool-header::before {
    content: "";
    position: absolute; left: 0; top: 0; right: 0;
    height: 24px;
    background: #ff9900;
    border-radius: 0 0 16px 0;
}
[data-theme="lcars"] .tool-header::after {
    content: "";
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 24px;
    background: #ff9900;
}
[data-theme="lcars"] .tool-header {
    padding: 36px 2rem 1rem 40px;
    min-height: 64px;
}
/* LCARS Tile Grid — alternating color stripes */
[data-theme="lcars"] .tile {
    border-left: 6px solid #ff9900;
    border-radius: 0 24px 24px 0;
    border-top: none; border-right: none; border-bottom: none;
}
[data-theme="lcars"] .tile:nth-child(even) {
    border-left-color: #9999ff;
}
[data-theme="lcars"] .tile:hover {
    border-left-color: #9999ff;
    box-shadow: 0 0 20px rgba(153, 153, 255, 0.4);
}
[data-theme="lcars"] .tile:nth-child(even):hover {
    border-left-color: #ff9900;
    box-shadow: 0 0 20px rgba(255, 153, 0, 0.4);
}
[data-theme="lcars"] .tile-grid {
    border-bottom: 3px solid #ff9900;
    padding-bottom: 2rem;
}
/* LCARS Buttons — fat pill shapes */
[data-theme="lcars"] button {
    border-radius: 24px;
    background: #9999ff;
    color: #0a0a1a;
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: "Century Gothic", "Futura", system-ui, sans-serif;
}
[data-theme="lcars"] button:hover {
    background: #ff9900;
    color: #0a0a1a;
}
/* LCARS Login — full panel frame */
[data-theme="lcars"] .login-container {
    border-top: 8px solid #9999ff;
    border-left: 40px solid #ff9900;
    border-right: none;
    border-bottom: none;
    border-radius: 0 24px 24px 0;
    padding-left: 2rem;
}
[data-theme="lcars"] .logout-link,
[data-theme="lcars"] .tool-header nav a {
    border-radius: 24px;
    font-family: "Century Gothic", "Futura", system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
/* LCARS Glow on header bars */
[data-theme="lcars"] .dashboard-header::before,
[data-theme="lcars"] .dashboard-header::after {
    box-shadow: 0 0 12px rgba(153, 153, 255, 0.4);
}
[data-theme="lcars"] .tool-header::before,
[data-theme="lcars"] .tool-header::after {
    box-shadow: 0 0 12px rgba(255, 153, 0, 0.4);
}
/* LCARS Separator lines */
[data-theme="lcars"] .post-list li {
    border-bottom-color: #ff9900;
    border-bottom-width: 2px;
}
[data-theme="lcars"] .blog-post {
    border-bottom: 2px solid #ff9900;
}

/* ============================
   Cyberpunk Theme — Night City Terminal
   ============================ */
[data-theme="cyberpunk"] {
    --color-bg-start: #0a0a12;
    --color-bg-end: #12081f;
    --color-surface: #1a1028;
    --color-surface-border: rgba(0, 240, 255, 0.4);
    --color-surface-alpha: rgba(26, 16, 40, 0.9);
    --color-text: #e0e0e0;
    --color-muted: #8888aa;
    --color-primary: #00f0ff;
    --color-primary-light: #1a2a3e;
    --color-primary-hover: #ff2d6b;
    --color-error: #ff2d6b;
    --color-error-bg: #2e1020;
    --shadow-sm: 0 0 4px rgba(0, 240, 255, 0.1);
    --shadow-md: 0 0 8px rgba(0, 240, 255, 0.15);
    --shadow-glow: 0 0 20px rgba(0, 240, 255, 0.3), 0 0 40px rgba(0, 240, 255, 0.1);
    --radius: 2px;
    --radius-lg: 4px;
}
/* Cyberpunk Headings — terminal style */
[data-theme="cyberpunk"] h1,
[data-theme="cyberpunk"] h2 {
    font-family: "Courier New", Courier, monospace;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5), 0 0 20px rgba(0, 240, 255, 0.3);
}
/* Cyberpunk Scanlines — denser, more visible */
[data-theme="cyberpunk"] body::after {
    content: "";
    position: fixed; inset: 0; z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 1.5px,
        rgba(0, 240, 255, 0.07) 1.5px,
        rgba(0, 240, 255, 0.07) 3px
    );
    pointer-events: none;
}
/* Cyberpunk CRT Vignette — dark monitor edges */
[data-theme="cyberpunk"] body::before {
    content: "";
    position: fixed; inset: 0; z-index: 9998;
    background: radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.4) 100%);
    pointer-events: none;
}
/* Cyberpunk Glitch — recurring every 4s */
[data-theme="cyberpunk"] .dashboard-header h1 {
    animation: cyberGlitch 4s ease-in-out infinite;
}
@keyframes cyberGlitch {
    0%, 2% { transform: translate(0); text-shadow: 0 0 10px rgba(0, 240, 255, 0.5), 0 0 20px rgba(0, 240, 255, 0.3); }
    0.5% { transform: translate(-3px, 1px); text-shadow: -3px 0 #ff2d6b, 3px 0 #00f0ff; }
    1% { transform: translate(3px, -1px); text-shadow: 3px 0 #ff2d6b, -3px 0 #00f0ff; }
    1.5% { transform: translate(-1px, -2px); text-shadow: -1px 0 #ff2d6b, 1px 0 #00f0ff; }
    2%, 100% { transform: translate(0); text-shadow: 0 0 10px rgba(0, 240, 255, 0.5), 0 0 20px rgba(0, 240, 255, 0.3); }
}
/* Cyberpunk Tiles — neon borders permanent, bigger corner cuts */
[data-theme="cyberpunk"] .tile {
    border: 1px solid rgba(0, 240, 255, 0.3);
    clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.2), inset 0 0 8px rgba(0, 240, 255, 0.05);
}
[data-theme="cyberpunk"] .tile:hover {
    border-color: #00f0ff;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.5), inset 0 0 15px rgba(0, 240, 255, 0.15);
}
/* Cyberpunk Pink Accents */
[data-theme="cyberpunk"] .header-subtitle,
[data-theme="cyberpunk"] .post-list time,
[data-theme="cyberpunk"] .blog-post time {
    color: #ff2d6b;
}
/* Cyberpunk Buttons — neon glow */
[data-theme="cyberpunk"] button {
    background: #00f0ff;
    color: #0a0a12;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}
[data-theme="cyberpunk"] button:hover {
    background: #ff2d6b;
    color: #fff;
    box-shadow: 0 0 10px rgba(255, 45, 107, 0.4);
}
/* Cyberpunk Login — dual neon borders with glow */
[data-theme="cyberpunk"] .login-container {
    border-top: 2px solid #00f0ff;
    border-bottom: 2px solid #ff2d6b;
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.15), 0 0 30px rgba(255, 45, 107, 0.1);
}

/* ============================
   Psychedelic Theme — Absoluter Wahnsinn
   ============================ */
[data-theme="psychedelic"] {
    --color-bg-start: #ff6b6b;
    --color-bg-end: #6b6bff;
    --color-surface: rgba(255, 255, 255, 0.85);
    --color-surface-border: #ff00ff;
    --color-surface-alpha: rgba(255, 255, 255, 0.7);
    --color-text: #1a0033;
    --color-muted: #660066;
    --color-primary: #ff00ff;
    --color-primary-light: rgba(255, 0, 255, 0.15);
    --color-primary-hover: #cc00cc;
    --color-error: #ff0044;
    --color-error-bg: #ffe0e8;
    --shadow-sm: 0 2px 8px rgba(255, 0, 255, 0.2);
    --shadow-md: 0 4px 16px rgba(255, 0, 255, 0.25);
    --shadow-glow: 0 0 20px rgba(255, 0, 255, 0.4), 0 0 40px rgba(0, 255, 255, 0.2);
    --radius: 50px;
    --radius-lg: 50px;
}
@media (prefers-color-scheme: dark) {
    [data-theme="psychedelic"] {
        --color-bg-start: #1a002e;
        --color-bg-end: #002e1a;
        --color-surface: rgba(40, 0, 60, 0.85);
        --color-surface-border: #ff00ff;
        --color-surface-alpha: rgba(40, 0, 60, 0.7);
        --color-text: #00ff88;
        --color-muted: #00cc66;
        --color-primary: #ff00ff;
        --color-primary-light: rgba(255, 0, 255, 0.2);
        --color-primary-hover: #ff66ff;
        --color-error: #ff4477;
        --color-error-bg: #2e0020;
        --shadow-glow: 0 0 25px rgba(255, 0, 255, 0.6), 0 0 50px rgba(0, 255, 255, 0.3);
    }
}
/* Psychedelic Background — slow rotating gradient */
[data-theme="psychedelic"] body {
    background: linear-gradient(135deg, #ff6b6b, #6b6bff, #ffff00, #ff6b6b);
    background-size: 400% 400%;
    animation: psychBg 15s ease infinite;
}
@media (prefers-color-scheme: dark) {
    [data-theme="psychedelic"] body {
        background: linear-gradient(135deg, #1a002e, #002e1a, #2e001a, #1a002e);
        background-size: 400% 400%;
        animation: psychBg 15s ease infinite;
    }
}
@keyframes psychBg {
    0% { background-position: 0% 50%; }
    25% { background-position: 100% 0%; }
    50% { background-position: 100% 100%; }
    75% { background-position: 0% 100%; }
    100% { background-position: 0% 50%; }
}
/* Psychedelic Rainbow Border — animated on everything */
@property --border-angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}
@keyframes rainbowBorder {
    to { --border-angle: 360deg; }
}
[data-theme="psychedelic"] .tile,
[data-theme="psychedelic"] .login-container,
[data-theme="psychedelic"] .dashboard-header,
[data-theme="psychedelic"] .tool-header {
    border: 3px solid #ff00ff;
    border-image: linear-gradient(var(--border-angle, 0deg), #ff00ff, #00ffff, #ffff00, #ff00ff) 1;
    animation: rainbowBorder 3s linear infinite, pulse 2s ease-in-out infinite;
}
/* Psychedelic Tiles — permanent pulsing, wave offset */
[data-theme="psychedelic"] .tile {
    background: linear-gradient(135deg, var(--color-surface), rgba(255, 0, 255, 0.08));
    border-radius: 50px;
    border: 3px solid #ff00ff;
    border-image: linear-gradient(var(--border-angle, 0deg), #ff00ff, #00ffff, #ffff00, #ff00ff) 1;
    animation: rainbowBorder 3s linear infinite, pulse 2s ease-in-out infinite;
}
[data-theme="psychedelic"] .tile:nth-child(1) { animation-delay: 0s, 0s; }
[data-theme="psychedelic"] .tile:nth-child(2) { animation-delay: 0s, 0.3s; }
[data-theme="psychedelic"] .tile:nth-child(3) { animation-delay: 0s, 0.6s; }
[data-theme="psychedelic"] .tile:nth-child(4) { animation-delay: 0s, 0.9s; }
[data-theme="psychedelic"] .tile:nth-child(5) { animation-delay: 0s, 1.2s; }
[data-theme="psychedelic"] .tile:nth-child(6) { animation-delay: 0s, 1.5s; }
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}
/* Psychedelic Hover — explosion */
[data-theme="psychedelic"] .tile:hover {
    transform: scale(1.1) rotate(2deg);
    box-shadow: 0 0 30px rgba(255, 0, 255, 0.5), 0 0 60px rgba(0, 255, 255, 0.3), 0 0 90px rgba(255, 255, 0, 0.2);
    animation: rainbowBorder 3s linear infinite, shimmer 0.5s ease infinite;
}
@keyframes shimmer {
    0%, 100% { border-color: #ff00ff; }
    33% { border-color: #00ffff; }
    66% { border-color: #ffff00; }
}
/* Psychedelic Headings — chromatic aberration */
[data-theme="psychedelic"] h1,
[data-theme="psychedelic"] h2 {
    text-shadow: 2px 2px 0 #00ffff, -2px -2px 0 #ff00ff;
}
/* Psychedelic Login — pulsing glow */
[data-theme="psychedelic"] .login-container {
    border-radius: 50px;
    animation: rainbowBorder 3s linear infinite, loginGlow 2s ease-in-out infinite alternate;
}
@keyframes loginGlow {
    0% { box-shadow: 0 0 30px rgba(255, 0, 255, 0.4), 0 0 60px rgba(255, 0, 255, 0.2); }
    100% { box-shadow: 0 0 30px rgba(0, 255, 255, 0.4), 0 0 60px rgba(0, 255, 255, 0.2); }
}
/* Psychedelic Buttons — animated gradient */
[data-theme="psychedelic"] button {
    background: linear-gradient(135deg, #ff00ff, #6b6bff, #00ffff, #ff00ff);
    background-size: 300% 300%;
    animation: psychBg 4s ease infinite;
    color: #fff;
    border-radius: 50px;
    font-weight: 700;
    text-transform: uppercase;
}
[data-theme="psychedelic"] button:hover {
    background: linear-gradient(135deg, #cc00cc, #4b4bdd, #00cccc, #cc00cc);
    background-size: 300% 300%;
}
/* Psychedelic Dashboard/Tool Header */
[data-theme="psychedelic"] .dashboard-header,
[data-theme="psychedelic"] .tool-header {
    background: var(--color-surface-alpha);
    border-radius: 0;
}
/* Psychedelic Blog — subtle rainbow text background */
[data-theme="psychedelic"] .post-content {
    background: linear-gradient(135deg, rgba(255, 0, 255, 0.04), rgba(0, 255, 255, 0.04), rgba(255, 255, 0, 0.04));
    padding: 1rem;
    border-radius: 12px;
}

/* ============================
   Plotter Tool
   ============================ */
.plotter { max-width: 1200px; margin: 0 auto; }

.plotter-controls {
    padding: 1.5rem 2rem 0;
}

.plotter .plotter-input-row {
    display: flex; align-items: center; gap: 0.75rem;
}
.plotter .plotter-input-row label {
    display: inline; font-family: "Courier New", monospace;
    font-size: 1.1rem; font-weight: 600;
    white-space: nowrap; margin: 0;
    color: var(--color-text);
}
.plotter .plotter-input-row input {
    flex: 1; width: auto; margin-top: 0;
    font-family: "Courier New", monospace; font-size: 1rem;
}
.plotter .plotter-input-row button {
    padding: 0.5rem 1.25rem; font-size: 0.875rem;
    white-space: nowrap; width: auto;
}

.plotter .plotter-error {
    color: var(--color-error); background: var(--color-error-bg);
    border: 1px solid var(--color-error); padding: 0.5rem;
    border-radius: var(--radius); font-size: 0.875rem;
    margin-top: 0.75rem;
}

.plotter .plotter-range-row {
    display: flex; gap: 1rem; margin-top: 0.75rem;
    align-items: center;
}
.plotter .plotter-range-row label {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.85rem; color: var(--color-muted); margin: 0;
}
.plotter .plotter-range-row input {
    width: 80px; text-align: center; flex: none; margin-top: 0;
    font-family: "Courier New", monospace;
}

/* Plotter Math Keypad */
.plotter-keypad {
    display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem;
}
.keypad-group { display: contents; }
.plotter-keypad button {
    font-family: "Courier New", monospace; font-size: 0.85rem;
    min-width: 44px; min-height: 36px;
    padding: 0.25rem 0.5rem;
    background: var(--color-surface); color: var(--color-text);
    border: 1px solid var(--color-surface-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}
.plotter-keypad button:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
}

/* Keypad Theme Overrides */
[data-theme="lcars"] .plotter-keypad button {
    border-radius: 8px;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
}
[data-theme="cyberpunk"] .plotter-keypad button {
    background: var(--color-surface);
    color: var(--color-muted);
    box-shadow: none;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
}
[data-theme="cyberpunk"] .plotter-keypad button:hover {
    color: #00f0ff;
    border-color: #00f0ff;
    background: var(--color-surface);
    box-shadow: 0 0 6px rgba(0, 240, 255, 0.3);
}
[data-theme="psychedelic"] .plotter-keypad button {
    border-radius: 12px;
    background: var(--color-surface);
    color: var(--color-text);
    animation: none;
    background-size: auto;
    font-weight: 400;
    text-transform: none;
}
[data-theme="psychedelic"] .plotter-keypad button:hover {
    background: var(--color-primary-light);
    background-size: auto;
}

.plotter-canvas-wrap {
    padding: 1rem 2rem 2rem;
}
.plotter-canvas-wrap canvas {
    width: 100%;
    background: var(--color-surface);
    border: 1px solid var(--color-surface-border);
    border-radius: var(--radius);
}

/* Plotter Layout: Main + History Sidebar */
.plotter-body { display: flex; gap: 1.5rem; }
.plotter-main { flex: 1; min-width: 0; }

.plotter-history {
    width: 250px; flex-shrink: 0;
    padding: 1.5rem 1rem;
}
.plotter-history-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 0.75rem;
}
.plotter-history-header h2 {
    font-size: 0.95rem; font-weight: 600; margin: 0;
}
.plotter-history-header button {
    padding: 0.25rem 0.6rem; font-size: 0.75rem;
    min-height: auto;
}
.plotter-history-empty {
    color: var(--color-muted); font-size: 0.8rem; font-style: italic;
}

#history-list {
    list-style: none; padding: 0; margin: 0;
    max-height: 500px; overflow-y: auto;
}
#history-list li {
    display: flex; align-items: center; gap: 0.25rem;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--color-surface-border);
    cursor: pointer;
    transition: background var(--transition);
    border-radius: var(--radius);
}
#history-list li:hover {
    background: var(--color-primary-light);
}
.history-formula {
    flex: 1; min-width: 0;
    font-family: "Courier New", monospace; font-size: 0.8rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-delete {
    flex-shrink: 0; width: 24px; height: 24px; min-height: auto;
    padding: 0; font-size: 1rem; line-height: 1;
    background: transparent; color: var(--color-muted);
    border: none; border-radius: 4px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: color var(--transition), background var(--transition);
}
.history-delete:hover {
    color: var(--color-error); background: var(--color-error-bg);
}

/* Psychedelic: tame the border-radius on history items */
[data-theme="psychedelic"] #history-list li {
    border-radius: 12px;
}

@media (max-width: 768px) {
    .plotter-body { flex-direction: column; }
    .plotter-history { width: 100%; }
    #history-list { max-height: 200px; }
}

@media (max-width: 480px) {
    .plotter-controls { padding: 1rem; }
    .plotter-input-row { flex-wrap: wrap; }
    .plotter-input-row input { min-width: 0; }
    .plotter-canvas-wrap { padding: 0.5rem 1rem 1rem; }
    .keypad-group {
        display: flex; flex-wrap: wrap; gap: 0.35rem;
        padding-bottom: 0.35rem;
        border-bottom: 1px solid var(--color-surface-border);
    }
    .keypad-group:last-child { border-bottom: none; padding-bottom: 0; }
}

/* ============================
   Notes Tool
   ============================ */
.notes { max-width: 800px; margin: 0 auto; }
.notes-content { padding: 1.5rem 2rem; }

/* Note Groups */
.note-group { margin-bottom: 1.5rem; }
.note-group:last-child { margin-bottom: 0; }
.note-group-header {
    font-size: 1.1rem; font-weight: 600;
    color: var(--color-text);
    padding-bottom: 0.375rem;
    border-bottom: 2px solid var(--color-surface-border);
    margin-bottom: 0;
}
.note-group-count {
    color: var(--color-muted); font-size: 0.85rem; font-weight: 400;
}

/* Note List */
.note-list { list-style: none; }
.note-list li {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.75rem 0; border-bottom: 1px solid var(--color-surface-border);
}
.note-list a {
    color: var(--color-text); text-decoration: none; font-weight: 500;
    min-height: 44px; display: inline-flex; align-items: center;
    transition: color var(--transition);
}
.note-list a:hover { color: var(--color-primary); text-decoration: none; }
.note-tags { display: flex; gap: 0.375rem; flex-wrap: wrap; }
.tag-pill {
    font-size: 0.7rem; color: var(--color-primary); background: var(--color-primary-light);
    padding: 0.125rem 0.5rem; border-radius: 999px;
}

/* Note Content — Prose Styles */
.note-content {
    padding: 1.5rem 2rem;
    line-height: 1.75;
}
.note-content h1 { font-size: 1.75rem; margin: 1.5rem 0 0.75rem; font-weight: 700; }
.note-content h2 { font-size: 1.375rem; margin: 1.5rem 0 0.5rem; font-weight: 600; }
.note-content h3 { font-size: 1.125rem; margin: 1.25rem 0 0.5rem; font-weight: 600; }
.note-content h4 { font-size: 1rem; margin: 1rem 0 0.5rem; font-weight: 600; }
.note-content p { margin: 0.75rem 0; }
.note-content ul, .note-content ol { margin: 0.75rem 0; padding-left: 1.5rem; }
.note-content li { margin: 0.25rem 0; }
.note-content blockquote {
    margin: 1rem 0; padding: 0.75rem 1rem;
    border-left: 3px solid var(--color-primary);
    background: var(--color-primary-light); border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--color-muted);
}
.note-content hr {
    border: none; border-top: 1px solid var(--color-surface-border);
    margin: 1.5rem 0;
}
.note-content table {
    width: 100%; border-collapse: collapse; margin: 1rem 0;
}
.note-content th, .note-content td {
    padding: 0.5rem 0.75rem; border: 1px solid var(--color-surface-border);
    text-align: left;
}
.note-content th {
    background: var(--color-primary-light); font-weight: 600;
}
.note-content code {
    font-family: "Courier New", monospace; font-size: 0.875em;
    background: var(--color-primary-light); padding: 0.125rem 0.375rem;
    border-radius: 4px;
}
.note-content pre {
    margin: 1rem 0; padding: 1rem;
    background: var(--color-surface); border: 1px solid var(--color-surface-border);
    border-radius: var(--radius); overflow-x: auto;
}
.note-content pre code {
    background: none; padding: 0; font-size: 0.85rem;
}
.note-content img {
    max-width: 100%; height: auto; border-radius: var(--radius);
    margin: 0.75rem 0;
}
.note-content a { color: var(--color-primary); }
.note-content a:hover { text-decoration: underline; }

/* LCARS Notes Overrides */
[data-theme="lcars"] .note-group-header {
    text-transform: uppercase; letter-spacing: 0.1em;
    font-family: "Century Gothic", "Futura", system-ui, sans-serif;
    border-bottom-color: #ff9900;
}
[data-theme="lcars"] .note-list li { border-bottom-color: #ff9900; border-bottom-width: 2px; }
[data-theme="lcars"] .tag-pill {
    border-radius: 0 12px 12px 0; background: #2a2a4e; color: #9999ff;
    font-family: "Century Gothic", "Futura", system-ui, sans-serif;
    text-transform: uppercase; letter-spacing: 0.05em;
}
[data-theme="lcars"] .note-content blockquote {
    border-left: 4px solid #ff9900; background: #1a1a2e;
}

/* Cyberpunk Notes Overrides */
[data-theme="cyberpunk"] .note-group-header {
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5), 0 0 20px rgba(0, 240, 255, 0.3);
    border-bottom-color: rgba(0, 240, 255, 0.4);
}
[data-theme="cyberpunk"] .tag-pill {
    background: rgba(0, 240, 255, 0.1); color: #00f0ff;
    border: 1px solid rgba(0, 240, 255, 0.3); border-radius: 2px;
}
[data-theme="cyberpunk"] .note-content blockquote {
    border-left: 3px solid #00f0ff; background: rgba(0, 240, 255, 0.05);
}
[data-theme="cyberpunk"] .note-content pre {
    border-color: rgba(0, 240, 255, 0.2);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.1);
}

/* Psychedelic Notes Overrides */
[data-theme="psychedelic"] .note-group-header {
    text-shadow: 2px 2px 0 #00ffff, -2px -2px 0 #ff00ff;
    border-bottom-color: #ff00ff;
}
[data-theme="psychedelic"] .tag-pill {
    background: linear-gradient(135deg, rgba(255, 0, 255, 0.15), rgba(0, 255, 255, 0.15));
    color: var(--color-primary); border-radius: 50px;
}
[data-theme="psychedelic"] .note-content blockquote {
    border-left: 3px solid #ff00ff;
    background: linear-gradient(135deg, rgba(255, 0, 255, 0.05), rgba(0, 255, 255, 0.05));
    border-radius: 0 12px 12px 0;
}

/* Notes Mobile */
@media (max-width: 480px) {
    .notes-content { padding: 1rem; }
    .note-content { padding: 1rem; }
    .note-list li { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
}
