* {
    box-sizing: border-box;
}

:root {
    --bg: #090b10;
    --panel: #121722;
    --panel-soft: #171f2d;
    --line: #263246;
    --text: #f4f7fb;
    --muted: #9aa8ba;
    --green: #4ade80;
    --cyan: #38bdf8;
    --red: #fb7185;
    --amber: #fbbf24;
    --shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 20% 0%, rgba(56, 189, 248, 0.12), transparent 28rem),
        linear-gradient(180deg, #090b10 0%, #0e121a 100%);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem clamp(1rem, 4vw, 3rem);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(9, 11, 16, 0.86);
    backdrop-filter: blur(12px);
}

.brand,
.topnav,
.hero-actions,
.panel-title,
.copy-line,
.tabs,
.leader-tabs {
    display: flex;
    align-items: center;
}

.brand {
    gap: 0.75rem;
    font-weight: 800;
}

.brand img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.topnav {
    gap: 0.7rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.topnav a,
.link-button {
    color: var(--muted);
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 0.45rem 0.6rem;
}

.page {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.5rem 0 3rem;
}

.hero-grid,
.cabinet-grid,
.grid {
    display: grid;
    gap: 1rem;
}

.hero-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
    align-items: stretch;
}

.cabinet-grid {
    grid-template-columns: minmax(280px, 0.42fr) minmax(0, 0.58fr);
}

.grid {
    margin-top: 1rem;
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.hero-panel {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(18, 23, 34, 0.92);
    box-shadow: var(--shadow);
}

.hero-panel {
    min-height: 360px;
    padding: clamp(1.5rem, 5vw, 3rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    background:
        linear-gradient(115deg, rgba(18, 23, 34, 0.94), rgba(18, 23, 34, 0.62)),
        url("../images/logo.webp") center right 8% / min(42vw, 360px) no-repeat;
}

.panel {
    padding: 1.1rem;
}

.hero-panel h1,
.profile-panel h1 {
    margin: 0;
    font-size: clamp(2.4rem, 8vw, 5rem);
    line-height: 0.95;
}

.profile-panel h1 {
    font-size: clamp(2rem, 6vw, 3.8rem);
}

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

.eyebrow,
.muted {
    color: var(--muted);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    margin-bottom: 0.75rem;
}

.button,
.icon-button,
.tab {
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: var(--panel-soft);
    cursor: pointer;
    min-height: 42px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.72rem 1rem;
    font-weight: 700;
}

.button.primary {
    border-color: rgba(56, 189, 248, 0.5);
    background: #0e7490;
}

.button.ghost {
    background: rgba(255, 255, 255, 0.04);
}

.button.danger {
    border-color: rgba(251, 113, 133, 0.45);
    background: rgba(251, 113, 133, 0.12);
}

.button.small {
    min-height: 34px;
    padding: 0.45rem 0.75rem;
}

.button.full {
    width: 100%;
}

.button-stack {
    display: grid;
    gap: 0.65rem;
}

.hero-actions {
    gap: 0.75rem;
    flex-wrap: wrap;
}

.input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0c1018;
    color: var(--text);
    padding: 0.75rem 0.9rem;
    outline: none;
}

.textarea {
    min-height: 180px;
    resize: vertical;
}

.input:focus {
    border-color: var(--cyan);
}

.auth-form,
.upload-form,
.profile-mini {
    display: grid;
    gap: 0.75rem;
}

.donate-form {
    margin-top: 1rem;
}

.donate-form code {
    display: block;
}

.donate-screen {
    padding: clamp(1.2rem, 3vw, 2rem);
}

.donate-screen__intro {
    max-width: 820px;
    margin-bottom: 1.25rem;
}

.donate-screen__intro h1 {
    margin: 0 0 0.75rem;
    font-size: clamp(2.4rem, 6vw, 4.8rem);
    line-height: 0.95;
}

.donate-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.6fr);
    gap: 1rem;
    align-items: start;
}

.donate-main,
.donate-side {
    height: 100%;
}

.donate-summary,
.donate-result__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
}

.donate-summary {
    margin-bottom: 1rem;
}

.donate-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.donate-amount {
    font-size: 1.05rem;
}

.donate-actions .button {
    min-width: 180px;
}

.donate-result {
    display: grid;
    gap: 0.9rem;
    margin-top: 1rem;
}

.donate-address-card {
    display: grid;
    gap: 0.75rem;
}

.donate-address-card code {
    padding: 0.85rem 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0c1018;
}

.donate-debug {
    margin-top: 1rem;
}

.debug-box {
    margin: 0;
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0c1018;
    color: #dbeafe;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.92rem;
    line-height: 1.45;
}

.hidden {
    display: none !important;
}

.tab {
    padding: 0.55rem 0.85rem;
    color: var(--muted);
}

