:root {
    --bg: #070914;
    --panel: rgba(255,255,255,.075);
    --panel-strong: rgba(255,255,255,.11);
    --border: rgba(255,255,255,.16);
    --text: #f7f8ff;
    --muted: #aeb4c8;
    --accent: #9e8cff;
    --accent-2: #59d8ff;
    --danger: #ff7f96;
    --success: #68e0a3;
    --shadow: 0 25px 80px rgba(0,0,0,.38);
    --radius: 28px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
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 15% 15%, rgba(109,84,255,.22), transparent 32rem),
        radial-gradient(circle at 85% 75%, rgba(40,188,255,.17), transparent 35rem),
        var(--bg);
    line-height: 1.5;
    overflow-x: hidden;
}

a { color: inherit; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }

.noise {
    position: fixed;
    inset: 0;
    opacity: .025;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
}

.ambient {
    position: fixed;
    border-radius: 999px;
    filter: blur(10px);
    opacity: .5;
    pointer-events: none;
    animation: drift 12s ease-in-out infinite alternate;
}
.ambient-one { width: 280px; height: 280px; background: rgba(128,92,255,.25); top: -80px; left: -70px; }
.ambient-two { width: 330px; height: 330px; background: rgba(44,195,255,.18); right: -100px; bottom: -110px; animation-delay: -4s; }
.ambient-three { width: 210px; height: 210px; background: rgba(255,77,184,.12); left: 58%; top: 35%; animation-delay: -7s; }
@keyframes drift { to { transform: translate3d(30px, 20px, 0) scale(1.08); } }

.glass-panel {
    background: linear-gradient(135deg, rgba(255,255,255,.11), rgba(255,255,255,.045));
    border: 1px solid var(--border);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.1);
    backdrop-filter: blur(24px) saturate(145%);
    -webkit-backdrop-filter: blur(24px) saturate(145%);
}

