:root {
    --bg-main: #031e11;
    --bg-card: #04281a;
    --bg-panel: #02160d;
    --accent: #14fdce;
    --accent-glow: rgba(20, 253, 206, 0.45);
    --text-primary: #c7ffe8;
    --text-secondary: #72e6c8;
    --text-dim: #3ea98c;
    --success: #14fdce;
    --warning: #f4f19c;
    --danger: #ff5f87;
    --radius: 10px;
    --crt-line: rgba(20, 253, 206, 0.22);
    --crt-border: rgba(20, 253, 206, 0.35);
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'VT323', 'Share Tech Mono', monospace;
    font-size: 22px;
    line-height: 1.35;
    margin: 0;
    padding: 20px;
    text-shadow: 0 0 12px rgba(20, 253, 206, 0.18);
    background-image: linear-gradient(180deg, rgba(2, 12, 8, 0.95), rgba(3, 30, 17, 1) 45%, rgba(2, 12, 8, 0.95));
    background-attachment: fixed;
}

button,
input,
select,
textarea {
    font-family: inherit;
    font-size: 0.77em;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
}

body::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.2'/%3E%3C/svg%3E");
    opacity: 0.22;
    mix-blend-mode: screen;
}

body::after {
    background-image: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.02),
        rgba(255, 255, 255, 0.02) 1px,
        rgba(0, 0, 0, 0.25) 2px,
        rgba(0, 0, 0, 0.25) 3px
    );
    opacity: 0.35;
}

a,
a:visited {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid var(--crt-line);
}

a:hover,
a:focus {
    background: rgba(20, 253, 206, 0.18);
    color: var(--accent);
    outline: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Header & Search */
/* =========================================
   HEADER & FILTER STYLES (Responsive & Wrapping)
   ========================================= */

header {
    display: flex;
    flex-direction: column; /* Default: Stack vertically for mobile */
    gap: 20px;
    margin-bottom: 30px;
}

/* Desktop: Side-by-side layout */
@media (min-width: 768px) {
    header {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start; /* Aligns to top */
    }

    /* Title & Tags Container */
    header > div:first-child {
        flex: 1; /* Takes up available space */
        margin-right: 30px; 
    }

    /* Button Container */
    header > div:last-child {
        flex-shrink: 0; /* Prevents buttons from squishing */
        margin-top: 5px; /* Aligns nicely with the H1 */
    }
}

h1 {
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 15px 0; /* Add space below title for the chips */
    font-size: 2.4rem;
    line-height: 1.2;
}

/* Filter Bar - Wrapping List */
.filter-bar {
    display: flex;
    flex-wrap: wrap; /* KEY CHANGE: Wraps tags to next line */
    gap: 8px;        /* Consistent spacing */
    width: 100%;
}

.chip {
    padding: 6px 14px;
    background: var(--bg-panel);
    border: 1px solid var(--crt-line);
    border-radius: 50px; /* Fully rounded pill shape */
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    user-select: none;
    box-shadow: inset 0 0 12px rgba(20, 253, 206, 0.08);
}

#search-input {
    width: 100%;
    max-width: 400px;
    padding: 10px 12px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 1px solid var(--crt-line);
    background: var(--bg-panel);
    color: var(--text-primary);
    font-family: inherit;
    caret-color: var(--accent);
}

::selection {
    background: rgba(20, 253, 206, 0.35);
    color: #04110b;
}

.chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

.chip.active {
    background: rgba(20, 253, 206, 0.18);
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 14px var(--accent-glow);
}

/* Card Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.card {
    background: linear-gradient(180deg, rgba(4, 40, 26, 0.92), rgba(3, 20, 12, 0.95));
    border-radius: var(--radius);
    padding: 24px; /* More padding */
    border: 1px solid var(--crt-border);
    box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.45), 0 0 18px rgba(20, 253, 206, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 320px;
}

.card h3 { 
    margin: 10px 0 10px 0; 
    font-size: 1.5rem; /* Larger Title */
    font-family: 'VT323', monospace;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 0 25px rgba(20, 253, 206, 0.16); }

