/* =========================================================================
   Yourney — "cool in 1999, but with modern scaling & polish".
   Web-safe retro fonts (Verdana / Trebuchet / Courier), beveled chrome,
   neon gradients, starfield backdrop — laid out with flexbox/grid so it
   actually works on phones.
   ========================================================================= */

:root {
    --neon-pink:   #ff3fa4;
    --neon-cyan:   #00e0d5;
    --neon-purple: #8a4fff;
    --neon-yellow: #ffe14d;
    --ink:         #1a1330;
    --panel:       #fffdf7;
    --panel-edge:  #2b2150;
    --space-1:     #1b1040;
    --space-2:     #3a1a6e;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(2px 2px at 20% 30%, #fff 50%, transparent 50%),
        radial-gradient(1px 1px at 70% 60%, #fff 50%, transparent 50%),
        radial-gradient(1.5px 1.5px at 40% 80%, #fff 50%, transparent 50%),
        radial-gradient(1px 1px at 90% 20%, #fff 50%, transparent 50%),
        linear-gradient(160deg, var(--space-1), var(--space-2) 60%, #5a2a8c);
    background-size: 300px 300px, 250px 250px, 400px 400px, 200px 200px, cover;
}

a { color: var(--neon-purple); }

/* ---- generic beveled panel ------------------------------------------------ */
.panel {
    background: var(--panel);
    border: 3px solid var(--panel-edge);
    border-radius: 10px;
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.35);
}

/* ---- app shell ------------------------------------------------------------ */
.app {
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.masthead {
    background: linear-gradient(90deg, var(--neon-pink), var(--neon-purple) 50%, var(--neon-cyan));
    border: 3px solid #fff;
    border-radius: 12px;
    box-shadow: 0 0 18px rgba(255, 63, 164, 0.6), 6px 6px 0 rgba(0,0,0,0.35);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.masthead h1 {
    font-family: "Trebuchet MS", "Comic Sans MS", sans-serif;
    margin: 0;
    font-size: 2.1rem;
    color: #fff;
    letter-spacing: 1px;
    text-shadow: 2px 2px 0 var(--ink), 0 0 12px rgba(255,255,255,0.8);
}
.masthead .tagline {
    font-family: "Courier New", monospace;
    font-size: 0.8rem;
    color: var(--ink);
    background: var(--neon-yellow);
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid var(--ink);
}
.masthead .userbar {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 0.85rem;
    text-shadow: 1px 1px 0 var(--ink);
}

/* ---- buttons -------------------------------------------------------------- */
button, .btn {
    font-family: Verdana, sans-serif;
    font-weight: bold;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--ink);
    background: linear-gradient(180deg, #ffffff, #d8d3ec);
    border: 2px solid var(--panel-edge);
    border-radius: 8px;
    padding: 8px 14px;
    box-shadow: 3px 3px 0 rgba(0,0,0,0.3);
    transition: transform .05s ease, box-shadow .05s ease, filter .1s ease;
}
button:hover, .btn:hover { filter: brightness(1.05); }
button:active, .btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 rgba(0,0,0,0.3); }
button:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: linear-gradient(180deg, var(--neon-cyan), #06b6ac); color: var(--ink); }
.btn-pink    { background: linear-gradient(180deg, var(--neon-pink), #d61f86); color: #fff; }
.btn-danger  { background: linear-gradient(180deg, #ff8080, #d63333); color: #fff; }
.btn-ghost   { background: transparent; box-shadow: none; border-color: #fff; color: #fff; }

/* ---- forms ---------------------------------------------------------------- */
input[type=text], input[type=password], input[type=datetime-local],
input[type=number], textarea, select {
    width: 100%;
    font-family: Verdana, sans-serif;
    font-size: 0.95rem;
    padding: 9px 11px;
    border: 2px solid var(--panel-edge);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}
textarea { resize: vertical; line-height: 1.5; }
label { font-size: 0.78rem; font-weight: bold; text-transform: uppercase; letter-spacing: .5px; color: var(--neon-purple); }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 160px; }

/* ---- auth screen ---------------------------------------------------------- */
.auth-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-card { width: 100%; max-width: 380px; padding: 26px; }
.auth-card h2 { margin-top: 0; font-family: "Trebuchet MS", sans-serif; color: var(--neon-pink); }
.auth-toggle { text-align: center; margin-top: 12px; font-size: 0.8rem; }
.auth-toggle button { background: none; border: none; box-shadow: none; color: var(--neon-purple); text-decoration: underline; padding: 2px; }

/* ---- main layout ---------------------------------------------------------- */
.content { display: grid; grid-template-columns: 300px 1fr; gap: 14px; flex: 1; align-items: start; }
@media (max-width: 760px) { .content { grid-template-columns: 1fr; } }

.sidebar { padding: 14px; position: sticky; top: 14px; }
.sidebar h3 { margin: 4px 0 10px; font-family: "Trebuchet MS"; color: var(--neon-purple); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

.search-box { margin-bottom: 12px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
    font-size: 0.72rem;
    background: linear-gradient(180deg, var(--neon-yellow), #f5c800);
    border: 1px solid var(--ink);
    border-radius: 12px;
    padding: 3px 9px;
    cursor: pointer;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.25);
}
.tag-chip.active { background: linear-gradient(180deg, var(--neon-pink), #d61f86); color: #fff; }

/* ---- entry list ----------------------------------------------------------- */
.entry-list { display: flex; flex-direction: column; gap: 12px; }
.entry-card { padding: 14px; cursor: pointer; transition: transform .08s ease; }
.entry-card:hover { transform: translate(-2px, -2px); box-shadow: 9px 9px 0 rgba(0,0,0,0.35); }
.entry-card h3 { margin: 0 0 4px; font-family: "Trebuchet MS"; color: var(--ink); }
.entry-meta { font-size: 0.74rem; color: #6a5d8a; font-family: "Courier New", monospace; margin-bottom: 6px; }
.entry-snippet { font-size: 0.86rem; color: #38304f; }
.entry-card .tags { margin-top: 8px; }

.empty-state { padding: 40px; text-align: center; color: #6a5d8a; }
.empty-state .big { font-size: 3rem; }

/* ---- editor --------------------------------------------------------------- */
.editor { padding: 18px; }
.editor h2 { margin-top: 0; font-family: "Trebuchet MS"; color: var(--neon-pink); }
.md-toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.md-toolbar button { padding: 5px 9px; font-size: 0.8rem; }
.attach-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.attach-list li { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; background: #f1eefb; border: 1px solid var(--panel-edge); border-radius: 6px; padding: 6px 9px; }
.attach-list .grow { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.gps-readout { font-family: "Courier New", monospace; font-size: 0.78rem; color: var(--neon-purple); }

/* ---- entry view ----------------------------------------------------------- */
.view { padding: 20px; }
.view h2 { margin-top: 0; font-family: "Trebuchet MS"; color: var(--ink); }
.view-meta { font-family: "Courier New", monospace; font-size: 0.8rem; color: #6a5d8a; margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 14px; }
.markdown-body { line-height: 1.65; font-size: 0.96rem; }
.markdown-body img { max-width: 100%; border: 3px solid var(--panel-edge); border-radius: 8px; box-shadow: 4px 4px 0 rgba(0,0,0,0.25); }
.markdown-body pre { background: #1b1040; color: #b6f; padding: 12px; border-radius: 8px; overflow-x: auto; }
.markdown-body code { font-family: "Courier New", monospace; background: #efeafc; padding: 1px 5px; border-radius: 4px; }
.markdown-body blockquote { border-left: 4px solid var(--neon-pink); margin-left: 0; padding-left: 14px; color: #4a4068; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { font-family: "Trebuchet MS"; }

.tags { display: flex; flex-wrap: wrap; gap: 5px; }

/* attachment gallery on view page */
.gallery { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.gallery a { font-size: 0.8rem; }
.gallery img { max-width: 160px; max-height: 160px; border: 2px solid var(--panel-edge); border-radius: 6px; }

/* inline video / pdf attachments share a captioned figure */
.media-attachment { margin: 0; display: flex; flex-direction: column; gap: 4px; flex: 1 1 320px; max-width: 100%; }
.media-attachment video { width: 100%; max-height: 420px; background: #000; border: 2px solid var(--panel-edge); border-radius: 6px; }
.media-attachment.pdf iframe { width: 100%; height: 480px; border: 2px solid var(--panel-edge); border-radius: 6px; background: #fff; }
.media-attachment figcaption { font-size: 0.8rem; }

/* ---- profile / danger zone ------------------------------------------------ */
.danger-zone { border-color: #d63333; }
.danger-zone h3 { color: #d63333; }
.danger-zone .check-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 0.85rem; cursor: pointer; }
.danger-zone .check-row input { width: auto; }
.view code { background: #f1eefb; border: 1px solid var(--panel-edge); border-radius: 4px; padding: 1px 5px; font-size: 0.85em; }
.export-status { font-size: 0.82rem; color: #6a5d8a; }
.btn-primary.disabled { opacity: 0.6; pointer-events: none; }

/* ---- toast / banners ------------------------------------------------------ */
.banner { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 0.85rem; border: 2px solid; }
.banner.error { background: #ffe3e3; border-color: #d63333; color: #8a1f1f; }
.banner.info  { background: #e3fbff; border-color: var(--neon-cyan); color: #075f5a; }

.spinner { text-align: center; padding: 30px; font-family: "Courier New", monospace; color: #fff; }

.footer { text-align: center; color: #cdbff0; font-size: 0.72rem; font-family: "Courier New", monospace; padding: 6px; }
.footer .blink { animation: blink 1.2s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

/* ---- ai entry drafting ---------------------------------------------------- */
.draft-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    vertical-align: middle;
    color: #fff;
    background: linear-gradient(180deg, var(--neon-cyan), #0a8f88);
    border: 2px solid var(--panel-edge);
    border-radius: 999px;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.25);
}
.ai-bar { border-color: var(--neon-cyan); margin-bottom: 14px; }
.ai-bar-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ai-hint, .ai-working { font-size: 0.8rem; color: #6a5d8a; }
.ai-working::after { content: " ▌"; animation: blink 1s steps(2) infinite; }
.ai-modify { margin-top: 12px; border-top: 2px dashed var(--panel-edge); padding-top: 12px; }
.big-mic { font-size: 1.05rem; padding: 14px 22px; }
.recording-line { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.rec-dot { color: #d63333; animation: blink 1s steps(2) infinite; }
