/* ========================================================================== 
   Asugura Roleplay — 2026 UI refresh
   Existing IDs, tab controls and API-driven components are intentionally kept.
   This layer only updates presentation and responsive behavior.
   ========================================================================== */

:root {
    --bg-dark: #070a12;
    --bg-card: rgba(17, 22, 37, 0.9);
    --primary: #ff4e87;
    --secondary: #54e6ff;
    --accent: #9c7cff;
    --text-main: #f7f8fc;
    --text-muted: #aab1c5;
    --text-sub: #cbd0df;
    --glass-border: rgba(255, 255, 255, 0.105);
    --surface: rgba(14, 19, 32, 0.88);
    --surface-raised: rgba(22, 28, 46, 0.94);
    --surface-soft: rgba(255, 255, 255, 0.045);
    --line: rgba(255, 255, 255, 0.1);
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 26px;
    --header-height: 116px;
    --transition: all 0.24s ease;
}

html {
    color-scheme: dark;
    scroll-padding-top: calc(var(--header-height) + 1rem);
}

body {
    background-color: var(--bg-dark);
    background-image:
        linear-gradient(180deg, rgba(7, 10, 18, 0.64), rgba(7, 10, 18, 0.94) 48%, #070a12 100%),
        url("/assets/los-santos-bg.png?v=4");
    background-position: center top;
    background-size: cover;
    background-attachment: fixed;
    color: var(--text-main);
    font-feature-settings: "palt" 1;
    line-height: 1.75;
}

::selection {
    background: rgba(84, 230, 255, 0.28);
    color: #fff;
}

img,
video,
canvas,
iframe {
    max-width: 100%;
}

h1,
h2,
h3,
h4,
p,
li,
td,
th,
a,
button,
label,
span {
    overflow-wrap: break-word;
}

h1,
h2,
h3,
h4 {
    text-wrap: balance;
}

p,
li {
    text-wrap: pretty;
}

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

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[contenteditable="true"]:focus-visible {
    outline: 3px solid rgba(84, 230, 255, 0.72);
    outline-offset: 3px;
}

.container {
    width: min(100% - 3rem, 1280px);
    max-width: 1280px;
    padding: 0;
}

.btn {
    min-height: 44px;
    justify-content: center;
    border-radius: var(--radius-sm);
    padding: 0.72rem 1.25rem;
    line-height: 1.25;
    white-space: nowrap;
    box-shadow: none;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, #ff4e87, #8d6cff);
    box-shadow: 0 10px 30px rgba(255, 78, 135, 0.18);
}

.btn-primary:hover {
    box-shadow: 0 14px 36px rgba(255, 78, 135, 0.28);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.065);
    border-color: rgba(255, 255, 255, 0.14);
}

.btn-discord {
    background: #5865f2;
    box-shadow: 0 10px 30px rgba(88, 101, 242, 0.2);
}

.btn-lg {
    min-height: 50px;
    padding: 0.84rem 1.4rem;
    font-size: 0.98rem;
}

/* Header ----------------------------------------------------------------- */

#navbar,
#navbar.scrolled {
    min-height: var(--header-height);
    padding: 0.7rem 0 0.6rem;
    background: rgba(7, 10, 18, 0.88);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(22px) saturate(135%);
    -webkit-backdrop-filter: blur(22px) saturate(135%);
}

#navbar::after {
    content: "";
    position: absolute;
    inset: auto 0 -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 78, 135, 0.55), rgba(84, 230, 255, 0.55), transparent);
    pointer-events: none;
}

#navbar .container {
    display: grid;
    grid-template-columns: minmax(240px, auto) 1fr auto;
    grid-template-rows: 48px 40px;
    column-gap: 1rem;
    row-gap: 0.35rem;
    align-items: center;
}

.logo {
    min-width: 0;
    gap: 0.7rem;
    font-size: 1.18rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.logo img {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    filter: drop-shadow(0 0 14px rgba(255, 78, 135, 0.35));
}

.logo span {
    white-space: nowrap;
    -webkit-text-fill-color: #f8f9fc;
    background: none;
}

#navbar nav {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
}

#navbar nav ul {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.35rem;
    min-width: 0;
}

#navbar nav li {
    flex: 0 0 auto;
}

#navbar nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0.42rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #aeb5c8;
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