/* Card Internals */
.card-top { display: flex; justify-content: space-between; margin-bottom: 10px; }
.freq-badge { 
    font-size: 0.7rem; text-transform: uppercase; font-weight: bold; padding: 4px 8px; border-radius: 4px; letter-spacing: 0.5px;
}
.freq-Daily { background: rgba(20, 253, 206, 0.12); color: var(--success); border: 1px solid rgba(20, 253, 206, 0.4); }
.freq-Weekly { background: rgba(244, 241, 156, 0.1); color: var(--warning); border: 1px solid rgba(244, 241, 156, 0.35); }
.freq-Monthly { background: rgba(20, 253, 206, 0.12); color: var(--accent); border: 1px solid rgba(20, 253, 206, 0.35); }
.freq-One-Time { background: rgba(20, 253, 206, 0.08); color: var(--text-dim); border: 1px solid rgba(20, 253, 206, 0.2); }

.card p { color: var(--text-secondary); line-height: 1.5; font-size: 1rem; flex-grow: 1; white-space: pre-wrap; }

/* The Hash Tag Style */
.hashtag {
    color: var(--text-primary);
    background: rgba(20, 253, 206, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
}
.hashtag:hover { text-decoration: underline; }

.card-actions { margin-top: auto; border-top: 1px solid var(--crt-line); padding-top: 15px; display: flex; gap: 10px; justify-content: flex-end; }
.btn-icon { background: none; border: none; cursor: pointer; color: var(--text-dim); font-size: 0.9rem; }
.btn-icon:hover { color: var(--accent); }

/* Wizard Modal */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(8px);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal.open { opacity: 1; pointer-events: all; }
.wizard-box {
    background: var(--bg-card); width: 500px; max-width: 90%; border-radius: 18px;
    padding: 30px; border: 1px solid var(--crt-border); box-shadow: 0 0 40px rgba(20, 253, 206, 0.1), 0 20px 60px rgba(0,0,0,0.6);
    font-size: 0.77em;
}

.preview-box {
    background: var(--bg-card);
    width: 900px;
    max-width: 95%;
    max-height: 85vh;
    overflow: hidden;
    border-radius: 18px;
    padding: 28px;
    border: 1px solid var(--crt-border);
    box-shadow: 0 0 40px rgba(20, 253, 206, 0.1), 0 20px 60px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-size: 1rem;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.preview-meta {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.preview-actions {
    display: flex;
    gap: 10px;
}

.preview-content {
    flex: 1;
    overflow: auto;
    padding-top: 16px;
    padding-right: 6px;
    border-top: 1px solid var(--crt-line);
    font-size: 1rem;
}

.preview-content .toastui-editor-contents {
    color: var(--text-primary);
    font-size: 1rem !important;
    line-height: 1.5;
}

.preview-content .toastui-editor-contents a {
    color: var(--accent);
}
.form-group { margin-bottom: 20px; }
.form-group label { display: block; color: var(--text-secondary); margin-bottom: 8px; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.06em; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 12px; background: var(--bg-panel); border: 1px solid var(--crt-line);
    color: var(--text-primary); border-radius: 8px; font-family: inherit; font-size: 1rem;
    box-sizing: border-box;
}
.form-group select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--accent) 50%),
        linear-gradient(135deg, var(--accent) 50%, transparent 50%);
    background-position:
        calc(100% - 18px) 50%,
        calc(100% - 12px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 34px;
}
.form-group select option {
    background: var(--bg-panel);
    color: var(--text-primary);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(20, 253, 206, 0.15); }

.btn-primary { background: rgba(20, 253, 206, 0.12); color: var(--accent); border: 1px solid var(--accent); padding: 10px 24px; border-radius: 8px; font-weight: 600; cursor: pointer; text-transform: uppercase; letter-spacing: 0.08em; box-shadow: inset 0 0 12px rgba(20, 253, 206, 0.2), 0 0 10px rgba(20, 253, 206, 0.12); }
.btn-primary:hover { background: rgba(20, 253, 206, 0.22); }
.btn-secondary {
    background: rgba(20, 253, 206, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--crt-border);
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.hidden { display: none !important; }

.view-toggle {
    display: flex;
    flex-wrap: wrap; /* Handle small screens */
}
.toggle-btn {
    background: var(--bg-panel);
    border: 1px solid var(--crt-line);
    color: var(--text-secondary);
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.toggle-btn.active { background: rgba(20, 253, 206, 0.18); color: var(--accent); border-color: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }

#view-notes {
    position: relative;
    padding-left: 26px;
    margin-left: 6px;
}

#view-notes::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 6px;
    bottom: 6px;
    width: 1px;
    background: var(--crt-line);
}

/* Project Drawer */
.project-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 900;
}