.tab.active {
    color: var(--text);
    border-color: rgba(56, 189, 248, 0.55);
    background: rgba(56, 189, 248, 0.12);
}

.tabs,
.leader-tabs {
    gap: 0.5rem;
    margin-bottom: 0.9rem;
    flex-wrap: wrap;
}

.form-message {
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.form-message.error {
    color: #fecdd3;
    border-color: rgba(251, 113, 133, 0.45);
    background: rgba(251, 113, 133, 0.1);
}

.form-message:not(.error) {
    color: #dcfce7;
    border-color: rgba(74, 222, 128, 0.38);
    background: rgba(20, 83, 45, 0.24);
}

.panel-title {
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-title h1,
.panel-title h2 {
    margin: 0;
}

.icon-button {
    width: 38px;
    height: 38px;
    font-size: 1.2rem;
}

.status-list,
.asset-list,
.changelog-list {
    display: grid;
    gap: 0.75rem;
}

.status-row,
.asset-item,
.change-item,
.stat,
.profile-list div {
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
}

.status-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
}

.status-row div {
    display: grid;
    gap: 0.15rem;
}

.status-row span,
.status-row em {
    color: var(--muted);
    font-style: normal;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--red);
    box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.12);
}

.status-dot.online {
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.12);
}

.copy-line {
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0c1018;
}

code {
    color: #bae6fd;
    overflow-wrap: anywhere;
}

.leader-list {
    display: none;
    margin: 0;
    padding-left: 1.3rem;
}

.leader-list.active {
    display: grid;
    gap: 0.55rem;
}

.leader-list li {
    padding: 0.45rem 0;
}

.leader-list li:not(.empty) {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
}

.leader-list strong {
    color: var(--amber);
}

.leader-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.change-item,
.asset-item {
    padding: 0.9rem;
}

.mail-recipient-list {
    display: grid;
    gap: 0.65rem;
    margin-top: 0.9rem;
}

.mail-recipient-item {
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.75rem;
}

.mail-recipient-item strong,
.mail-recipient-item span {
    display: block;
}

.history-stats {
    margin-top: 1rem;
}

.change-item span,
.change-item time,
.asset-item span {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
}

.skin-viewer {
    height: 390px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: radial-gradient(circle at 50% 25%, rgba(56, 189, 248, 0.16), #0c1018 55%);
    display: grid;
    place-items: center;
    overflow: hidden;
    margin-bottom: 1rem;
}

.skin-viewer canvas {
    width: 100% !important;
    height: 100% !important;
}

.skin-viewer img {
    width: 128px;
    image-rendering: pixelated;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.stats-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat {
    padding: 1rem;
}

.stat span {
    display: block;
    color: var(--muted);
    margin-bottom: 0.45rem;
}

.stat strong {
    font-size: 1.5rem;
    overflow-wrap: anywhere;
}

.profile-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 0 0 1rem;
}

.profile-list div {
    padding: 0.9rem;
}

.profile-list dt {
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.profile-list dd {
    margin: 0;
}

.site-footer {
    margin-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(9, 11, 16, 0.72);
}

.footer-inner {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1rem 0 1.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.footer-inner p {
    margin: 0.45rem 0 0;
}

.support-links {
    display: grid;
    gap: 0.55rem;
    justify-items: end;
}

.support-links a {
    color: #bae6fd;
}

.toast {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 20;
    max-width: min(360px, calc(100% - 2rem));
    padding: 0.85rem 1rem;
    border: 1px solid rgba(74, 222, 128, 0.38);
    border-radius: 8px;
    color: #dcfce7;
    background: rgba(20, 83, 45, 0.94);
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 900px) {
    .hero-grid,
    .cabinet-grid,
    .donate-layout,
    .grid.two,
    .grid.three,
    .leader-grid {
        grid-template-columns: 1fr;
    }

    .donate-summary,
    .donate-result__grid {
        grid-template-columns: 1fr;
    }

    .footer-inner {
        display: grid;
    }

    .hero-panel {
        min-height: 300px;
        background:
            linear-gradient(115deg, rgba(18, 23, 34, 0.96), rgba(18, 23, 34, 0.76)),
            url("../images/logo.webp") center right -2rem / 280px no-repeat;
    }
}

@media (max-width: 560px) {
    .topbar,
    .topnav,
    .hero-actions,
    .panel-title {
        align-items: stretch;
    }

    .topbar {
        flex-direction: column;
    }

    .topnav,
    .hero-actions,
    .button,
    .copy-line,
    .donate-actions,
    .profile-list,
    .stats-grid,
    .support-links {
        width: 100%;
    }

    .topnav,
    .hero-actions,
    .donate-actions,
    .copy-line,
    .panel-title {
        flex-direction: column;
    }

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

    .support-links {
        justify-items: stretch;
    }
}