#navbar nav a::after {
    display: none;
}

#navbar nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.055);
    border-color: rgba(255, 255, 255, 0.08);
}

#navbar nav a.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(255, 78, 135, 0.18), rgba(84, 230, 255, 0.12));
    border-color: rgba(84, 230, 255, 0.24);
    box-shadow: inset 0 0 18px rgba(84, 230, 255, 0.04);
}

.cta-nav {
    grid-column: 3;
    grid-row: 1;
    min-width: 0;
    gap: 0.45rem !important;
    flex-wrap: nowrap;
}

.cta-nav .btn,
.cta-nav > button {
    min-height: 38px;
    padding: 0.55rem 0.85rem !important;
    border-radius: 10px !important;
    font-size: 0.78rem !important;
    line-height: 1.15;
    white-space: nowrap;
}

#nav-discord-login-btn {
    background: rgba(88, 101, 242, 0.88) !important;
}

#nav-user-info {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-menu-btn {
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.055);
}

/* Hero ------------------------------------------------------------------- */

.hero {
    min-height: auto;
    padding: calc(var(--header-height) + 3.8rem) 0 0;
    overflow: hidden;
}

.hero-bg {
    background:
        radial-gradient(circle at 12% 18%, rgba(84, 230, 255, 0.13), transparent 34%),
        radial-gradient(circle at 85% 28%, rgba(255, 78, 135, 0.15), transparent 38%);
}

.hero-bg::before {
    opacity: 0.025;
}

.hero-content {
    display: grid;
    grid-template-columns: minmax(250px, 330px) minmax(0, 1fr);
    grid-auto-rows: auto;
    align-items: start;
    column-gap: clamp(2.5rem, 5vw, 5rem);
    row-gap: 1.15rem;
    max-width: none;
    margin: 0;
    text-align: left;
}

.hero-content > * {
    min-width: 0;
}

.hero-logo {
    grid-column: 1;
    grid-row: 1 / span 7;
    align-self: start;
    width: 100%;
    max-width: 330px;
    margin: 0;
    padding: clamp(1.4rem, 3vw, 2.7rem);
    aspect-ratio: 1;
    object-fit: contain;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 30px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.018)),
        radial-gradient(circle at 50% 35%, rgba(255, 78, 135, 0.12), transparent 65%);
    box-shadow: var(--shadow), inset 0 1px rgba(255, 255, 255, 0.08);
    filter: drop-shadow(0 16px 30px rgba(255, 78, 135, 0.15));
}

.hero h1 {
    grid-column: 2;
    margin: 0;
    font-size: clamp(2.6rem, 4.6vw, 4.7rem);
    line-height: 1.08;
    letter-spacing: -0.045em;
}

.hero h1 span {
    background: linear-gradient(110deg, #ff739f, #f9f9ff 48%, #74eaff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero h1 span::after {
    display: none;
}

.hero-content > p {
    grid-column: 2;
    max-width: 760px;
    margin: 0;
    color: #c5cada;
    font-size: clamp(1rem, 1.5vw, 1.16rem);
    line-height: 1.85;
}

.server-desc-box {
    grid-column: 2;
    margin: 0 !important;
    padding: 1.25rem 1.35rem !important;
    background: rgba(9, 13, 23, 0.72) !important;
    border: 1px solid var(--line);
    border-left: 3px solid var(--secondary);
    border-radius: var(--radius-md) !important;
    color: #bfc5d5;
    font-size: 0.9rem !important;
    line-height: 1.85 !important;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.16);
}

.server-desc-box strong {
    color: #fff;
}

.hero-btns {
    grid-column: 2;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    justify-content: stretch;
    width: 100%;
    max-width: 720px;
}

.hero-btns .btn {
    width: 100%;
}

.server-status-group {
    grid-column: 2;
    margin: 0;
    justify-content: flex-start;
}

.server-status {
    min-height: 38px;
    padding: 0.45rem 0.9rem;
    background: rgba(255, 255, 255, 0.045);
    border-radius: 10px;
}

.player-list-bar {
    grid-column: 2;
    margin: -0.4rem 0 0;
    padding: 0;
}

.player-list {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    max-width: none;
    padding: 0;
}

.player-name {
    min-width: 0;
    border-radius: 9px;
}

/* Shared section treatments --------------------------------------------- */