.project-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 340px;
    max-width: 85%;
    height: 100%;
    background: var(--bg-panel);
    border-right: 1px solid var(--crt-border);
    box-shadow: 20px 0 40px rgba(0,0,0,0.4), 0 0 20px rgba(20, 253, 206, 0.08);
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    font-size: 0.77em;
}

.project-drawer.open {
    transform: translateX(0);
}

.project-drawer-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.project-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.project-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding-right: 6px;
}

.project-item {
    border: 1px solid var(--crt-line);
    border-radius: 12px;
    padding: 12px 14px;
    background: var(--bg-card);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.77em;
}

.project-item.active {
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.project-item h4 {
    margin: 0;
    font-size: 1rem;
    color: #e2e8f0;
}

.project-item p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.project-create {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--crt-line);
}

.project-create h3 {
    margin: 0 0 12px 0;
}

/* Templates */
.template-picker {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid var(--crt-line);
    border-radius: 12px;
    background: var(--bg-panel);
    font-size: 0.77em;
}

.template-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.template-picker-header h3 {
    margin: 0;
    font-size: 1rem;
}

.template-picker-header p {
    margin: 4px 0 0 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.template-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.template-card {
    text-align: left;
    background: var(--bg-card);
    border: 1px solid var(--crt-line);
    border-radius: 10px;
    padding: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
    font-size: 0.77em;
}

.template-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.template-card small {
    color: var(--text-secondary);
}

.export-images-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-panel);
    border: 1px solid var(--crt-line);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.export-images-toggle input {
    accent-color: var(--accent);
}

/* Calendar Container */
.calendar-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--crt-border);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4);
    font-size: 0.77em;
}

/* Notes Section */
.notes-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
}

.notes-sidebar {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--crt-border);
    height: fit-content;
    font-size: 0.77em;
}

.notes-filter-bar {
    margin-top: 16px;
    gap: 6px;
}

.notes-filter-bar .chip {
    padding: 4px 10px;
    font-size: 0.75rem;
}

.notes-stream {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--crt-border);
    min-height: 400px;
    font-size: 0.77em;
}

.notes-stream-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.notes-stream-header h2 {
    margin: 0;
}

.notes-stream-header p {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.notes-list {
    display: grid;
    gap: 12px;
}

.note-card {
    background: var(--bg-panel);
    border: 1px solid var(--crt-line);
    border-radius: 12px;
    padding: 16px;
    display: grid;
    gap: 10px;
    font-size: 0.77em;
}

.note-card h4 {
    margin: 0;
    font-size: 1.1rem;
}

.note-card p {
    margin: 0;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.note-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.note-links {
    display: grid;
    gap: 6px;
    font-size: 0.9rem;
}

.note-links a {
    color: var(--accent);
    text-decoration: none;
}

.note-links a:hover {
    text-decoration: underline;
}

.note-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--crt-line);
    padding-top: 10px;
}

.note-media {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.note-media a {
    display: inline-flex;
    border: 1px solid var(--crt-line);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-panel);
}

.note-media img {
    display: block;
    width: 96px;
    height: 96px;
    object-fit: cover;
}

