:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --line: #d9e2f2;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 88% 78%, rgba(236, 214, 221, 0.34) 0%, rgba(236, 214, 221, 0) 34%),
        radial-gradient(circle at 14% 72%, rgba(236, 226, 206, 0.28) 0%, rgba(236, 226, 206, 0) 32%),
        linear-gradient(180deg, #f2ece8 0%, #f4efeb 100%);
    color: var(--text);
}

.page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px;
}

.home-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}

.topbar-centered {
    justify-content: center;
    margin-bottom: 40px;
}

.brand {
    color: var(--text);
    font-size: 24px;
    font-weight: 700;
    text-decoration: none;
}

.brand-centered {
    text-align: center;
}

.nav {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.nav a,
.link-button {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.hero,
.card,
.panel,
.status-box {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

.hero {
    padding: 32px;
    margin-bottom: 24px;
}

.hero h1 {
    margin: 0 0 12px;
    font-size: 34px;
}

.hero.compact h1 {
    margin-bottom: 0;
}

.hero p {
    margin: 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.7;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.card {
    padding: 24px;
}

.card h2,
.panel h2,
.section h2,
.preview-body h1,
.preview-body h2,
.preview-body h3,
.preview-body h4,
.preview-body h5,
.preview-body h6 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 22px;
}

.preview-body h1 {
    font-size: 30px;
}

.preview-body h2 {
    font-size: 26px;
}

.preview-body h3 {
    font-size: 22px;
}

.card p,
.panel p,
.section p,
.section li,
.meta,
.empty,
.preview-body li {
    color: var(--muted);
    line-height: 1.7;
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 18px;
    border-radius: 10px;
    border: 0;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
}

.button.secondary {
    background: #e8eefc;
    color: var(--primary);
}

.button:hover,
button:hover {
    background: var(--primary-dark);
}

.button.secondary:hover {
    background: #dbe7ff;
}

.actions,
.table-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.actions {
    margin-top: 20px;
}

.home-main {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.home-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    width: 100%;
    padding-top: 12px;
}

.home-button {
    min-width: 168px;
    min-height: 52px;
    padding: 0 28px;
    border-radius: 14px;
    font-size: 18px;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.16);
}

.card.compact h2 {
    margin-bottom: 0;
}

.card.compact .actions {
    margin-top: 12px;
}

.card.actions-only .actions {
    margin-top: 0;
}

.panel {
    padding: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

input[type="text"],
input[type="search"],
input[type="file"],
select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 15px;
    background: #fff;
}

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 14px 12px;
    border-bottom: 1px solid #eef2f7;
    text-align: left;
    vertical-align: top;
}

.table th {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.badge {
    display: inline-flex;
    padding: 4px 10px;
    background: #eef4ff;
    color: var(--primary);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.pagination {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
    margin-top: 18px;
    flex-wrap: wrap;
}

.status-box {
    padding: 18px 20px;
    margin-bottom: 20px;
}

.status-box.success {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.status-box.error {
    border-color: #fecaca;
    background: #fef2f2;
}

.help-list {
    padding-left: 20px;
    margin: 0;
}

.code-inline,
.preview-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: #eef2ff;
    color: #4338ca;
    padding: 2px 8px;
    border-radius: 8px;
}

.preview-shell {
    display: grid;
    gap: 20px;
    min-width: 0;
}

.preview-shell-plain {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.preview-header {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.preview-title {
    margin: 0;
    font-size: clamp(20px, 4.2vw, 38px);
    line-height: 1.15;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.preview-meta {
    margin: 0;
    color: var(--muted);
    font-size: 16px;
}

.preview-actions {
    margin-top: 0;
    align-items: center;
    flex-wrap: wrap;
}

.preview-media {
    max-width: 100%;
    max-height: 75vh;
    display: block;
    margin: 0;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
}

.preview-frame {
    width: 100%;
    min-height: 75vh;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
}

.preview-text {
    margin: 0;
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #0f172a;
    color: #e2e8f0;
    overflow: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

.preview-body {
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
}

.preview-body pre {
    margin: 0 0 16px;
    padding: 16px;
    border-radius: 14px;
    background: #0f172a;
    color: #e2e8f0;
    overflow: auto;
}

.preview-body ul,
.preview-body ol {
    padding-left: 24px;
}

.preview-note {
    padding: 14px 16px;
    border-radius: 14px;
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #9a3412;
}

.download-link-box {
    display: grid;
    gap: 10px;
    padding: 16px 18px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
}

.download-link-label {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.download-link-button {
    white-space: nowrap;
}

.download-url-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--primary);
    font-size: clamp(14px, 2.5vw, 18px);
    font-weight: 600;
    line-height: 1.5;
    box-sizing: border-box;
    cursor: text;
}

.download-url-input:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.45);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

@media (max-width: 720px) {
    .page {
        padding: 18px;
    }

    .hero {
        padding: 24px;
    }

    .hero h1,
    .preview-body h1 {
        font-size: 28px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-centered {
        align-items: center;
    }

    .home-page {
        padding-top: 18px;
        padding-bottom: 18px;
    }

    .home-main {
        justify-content: flex-start;
    }

    .home-actions {
        gap: 14px;
    }

    .home-button {
        width: 100%;
        max-width: none;
        font-size: 17px;
    }
}