.section-title {
    margin-bottom: 3.2rem;
    font-size: clamp(1.9rem, 3vw, 2.8rem);
    letter-spacing: -0.025em;
}

.section-title::after {
    bottom: -0.9rem;
    width: 52px;
    height: 3px;
}

.features-inner {
    margin-top: 5rem;
    padding-bottom: 5rem;
}

.feature-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.feature-card,
.wiki-teaser-card,
.support-card,
.music-card,
.streamer-card,
.stock-owners-container,
.admin-tab-section,
.admin-stat-card,
.wiki-home-card {
    background: linear-gradient(145deg, rgba(24, 30, 49, 0.92), rgba(12, 17, 29, 0.94));
    border-color: var(--line);
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.16);
}

.feature-card {
    padding: 2rem 1.5rem;
    border-radius: var(--radius-md);
    text-align: left;
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: rgba(84, 230, 255, 0.38);
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.24);
}

.feature-card .icon {
    display: flex;
    width: 46px;
    height: 46px;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.3rem;
    border: 1px solid rgba(84, 230, 255, 0.18);
    border-radius: 13px;
    background: rgba(84, 230, 255, 0.07);
    font-size: 1.35rem;
}

.feature-card h3 {
    margin-bottom: 0.65rem;
    font-size: 1.1rem;
}

.feature-card p {
    font-size: 0.9rem;
    line-height: 1.8;
}

.community {
    padding: 1rem 0 5rem;
}

.community-box {
    gap: 3rem;
    padding: clamp(2rem, 5vw, 4rem);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(120deg, rgba(88, 101, 242, 0.18), rgba(156, 124, 255, 0.06)),
        rgba(14, 19, 32, 0.9);
    border-color: rgba(124, 137, 255, 0.26);
    box-shadow: var(--shadow);
}

.community-content {
    min-width: 0;
}

.community-content h2 {
    font-size: clamp(1.9rem, 3.5vw, 3.2rem);
}

.community-img {
    flex: 0 0 auto;
    font-size: clamp(6rem, 13vw, 10rem);
    opacity: 0.16;
}

.wiki-teaser {
    padding: 5rem 0 6rem;
    background: linear-gradient(180deg, transparent, rgba(84, 230, 255, 0.025), transparent);
}

.wiki-teaser-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.wiki-teaser-card {
    min-width: 0;
    padding: 1.6rem 1.25rem;
    border-radius: var(--radius-md);
}

.wiki-teaser-card:hover {
    transform: translateY(-4px);
    border-color: rgba(84, 230, 255, 0.38);
}

/* Standalone tabs -------------------------------------------------------- */

.streamers-section,
.music,
.stock-section,
.support-hero {
    min-height: 72vh;
    padding-top: calc(var(--header-height) + 4.5rem);
    padding-bottom: 6rem;
    background: transparent;
}

.streamers-subtitle,
.section-subtitle {
    max-width: 720px;
    margin-right: auto;
    margin-left: auto;
    color: var(--text-muted);
    line-height: 1.8;
}

.streamers-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.streamer-card {
    min-width: 0;
    min-height: 112px;
    padding: 1.15rem;
    border-radius: var(--radius-md);
}

.streamer-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 78, 135, 0.4);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.23);
}

.streamer-info,
.streamer-name,
.streamer-desc {
    min-width: 0;
}

.official-stream-card {
    background: linear-gradient(145deg, rgba(53, 42, 20, 0.88), rgba(18, 20, 29, 0.95));
}

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

.music-card {
    min-width: 0;
    overflow: hidden;
    border-radius: var(--radius-md);
}

.music-card:hover {
    transform: translateY(-4px);
    border-color: rgba(84, 230, 255, 0.38);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

.music-card h3 {
    display: flex;
    min-height: 64px;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0.9rem 1rem;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.5;
}

.support-hero {
    text-align: center;
    background: radial-gradient(circle at 50% 22%, rgba(255, 78, 135, 0.09), transparent 38%);
}

.support-badge {
    padding: 0.45rem 0.9rem;
    border: 1px solid rgba(84, 230, 255, 0.2);
    border-radius: 10px;
    letter-spacing: 0.04em;
}

.support-title {
    max-width: 900px;
    margin-right: auto;
    margin-left: auto;
    font-size: clamp(2.2rem, 5vw, 4.2rem);
    letter-spacing: -0.04em;
}

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

.support-card {
    min-width: 0;
    padding: 2rem 1.5rem;
    border-radius: var(--radius-md);
}

.support-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 78, 135, 0.38);
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.24);
}