.front-body { display: flex; flex-direction: column; }
.front-shell {
    width: min(100% - 28px, 760px);
    margin: auto;
    padding: 54px 0 28px;
    position: relative;
    z-index: 1;
}
.hero { border-radius: 36px; padding: clamp(28px, 6vw, 58px); text-align: center; }
.avatar {
    width: 78px;
    height: 78px;
    margin: 0 auto 20px;
    display: grid;
    place-items: center;
    border-radius: 24px;
    font-size: 38px;
    background: linear-gradient(145deg, rgba(255,255,255,.2), rgba(255,255,255,.06));
    border: 1px solid rgba(255,255,255,.2);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 20px 45px rgba(0,0,0,.2);
    overflow: hidden;
}
.avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
.avatar-circle { border-radius: 50%; }
.avatar-wide { width: 168px; height: 92px; border-radius: 24px; }
.avatar.has-photo { background: rgba(255,255,255,.08); }
.avatar.small { width: 64px; height: 64px; font-size: 30px; border-radius: 20px; }
.eyebrow { margin: 0 0 8px; letter-spacing: .22em; font-size: .72rem; font-weight: 800; color: #c5bfff; }
h1 { margin: 0; font-size: clamp(2rem, 7vw, 4.3rem); line-height: 1.04; letter-spacing: -.055em; }
.intro, .muted { color: var(--muted); }
.intro { margin: 15px auto 30px; max-width: 520px; font-size: 1.04rem; }

.links-grid { display: grid; gap: 14px; }
.glass-link {
    position: relative;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 30px;
    align-items: center;
    gap: 14px;
    min-height: 78px;
    padding: 13px 17px;
    text-align: left;
    text-decoration: none;
    border-radius: 22px;
    border: 1px solid rgba(255,255,255,.14);
    background: linear-gradient(115deg, rgba(255,255,255,.09), rgba(255,255,255,.035));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.09), 0 12px 30px rgba(0,0,0,.12);
    transition: transform .22s ease, border-color .22s ease, background .22s ease, box-shadow .22s ease;
    overflow: hidden;
}
.glass-link::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 25%, rgba(255,255,255,.12), transparent 65%);
    transform: translateX(-120%);
    transition: transform .55s ease;
}
.glass-link:hover, .glass-link:focus-visible {
    transform: translateY(-3px) scale(1.008);
    border-color: rgba(255,255,255,.28);
    background: linear-gradient(115deg, rgba(255,255,255,.15), rgba(255,255,255,.055));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 18px 40px rgba(0,0,0,.2);
    outline: none;
}
.glass-link:hover::before { transform: translateX(120%); }
.link-icon, .mini-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 15px;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.12);
    font-size: 1.35rem;
}
.link-copy { min-width: 0; display: flex; flex-direction: column; }
.link-copy strong { font-size: 1rem; letter-spacing: -.01em; }
.link-copy small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-arrow { color: #d9d5ff; font-size: 1.2rem; transition: transform .2s ease; }
.glass-link:hover .link-arrow { transform: translate(2px, -2px); }
.site-footer { position: relative; z-index: 1; padding: 10px 20px 28px; text-align: center; color: #80879e; font-size: .82rem; }
.empty-state { padding: 28px; color: var(--muted); border: 1px dashed rgba(255,255,255,.16); border-radius: 20px; }
.empty-state.roomy { margin: 20px; }

.login-body { display: grid; place-items: center; padding: 24px; }
.login-shell { width: min(100%, 450px); position: relative; z-index: 1; }
.login-card { border-radius: 30px; padding: clamp(26px, 6vw, 42px); }
.login-card h1 { font-size: 2.25rem; margin-top: 4px; }
.login-card .muted { margin: 8px 0 24px; }
.back-link { display: inline-block; margin-bottom: 26px; text-decoration: none; color: var(--muted); font-size: .9rem; }
.back-link:hover { color: var(--text); }

label { display: grid; gap: 8px; margin-bottom: 18px; font-size: .88rem; font-weight: 700; color: #d9dced; }
input, textarea, select {
    width: 100%;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 14px;
    background: rgba(4,7,17,.42);
    color: var(--text);
    padding: 13px 14px;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
textarea { resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #c9ccef 50%), linear-gradient(135deg, #c9ccef 50%, transparent 50%); background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px); background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; padding-right: 38px; }
select option { background: #111526; color: var(--text); }
input[type="file"] { padding: 9px; }
input[type="file"]::file-selector-button { border: 0; border-radius: 10px; padding: 9px 12px; margin-right: 10px; background: rgba(255,255,255,.11); color: var(--text); cursor: pointer; font-weight: 800; }
input:focus, textarea:focus, select:focus { border-color: rgba(158,140,255,.72); box-shadow: 0 0 0 4px rgba(158,140,255,.12); background-color: rgba(4,7,17,.58); }
.field-help { color: var(--muted); font-size: .75rem; font-weight: 500; line-height: 1.4; }

.primary-button, .secondary-button, .icon-button {
    appearance: none;
    border: 0;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    font-weight: 800;
    transition: transform .18s ease, filter .18s ease, background .18s ease;
}
.primary-button {
    width: 100%;
    min-height: 48px;
    padding: 12px 18px;
    background: linear-gradient(135deg, var(--accent), #6b8cff);
    color: white;
    box-shadow: 0 13px 30px rgba(112,104,255,.27), inset 0 1px 0 rgba(255,255,255,.25);
}
.primary-button.inline { width: auto; white-space: nowrap; }
.primary-button:hover, .secondary-button:hover, .icon-button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.secondary-button { min-height: 46px; padding: 11px 18px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.13); }

.alert { border-radius: 15px; padding: 12px 15px; margin-bottom: 20px; font-size: .9rem; }
.alert ul { margin: 8px 0 0; padding-left: 20px; }
.alert.error { background: rgba(255,75,111,.12); border: 1px solid rgba(255,127,150,.27); color: #ffd2da; }
.alert.success { background: rgba(63,215,142,.12); border: 1px solid rgba(104,224,163,.27); color: #c9ffe1; }

.admin-body { padding-top: 92px; }
.admin-topbar {
    position: fixed;
    z-index: 20;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    width: min(100% - 28px, 1180px);
    min-height: 62px;
    padding: 10px 12px 10px 18px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand { text-decoration: none; font-weight: 900; display: flex; align-items: center; gap: 9px; letter-spacing: -.02em; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: rgba(255,255,255,.1); }
.admin-nav { display: flex; align-items: center; gap: 4px; }
.admin-nav a { text-decoration: none; color: var(--muted); font-size: .88rem; font-weight: 700; padding: 10px 12px; border-radius: 11px; }
.admin-nav a:hover { color: var(--text); background: rgba(255,255,255,.07); }
.menu-button { display: none; border: 0; background: rgba(255,255,255,.08); width: 42px; height: 42px; border-radius: 12px; cursor: pointer; }
.admin-shell { width: min(100% - 28px, 1180px); min-height: calc(100vh - 145px); margin: 0 auto; position: relative; z-index: 2; padding: 28px 0 55px; }
.admin-footer { padding-bottom: 24px; }
.dashboard-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin: 25px 0 26px; }
.dashboard-heading.compact { margin-bottom: 22px; }
.dashboard-heading h1 { font-size: clamp(2.2rem, 6vw, 3.8rem); }
.dashboard-heading .muted { margin: 10px 0 0; }
.heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 18px; }
.stat-card { border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.stat-card span { color: var(--muted); font-size: .86rem; font-weight: 700; }
.stat-card strong { font-size: 2rem; line-height: 1; }
.content-card, .form-card { border-radius: var(--radius); overflow: hidden; }
.table-heading { padding: 20px 22px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(255,255,255,.1); }
.table-heading h2 { margin: 0; font-size: 1.15rem; }
.table-heading span { color: var(--muted); font-size: .84rem; }
.responsive-table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 16px 18px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.08); vertical-align: middle; }
th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; }
td { font-size: .9rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255,255,255,.025); }
.link-title-cell { display: flex; align-items: center; gap: 12px; min-width: 190px; }
.mini-icon { width: 38px; height: 38px; border-radius: 12px; font-size: 1rem; }
.link-title-cell div { display: flex; flex-direction: column; }
.link-title-cell small { color: var(--muted); max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-url { display: block; color: #bab5ff; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.status { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 9px; font-size: .75rem; font-weight: 800; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.active { background: rgba(70,213,147,.11); color: var(--success); }
.status.hidden, .status.private { background: rgba(255,255,255,.07); color: #a5aabc; }
.actions-column { text-align: right; }
.actions { text-align: right; white-space: nowrap; }
.inline-form { display: inline; }
.icon-button { min-height: 34px; padding: 7px 10px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); font-size: .78rem; }
.icon-button.danger { color: #ffbac7; background: rgba(255,80,115,.08); }


.appearance-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
    gap: 18px;
    align-items: start;
}
.appearance-preview {
    position: sticky;
    top: 106px;
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
}
.preview-hero {
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 24px;
    padding: 26px 20px;
    background: linear-gradient(135deg, rgba(255,255,255,.07), rgba(255,255,255,.025));
}
.preview-hero h2 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.5rem); line-height: 1.05; letter-spacing: -.045em; overflow-wrap: anywhere; }
.preview-hero .muted { margin: 12px 0 0; font-size: .9rem; }
.preview-note { margin: 16px 2px 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.remove-image-toggle { margin: 2px 0 20px; padding: 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 15px; background: rgba(255,255,255,.035); }

.form-card { padding: clamp(22px, 5vw, 36px); }
.form-card.narrow { max-width: 650px; }
.admin-form { max-width: 850px; }
.form-row { display: grid; gap: 16px; }
.two-columns { grid-template-columns: minmax(0, 2fr) minmax(150px, 1fr); }
.align-end { align-items: end; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 6px; }
.switch-label { display: flex; align-items: center; gap: 11px; min-height: 48px; cursor: pointer; }
.switch-label input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 44px; height: 24px; border-radius: 999px; background: rgba(255,255,255,.15); position: relative; transition: background .2s; }
.switch::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: white; top: 3px; left: 3px; transition: transform .2s; box-shadow: 0 3px 10px rgba(0,0,0,.3); }
.switch-label input:checked + .switch { background: linear-gradient(135deg, var(--accent), #6b8cff); }
.switch-label input:checked + .switch::after { transform: translateX(20px); }

@media (max-width: 800px) {
    .menu-button { display: grid; place-items: center; }
    .admin-nav {
        display: none;
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        right: 0;
        padding: 10px;
        flex-direction: column;
        align-items: stretch;
        background: rgba(12,14,28,.94);
        border: 1px solid var(--border);
        border-radius: 17px;
        box-shadow: var(--shadow);
        backdrop-filter: blur(20px);
    }
    .admin-nav.open { display: flex; }
    .admin-nav a { padding: 11px 12px; }
    .dashboard-heading { align-items: stretch; flex-direction: column; }
    .dashboard-heading .primary-button { align-self: flex-start; }
    .heading-actions { justify-content: flex-start; }
    .appearance-layout { grid-template-columns: 1fr; }
    .appearance-preview { position: static; }
    .stats-grid { grid-template-columns: 1fr; }
    .responsive-table { overflow: visible; padding: 10px; }
    table, thead, tbody, th, td, tr { display: block; }
    thead { display: none; }
    tbody { display: grid; gap: 10px; }
    tbody tr { border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.035); border-radius: 17px; padding: 12px; }
    td { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 12px; padding: 8px 4px; border: 0; text-align: left !important; white-space: normal; }
    td::before { content: attr(data-label); color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; padding-top: 5px; }
    .table-url { max-width: 100%; }
    .actions { white-space: normal; }
    .actions .inline-form { display: inline-block; margin: 2px 2px 2px 0; }
}

@media (max-width: 560px) {
    .front-shell { width: min(100% - 18px, 760px); padding-top: 24px; }
    .hero { padding: 24px 16px; border-radius: 28px; }
    .glass-link { grid-template-columns: 42px minmax(0, 1fr) 24px; padding: 12px; border-radius: 18px; min-height: 72px; }
    .link-icon { width: 40px; height: 40px; border-radius: 13px; }
    .admin-topbar, .admin-shell { width: calc(100% - 18px); }
    .admin-shell { padding-top: 14px; }
    .two-columns { grid-template-columns: 1fr; }
    .form-actions { flex-direction: column-reverse; }
    .form-actions > * { width: 100% !important; }
    .heading-actions { width: 100%; }
    .heading-actions > * { width: 100% !important; }
    .avatar-wide { width: 150px; height: 84px; }
    td { grid-template-columns: 68px minmax(0, 1fr); }
    .link-title-cell { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Account and Authenticator security */
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.label-row a { color: #bab5ff; font-size: .78rem; font-weight: 700; text-decoration: none; }
.label-row a:hover { text-decoration: underline; }
.login-note { margin: 16px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.5; text-align: center; }
.code-input { letter-spacing: .32em; font-variant-numeric: tabular-nums; font-weight: 900; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; align-items: start; }
.settings-grid .form-card { height: 100%; }
.section-heading { margin-bottom: 24px; }
.section-heading h2 { margin: 3px 0 0; font-size: 1.35rem; }
.section-heading.split { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.section-heading.split .muted { margin: 8px 0 0; max-width: 720px; }
.authenticator-card { margin-top: 18px; }
.security-summary { max-width: 820px; margin-bottom: 22px; }
.security-summary p { margin: 0 0 8px; }
.setup-panel { border: 1px solid rgba(255,255,255,.1); border-radius: 20px; padding: clamp(18px, 4vw, 26px); background: rgba(255,255,255,.035); }
.setup-panel h3 { margin-top: 0; }
.setup-steps { padding-left: 22px; color: #d9dced; }
.setup-steps li { margin-bottom: 8px; }
.secret-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid rgba(158,140,255,.38); background: rgba(4,7,17,.55); padding: 12px 14px; border-radius: 14px; margin: 14px 0; }
.secret-box code { overflow-wrap: anywhere; letter-spacing: .12em; font-size: clamp(.82rem, 2vw, 1rem); color: #e4e1ff; }
.secret-box .copy-button { flex: 0 0 auto; }
.advanced-details { margin: 10px 0 14px; }
.advanced-details summary { cursor: pointer; color: var(--muted); font-size: .82rem; }
.uri-code { display: block; margin-top: 10px; padding: 12px; border-radius: 12px; background: rgba(4,7,17,.5); overflow-wrap: anywhere; color: #bfc4d8; font-size: .72rem; }
.warning-help { padding: 11px 12px; border-left: 3px solid #d8c477; background: rgba(216,196,119,.07); border-radius: 0 10px 10px 0; }
.setup-confirm-form { margin-top: 22px; }
.auth-actions-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.compact-form { border: 1px solid rgba(255,255,255,.1); border-radius: 18px; padding: 20px; background: rgba(255,255,255,.025); }
.compact-form label:last-of-type { margin-bottom: 16px; }
.compact-form .secondary-button, .compact-form .primary-button { width: 100%; }
.setup-start-form { max-width: 520px; }
.danger-zone { border-color: rgba(255,127,150,.22); }
.danger-button { color: #ffd2da; background: rgba(255,75,111,.1); border-color: rgba(255,127,150,.25); }

@media (max-width: 800px) {
    .settings-grid, .auth-actions-grid { grid-template-columns: 1fr; }
    .section-heading.split { flex-direction: column; }
}

@media (max-width: 560px) {
    .secret-box { align-items: stretch; flex-direction: column; }
    .secret-box .copy-button { width: 100%; }
}