.note-existing-images {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.note-existing-image {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    border: 1px solid var(--crt-line);
    border-radius: 8px;
    background: var(--bg-panel);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.note-existing-image.removed {
    opacity: 0.6;
    text-decoration: line-through;
}

.note-more summary {
    cursor: pointer;
    color: var(--accent);
    font-weight: 600;
    display: inline-block;
}

.note-more p {
    margin-top: 10px;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.more-toggle {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-weight: 600;
    padding: 0;
    display: inline-block;
    margin-left: 6px;
}

.more-content {
    margin-top: 0;
    color: var(--text-secondary);
    white-space: pre-wrap;
    display: inline;
}

.more-text {
    white-space: pre-wrap;
}

.more-less {
    margin-left: 6px;
}

.entry-text,
.note-text {
    white-space: pre-wrap;
    font-size: 1rem;
}

/* Mini Calendar */
.mini-cal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.mini-cal-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--accent);
}

.mini-cal-header button {
    background: var(--bg-panel);
    border: 1px solid var(--crt-line);
    color: var(--text-primary);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
}

.mini-cal-header button:hover { background: rgba(20, 253, 206, 0.2); }

.mini-cal-grid-header,
.mini-cal-grid-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.mini-cal-grid-header div {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 4px 0;
}

.mini-cal-day {
    background: var(--bg-panel);
    border-radius: 6px;
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--text-dim);
    cursor: pointer;
    position: relative;
}

.mini-cal-day:hover { background: rgba(20, 253, 206, 0.08); }
.mini-cal-day.today { outline: 1px solid var(--accent); }
.mini-cal-day.selected { background: rgba(20, 253, 206, 0.16); color: var(--accent); }

.mini-cal-dot {
    position: absolute;
    bottom: 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}
.cal-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;
}
.cal-header h2 { margin: 0; color: var(--accent); }
.cal-header button {
    background: var(--bg-panel); border: 1px solid var(--crt-line); color: var(--text-primary); width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
}
.cal-header button:hover { background: rgba(20, 253, 206, 0.2); }

/* Calendar Grid */
.cal-grid-header, .cal-grid-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: rgba(20, 253, 206, 0.2); /* Border color */
    border: 1px solid var(--crt-line);
}
.cal-grid-header div {
    background: var(--bg-card);
    padding: 10px;
    text-align: center;
    color: var(--text-secondary);
    font-weight: bold;
}
.cal-day {
    background: var(--bg-panel);
    min-height: 120px;
    padding: 5px;
    position: relative;
    cursor: pointer;
}
.cal-day:hover { background: rgba(20, 253, 206, 0.08); }
.cal-day.today { background: rgba(20, 253, 206, 0.12); }
.day-number {
    position: absolute; top: 5px; right: 8px; color: var(--text-dim); font-size: 0.9rem;
}

/* Calendar Events */
.cal-event {
    font-size: 0.75rem;
    margin-top: 2px;
    padding: 3px 6px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}
.cal-event.type-one-time { background: var(--accent); color: black; font-size: 1.05em; }
.cal-event.type-daily { background: rgba(20, 253, 206, 0.2); color: var(--success); border-left: 2px solid var(--success); }
.cal-event.type-weekly { background: rgba(244, 241, 156, 0.2); color: var(--warning); border-left: 2px solid var(--warning); }
.cal-event.type-monthly { background: rgba(20, 253, 206, 0.2); color: var(--accent); border-left: 2px solid var(--accent); }
.cal-event.type-yearly { 
    background: rgba(255, 64, 129, 0.2); 
    color: #ff4081; 
    border-left: 2px solid #ff4081; 
}

.cal-event::before {
    content: '•';
    margin-right: 4px;
    font-weight: bold;
    color: rgba(255,255,255,0.7);
}