.support-card .icon {
    width: 54px;
    height: 54px;
    margin: 0 auto 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(84, 230, 255, 0.18);
    border-radius: 15px;
    background: rgba(84, 230, 255, 0.07);
    font-size: 1.5rem;
}

.support-card h3 {
    font-size: 1.25rem;
}

.support-card p {
    font-size: 0.92rem;
    line-height: 1.85;
}

/* Finance and stock ------------------------------------------------------ */

.stock-display {
    margin-top: 3rem;
}

.stock-total-header,
.shares-info {
    border: 1px solid rgba(84, 230, 255, 0.18);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(135deg, rgba(84, 230, 255, 0.08), rgba(156, 124, 255, 0.05)),
        rgba(14, 19, 32, 0.9);
    box-shadow: var(--shadow);
}

.stock-total-header {
    padding: clamp(1.6rem, 4vw, 2.8rem);
}

.stock-total-header .stat-value,
.shares-value {
    font-size: clamp(2.25rem, 6vw, 4.2rem);
}

.stock-owners-container {
    min-width: 0;
    padding: 1.4rem;
    overflow-x: auto;
    border-radius: var(--radius-md);
    scrollbar-color: rgba(84, 230, 255, 0.38) transparent;
}

.stock-owners-container h3 {
    margin-bottom: 1.2rem;
    font-size: 1.1rem;
}

.owners-table,
.stock-section table,
.admin-table {
    width: 100%;
    min-width: 620px;
}

.owners-table th,
.owners-table td,
.admin-table th,
.admin-table td {
    padding: 0.8rem 0.9rem;
    white-space: normal;
    vertical-align: middle;
}

.owners-table th,
.admin-table th {
    color: #c1c7d6;
    background: rgba(255, 255, 255, 0.055);
    font-size: 0.76rem;
    letter-spacing: 0.04em;
}

.stock-notice {
    padding: clamp(1.2rem, 3vw, 2rem);
    border-radius: var(--radius-md);
    background: linear-gradient(145deg, rgba(24, 30, 49, 0.94), rgba(12, 17, 29, 0.96));
    border-color: var(--line);
    box-shadow: var(--shadow);
}

.stock-notice-block {
    min-width: 0;
    background: rgba(84, 230, 255, 0.055);
    border-left-color: var(--secondary);
    border-radius: 10px;
}

.stock-notice-block > div,
.stock-notice-rules,
.stock-notice-rules li {
    min-width: 0;
}

/* Wiki ------------------------------------------------------------------- */

#tab-wiki {
    padding-top: var(--header-height);
    background: rgba(7, 10, 18, 0.72);
}

.wiki-topbar {
    top: var(--header-height);
    padding: 0.6rem 0;
    background: rgba(10, 14, 24, 0.96);
    border-color: var(--line);
    z-index: 240;
}

.wiki-topbar-inner {
    min-height: 42px;
    padding: 0 1.25rem;
}

.wiki-topbar-inner > div {
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.wiki-topbar-btn {
    min-height: 36px;
    border-radius: 9px !important;
    white-space: nowrap;
}

.wiki-wrapper {
    min-height: calc(100vh - var(--header-height) - 62px);
}

.wiki-nav-sidebar {
    top: calc(var(--header-height) + 62px);
    height: calc(100vh - var(--header-height) - 62px);
    background: rgba(10, 14, 24, 0.98);
    border-color: var(--line);
}

.wiki-nav-brand {
    background: linear-gradient(90deg, rgba(84, 230, 255, 0.08), transparent);
}

.wiki-nav-top-link,
.wiki-nav-cat-header,
.wiki-nav-page-link {
    min-width: 0;
}

.wiki-nav-cat-header span,
.wiki-nav-page-link {
    overflow-wrap: anywhere;
}

.wiki-nav-top-link.active,
.wiki-nav-page-link.active {
    background: rgba(84, 230, 255, 0.09);
}

.wiki-main {
    min-width: 0;
    padding: clamp(1.3rem, 3vw, 2.75rem);
}

.wiki-home-banner {
    min-width: 0;
    padding: clamp(1.5rem, 4vw, 2.7rem);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(125deg, rgba(255, 78, 135, 0.1), rgba(84, 230, 255, 0.055)),
        rgba(16, 21, 35, 0.92);
    box-shadow: var(--shadow);
}

.wiki-home-banner > div {
    min-width: 0;
}

.wiki-home-title {
    font-size: clamp(1.6rem, 3vw, 2.35rem);
    overflow-wrap: anywhere;
}

.wiki-home-cat-card {
    min-width: 0;
    padding: 1.15rem 1.35rem;
    border-radius: 14px;
}

.wiki-home-cat-card > div:not(.wiki-home-cat-icon),
.wiki-recent-info,
.wiki-staff-info {
    min-width: 0;
}

.wiki-home-cat-card h3,
.wiki-home-cat-card p,
.wiki-recent-title,
.wiki-staff-name,
.wiki-staff-detail {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
}

.wiki-home-card {
    min-width: 0;
    border-radius: var(--radius-md);
}

.wiki-content {
    min-width: 0;
    color: #d4d8e3;
}

.wiki-content img {
    height: auto;
}

.wiki-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    white-space: normal;
}

