:root {
    color-scheme: light;
    --bg: #f4f7fb;
    --surface: rgba(255, 255, 255, .86);
    --surface-strong: #fff;
    --text: #142033;
    --muted: #64748b;
    --line: #dbe3ef;
    --primary: #5b5cf0;
    --primary-hover: #4849d8;
    --accent: #17b897;
    --danger: #dc4c64;
    --shadow: 0 24px 70px rgba(43, 56, 91, .14);
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0c1220;
    --surface: rgba(20, 29, 48, .88);
    --surface-strong: #141d30;
    --text: #edf3ff;
    --muted: #9aa8bd;
    --line: #2a3750;
    --primary: #7c7df7;
    --primary-hover: #9293ff;
    --accent: #37d4b2;
    --danger: #ff7189;
    --shadow: 0 28px 80px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 12% 12%, rgba(91, 92, 240, .18), transparent 31rem),
        radial-gradient(circle at 88% 88%, rgba(23, 184, 151, .14), transparent 28rem),
        var(--bg);
    transition: background-color .25s, color .25s;
}

.shell { width: min(940px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 48px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 56px; }
.brand { color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: -.03em; font-size: 1.12rem; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; margin-right: 9px; border-radius: 11px; color: white; background: linear-gradient(135deg, var(--primary), var(--accent)); }
.nav { display: flex; align-items: center; gap: 8px; }
.nav a, .theme-toggle { border: 1px solid transparent; border-radius: 11px; padding: 9px 12px; color: var(--muted); background: transparent; font: inherit; text-decoration: none; cursor: pointer; }
.nav a:hover, .theme-toggle:hover { color: var(--text); background: var(--surface); border-color: var(--line); }
.theme-toggle { width: 42px; padding-inline: 0; font-size: 1.05rem; }

.card { max-width: 620px; margin: 0 auto; padding: clamp(24px, 5vw, 46px); border: 1px solid var(--line); border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.eyebrow { margin: 0 0 10px; color: var(--primary); font-size: .78rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.1rem); line-height: 1.04; letter-spacing: -.055em; }
.lead { margin: 16px 0 30px; color: var(--muted); line-height: 1.65; }
label { display: block; margin-bottom: 9px; font-size: .92rem; font-weight: 700; }
input[type="file"], .code-input { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 14px; color: var(--text); background: var(--surface-strong); font: inherit; outline: none; }
.text-input, textarea { width: 100%; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 14px; padding: 14px; color: var(--text); background: var(--surface-strong); font: inherit; outline: none; resize: vertical; }
.text-input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(91, 92, 240, .13); }
input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(91, 92, 240, .13); }
input[type="file"]::file-selector-button { margin-right: 12px; border: 0; border-radius: 9px; padding: 9px 12px; color: var(--text); background: var(--line); font-weight: 700; cursor: pointer; }
.code-input { text-align: center; font-size: 2rem; font-weight: 800; letter-spacing: .42em; padding-left: calc(14px + .42em); }
.hint { margin: 8px 0 0; color: var(--muted); font-size: .82rem; }
.button { display: inline-flex; justify-content: center; align-items: center; width: 100%; margin-top: 22px; border: 0; border-radius: 14px; padding: 14px 18px; color: #fff; background: var(--primary); font: inherit; font-weight: 800; cursor: pointer; box-shadow: 0 10px 24px rgba(91, 92, 240, .22); }
.button:hover { background: var(--primary-hover); transform: translateY(-1px); }
.alert { margin: 0 0 24px; padding: 14px 16px; border-radius: 13px; line-height: 1.5; }
.alert.error { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }
.success { text-align: center; }
.success-icon { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 18px; border-radius: 18px; color: #fff; background: var(--accent); font-size: 1.7rem; }
.access-code { margin: 22px 0 12px; color: var(--primary); font-size: clamp(2.7rem, 10vw, 4.7rem); font-weight: 900; letter-spacing: .2em; padding-left: .2em; line-height: 1; }
.filename { overflow-wrap: anywhere; color: var(--muted); }
.secondary-link { display: inline-block; margin-top: 24px; color: var(--primary); font-weight: 700; text-decoration: none; }
.footer { margin-top: 34px; color: var(--muted); text-align: center; font-size: .82rem; }

.hero { min-height: 480px; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr); align-items: center; gap: clamp(35px, 8vw, 90px); padding: 40px clamp(0px, 2vw, 20px) 80px; }
.hero-copy h1 { max-width: 680px; font-size: clamp(2.8rem, 7vw, 5.8rem); }
.hero-copy .lead { max-width: 650px; font-size: 1.08rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.button-auto { width: auto; margin-top: 0; padding-inline: 22px; text-decoration: none; }
.button-secondary { color: var(--text); background: var(--surface); border: 1px solid var(--line); box-shadow: none; }
.button-secondary:hover { color: #fff; background: var(--primary); }
.profile-art { position: relative; display: grid; place-items: center; aspect-ratio: 1; max-width: 310px; width: 100%; margin: auto; }
.profile-monogram { display: grid; place-items: center; width: 58%; aspect-ratio: 1; border-radius: 34%; color: white; background: linear-gradient(135deg, var(--primary), var(--accent)); box-shadow: var(--shadow); font-size: clamp(4rem, 10vw, 7rem); font-weight: 900; transform: rotate(-5deg); }
.orbit { position: absolute; border: 1px solid var(--line); border-radius: 50%; inset: 7%; animation: orbit 18s linear infinite; }
.orbit::after { content: ''; position: absolute; top: 7%; left: 14%; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 24px var(--accent); }
.orbit-two { inset: 0; animation-direction: reverse; animation-duration: 25s; }
.orbit-two::after { top: auto; left: auto; right: 7%; bottom: 19%; width: 12px; height: 12px; background: var(--primary); }
@keyframes orbit { to { transform: rotate(360deg); } }
.section-block { padding: 60px 0 30px; }
.section-block > h2 { margin: 0 0 26px; font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -.04em; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature-card { display: block; padding: 25px; border: 1px solid var(--line); border-radius: 20px; color: var(--text); background: var(--surface); text-decoration: none; transition: transform .2s, border-color .2s, box-shadow .2s; }
.feature-card:hover { transform: translateY(-5px); border-color: var(--primary); box-shadow: var(--shadow); }
.feature-icon { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 13px; color: white; background: linear-gradient(135deg, var(--primary), var(--accent)); font-size: 1.3rem; }
.feature-card h3 { margin: 20px 0 8px; font-size: 1.18rem; }
.feature-card p { min-height: 70px; margin: 0 0 18px; color: var(--muted); line-height: 1.55; }
.card-link { color: var(--primary); font-size: .9rem; font-weight: 800; }
.page-heading { max-width: 720px; padding: 55px 0 35px; }
.post-list { display: grid; gap: 16px; max-width: 780px; }
.post-card { overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); }
.post-card-body { padding: clamp(22px, 4vw, 34px); }
.post-card .post-media { width: 100%; max-height: 390px; border-radius: 0; margin: 0; }
.post-meta { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .82rem; }
.post-tag { padding: 5px 9px; border-radius: 999px; color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); font-weight: 800; }
.post-card h2 { margin: 18px 0 10px; font-size: clamp(1.35rem, 3vw, 1.85rem); letter-spacing: -.03em; }
.post-card h2 a { color: var(--text); text-decoration: none; }
.post-card h2 a:hover { color: var(--primary); }
.post-card p { margin: 0; color: var(--muted); line-height: 1.65; }
.quick-links { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px 18px; margin: 28px auto 0; color: var(--muted); font-size: .9rem; }
.quick-links a { color: var(--primary); font-weight: 800; text-decoration: none; }
.quick-links a:hover { text-decoration: underline; }
.single-post { max-width: 800px; margin: 30px auto 0; }
.single-post h1 { margin-bottom: 12px; }
.post-date { display: block; color: var(--muted); font-size: .88rem; }
.post-media { display: block; width: 100%; max-height: 560px; margin: 30px 0; border-radius: 22px; background: #05070c; object-fit: cover; }
.post-content { margin-top: 30px; color: var(--text); font-size: 1.06rem; line-height: 1.85; overflow-wrap: anywhere; }
.back-link { display: inline-block; margin-bottom: 35px; color: var(--primary); font-weight: 800; text-decoration: none; }
.empty-state { padding: 40px; border: 1px dashed var(--line); border-radius: 20px; color: var(--muted); text-align: center; }
.owner-card { max-width: 760px; }
.owner-card label { margin-top: 4px; }
.optional { color: var(--muted); font-weight: 500; }
.admin-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 25px; margin: 35px 0; }
.admin-heading .lead { margin-bottom: 0; }
.admin-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.admin-card { display: flex; align-items: flex-start; gap: 18px; padding: 25px; border: 1px solid var(--line); border-radius: 20px; color: var(--text); background: var(--surface); text-decoration: none; transition: .2s; }
.admin-card:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: var(--shadow); }
.admin-card .feature-icon { flex: 0 0 auto; }
.admin-card h2 { margin: 2px 0 7px; font-size: 1.12rem; }
.admin-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.danger-link { border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); border-radius: 11px; padding: 10px 13px; color: var(--danger); background: transparent; font: inherit; font-weight: 700; cursor: pointer; }
.success-alert { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.admin-editor { max-width: 800px; margin: 25px auto; padding: clamp(22px, 4vw, 38px); border: 1px solid var(--line); border-radius: 24px; background: var(--surface); }
.editor-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 28px; }
.editor-heading h1 { font-size: clamp(1.8rem, 4vw, 2.7rem); }
.current-media { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 18px; padding: 13px; border-radius: 12px; color: var(--muted); background: var(--surface-strong); }
.current-media a { color: var(--primary); font-weight: 700; }
.check-label { display: inline-flex; align-items: center; gap: 7px; margin: 0 0 0 auto !important; color: var(--danger); cursor: pointer; }
.admin-post-list { display: grid; gap: 12px; }
.admin-post-row { display: flex; justify-content: space-between; gap: 28px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.admin-post-info { min-width: 0; }
.admin-post-info h2 { margin: 6px 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.admin-post-info p { margin: 0; color: var(--muted); line-height: 1.5; }
.row-actions { display: flex; align-items: center; flex: 0 0 auto; gap: 8px; }
.row-actions a, .row-actions button { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; color: var(--muted); background: transparent; font: inherit; font-size: .82rem; font-weight: 700; text-decoration: none; cursor: pointer; }
.row-actions .edit-action { color: var(--primary); }
.row-actions button { color: var(--danger); }
.row-actions form { margin: 0; }
.file-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.admin-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.admin-table th, .admin-table td { padding: 15px 17px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.admin-table th { color: var(--muted); font-size: .76rem; letter-spacing: .05em; text-transform: uppercase; }
.admin-table td { color: var(--muted); font-size: .9rem; }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: color-mix(in srgb, var(--primary) 4%, transparent); }
.admin-table .file-name-cell { max-width: 310px; color: var(--text); font-weight: 700; overflow-wrap: anywhere; }
.code-badge { display: inline-block; border-radius: 8px; padding: 6px 9px; color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); font-weight: 900; letter-spacing: .1em; }
.table-action { border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; color: var(--primary); font-size: .82rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
.table-actions { display: flex; align-items: center; gap: 7px; }
.table-actions form { margin: 0; }
.table-delete { border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); border-radius: 9px; padding: 7px 9px; color: var(--danger); background: transparent; font: inherit; font-size: .82rem; font-weight: 800; cursor: pointer; white-space: nowrap; }
.table-delete:hover { color: white; background: var(--danger); }
.compact-editor { max-width: 650px; }
.file-summary { display: flex; gap: 12px; margin: -10px 0 25px; color: var(--muted); font-size: .85rem; }
.file-summary span + span::before { content: '•'; margin-right: 12px; }
.short-code { max-width: 180px; font-size: 1.35rem; font-weight: 900; letter-spacing: .2em; }

@media (max-width: 560px) {
    .shell { width: min(100% - 20px, 940px); padding-top: 15px; }
    .topbar { margin-bottom: 30px; }
    .nav a { display: none; }
    .card { border-radius: 22px; }
}

@media (max-width: 800px) {
    .hero { grid-template-columns: 1fr; padding-top: 20px; }
    .profile-art { order: -1; max-width: 190px; }
    .feature-grid { grid-template-columns: 1fr; }
    .feature-card p { min-height: 0; }
    .admin-grid { grid-template-columns: 1fr; }
    .admin-heading, .admin-post-row { align-items: stretch; flex-direction: column; }
    .row-actions { flex-wrap: wrap; }
}
