:root {
    --bg: #f6f1e8;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-strong: #fffaf2;
    --text: #1e1b16;
    --muted: #6f6557;
    --accent: #0d6b5f;
    --accent-dark: #084b42;
    --danger: #b14530;
    --border: rgba(39, 30, 17, 0.12);
    --shadow: 0 18px 40px rgba(58, 40, 14, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Avenir Next", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(13, 107, 95, 0.12), transparent 28%),
        radial-gradient(circle at bottom right, rgba(177, 69, 48, 0.12), transparent 24%),
        linear-gradient(180deg, #f8f4ed 0%, var(--bg) 100%);
}

a {
    color: inherit;
}

.container {
    width: min(1100px, calc(100% - 2rem));
    margin: 0 auto;
}

.topbar {
    position: sticky;
    top: 0;
    backdrop-filter: blur(14px);
    background: rgba(246, 241, 232, 0.75);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

.brand {
    font-size: 1.3rem;
    font-weight: 800;
    text-decoration: none;
    letter-spacing: 0.04em;
}

.nav {
    display: flex;
    gap: 1rem;
}

.nav a {
    text-decoration: none;
    color: var(--muted);
}

.page {
    padding: 3rem 0;
}

.footer {
    padding: 0 0 2rem;
    color: var(--muted);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.hero {
    padding: 3rem;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.76rem;
    color: var(--accent);
    font-weight: 700;
}

h1, h2, h3, p {
    margin-top: 0;
}

h1 {
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1.05;
    margin-bottom: 1rem;
}

.actions,
.card-head {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    padding: 0.9rem 1.3rem;
    text-decoration: none;
    background: var(--accent);
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: transform 160ms ease, background 160ms ease;
}

.button:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
}

.button-secondary {
    background: #ece2d0;
    color: var(--text);
}

.button-danger {
    background: var(--danger);
}

.button-small {
    padding: 0.65rem 1rem;
    font-size: 0.92rem;
}

.stack {
    display: grid;
    gap: 1rem;
}

label {
    display: grid;
    gap: 0.45rem;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--border);
    padding: 0.9rem 1rem;
    font: inherit;
    background: var(--surface-strong);
}

.grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1.1fr 1fr;
}

.share-list {
    display: grid;
    gap: 1rem;
}

.share-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border-radius: 18px;
    background: rgba(255, 250, 242, 0.9);
    border: 1px solid var(--border);
}

.replace-box {
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border);
}

.replace-box summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--accent-dark);
}

.replace-form {
    margin-top: 0.9rem;
}

.replace-current,
.replace-selected {
    margin-bottom: 0;
}

.replace-selected {
    font-weight: 700;
    color: var(--accent-dark);
}

.meta {
    color: var(--muted);
    font-size: 0.95rem;
}

.upload-status {
    min-height: 1.4rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.upload-status-info {
    color: var(--accent-dark);
}

.upload-status-error {
    color: var(--danger);
}

.flash-list {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.flash {
    border-radius: 14px;
    padding: 0.95rem 1rem;
    border: 1px solid var(--border);
}

.flash-success {
    background: rgba(13, 107, 95, 0.12);
}

.flash-error {
    background: rgba(177, 69, 48, 0.12);
}

.auth-card,
.share-card {
    max-width: 620px;
}

.download-box {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    border-radius: 18px;
    background: rgba(13, 107, 95, 0.08);
}

.archive-browser {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.archive-browser-head {
    margin-bottom: 1rem;
}

.file-tree {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.75rem;
}

.file-tree .file-tree {
    margin-top: 0.75rem;
    margin-left: 1rem;
}

.file-tree-item {
    list-style: none;
}

.tree-folder,
.tree-file-row {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 250, 242, 0.82);
    padding: 0.85rem 1rem;
}

.tree-folder summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-weight: 700;
    flex-wrap: wrap;
}

.tree-folder summary::-webkit-details-marker {
    display: none;
}

.tree-folder-meta {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
}

.tree-count-icon {
    display: inline-block;
    margin-right: 0.15rem;
}

.tree-count-separator {
    display: inline-block;
    margin: 0 0.35rem;
}

.tree-file-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.tree-file-row > div:first-child,
.tree-file-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.tree-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4.5rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: rgba(13, 107, 95, 0.12);
    color: var(--accent-dark);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

@media (max-width: 860px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 2rem;
    }

    .share-item {
        flex-direction: column;
    }

    .file-tree .file-tree {
        margin-left: 0.35rem;
    }
}