.wiki-article-header > div,
.wiki-editor-header > * {
    min-width: 0;
}

.wiki-title-input,
.wiki-editor-body,
.wiki-input,
.wiki-select {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.13);
    color: var(--text-main);
}

.wiki-input::placeholder,
.wiki-title-input::placeholder {
    color: #7f879b;
}

.wiki-input:focus,
.wiki-title-input:focus,
.wiki-select:focus {
    background: rgba(255, 255, 255, 0.085);
    border-color: var(--secondary);
}

.wiki-select option {
    background: #141927;
    color: #fff;
}

.wiki-label,
.wiki-modal label {
    color: #cbd0df;
}

.wiki-modal-overlay {
    padding: 1rem;
    background: rgba(2, 5, 12, 0.78);
    backdrop-filter: blur(10px);
}

.wiki-modal {
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    padding: clamp(1.4rem, 4vw, 2.2rem);
    background: #151a29;
    border-color: var(--line);
    border-radius: var(--radius-md);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.52);
}

.wiki-modal-title,
.wiki-modal h3 {
    color: #fff;
}

.wiki-modal p {
    color: var(--text-muted);
}

.wiki-modal-close {
    background: rgba(255, 255, 255, 0.08);
    color: #d8dce7;
}

/* Admin ------------------------------------------------------------------ */

.admin-tab-wrapper {
    max-width: 1180px;
    padding: calc(var(--header-height) + 4rem) 1.5rem 5rem;
}

.admin-tab-header,
.admin-section-header,
.admin-staff-row,
.admin-tab-section > div[style*="display:flex"] {
    min-width: 0;
}

.admin-tab-stats {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.admin-stat-card,
.admin-tab-section,
.admin-tab-login-box {
    border-color: var(--line);
    border-radius: var(--radius-md);
}

.admin-tab-section {
    padding: clamp(1.15rem, 3vw, 1.8rem);
}

.admin-table-wrap {
    max-width: 100%;
    overflow-x: auto;
}

.admin-staff-info,
.admin-staff-info strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.admin-link-card {
    min-width: 0;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.045);
}

/* Footer and chatbot ----------------------------------------------------- */

footer {
    padding: 4.5rem 0 1.8rem;
    background: #080b13;
    border-color: var(--line);
}

.footer-grid {
    grid-template-columns: minmax(0, 2fr) minmax(160px, 1fr) minmax(160px, 1fr);
    gap: clamp(2rem, 5vw, 5rem);
}

.footer-grid > * {
    min-width: 0;
}

.social-icons a {
    display: flex;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
}

.ai-chat-widget {
    right: 22px;
    bottom: 22px;
}

.ai-chat-btn {
    width: 56px;
    height: 56px;
    border-radius: 17px;
    font-size: 1.45rem;
    box-shadow: 0 16px 38px rgba(255, 78, 135, 0.28);
}

.ai-chat-window {
    width: min(370px, calc(100vw - 2rem));
    height: min(540px, calc(100vh - 130px));
    background: rgba(15, 20, 33, 0.97);
    border-radius: var(--radius-md);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
}

.ai-message-content,
.ai-chat-header {
    overflow-wrap: anywhere;
}

