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

:root {
    --bg: #09090b;
    --surface: #131316;
    --surface2: #1a1a1f;
    --surface3: #222228;
    --border: #27272a;
    --border-hover: #3f3f46;
    --text: #fafafa;
    --text-secondary: #a1a1aa;
    --text-dim: #71717a;
    --accent: #6d5cff;
    --accent-hover: #7c6dff;
    --accent-glow: rgba(109, 92, 255, 0.15);
    --accent-subtle: rgba(109, 92, 255, 0.08);
    --danger: #ef4444;
    --danger-subtle: rgba(239, 68, 68, 0.1);
    --success: #22c55e;
    --success-subtle: rgba(34, 197, 94, 0.1);
    --warning: #f59e0b;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.35);
    --transition: 0.15s ease;

    /* Landscape defaults (noon) */
    --sky-top: #1e90ff;
    --sky-bottom: #87ceeb;
    --hill-back: #4a8c3f;
    --hill-mid: #5da04e;
    --hill-front: #6db85a;
    --cloud-opacity: 0.9;
    --star-opacity: 0;
    --moon-opacity: 0;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== BLISS LANDSCAPE PAGE ===== */

.bliss-page {
    background: linear-gradient(to bottom, var(--sky-top), var(--sky-bottom));
    overflow: hidden;
    transition: background 2s ease;
}

.landscape {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

/* Stars */
.stars {
    position: absolute;
    inset: 0;
    opacity: var(--star-opacity);
    transition: opacity 2s ease;
}

/* Moon */
.moon {
    position: absolute;
    top: 8%;
    right: 15%;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #f0e68c;
    box-shadow: 0 0 20px 8px rgba(240, 230, 140, 0.3), 0 0 60px 20px rgba(240, 230, 140, 0.1);
    opacity: var(--moon-opacity);
    transition: opacity 2s ease;
}

/* Clouds */
.cloud {
    position: absolute;
    background: #fff;
    border-radius: 50px;
    opacity: var(--cloud-opacity);
    transition: opacity 2s ease;
}

.cloud::before,
.cloud::after {
    content: '';
    position: absolute;
    background: #fff;
    border-radius: 50%;
}

.cloud-1 {
    width: 180px;
    height: 50px;
    top: 15%;
    left: -10%;
    animation: cloudDrift1 80s linear infinite;
}
.cloud-1::before {
    width: 70px;
    height: 70px;
    top: -35px;
    left: 30px;
}
.cloud-1::after {
    width: 90px;
    height: 80px;
    top: -40px;
    left: 70px;
}

.cloud-2 {
    width: 140px;
    height: 40px;
    top: 22%;
    left: -10%;
    animation: cloudDrift2 100s linear infinite;
    animation-delay: -40s;
}
.cloud-2::before {
    width: 55px;
    height: 55px;
    top: -28px;
    left: 25px;
}
.cloud-2::after {
    width: 70px;
    height: 60px;
    top: -32px;
    left: 55px;
}

.cloud-3 {
    width: 160px;
    height: 44px;
    top: 10%;
    left: -10%;
    animation: cloudDrift3 120s linear infinite;
    animation-delay: -70s;
}
.cloud-3::before {
    width: 60px;
    height: 60px;
    top: -30px;
    left: 35px;
}
.cloud-3::after {
    width: 80px;
    height: 70px;
    top: -36px;
    left: 65px;
}

@keyframes cloudDrift1 {
    from { transform: translateX(0); }
    to { transform: translateX(calc(100vw + 200px)); }
}
@keyframes cloudDrift2 {
    from { transform: translateX(0); }
    to { transform: translateX(calc(100vw + 200px)); }
}
@keyframes cloudDrift3 {
    from { transform: translateX(0); }
    to { transform: translateX(calc(100vw + 200px)); }
}

/* Hills */
.hill {
    position: absolute;
    border-radius: 50% 50% 0 0;
    transition: background 2s ease;
}

.hill-back {
    width: 160%;
    height: 40vh;
    bottom: -8vh;
    left: -30%;
    background: var(--hill-back);
}

.hill-mid {
    width: 140%;
    height: 32vh;
    bottom: -6vh;
    left: -5%;
    background: var(--hill-mid);
}

.hill-front {
    width: 180%;
    height: 28vh;
    bottom: -10vh;
    left: -40%;
    background: var(--hill-front);
}

/* Glass card container */
.glass-container {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.glass-card {
    width: 100%;
    max-width: 520px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 40px 36px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.glass-title {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #fff;
    margin-bottom: 28px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* Override form styles for glass card */
.glass-card .input-row {
    display: flex;
    gap: 0;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.glass-card .input-row:focus-within {
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.glass-card .input-row input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    padding: 14px 16px;
    font-size: 0.95rem;
    font-family: var(--font);
    outline: none;
    min-width: 0;
}

.glass-card .input-row input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.glass-card .input-row button {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    padding: 14px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: background var(--transition);
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.glass-card .input-row button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
}

.glass-card .input-row button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.glass-card .pow-status {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    min-height: 1.3em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.glass-card .pow-status:not(:empty)::before {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.glass-card .status {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    min-height: 1.3em;
}

.glass-card .status.error {
    color: #ff6b6b;
}

.glass-card .result {
    display: none;
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
    overflow: hidden;
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.glass-card .result.show {
    display: block;
}

.glass-card .result-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.glass-card .result-url {
    flex: 1;
    font-family: var(--mono);
    font-size: 1rem;
    min-width: 0;
}

.glass-card .result-url a {
    color: #fff;
    text-decoration: none;
    word-break: break-all;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.glass-card .result-url a:hover {
    text-decoration: underline;
}

.glass-card .copy-btn {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.glass-card .copy-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.glass-card .copy-btn.copied {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.4);
    color: #6ee7a0;
}

/* ===== SHARED FORM ELEMENTS ===== */

.shorten-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    appearance: none;
    -webkit-appearance: none;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717a' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

input:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

button, .btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    letter-spacing: -0.01em;
}

button:hover, .btn:hover {
    background: var(--accent-hover);
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

button:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-danger {
    background: var(--danger-subtle);
    color: var(--danger);
    border: 1px solid transparent;
}
.btn-danger:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-small {
    padding: 5px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover {
    border-color: var(--border-hover);
    background: var(--surface);
    color: var(--text);
}

/* ===== ADMIN LOGIN ===== */

.login-container {
    max-width: 380px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    box-shadow: var(--shadow-lg);
}

.login-card h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.login-subtitle {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 28px;
}

.login-card input[type="password"] {
    width: 100%;
    margin-bottom: 16px;
    padding: 12px 14px;
}

.login-card button {
    width: 100%;
    padding: 12px;
    font-weight: 600;
}

.login-status {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-dim);
    text-align: center;
    min-height: 1.3em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

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

.login-status.working::before {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    flex-shrink: 0;
}

/* ===== ADMIN LAYOUT ===== */

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 24px 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.admin-sidebar .sidebar-brand {
    padding: 0 20px;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand .brand-icon {
    width: 28px;
    height: 28px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-brand span {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}

.admin-sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 8px;
    flex: 1;
}

.admin-sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 450;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.admin-sidebar nav a .nav-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity var(--transition);
}

.admin-sidebar nav a:hover {
    color: var(--text-secondary);
    background: var(--surface2);
}

.admin-sidebar nav a:hover .nav-icon {
    opacity: 0.7;
}

.admin-sidebar nav a.active {
    color: var(--text);
    background: var(--surface2);
}

.admin-sidebar nav a.active .nav-icon {
    opacity: 1;
}

.admin-sidebar nav .nav-spacer {
    flex: 1;
}

.admin-sidebar nav a#logoutLink {
    color: var(--text-dim);
    margin-top: auto;
}

.admin-sidebar nav a#logoutLink:hover {
    color: var(--danger);
    background: var(--danger-subtle);
}

.admin-main {
    flex: 1;
    padding: 32px 40px;
    overflow-x: auto;
    max-width: 100%;
}

.admin-main h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

/* ===== STATS ===== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 36px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: border-color var(--transition);
}

.stat-card:hover {
    border-color: var(--border-hover);
}

.stat-card .label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

/* ===== TABLES ===== */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

thead {
    position: sticky;
    top: 0;
}

th {
    text-align: left;
    padding: 10px 14px;
    color: var(--text-dim);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

tr:hover td {
    background: var(--accent-subtle);
}

td code {
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--text);
    background: var(--surface2);
    padding: 2px 7px;
    border-radius: 4px;
}

td a {
    color: var(--accent);
    text-decoration: none;
}

td a:hover {
    text-decoration: underline;
}

.url-cell {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-enabled {
    background: var(--success-subtle);
    color: var(--success);
}

.badge-disabled {
    background: var(--danger-subtle);
    color: var(--danger);
}

.td-actions {
    display: flex;
    gap: 6px;
}

/* ===== PAGINATION ===== */

.pagination {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    align-items: center;
}

.page-info {
    font-size: 0.82rem;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

/* ===== SEARCH BAR ===== */

.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.search-bar input {
    flex: 1;
    max-width: 320px;
}

/* ===== SETTINGS ===== */

.settings-form {
    max-width: 480px;
}

.settings-section {
    margin-bottom: 32px;
}

.settings-section-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 450;
}

.form-group input, .form-group select {
    width: 100%;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ===== BLACKLIST ===== */

.blacklist-add {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.blacklist-add select {
    min-width: 120px;
}

.blacklist-add input {
    flex: 1;
    min-width: 180px;
}

/* ===== TOAST ===== */

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    z-index: 1000;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-md);
    color: var(--text-secondary);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.4);
    color: var(--danger);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 12px 0;
    }

    .admin-sidebar .sidebar-brand {
        padding: 0 16px;
        margin-bottom: 12px;
    }

    .admin-sidebar nav {
        flex-direction: row;
        overflow-x: auto;
        gap: 2px;
        padding: 0 8px;
        -webkit-overflow-scrolling: touch;
    }

    .admin-sidebar nav a {
        white-space: nowrap;
        padding: 8px 14px;
    }

    .admin-sidebar nav .nav-spacer {
        display: none;
    }

    .admin-main {
        padding: 20px 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .glass-card {
        padding: 28px 22px;
    }
}

@media (max-width: 480px) {
    .glass-card .input-row button {
        padding: 14px 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}
