@font-face {
    font-family: 'DM Sans';
    src: url('/shared/fonts/DMSans-Variable.woff2') format('woff2');
    font-weight: 100 1000;
    font-display: swap;
}
@font-face {
    font-family: 'Google Sans Flex';
    src: url('/shared/fonts/gsf/GoogleSansFlexRounded-Variable.ttf') format('truetype');
    font-weight: 100 1000;
    font-display: swap;
}
@font-face { font-family: 'IBM Plex Sans Arabic'; src: url('/shared/fonts/ibmplexarabic/IBMPlexSansArabic-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans Arabic'; src: url('/shared/fonts/ibmplexarabic/IBMPlexSansArabic-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

@font-face {
    font-family: 'Google Sans Flex';
    src: url('/shared/fonts/gsf/GoogleSansFlexRounded-Variable.ttf') format('truetype');
    font-weight: 100 1000;
    font-display: swap;
}

@font-face {
    font-family: 'Commit Mono';
    src: url('/shared/fonts/mono/CommitMono-400.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'Commit Mono';
    src: url('/shared/fonts/mono/CommitMono-700.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

:root {
    --bg: var(--surface-dim);
    --bg-elevated: var(--surface-container-low);
    --bg-card: var(--surface-container);
    --bg-hover: var(--surface-container-high);
    --border: var(--outline-variant);
    --border-subtle: var(--surface-container);
    --text-primary: var(--on-surface);
    --text-secondary: var(--on-surface-variant);
    --text-muted: var(--on-surface-variant);
    --accent: var(--primary);
    --success-dot: var(--primary);
    --danger: var(--error);
    --radius: 16px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-xl: 28px;
    --radius-full: 9999px;
    --glow-wash: radial-gradient(ellipse 90% 55% at 50% -8%, rgba(136,192,208,0.10), transparent 70%);
    --glow-soft-l: radial-gradient(ellipse 60% 40% at 12% -12%, rgba(129,161,193,0.08), transparent 70%);
    --glow-soft-r: radial-gradient(ellipse 60% 40% at 88% -12%, rgba(143,188,187,0.08), transparent 70%);
}

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

::selection {
    background: #88c0d0;
    color: #2e3440;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

body {
    font-family: 'Google Sans Flex', 'IBM Plex Sans Arabic', system-ui, sans-serif;
    background: var(--bg);
    background-image: var(--glow-wash), var(--glow-soft-l), var(--glow-soft-r);
    background-repeat: no-repeat;
    color: var(--text-primary);
    padding: 24px 32px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
body > main {
    flex: 1 0 auto;
}
body > header,
body > main {
    width: 100%;
}
body > .site-footer {
    margin-bottom: -24px;
    margin-inline: -32px;
}
@media (max-width: 1100px) {
    body > .site-footer { margin-bottom: -16px; margin-inline: -20px; }
}
@media (max-width: 760px) {
    body > .site-footer { margin-bottom: -14px; margin-inline: -16px; }
}
@media (max-width: 560px) {
    body > .site-footer { margin-bottom: -10px; margin-inline: -12px; }
}

/* ---------- HEADER ---------- */

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.header-left h1 {
    font-family: 'Google Sans Flex', 'IBM Plex Sans Arabic', system-ui, sans-serif;
    font-size: 1.4em;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--text-primary);
    white-space: nowrap;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.splash-text {
    font-size: 0.8em;
    font-weight: 400;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    padding: 4px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.splash-text:hover { background: var(--bg-hover); border-color: var(--border); }
.splash-flash { animation: splashFlash 0.6s ease-out; }
@keyframes splashFlash {
    0% { background: var(--accent); color: var(--on-primary); border-color: var(--accent); transform: scale(1.05); }
    100% { background: var(--bg-elevated); color: var(--text-muted); border-color: var(--border-subtle); transform: scale(1); }
}
.sep { color: var(--text-muted); }

.conn-badge {
    font-size: 0.7em;
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 3px;
}

#connHost { color: var(--text-secondary); }

.conn-badge .conn-label { display: inline; }

/* Square icon buttons */
.auth-status,
#themeToggle,
.pause-btn {
    width: 34px;
    height: 34px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.auth-status:hover,
#themeToggle:hover,
.pause-btn:hover { border-color: var(--text-primary); }

.auth-status img { width: 16px; height: 16px; opacity: 0.5; transition: opacity 0.2s, transform 0.2s ease, width 0.2s ease, height 0.2s ease; }
.auth-status:hover img { opacity: 0.8; }
.auth-status.unlocked img { opacity: 1; }
#themeToggle img,
.pause-btn img { width: 16px; height: 16px; opacity: 0.6; transition: opacity 0.2s, transform 0.2s ease, width 0.2s ease, height 0.2s ease; }
#themeToggle:hover img,
.pause-btn:hover img { opacity: 0.9; }

.auth-timer {
    font-size: 0.6em;
    font-family: 'Commit Mono', monospace;
    color: var(--accent);
    min-width: 28px;
    text-align: center;
}

/* Icon color filters */
.pause-btn img { filter: var(--tabler-filter); }
#themeToggle img { filter: var(--tabler-filter); }
.service-card .card-icon img[src*="tabler-white"] { filter: var(--tabler-filter); }
.service-card .card-icon img[src*="/icons/tabler/"] { filter: var(--tabler-filter); }
.service-card .card-icon img[src*="/icons/custom/"] { filter: var(--tabler-filter); }



/* ---------- STATS BAR ---------- */

.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 28px;
}

.stat-item {
    --warmth: 0;
    --hue: 0;
    background: var(--bg-card);
    border: 1px solid color-mix(in srgb, var(--border-subtle) calc((1 - var(--warmth)) * 100%), var(--danger) calc(var(--warmth) * 80%));
    border-radius: var(--radius);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    transition: border-color 0.2s;
    box-shadow: 0 0 calc(var(--warmth) * 10px) color-mix(in srgb, transparent calc((1 - var(--warmth)) * 100%), var(--danger) calc(var(--warmth) * 30%));
}



.stat-icon {
    width: 32px;
    height: 32px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.stat-icon img { width: 18px; height: 18px; object-fit: contain; filter: var(--tabler-filter); transition: transform 0.2s ease; }

.stat-body { flex: 1; min-width: 0; }

.stat-value {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.65em;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ---------- SERVICE SECTIONS ---------- */

.service-section { margin-bottom: 28px; }

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border-subtle);
}

.section-header h2 {
    font-size: 0.8em;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.section-count {
    font-size: 0.7em;
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 2px 8px;
    border-radius: 10px;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
    gap: 10px;
}

/* ---------- SERVICE CARD ---------- */

.service-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 16px;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
}

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

.service-card .card-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.service-card .card-icon {
    width: 48px;
    height: 48px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.service-card .card-icon img { width: 28px; height: 28px; object-fit: contain; transition: transform 0.2s ease; }
.service-card .card-info { flex: 1; min-width: 0; }
.service-card, .mc-server-card, .net-card { min-width: 0; }

.service-card .card-label {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-primary);
}

.service-card .card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.service-card .status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.service-card .status-dot.running { background: var(--success-dot); }
.service-card .status-dot.stopped { background: var(--danger); }

.service-card .status-text {
    font-size: 0.7em;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

.service-card.clickable { cursor: pointer; }

.service-card .card-links-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.35;
    transition: opacity 0.2s, transform 0.2s ease;
    padding: 2px;
}

.service-card .card-links-hint img { width: 15px; height: 15px; filter: var(--custom-filter); }
.service-card:hover .card-links-hint { opacity: 0.95; transform: scale(1.15); }

/* ---------- MINECRAFT CARDS ---------- */

#mcCard {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
    gap: 10px;
}

.mc-empty {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 28px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85em;
    grid-column: 1 / -1;
}

.mc-server-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: all 0.2s;
}

.mc-server-card:hover { border-color: var(--border); transform: translateY(-2px); }

.mc-server-card.running { border-left: 3px solid var(--success-dot); grid-column: 1 / -1; }
.mc-server-card.offline { border-left: 3px solid var(--danger); }

.mc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mc-header-left { display: flex; align-items: center; gap: 8px; }
.mc-server-name { font-size: 1.05em; font-weight: 600; color: var(--text-primary); }
.mc-type-icon { width: 18px; height: 18px; display: flex; align-items: center; }
.mc-type-icon img { width: 18px; height: 18px; object-fit: contain; }

.mc-header-right { display: flex; align-items: center; gap: 6px; }
.mc-status-dot { width: 8px; height: 8px; border-radius: 50%; }
.mc-status-dot.running { background: var(--success-dot); animation: pulse 2s ease-in-out infinite; }
.mc-status-dot.stopped { background: var(--danger); }
.mc-status-text { font-size: 0.7em; color: var(--text-muted); letter-spacing: 0.03em; }

.mc-stats-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.mc-stat { display: flex; flex-direction: column; gap: 1px; min-width: 50px; }
.mc-stat-value { font-size: 0.95em; font-weight: 600; color: var(--text-primary); font-family: 'Commit Mono', monospace; }
.mc-stat-label { font-size: 0.6em; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

.mc-links {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.mc-links .btn {
    font-family: 'DM Sans', sans-serif;
    padding: 6px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.7em;
    text-decoration: none;
    color: var(--text-muted);
    background: var(--bg-elevated);
    transition: all 0.15s;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.mc-links .btn:hover { border-color: var(--border); color: var(--text-secondary); transform: translateY(-1px); }
.mc-links .btn img { width: 12px; height: 12px; opacity: 0.5; filter: var(--custom-filter); }

/* ---------- LOCAL / FOOTER / TOAST ---------- */

#section-local { display: none; }
#section-local.visible { display: block; }

footer {
    margin-top: 60px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.65em;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.footer-sep { color: var(--text-muted); }
#footerClock { font-family: 'Commit Mono', monospace; }

#toastContainer {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
}

.toast {
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.8em;
    font-family: 'DM Sans', sans-serif;
    animation: toastIn 0.3s ease;
}

.toast.success { background: rgba(74,222,128,0.1); color: #4ade80; border: 1px solid rgba(74,222,128,0.2); }
.toast.error { background: rgba(239,68,68,0.1); color: #ef4444; border: 1px solid rgba(239,68,68,0.2); }

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

/* ======== ANIMATIONS ======== */

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}


body {
    animation: fadeUp 0.4s ease-out;
}

.first-load .stat-item {
    animation: fadeUp 0.4s ease-out both;
}
.first-load .stat-item:nth-child(1) { animation-delay: 0.02s; }
.first-load .stat-item:nth-child(2) { animation-delay: 0.06s; }
.first-load .stat-item:nth-child(3) { animation-delay: 0.10s; }
.first-load .stat-item:nth-child(4) { animation-delay: 0.14s; }
.first-load .stat-item:nth-child(5) { animation-delay: 0.18s; }
.first-load .stat-item:nth-child(6) { animation-delay: 0.22s; }

.first-load .service-card {
    animation: fadeUp 0.35s ease-out both;
}
.first-load .service-card:nth-child(1) { animation-delay: 0.03s; }
.first-load .service-card:nth-child(2) { animation-delay: 0.06s; }
.first-load .service-card:nth-child(3) { animation-delay: 0.09s; }
.first-load .service-card:nth-child(4) { animation-delay: 0.12s; }
.first-load .service-card:nth-child(5) { animation-delay: 0.15s; }
.first-load .service-card:nth-child(6) { animation-delay: 0.18s; }
.first-load .service-card:nth-child(7) { animation-delay: 0.21s; }
.first-load .service-card:nth-child(8) { animation-delay: 0.24s; }
.first-load .service-card:nth-child(9) { animation-delay: 0.27s; }
.first-load .service-card:nth-child(10) { animation-delay: 0.30s; }

.first-load .mc-server-card {
    animation: fadeUp 0.4s ease-out 0.15s both;
}

.service-card .status-dot.running {
    animation: pulse 2s ease-in-out infinite;
}

.service-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.service-card:hover .card-icon {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.service-card:hover .card-icon img {
    transform: scale(1.15);
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.stat-item:hover .stat-icon {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.stat-item:hover .stat-icon img {
    transform: scale(1.15);
}

#mcCard:hover {
    border-color: transparent;
}
.mc-server-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.auth-status:hover,
#themeToggle:hover,
.pause-btn:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.auth-status:hover img,
#themeToggle:hover img,
.pause-btn:hover img {
    transform: scale(1.2);
}

.service-card .card-links-hint {
    transition: all 0.2s ease;
}

.svc-link-btn {
    transition: all 0.2s ease;
}

.svc-link-btn:hover {
    transform: translateY(-2px) scale(1.02);
    border-color: var(--accent);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.mc-links .btn {
    transition: all 0.2s ease;
}

.mc-links .btn:hover {
    transform: translateY(-2px) scale(1.05);
    border-color: var(--accent);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.mc-links .btn.primary:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 14px rgba(136, 192, 208, 0.35);
}

/* Smooth theme transitions */
html, body, header, footer, .service-card, .stat-item, #mcCard,
.splash-text, .conn-badge, .auth-status, #themeToggle, .pause-btn,
.service-card .card-icon, .stat-icon, .svc-link-btn, .mc-links .btn {
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease, padding 0.25s ease, font-size 0.25s ease, gap 0.25s ease, width 0.25s ease, height 0.25s ease, margin 0.25s ease, max-width 0.25s ease, flex-basis 0.25s ease;
}

.service-card .card-label,
.service-card .status-text,
.stat-value, .stat-label,
.mc-server-name, .mc-stats-row, .mc-header,
header h1, .conn-badge, #connHost,
footer, .section-header h2 {
    transition: color 0.3s ease, font-size 0.25s ease, gap 0.25s ease, padding 0.25s ease;
}

/* Fluid resize: tween shell sizing across the 1100/760/560/400px breakpoints
   (grid column counts can't transition — gap/padding tweens carry the feel) */
.services-grid { transition: gap 0.25s ease; }
.header-left, .header-right { transition: gap 0.25s ease; }
.auth-timer { transition: font-size 0.25s ease, min-width 0.25s ease; }
.toast { transition: font-size 0.25s ease, padding 0.25s ease; }

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

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

@media (max-width: 1100px) {
    .stats-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    body { padding: 16px 20px; }
    header { gap: 8px; }
    .conn-badge { font-size: 0.65em; padding: 3px 8px; }
    .conn-badge .conn-label { display: none; }
    .header-left { gap: 10px; }
    .header-left h1 { font-size: 1em; }
    .splash-text { max-width: 160px; font-size: 0.7em; padding: 3px 10px; }
    .header-right { gap: 6px; }
    .auth-status, #themeToggle, .pause-btn { width: 32px; height: 32px; }
    .auth-status img, #themeToggle img, .pause-btn img { width: 15px; height: 15px; }
    .auth-timer { font-size: 0.55em; min-width: 24px; }
    .stats-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    footer { font-size: 0.6em; gap: 6px; }
}

@media (max-width: 560px) {
    body { padding: 14px 16px; }
    header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 14px;
        flex-wrap: nowrap;
    }
    .conn-badge {
        font-size: 0.6em;
        padding: 2px 8px;
        flex: 0 0 auto;
    }
    .header-left {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1 1 auto;
        min-width: 0;
        justify-content: center;
    }
    .header-left h1 { font-size: 0.95em; letter-spacing: 0.08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .splash-text { max-width: 90px; font-size: 0.65em; padding: 2px 8px; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
    .header-right {
        display: flex;
        align-items: center;
        gap: 5px;
        flex: 0 0 auto;
    }
    .lang-toggle { min-width: 32px; height: 26px; font-size: 0.6em; padding: 0 6px; flex: 0 0 auto; justify-content: center; }
    .pause-btn { width: 26px; height: 26px; flex: 0 0 auto; }
    .auth-status, #themeToggle, .pause-btn { width: 26px; height: 26px; flex: 0 0 auto; }
    .auth-status img, #themeToggle img, .pause-btn img { width: 13px; height: 13px; }
    .auth-timer { font-size: 0.5em; min-width: 22px; }

    .stat-item { padding: 10px 14px; gap: 10px; flex-basis: 120px; }
    .stat-icon { width: 28px; height: 28px; }
    .stat-icon img { width: 16px; height: 16px; }
    .stat-value { font-size: 0.95em; overflow-wrap: anywhere; word-break: break-word; }
    .services-grid { grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr)); gap: 8px; }
    .service-card { padding: 14px; }
    .service-card .card-icon { width: 32px; height: 32px; }
    .service-card .card-icon img { width: 18px; height: 18px; }
    .service-card .card-label { font-size: 1.05em; }
    .service-card .card-links-hint img { width: 13px; height: 13px; }
    #mcCard { gap: 8px; }
    .mc-server-card { padding: 14px 16px; gap: 10px; }
    .mc-server-name { font-size: 0.9em; }
    .mc-stats-row { gap: 8px; }
    .mc-stat-value { font-size: 0.85em; }
    .mc-links .btn { font-size: 0.65em; padding: 4px 10px; }
    footer { padding-top: 14px; margin-top: 40px; }
}

@media (max-width: 400px) {
    body { padding: 10px 12px; }
    header { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 12px; flex-wrap: nowrap; }
    .conn-badge { font-size: 0.5em; padding: 1px 5px; flex: 0 0 auto; }
    .header-left { flex: 1 1 auto; min-width: 0; justify-content: center; gap: 6px; }
    .header-left h1 { font-size: 0.85em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .splash-text { max-width: 80px; font-size: 0.55em; padding: 2px 6px; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
    .header-right { gap: 4px; flex: 0 0 auto; }
    .auth-status, #themeToggle, .pause-btn { width: 28px; height: 28px; }
    .auth-status img, #themeToggle img, .pause-btn img { width: 13px; height: 13px; }
    .auth-timer { font-size: 0.45em; min-width: 20px; }
    .services-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    .service-card { padding: 10px; }
    #mcCard { grid-template-columns: 1fr; gap: 6px; }
    .mc-server-card { padding: 12px; gap: 8px; }
    .mc-links .btn { flex: 1; justify-content: center; }
    #toastContainer { bottom: 16px; right: 16px; left: 16px; }
    .toast { font-size: 0.75em; padding: 8px 14px; }
}

/* ======== AUTH OVERLAYS ======== */

.auth-overlay,
.pw-change-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.auth-overlay.active,
.pw-change-overlay.active { display: flex; }

.auth-box,
.pw-change-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
    width: 100%;
    max-width: 420px;
    animation: fadeUp 0.3s ease;
}

.auth-box h2,
.pw-change-box h2 {
    font-size: 1.05em;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 24px;
    text-align: center;
}

.auth-error {
    font-size: 0.82em;
    color: var(--danger);
    text-align: center;
    margin-bottom: 14px;
    min-height: 1.2em;
}

.form-input {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.92em;
    outline: none;
    transition: border-color 0.15s;
    margin-bottom: 14px;
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--text-muted); }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-bottom: 18px;
}
.checkbox-row input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px; }

.btn {
    font-family: 'DM Sans', sans-serif;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8em;
    text-decoration: none;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    transition: all 0.15s;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn:hover { border-color: var(--text-primary); color: var(--text-primary); }
.btn.primary {
    width: 100%;
    background: var(--accent);
    color: var(--on-primary);
    border-color: var(--accent);
}
.btn.primary:hover { opacity: 0.85; }
.btn.logout-btn { color: var(--danger); border-color: var(--danger); }
.btn.logout-btn:hover { background: var(--danger); color: var(--on-primary); }

.shake { animation: shake 0.3s ease; }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* ======== SERVICE LINKS POPUP ======== */

.svc-links-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.svc-links-overlay.active { display: flex; }

.svc-links-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    width: 100%;
    max-width: 380px;
    animation: fadeUp 0.3s ease;
}

.svc-links-box h2 {
    font-size: 1em;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 18px;
    text-align: center;
}

.svc-links-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.svc-link-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.9em;
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
}

.svc-link-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.svc-link-btn img {
    width: 18px;
    height: 18px;
    filter: var(--custom-filter);
    flex-shrink: 0;
}

.svc-link-btn .svc-link-arrow {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 1em;
}

.svc-links-none {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85em;
    padding: 12px 0;
}

.svc-links-authnote {
    margin-top: 12px;
    text-align: center;
    font-size: 0.75em;
    color: var(--text-muted);
}

/* ======== NETWORK & DNS SECTION ======== */

.net-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
    gap: 12px;
}

.net-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.net-card .card-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.net-card .card-icon {
    width: 36px;
    height: 36px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.net-card .card-icon img { width: 20px; height: 20px; object-fit: contain; }
.net-card .card-icon img.icon-stroke { filter: var(--custom-filter); }
.net-card .card-info { flex: 1; min-width: 0; }
.net-card .card-label { font-size: 0.95em; font-weight: 500; color: var(--text-primary); }
.net-card .card-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.net-card .status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.net-card .status-dot.running { background: var(--success-dot); animation: pulse 2s ease-in-out infinite; }
.net-card .status-dot.stopped { background: var(--danger); }
.net-card .status-text { font-size: 0.7em; color: var(--text-muted); letter-spacing: 0.03em; }

.net-speeds {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.net-speed {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.net-speed .net-val {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--primary);
    font-family: 'Commit Mono', monospace;
}

.net-speed .net-stl {
    font-size: 0.6em;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.net-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.net-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8em;
    color: var(--text-secondary);
    border-bottom: 1px dashed var(--border-subtle);
    padding-bottom: 4px;
}

.net-row b { font-family: 'Commit Mono', monospace; color: var(--text-primary); font-weight: 500; }

.net-top {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}

.net-top-title {
    font-size: 0.65em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.net-top-list {
    margin: 0; padding: 0 0 0 18px;
    font-size: 0.75em;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.net-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85em;
    padding: 18px 0;
}

/* Responsive */
@media (max-width: 560px) {
    .net-grid { grid-template-columns: 1fr; gap: 8px; }
    .net-card { padding: 14px; }
}

/* Language toggle (same pill as splash) */
.lang-toggle {
    font-size: 0.75em;
    color: var(--text-muted);
    text-decoration: none;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    padding: 3px 12px;
    white-space: nowrap;
}

.lang-toggle:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

/* --- [dir="rtl"] overrides (Arabic) --- */
/* letter-spacing breaks Arabic joining — drop it everywhere in ar mode */
[dir="rtl"] body,
[dir="rtl"] body * {
    letter-spacing: 0;
}

/* Arabic glyphs resolve via arabic.css (loaded only when lang=ar) */
[dir="rtl"] body {
    font-family: 'Google Sans Flex', 'IBM Plex Sans Arabic', 'DM Sans', system-ui, sans-serif;
}

[dir="rtl"] .header-left h1,
[dir="rtl"] h2 {
    font-family: 'Google Sans Flex', 'IBM Plex Sans Arabic', system-ui, sans-serif;
}

/* status accent flips side */
[dir="rtl"] .mc-server-card.running,
[dir="rtl"] .mc-server-card.offline {
    border-left: 0;
}

[dir="rtl"] .mc-server-card.running {
    border-right: 3px solid var(--success-dot);
}

[dir="rtl"] .mc-server-card.offline {
    border-right: 3px solid var(--danger);
}

/* toast + mobile badge corners flip */
[dir="rtl"] #toastContainer {
    right: auto;
    left: 30px;
}

@media (max-width: 560px) {
    [dir="rtl"] .conn-badge {
        left: auto;
        right: 0;
    }

    [dir="rtl"] .header-right {
        right: auto;
        left: 0;
    }
}

/* =====================================================================
   MATERIAL 3 EXPRESSIVE LAYER  (appended, no structure removed)
   Mirrors laptoo.xyz's splash: tonal containers, the M3 shape scale,
   ::before state layers (hover can never flash white), sampled springs,
   a staged page-load reveal and the expressive type scale.

   The shared /shared/theme.css is deliberately NOT modified, so the
   handful of tokens this layer needs are declared locally below.
   ===================================================================== */

:root {
    --m3-shape-lg-inc: 20px;
    --m3-shape-xl-inc: 32px;
    --m3-shape-2xl: 48px;
    --m3-state-hover: .08;
    --m3-state-focus: .10;
    --m3-state-press: .10;

    /* sampled spring easings (spatial may overshoot, effects may not) */
    --m3-spring-spatial-fast: linear(0, 0.036, 0.126, 0.249, 0.388, 0.527, 0.659, 0.775, 0.874, 0.952, 1.011, 1.052, 1.078, 1.092, 1.095, 1.091, 1.082, 1.07, 1.056, 1.043, 1.031, 1.02, 1.011, 1.004, 0.998, 0.995, 0.992, 0.991, 0.991, 0.991, 0.992, 0.994, 0.995, 0.996, 0.997, 0.998, 1);
    --m3-spring-spatial-fast-duration: 360ms;
    --m3-spring-spatial-default: linear(0, 0.024, 0.084, 0.167, 0.262, 0.36, 0.457, 0.548, 0.631, 0.705, 0.769, 0.824, 0.869, 0.907, 0.937, 0.96, 0.978, 0.991, 1.001, 1.008, 1.012, 1.014, 1.015, 1.015, 1.014, 1.013, 1.012, 1.01, 1.009, 1.008, 1.006, 1.005, 1.004, 1.003, 1.002, 1.002, 1);
    --m3-spring-spatial-default-duration: 430ms;
    --m3-spring-spatial-slow: linear(0, 0.023, 0.081, 0.162, 0.254, 0.35, 0.445, 0.535, 0.618, 0.692, 0.756, 0.812, 0.859, 0.897, 0.928, 0.953, 0.972, 0.987, 0.998, 1.005, 1.01, 1.013, 1.015, 1.015, 1.015, 1.014, 1.013, 1.011, 1.01, 1.008, 1.007, 1.006, 1.005, 1.004, 1.003, 1.002, 1);
    --m3-spring-spatial-slow-duration: 580ms;
    --m3-spring-effects-fast: linear(0, 0.028, 0.094, 0.181, 0.274, 0.368, 0.456, 0.537, 0.609, 0.672, 0.726, 0.773, 0.813, 0.846, 0.874, 0.897, 0.916, 0.932, 0.945, 0.955, 0.964, 0.971, 0.977, 0.981, 0.985, 0.988, 0.99, 0.992, 0.994, 0.995, 0.996, 0.997, 0.998, 0.998, 0.998, 0.999, 1);
    --m3-spring-effects-fast-duration: 150ms;
    --m3-spring-effects-default: linear(0, 0.028, 0.094, 0.179, 0.272, 0.365, 0.453, 0.534, 0.606, 0.669, 0.724, 0.771, 0.811, 0.844, 0.872, 0.895, 0.915, 0.931, 0.944, 0.954, 0.963, 0.97, 0.976, 0.981, 0.985, 0.988, 0.99, 0.992, 0.994, 0.995, 0.996, 0.997, 0.997, 0.998, 0.998, 0.999, 1);
    --m3-spring-effects-default-duration: 230ms;
    --m3-spring-effects-slow: linear(0, 0.025, 0.086, 0.167, 0.255, 0.344, 0.429, 0.508, 0.58, 0.643, 0.699, 0.748, 0.789, 0.824, 0.854, 0.879, 0.901, 0.918, 0.933, 0.945, 0.955, 0.963, 0.97, 0.976, 0.98, 0.984, 0.987, 0.989, 0.991, 0.993, 0.994, 0.996, 0.996, 0.997, 0.998, 0.998, 1);
    --m3-spring-effects-slow-duration: 310ms;
}

@supports not (transition-timing-function: linear(0, 1)) {
    :root {
        --m3-spring-spatial-fast: cubic-bezier(.42,1.6,.4,1);
        --m3-spring-spatial-default: cubic-bezier(.38,1.21,.22,1);
        --m3-spring-spatial-slow: cubic-bezier(.35,1.12,.25,1);
        --m3-spring-effects-fast: cubic-bezier(.2,0,0,1);
        --m3-spring-effects-default: cubic-bezier(.2,0,0,1);
        --m3-spring-effects-slow: cubic-bezier(.2,0,0,1);
    }
}

/* --- shape scale: M3 Expressive corners on every existing alias ----- */
:root {
    --radius-sm: 12px;
    --radius: var(--m3-shape-lg-inc);      /* 20px cards */
    --radius-lg: 24px;
    --radius-xl: var(--m3-shape-xl-inc);   /* 32px popups */
    --radius-full: 9999px;
}

/* --- typography: expressive scale -------------------------------- */
:root {
    --type-title-lg: 600 1.4em/1.25 'Google Sans Flex', 'IBM Plex Sans Arabic', system-ui, sans-serif;
    --type-title-md: 600 1.05em/1.3 'Google Sans Flex', 'IBM Plex Sans Arabic', system-ui, sans-serif;
    --type-label-lg: 500 0.82em/1.35 'Google Sans Flex', 'IBM Plex Sans Arabic', system-ui, sans-serif;
    --type-label-md: 500 0.75em/1.35 'Google Sans Flex', 'IBM Plex Sans Arabic', system-ui, sans-serif;
}

::selection { background: var(--primary-container); color: var(--on-primary-container); }

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

/* --- state layers -------------------------------------------------
   A tinted ::before instead of an opaque hover background: this is what
   removes the pure-white flash, because the layer is always made from
   on-surface at 8/10 %, never from a solid colour.                     */
.service-card,
.stat-item,
.mc-server-card,
.net-card,
.pause-btn,
#themeToggle,
.auth-status,
.splash-text,
.conn-badge,
.btn,
.svc-link-btn,
.lang-toggle,
.section-count {
    position: relative;
    isolation: isolate;
}

.service-card::before,
.stat-item::before,
.mc-server-card::before,
.net-card::before,
.pause-btn::before,
#themeToggle::before,
.auth-status::before,
.splash-text::before,
.btn::before,
.svc-link-btn::before,
.lang-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: currentColor;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
    transition: opacity var(--m3-spring-effects-fast-duration) var(--m3-spring-effects-fast);
}

.service-card:hover::before,
.stat-item:hover::before,
.mc-server-card:hover::before,
.net-card:hover::before,
.pause-btn:hover::before,
#themeToggle:hover::before,
.auth-status:hover::before,
.splash-text:hover::before,
.btn:hover::before,
.svc-link-btn:hover::before,
.lang-toggle:hover::before { opacity: var(--m3-state-hover); }

.service-card:focus-visible::before,
.stat-item:focus-visible::before,
.mc-server-card:focus-visible::before,
.pause-btn:focus-visible::before,
#themeToggle:focus-visible::before,
.splash-text:focus-visible::before { opacity: var(--m3-state-focus); }

.service-card:active::before,
.stat-item:active::before,
.mc-server-card:active::before,
.pause-btn:active::before,
#themeToggle:active::before,
.splash-text:active::before,
.btn:active::before,
.svc-link-btn:active::before,
.lang-toggle:active::before { opacity: var(--m3-state-press); }

/* --- page shell --------------------------------------------------- */
body {
    background-color: var(--surface-dim);
    background-image: none;
    padding: 22px 32px 8px;
}

/* --- app bar: a tonal pill instead of a bordered strip ------------ */
header {
    background: var(--surface-container);
    border: 0;
    border-radius: var(--m3-shape-xl-inc);
    padding: 12px 20px;
    margin-bottom: 26px;
    box-shadow: 0 1px 0 var(--outline-variant) inset;
    transition: background-color var(--m3-spring-effects-slow-duration) var(--m3-spring-effects-slow),
                border-radius var(--m3-spring-spatial-default-duration) var(--m3-spring-spatial-default);
}

.header-left h1 {
    font: var(--type-title-lg);
    font-size: 1.32em;
    letter-spacing: -0.02em;
}

.splash-text {
    background: var(--surface-container-high);
    border-color: transparent;
    border-radius: var(--radius-full);
    font: var(--type-label-md);
    color: var(--on-surface-variant);
}
.splash-text:hover { background: var(--surface-container-high); border-color: transparent; }

.conn-badge {
    background: color-mix(in srgb, var(--secondary-container) 70%, transparent);
    color: var(--on-secondary-container);
    border-color: transparent;
    border-radius: var(--radius-full);
    font: var(--type-label-md);
}
#connHost { color: var(--on-secondary-container); }

.auth-status,
#themeToggle,
.pause-btn {
    background: transparent;
    border-color: transparent;
    border-radius: var(--radius-full);
    color: var(--on-surface-variant);
}
.auth-status:hover,
#themeToggle:hover,
.pause-btn:hover { border-color: transparent; }

.lang-toggle {
    border-radius: var(--radius-full) !important;
    border-color: transparent !important;
    background: var(--surface-container-high) !important;
    color: var(--on-surface-variant) !important;
    font: var(--type-label-md) !important;
}
.lang-toggle:hover { background: var(--surface-container-highest) !important; color: var(--on-surface) !important; }

/* --- section headers --------------------------------------------- */
.section-header {
    border-bottom: 0;
    padding-bottom: 6px;
    margin-bottom: 10px;
}
.section-header h2 {
    font: var(--type-label-lg);
    font-size: 0.78em;
    letter-spacing: 0.12em;
    color: var(--on-surface-variant);
}
.section-count {
    background: var(--surface-container-high);
    color: var(--on-surface-variant);
    border-radius: var(--radius-full);
    font: var(--type-label-md);
    padding: 2px 10px;
}

/* --- stats bar ---------------------------------------------------- */
.stats-bar { gap: 12px; }

.stat-item {
    background: var(--surface-container);
    border-color: transparent;
    box-shadow: 0 0 0 calc(var(--warmth) * 2px) color-mix(in srgb, var(--error) calc(var(--warmth) * 70%), transparent);
    border-radius: var(--m3-shape-lg-inc);
    padding: 14px 18px;
    color: var(--on-surface);
    transition: background-color var(--m3-spring-effects-default-duration) var(--m3-spring-effects-default),
                border-radius var(--m3-spring-spatial-default-duration) var(--m3-spring-spatial-default),
                transform var(--m3-spring-spatial-default-duration) var(--m3-spring-spatial-default);
}
.stat-item:hover {
    border-radius: var(--m3-shape-xl-inc);
    transform: translateY(-2px);
    border-color: transparent;
    box-shadow: 0 0 0 calc(var(--warmth) * 2px) color-mix(in srgb, var(--error) calc(var(--warmth) * 70%), transparent);
}

.stat-icon {
    background: color-mix(in srgb, var(--primary) 14%, transparent);
    border-color: transparent;
    border-radius: var(--radius-sm);
}

/* --- service cards ------------------------------------------------ */
.services-grid { gap: 12px; }

.service-card {
    background: var(--surface-container);
    border-color: transparent;
    border-radius: var(--m3-shape-lg-inc);
    padding: 18px;
    color: var(--on-surface);
    transition: background-color var(--m3-spring-effects-default-duration) var(--m3-spring-effects-default),
                border-radius var(--m3-spring-spatial-default-duration) var(--m3-spring-spatial-default),
                transform var(--m3-spring-spatial-default-duration) var(--m3-spring-spatial-default),
                box-shadow var(--m3-spring-spatial-default-duration) var(--m3-spring-spatial-default);
}
.service-card:hover {
    border-color: transparent;
    border-radius: var(--m3-shape-xl-inc);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px -12px color-mix(in srgb, var(--on-surface) 45%, transparent);
}
.service-card:active { border-radius: var(--m3-shape-lg-inc); transform: scale(.985); }

.service-card .card-icon {
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    border-color: transparent;
    border-radius: var(--radius-sm);
}
.service-card .card-label { font: var(--type-label-lg); font-size: 0.95em; color: var(--on-surface); }
.service-card .card-meta { font: var(--type-label-md); color: var(--on-surface-variant); }
.service-card .status-text { font: var(--type-label-md); color: var(--on-surface-variant); }

/* --- minecraft cards --------------------------------------------- */
#mcCard { gap: 12px; }

.mc-server-card {
    background: var(--surface-container);
    border-color: transparent;
    border-radius: var(--m3-shape-lg-inc);
    padding: 20px 22px;
    color: var(--on-surface);
    transition: background-color var(--m3-spring-effects-default-duration) var(--m3-spring-effects-default),
                border-radius var(--m3-spring-spatial-default-duration) var(--m3-spring-spatial-default),
                transform var(--m3-spring-spatial-default-duration) var(--m3-spring-spatial-default);
}
.mc-server-card:hover { border-color: transparent; border-radius: var(--m3-shape-xl-inc); }

/* running/offline accent bars: logical so RTL needs no mirror rule */
.mc-server-card.running { border-left: 3px solid var(--primary); border-radius: var(--m3-shape-xl-inc); }
.mc-server-card.offline { border-left: 3px solid var(--error); border-radius: var(--m3-shape-xl-inc); }
[dir="rtl"] .mc-server-card.running { border-left: 0; border-right: 3px solid var(--primary); }
[dir="rtl"] .mc-server-card.offline { border-left: 0; border-right: 3px solid var(--error); }

.mc-server-name { font: var(--type-title-md); font-size: 1.02em; color: var(--on-surface); }
.mc-stat-value { font: 600 0.95em 'Commit Mono', ui-monospace, monospace; color: var(--on-surface); }
.mc-stat-label { font: var(--type-label-md); font-size: 0.6em; color: var(--on-surface-variant); }
.mc-status-text { font: var(--type-label-md); font-size: 0.68em; color: var(--on-surface-variant); }
.mc-empty { color: var(--on-surface-variant); }

/* --- buttons ------------------------------------------------------ */
.btn {
    background: var(--surface-container-high);
    border-color: transparent;
    border-radius: var(--radius-full);
    color: var(--on-surface-variant);
    font: var(--type-label-md);
    letter-spacing: 0.04em;
    padding: 6px 16px;
    transition: border-radius var(--m3-spring-spatial-fast-duration) var(--m3-spring-spatial-fast),
                transform var(--m3-spring-spatial-fast-duration) var(--m3-spring-spatial-fast),
                background-color var(--m3-spring-effects-fast-duration) var(--m3-spring-effects-fast);
}
.btn:hover { border-color: transparent; color: var(--on-surface); }
.btn:active { transform: scale(.95); }
.btn.primary {
    background: var(--primary);
    color: var(--on-primary);
    border-color: transparent;
}
.btn.primary:hover { opacity: 1; color: var(--on-primary); }
.mc-links .btn:hover { border-color: transparent; color: var(--on-surface); transform: translateY(-1px); }

/* --- network cards ------------------------------------------------ */
.net-grid { gap: 12px; }
.net-card {
    background: var(--surface-container);
    border-color: transparent;
    border-radius: var(--m3-shape-lg-inc);
    color: var(--on-surface);
    transition: background-color var(--m3-spring-effects-default-duration) var(--m3-spring-effects-default),
                border-radius var(--m3-spring-spatial-default-duration) var(--m3-spring-spatial-default);
}
.net-card:hover { border-color: transparent; border-radius: var(--m3-shape-xl-inc); }

/* --- footer ------------------------------------------------------- */
/* Same slab as splash .site-footer + relay .site-footer: tonal top-rounded
   band with pill chips. One rule lives over the base footer block so
   margins/padding can't shrink the slab away. */
.site-footer {
    margin: 60px 0 0;
    padding: 18px 16px 20px;
    font-size: 1em;
    background: var(--surface-container-low);
    border-start-start-radius: var(--radius-lg);
    border-start-end-radius: var(--radius-lg);
}
.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.f-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    background: var(--surface-container-high);
    color: var(--on-surface-variant);
    font: var(--type-label-md);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.f-chip .t-icon { width: 14px; height: 14px; object-fit: contain; filter: var(--custom-filter); }
.f-badge a { display: inline-flex; }
.f-badge img { display: block; }
#footerClock { font-family: 'Commit Mono', monospace; }
#lastModified { font-variant-numeric: tabular-nums; }

/* --- popups / toasts --------------------------------------------- */
.svc-links-overlay { background: color-mix(in srgb, var(--scrim, #000) 55%, transparent); }

.svc-links-box {
    background: var(--surface-container-high);
    border-color: transparent;
    border-radius: var(--m3-shape-xl-inc);
    box-shadow: 0 24px 48px -24px color-mix(in srgb, #000 65%, transparent);
    animation: m3Pop var(--m3-spring-spatial-fast-duration) var(--m3-spring-spatial-fast) both;
}
@keyframes m3Pop {
    from { opacity: 0; transform: scale(.92); }
    to   { opacity: 1; transform: scale(1); }
}

.svc-link-btn {
    background: var(--surface-container-highest);
    border-color: transparent;
    border-radius: var(--radius);
    color: var(--on-surface);
}
.svc-link-btn:hover { border-color: var(--primary); color: var(--on-surface); }

.toast {
    border-radius: var(--radius-full);
    border-color: transparent;
    background: var(--surface-container-highest);
    color: var(--on-surface);
    animation: m3Pop var(--m3-spring-spatial-fast-duration) var(--m3-spring-spatial-fast) both;
}

/* --- staged page-load reveal --------------------------------------
   Same idea as splash: a short fade+rise, staggered by position, on the
   spatial spring so it settles rather than snaps.                      */
@keyframes m3Reveal {
    from { opacity: 0; transform: translateY(10px) scale(.985); }
    to   { opacity: 1; transform: none; }
}

body { animation: m3Reveal var(--m3-spring-spatial-slow-duration) var(--m3-spring-spatial-slow) both; }

.first-load .stat-item,
.first-load .service-card,
.first-load .mc-server-card,
.first-load .net-card,
.first-load .section-header {
    animation: m3Reveal var(--m3-spring-spatial-slow-duration) var(--m3-spring-spatial-slow) both !important;
}

.first-load .section-header { animation-delay: .02s; }
.first-load .stat-item:nth-child(1) { animation-delay: .05s; }
.first-load .stat-item:nth-child(2) { animation-delay: .09s; }
.first-load .stat-item:nth-child(3) { animation-delay: .13s; }
.first-load .stat-item:nth-child(4) { animation-delay: .17s; }
.first-load .stat-item:nth-child(5) { animation-delay: .21s; }
.first-load .stat-item:nth-child(6) { animation-delay: .25s; }
.first-load .service-card:nth-child(1) { animation-delay: .10s; }
.first-load .service-card:nth-child(2) { animation-delay: .13s; }
.first-load .service-card:nth-child(3) { animation-delay: .16s; }
.first-load .service-card:nth-child(4) { animation-delay: .19s; }
.first-load .service-card:nth-child(5) { animation-delay: .22s; }
.first-load .service-card:nth-child(6) { animation-delay: .25s; }
.first-load .service-card:nth-child(7) { animation-delay: .28s; }
.first-load .service-card:nth-child(8) { animation-delay: .31s; }
.first-load .service-card:nth-child(9) { animation-delay: .34s; }
.first-load .service-card:nth-child(10) { animation-delay: .37s; }
.first-load .service-card:nth-child(11) { animation-delay: .40s; }
.first-load .service-card:nth-child(12) { animation-delay: .43s; }
.first-load .service-card:nth-child(n+13) { animation-delay: .46s; }
.first-load .mc-server-card:nth-child(1) { animation-delay: .10s; }
.first-load .mc-server-card:nth-child(2) { animation-delay: .14s; }
.first-load .mc-server-card:nth-child(3) { animation-delay: .18s; }
.first-load .net-card:nth-child(1) { animation-delay: .10s; }
.first-load .net-card:nth-child(2) { animation-delay: .14s; }
.first-load .net-card:nth-child(3) { animation-delay: .18s; }
.first-load .net-card:nth-child(4) { animation-delay: .22s; }

/* --- RTL ---------------------------------------------------------- */
[dir="rtl"] .section-header { flex-direction: row-reverse; }
[dir="rtl"] .stat-item { flex-direction: row-reverse; }
[dir="rtl"] .service-card .card-top { flex-direction: row-reverse; }
[dir="rtl"] .mc-header { flex-direction: row-reverse; }
[dir="rtl"] .service-card,
[dir="rtl"] .stat-item,
[dir="rtl"] .mc-server-card,
[dir="rtl"] .section-header { text-align: right; }

/* --- small screens ------------------------------------------------ */
@media (max-width: 700px) {
    body { padding: 14px 16px 6px; }
    header { padding: 10px 14px; border-radius: 24px; }
    .stats-bar { gap: 8px; }
    .stat-item { padding: 12px 14px; }
    .service-card { padding: 15px; }
    .mc-server-card { padding: 16px 18px; }
    .services-grid { gap: 10px; }
}

@media (max-width: 560px) {
    header { border-radius: 22px; margin-bottom: 18px; padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: nowrap; }
    .header-left { flex-basis: 100%; justify-content: center; }
    .header-left h1 { font-size: 0.98em; }
    .service-card, .stat-item, .mc-server-card, .net-card { border-radius: 18px; }
    .service-card:hover, .mc-server-card:hover, .net-card:hover { border-radius: 22px; }
}

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