/* Tablet navigation and layout ------------------------------------------ */

@media (max-width: 1120px) {
    :root {
        --header-height: 72px;
    }

    #navbar,
    #navbar.scrolled {
        min-height: var(--header-height);
        padding: 0.7rem 0;
        background: rgba(7, 10, 18, 0.97);
        /* backdrop-filter creates a containing block for fixed menu children */
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    #navbar .container {
        display: flex;
        min-height: 48px;
        justify-content: space-between;
        align-items: center;
    }

    #navbar nav,
    #navbar .cta-nav {
        display: none !important;
    }

    #navbar .mobile-menu-btn {
        display: flex;
        flex: 0 0 44px;
    }

    #navbar nav.open {
        display: flex !important;
        position: fixed;
        inset: 0;
        z-index: 999;
        align-items: stretch;
        justify-content: flex-start;
        overflow-y: auto;
        padding: calc(var(--header-height) + 1.4rem) 1.5rem 10rem;
        background:
            radial-gradient(circle at 50% 0, rgba(84, 230, 255, 0.1), transparent 35%),
            rgba(7, 10, 18, 0.985);
        backdrop-filter: blur(24px);
    }

    #navbar nav.open ul {
        width: min(100%, 520px);
        margin: 0 auto;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0.55rem;
    }

    #navbar nav.open li {
        width: 100%;
    }

    #navbar nav.open a {
        width: 100%;
        min-height: 50px;
        justify-content: flex-start;
        padding: 0.8rem 1rem;
        border-color: var(--line);
        background: rgba(255, 255, 255, 0.035);
        font-size: 1rem;
    }

    #navbar nav.open a.active {
        background: linear-gradient(135deg, rgba(255, 78, 135, 0.18), rgba(84, 230, 255, 0.1));
    }

    #navbar .cta-nav.open {
        display: flex !important;
        position: fixed;
        right: auto;
        bottom: 1rem;
        left: 50%;
        z-index: 1000;
        width: min(calc(100% - 2rem), 520px);
        max-width: none;
        padding: 0.75rem;
        flex-wrap: wrap;
        justify-content: center;
        border: 1px solid var(--line);
        border-radius: 16px;
        background: rgba(14, 19, 32, 0.97);
        box-shadow: var(--shadow);
        transform: translateX(-50%);
    }

    #navbar .cta-nav.open > * {
        flex: 1 1 125px;
    }

    body:has(#navbar nav.open) .ai-chat-widget {
        opacity: 0;
        pointer-events: none;
    }

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

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

    #tab-wiki {
        padding-top: var(--header-height);
    }

    .wiki-topbar {
        top: var(--header-height);
    }

    .wiki-nav-sidebar {
        top: calc(var(--header-height) + 62px);
        height: calc(100vh - var(--header-height) - 62px);
    }
}

@media (max-width: 900px) {
    .hero {
        padding-top: calc(var(--header-height) + 2.6rem);
    }

    .hero-content {
        grid-template-columns: 1fr;
        row-gap: 1.15rem;
        text-align: center;
    }

    .hero-logo,
    .hero h1,
    .hero-content > p,
    .server-desc-box,
    .hero-btns,
    .server-status-group,
    .player-list-bar {
        grid-column: 1;
    }

    .hero-logo {
        grid-row: auto;
        width: min(46vw, 240px);
        margin: 0 auto 0.6rem;
        border-radius: 24px;
    }

    .hero h1 {
        font-size: clamp(2.35rem, 8vw, 4rem);
    }

    .hero-content > p {
        margin: 0 auto;
    }

    .server-desc-box {
        text-align: left;
    }

    .hero-btns {
        margin: 0 auto;
    }

    .server-status-group {
        justify-content: center;
    }

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

    .wiki-nav-sidebar {
        top: calc(var(--header-height) + 62px);
        left: -300px;
        height: calc(100vh - var(--header-height) - 62px);
        padding-top: 0;
        z-index: 300;
    }

    .wiki-sidebar-backdrop.open {
        display: block;
    }

    .wiki-main {
        max-width: 100%;
    }

    .wiki-breadcrumb {
        display: flex !important;
    }

    .wiki-nav-tree {
        display: block !important;
    }
}

