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

body {
    background: #e9eaef;
    color: #1a1a1a;
    font-family: 'Lexend', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
}

.page {
    max-width: 680px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem 4rem;
}

/* ── Header ─────────────────────────────────────────── */
.site-header { margin-bottom: 1rem; }

.back-link {
    font-size: 0.72rem;
    font-weight: 300;
    color: #aaa;
    text-decoration: none;
    display: block;
    margin-bottom: 0.3rem;
    transition: color 0.12s;
}
.back-link:hover { color: #555; }

.site-name {
    font-family: 'Matemasie', sans-serif;
    font-size: 1.7rem;
    font-weight: 400;
    background: linear-gradient(
        120deg,
        #0a0a0a, #4a4a4a, #606060, #1c1c1c,
        #555, #111, #3a3a3a, #0a0a0a
    );
    background-size: 350% 350%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: aurora 70s ease infinite;
    display: inline-block;
}

@keyframes aurora {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ── Server status ───────────────────────────────────── */
.server-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ccc;
    flex-shrink: 0;
    transition: background 0.3s;
}
.status-dot.ok      { background: #2a8a80; }
.status-dot.loading { background: #b87215; animation: pulse 1.2s ease-in-out infinite; }
.status-dot.error   { background: #c0392b; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
}

.status-label {
    font-size: 0.7rem;
    font-weight: 300;
    color: #aaa;
}

/* ── Source tabs ─────────────────────────────────────── */
.source-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0.9rem;
    border-bottom: 1px solid #d8dae3;
}

.source-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    padding: 0.35rem 0.9rem 0.35rem 0;
    font-family: 'Bagel Fat One', sans-serif;
    font-size: 0.72rem;
    color: #aaa;
    cursor: pointer;
    transition: color 0.12s, border-color 0.12s;
}
.source-tab.active      { color: #2a8a80; border-bottom-color: #2a8a80; }
.source-tab:hover:not(.active) { color: #555; }

/* ── Drop zone ───────────────────────────────────────── */
.drop-zone {
    border: 1.5px dashed #c8cad3;
    border-radius: 10px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: #fff;
    margin-bottom: 1rem;
    user-select: none;
}
.drop-zone:hover, .drop-zone.drag-over {
    border-color: #2a8a80;
    background: #f4fbfa;
}
.drop-icon {
    font-size: 1.8rem;
    color: #ccc;
    margin-bottom: 0.5rem;
    transition: color 0.15s;
}
.drop-zone:hover .drop-icon { color: #2a8a80; }
.drop-label { font-size: 0.85rem; font-weight: 400; color: #555; }
.drop-sub   { font-size: 0.7rem; font-weight: 300; color: #aaa; margin-top: 0.2rem; }
.mono       { font-family: monospace; font-size: 0.9em; }

/* ── Notion panel ────────────────────────────────────── */
.notion-db-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0.6rem;
    border-bottom: 1px solid #d8dae3;
}

.notion-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    padding: 0.3rem 0.75rem 0.3rem 0;
    font-family: 'Lexend', sans-serif;
    font-size: 0.72rem;
    font-weight: 300;
    color: #aaa;
    cursor: pointer;
    transition: color 0.12s, border-color 0.12s;
}
.notion-tab.active           { color: #2a8a80; border-bottom-color: #2a8a80; }
.notion-tab:hover:not(.active) { color: #555; }

.notion-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
    border: 1px solid #d8dae3;
    border-radius: 8px;
    background: #fff;
}

.notion-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.8rem;
    border-bottom: 1px solid #edeef3;
    cursor: pointer;
    transition: background 0.1s;
}
.notion-row:last-child { border-bottom: none; }
.notion-row:hover      { background: #f5f6fa; }
.notion-row.loading-row { pointer-events: none; }

.notion-row-body { flex: 1; min-width: 0; }
.notion-row-title {
    font-size: 0.8rem;
    font-weight: 400;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notion-row-meta {
    font-size: 0.67rem;
    font-weight: 300;
    color: #aaa;
}
.notion-row-arrow {
    font-size: 0.7rem;
    color: #ccc;
    flex-shrink: 0;
}

.loading {
    font-size: 0.78rem;
    font-weight: 300;
    color: #aaa;
    padding: 1rem 0.8rem;
}

/* ── Editor panel ────────────────────────────────────── */
#editor-panel { margin-bottom: 0.75rem; }

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}

.editor-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    margin-right: 0.75rem;
}

.editor-clear {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 300;
    color: #aaa;
    padding: 0.1rem 0.3rem;
    flex-shrink: 0;
    transition: color 0.12s;
}
.editor-clear:hover { color: #555; }

.editor-area {
    width: 100%;
    min-height: 280px;
    max-height: 520px;
    padding: 0.75rem 0.9rem;
    font-family: 'Lexend', sans-serif;
    font-size: 0.78rem;
    font-weight: 300;
    line-height: 1.65;
    color: #1a1a1a;
    background: #fff;
    border: 1px solid #d8dae3;
    border-radius: 8px;
    resize: vertical;
    outline: none;
    transition: border-color 0.12s;
    display: block;
}
.editor-area:focus { border-color: #2a8a80; }

.editor-hint {
    font-size: 0.67rem;
    font-weight: 300;
    color: #bbb;
    margin-top: 0.3rem;
    margin-bottom: 0.75rem;
}

/* ── Options ─────────────────────────────────────────── */
.options-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.option-label {
    font-size: 0.7rem;
    font-weight: 300;
    color: #aaa;
}

.option-select {
    font-family: 'Lexend', sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    color: #1a1a1a;
    background: #fff;
    border: 1px solid #d8dae3;
    border-radius: 5px;
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.12s;
}
.option-select:focus { border-color: #2a8a80; }

/* ── Convert button ──────────────────────────────────── */
.convert-btn {
    width: 100%;
    padding: 0.75rem;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: 'Lexend', sans-serif;
    font-size: 0.82rem;
    font-weight: 400;
    cursor: pointer;
    transition: background 0.12s, opacity 0.12s;
}
.convert-btn:hover    { background: #333; }
.convert-btn:disabled { opacity: 0.4; pointer-events: none; }

/* ── Progress ────────────────────────────────────────── */
.progress-wrap {
    height: 3px;
    background: #e8eaf0;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.4rem;
    margin-top: 0.75rem;
}

.progress-bar {
    height: 100%;
    background: #2a8a80;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

.progress-label {
    font-size: 0.7rem;
    font-weight: 300;
    color: #aaa;
    margin-bottom: 0.75rem;
}

/* ── Player card ─────────────────────────────────────── */
.player-card {
    background: #fff;
    border: 1px solid #d8dae3;
    border-radius: 10px;
    padding: 1rem;
    margin-top: 0.75rem;
}

.player-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.player-info   { flex: 1; min-width: 0; }
.player-filename {
    font-size: 0.82rem;
    font-weight: 400;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player-duration {
    font-size: 0.68rem;
    font-weight: 300;
    color: #aaa;
    margin-top: 0.1rem;
}

.download-btn {
    font-size: 0.72rem;
    font-weight: 300;
    color: #2a8a80;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0.25rem 0;
    transition: opacity 0.12s;
}
.download-btn:hover { opacity: 0.6; }

.scrubber-wrap {
    height: 3px;
    background: #e8eaf0;
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    margin-bottom: 0.6rem;
}
.scrubber-bar {
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    background: #2a8a80;
    width: 0%;
    border-radius: 2px;
    pointer-events: none;
    transition: width 0.2s linear;
}

.ctrl-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ctrl-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Lexend', sans-serif;
    font-size: 0.72rem;
    font-weight: 400;
    color: #555;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    transition: background 0.1s;
}
.ctrl-btn:hover { background: #f0f1f5; }

.play-btn {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    color: #fff;
    border-radius: 50%;
    font-size: 0.8rem;
    padding: 0;
}
.play-btn:hover { background: #333; }

/* ── Error ───────────────────────────────────────────── */
.error-msg {
    font-size: 0.78rem;
    font-weight: 300;
    color: #c0392b;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 7px;
    padding: 0.7rem 0.9rem;
    margin-top: 0.75rem;
}

/* ── Mobile ─────────────────────────────────────────── */
@media (max-width: 520px) {
    .page { padding: 0.75rem 1rem 3rem; }
}