/* Specific colors for categories if you want them */
.cal-event[onclick*="brain-dump"] { border-right: 3px solid #e040fb; }
.cal-event[onclick*="project"]    { border-right: 3px solid #00bcd4; }
.cal-event[onclick*="chore"]      { border-right: 3px solid #ffab00; }

#search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}


@media (max-width: 768px) {
    
    /* 1. Header controls: Make them smaller */
    .cal-header h2 { font-size: 1.1rem; }
    .cal-header button { width: 32px; height: 32px; }

    /* 2. The Grid: Reduce height and font size */
    .cal-day {
        min-height: 50px; /* Much shorter than desktop */
        font-size: 0.8rem;
        padding: 2px;
        display: flex;
        flex-direction: column;
        align-items: center; /* Center the dots */
    }

    /* 3. The Events: Transform text bars into DOTS */
    .cal-event {
        font-size: 0;       /* Hide text */
        width: 6px;         /* Dot width */
        height: 6px;        /* Dot height */
        padding: 0;         
        border-radius: 50%; /* Circle */
        border: none !important; /* Remove the left-border styling */
        margin: 1px;
        display: inline-block;
    }

    /* Keep colors but apply to background */
    .cal-event.type-one-time { background: var(--accent); }
    .cal-event.type-daily    { background: var(--success); }
    .cal-event.type-weekly   { background: var(--warning); }
    .cal-event.type-monthly  { background: #2979ff; }
    .cal-event.type-yearly   { background: #ff4081; }

    /* 4. Container for the Dots */
    /* This forces dots to wrap if there are many */
    .cal-day {
        display: flex;
        flex-flow: row wrap; 
        justify-content: center;
        align-content: flex-start;
        gap: 2px;
        padding-top: 20px; /* Make room for the number */
    }
    
    .day-number {
        position: absolute;
        top: 2px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 0.75rem;
    }

    /* 5. Selected State for Mobile */
    .cal-day.selected {
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid var(--accent);
    }

    .notes-container {
        grid-template-columns: 1fr;
    }

    .notes-stream-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Styles for the Details Box below calendar (Visible on mobile) */
.mobile-day-details {
    margin-top: 20px;
    border-top: 1px solid var(--crt-line);
    padding-top: 15px;
    animation: fadeIn 0.3s ease;
}

.mobile-day-details h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

/* Reuse card styles for the mobile list items */
.mobile-event-card {
    background: var(--bg-panel);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 4px solid transparent;
    cursor: pointer;
    display: flex; 
    justify-content: space-between;
    align-items: center;
}


/* 2. New Photo Gallery Styles */
.photo-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.gallery-item {
    aspect-ratio: 1; /* Square tiles */
    background: var(--bg-panel);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--crt-line);
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-item:hover {
    transform: scale(1.02);
    border-color: var(--accent);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    padding: 10px;
    opacity: 0;
    transition: opacity 0.2s;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-date {
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}


/* Add to style.css */

/* Make the modal wider/taller when writing stories */
.wizard-box.wizard-wide {
    width: 90%;
    height: 90vh; /* 90% of viewport height */
    max-width: 1200px;
    display: flex;
    flex-direction: column;
}

/* Ensure the body of the wizard takes up available space */
.wizard-box.wizard-wide #wizard-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Fix Toast UI Editor in Dark Mode to match our theme */
.toastui-editor-defaultUI {
    background-color: var(--bg-panel) !important;
    border: 1px solid var(--crt-border) !important;
}

.toastui-editor-defaultUI-toolbar {
    background: var(--bg-panel) !important;
    border-bottom: 1px solid var(--crt-line) !important;
}

.toastui-editor-defaultUI-toolbar button {
    color: var(--text-secondary) !important;
}

.toastui-editor-defaultUI-toolbar button:hover {
    color: var(--accent) !important;
}

.toastui-editor-defaultUI .ProseMirror {
    color: var(--text-primary) !important;
    font-family: 'VT323', monospace !important;
    font-size: 1rem;
}

.toastui-editor-md-container,
.toastui-editor-ww-container {
    background: var(--bg-panel) !important;
}

.toastui-editor-contents {
    font-family: 'VT323', monospace !important;
    color: var(--text-primary) !important;
    font-size: 1rem;
}

.toastui-editor-contents p,
.toastui-editor-contents li,
.toastui-editor-contents h1,
.toastui-editor-contents h2,
.toastui-editor-contents h3,
.toastui-editor-contents h4,
.toastui-editor-contents h5,
.toastui-editor-contents h6 {
    color: inherit !important;
}

.toastui-editor-defaultUI .toastui-editor-md-preview {
    background: var(--bg-panel) !important;
}

.toastui-editor-mode-switch {
    background-color: var(--bg-panel) !important; 
}

/* Ensure the editor fills the remaining vertical space */
#editor-container {
    flex: 1; 
    min-height: 400px; /* Minimum height */
}