@media (max-width: 700px) {
    .container {
        width: min(100% - 2rem, 1280px);
    }

    .logo {
        font-size: 1rem;
    }

    .logo img {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }

    .hero {
        padding-top: calc(var(--header-height) + 2rem);
    }

    .hero-logo {
        width: min(52vw, 200px);
        padding: 1.4rem;
    }

    .hero h1 {
        font-size: clamp(2.05rem, 10.5vw, 3rem);
        line-height: 1.12;
    }

    .hero-content > p {
        font-size: 0.98rem;
    }

    .server-desc-box {
        padding: 1rem !important;
        font-size: 0.84rem !important;
    }

    .hero-btns {
        grid-template-columns: 1fr;
        max-width: 420px;
    }

    .feature-grid,
    .support-grid,
    .music-grid,
    .wiki-teaser-grid {
        grid-template-columns: 1fr;
    }

    .features-inner {
        margin-top: 3.8rem;
        padding-bottom: 3.5rem;
    }

    .community-box {
        flex-direction: column;
        align-items: flex-start;
    }

    .community-img {
        position: absolute;
        right: -1rem;
        bottom: -2rem;
        opacity: 0.08;
    }

    .wiki-teaser {
        padding: 4rem 0;
    }

    .streamers-section,
    .music,
    .stock-section,
    .support-hero {
        padding-top: calc(var(--header-height) + 3rem);
        padding-bottom: 4rem;
    }

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

    .stock-notice-block {
        flex-direction: column;
    }

    .stock-owners-container {
        padding: 1rem;
    }

    .shares-info {
        width: 100%;
        padding: 1.7rem 1rem;
    }

    .wiki-topbar-inner {
        gap: 0.45rem;
        padding: 0 0.75rem;
    }

    .wiki-user-info-text:empty {
        display: none;
    }

    .wiki-topbar-inner > div {
        gap: 0.4rem !important;
    }

    .wiki-topbar-btn {
        padding: 0.35rem 0.6rem !important;
        font-size: 0.72rem !important;
    }

    .wiki-home-banner {
        align-items: center;
        text-align: center;
    }

    .wiki-home-logo {
        width: 64px;
        height: 64px;
    }

    .wiki-home-cat-card {
        align-items: flex-start;
        gap: 0.9rem;
    }

    .wiki-home-cat-icon {
        width: 44px;
        height: 44px;
        font-size: 1.35rem;
    }

    .wiki-article-header,
    #wiki-page-content,
    .wiki-article-card > .wiki-content {
        padding: 1.15rem !important;
    }

    .wiki-editor-header > div,
    .wiki-page-actions {
        width: 100%;
    }

    .admin-tab-wrapper {
        padding: calc(var(--header-height) + 3rem) 1rem 4rem;
    }

    .admin-tab-section > div[style*="display:flex"],
    .admin-section-header,
    .admin-staff-row {
        align-items: stretch !important;
        flex-direction: column;
    }

    .admin-staff-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        margin-bottom: 2.5rem;
    }

    .ai-chat-widget {
        right: 14px;
        bottom: 14px;
    }

    .ai-chat-window {
        right: 0;
        bottom: 68px;
        width: calc(100vw - 28px);
        height: min(520px, calc(100vh - 110px));
    }
}

@media (max-width: 420px) {
    .container {
        width: min(100% - 1.5rem, 1280px);
    }

    .logo span {
        max-width: 190px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #navbar nav.open {
        padding-right: 0.85rem;
        padding-left: 0.85rem;
    }

    #navbar .cta-nav.open {
        width: calc(100% - 1rem);
    }

    .server-status-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .server-status {
        justify-content: center;
        padding: 0.4rem 0.55rem;
    }

    .support-card,
    .feature-card {
        padding: 1.5rem 1.15rem;
    }

    .streamer-card {
        gap: 0.85rem;
        padding: 1rem;
    }

    .streamer-avatar {
        width: 54px;
        height: 54px;
    }

    .official-badge {
        position: static;
        width: fit-content;
        margin-bottom: 0.35rem;
    }

    .wiki-main {
        padding: 0.85rem;
    }

    .wiki-home-card {
        padding: 1.1rem;
    }

    .wiki-home-cat-card {
        padding: 1rem;
    }

    .wiki-home-cat-card p {
        font-size: 0.8rem;
    }

    .wiki-modal {
        margin: 0;
    }
}

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