/* MeteorBall public pages (server-rendered): the game's palette and type, laid out for reading. */

html:has(body.public), body.public {
    background-color: #07060c;
    height: auto;
    min-height: 100%;
    overflow: auto;
    -webkit-user-select: text;
    user-select: text;
}
body.public {
    background: #07060c radial-gradient(ellipse at 50% -10%, #241a3a 0%, #07060c 60%) no-repeat;
    line-height: 1.55;
    font-size: 1.05rem;
}
body.public a { color: var(--mb-accent); }
body.public a:hover { text-decoration-thickness: 2px; }
body.public :focus-visible { outline: 3px solid var(--mb-accent); outline-offset: 2px; }

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 50; padding: 8px 14px; background: var(--mb-accent); color: #111 !important; border-radius: 8px; font-weight: 700; }
.skip-link:focus { top: 12px; }

/* ---------- Header and footer ---------- */
.site-header {
    position: relative; z-index: 20;
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px;
    padding: 10px 20px;
    background: rgba(7, 6, 12, 0.85);
    border-bottom: 1px solid #2a2433;
}
.site-brand { line-height: 0; }
.site-brand img { width: 120px; height: auto; }
.site-nav { flex: 1; }
.site-nav ul, .site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.site-nav a, .site-account a { text-decoration: none; font-weight: 600; padding: 6px 0; display: inline-block; }
.site-nav a:hover, .site-account a:hover { text-decoration: underline; }
.site-account { display: flex; gap: 14px; align-items: center; }
.site-account-name { color: #d8cccc; }
.site-main { display: block; min-height: 60vh; }
.site-main:focus { outline: none; }
.site-footer { margin-top: 48px; padding: 24px 20px 32px; border-top: 1px solid #2a2433; color: #bfb3b3; font-size: 0.95rem; }
.site-footer ul { justify-content: center; margin-bottom: 10px; }
.site-footer p { text-align: center; margin: 0; }

/* ---------- Home: the original title screen ---------- */
body.public:has(.home-hero) .site-header { position: absolute; inset: 0 0 auto 0; background: linear-gradient(rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0)); border: 0; }
.home-hero { position: relative; height: 100vh; height: 100svh; min-height: 620px; overflow: hidden; }
.home-hero .menu-content { padding-top: max(8vh, 84px); }
.home-hero .menu-play, .home-hero .menu-creator { display: block; }
.menu-island { min-height: calc(min(60vw, 263px) * 300 / 630); display: flex; justify-content: center; }
.menu-island .menu-options { width: min(60vw, 263px); }
.menu-island .overlay { position: fixed; }
.home-more {
    position: absolute; right: 18px; bottom: 18px;
    padding: 8px 18px; border-radius: 999px; background: rgba(7, 6, 12, 0.8); font-weight: 600; text-decoration: none;
}

/* ---------- Content ---------- */
.page-content { max-width: 960px; margin: 0 auto; padding: 8px 20px 0; box-sizing: border-box; }
.page-content h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); line-height: 1.2; margin: 12px 0 10px; }
.page-content h2 { font-size: 1.35rem; margin: 30px 0 10px; }
.page-content h3 { font-size: 1.1rem; margin: 0; }
.lead { font-size: 1.15rem; color: #e8dfdf; }
.prose p, .prose li { max-width: 72ch; }
.prose li { margin: 6px 0; }
.prose code { background: #241f2b; padding: 1px 6px; border-radius: 4px; }
.fact-list li { margin: 8px 0; }
.fact-table { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 16px 0; padding: 16px 20px; background: rgba(36, 31, 43, 0.7); border-radius: 12px; }
.fact-table dt { font-weight: 700; color: #d8cccc; }
.fact-table dd { margin: 0; }
.link-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 24px 0; }
.plain-list { list-style: none; padding: 0; }
.notice, .result-count { color: #e0d6d6; }
.home-sections { padding-top: 24px; }

.button {
    display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 18px; box-sizing: border-box;
    border-radius: 10px; border: 2px solid var(--mb-accent); background: var(--mb-accent); color: #1a1414 !important;
    font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.button-secondary { background: #2a2626; color: var(--mb-text) !important; border-color: #5a5252; }
.button-large { min-height: 52px; font-size: 1.15rem; padding: 10px 26px; }

.breadcrumbs { max-width: 960px; margin: 0 auto; padding: 14px 20px 0; box-sizing: border-box; font-size: 0.92rem; }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs li + li::before { content: "›"; margin-right: 6px; color: #9a8f8f; }
.breadcrumbs [aria-current] { color: #d8cccc; }

/* ---------- Community ---------- */
.community-search { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 12px; }
.community-search input {
    flex: 1; min-width: 200px; min-height: 44px; padding: 8px 12px; box-sizing: border-box;
    font: inherit; color: var(--mb-text); background: #2a2626; border: 2px solid #5a5252; border-radius: 10px;
}
.community-sorts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.community-sort { padding: 6px 14px; border-radius: 999px; border: 2px solid #5a5252; background: #2a2626; color: var(--mb-text) !important; text-decoration: none; font-weight: 600; }
.community-sort.active { border-color: var(--mb-accent); background: #4a3a1f; }
.level-list { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 10px; }
.level-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; background: rgba(36, 31, 43, 0.85); border-radius: 12px; }
.level-card-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0 0; font-size: 0.93rem; color: #d8cccc; }
.level-card-name a { text-decoration: none; }
.level-card-name a:hover { text-decoration: underline; }
.player-rating { color: #ffe08a; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 18px 0; }

.level-header { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.level-header h1 { margin-bottom: 0; }
.level-byline { margin: 0 0 10px; font-size: 1.1rem; }
.version-list li { margin: 6px 0; }

/* ---------- Owner review and status pages ---------- */
.owner-review { margin: 16px 0; padding: 12px 16px; border: 2px dashed var(--mb-accent); border-radius: 10px; background: rgba(74, 58, 31, 0.35); }
.status-page { padding-top: 40px; text-align: center; }
.status-page .link-row { justify-content: center; }
.request-id { text-align: center; color: #bfb3b3; }

@media (max-width: 640px) {
    .site-header { padding: 8px 16px; }
    /* On phones the wrapped navigation sits above the title screen instead of over the logo. */
    body.public:has(.home-hero) .site-header { position: relative; background: rgba(7, 6, 12, 0.95); border-bottom: 1px solid #2a2433; }
    .home-hero .menu-content { padding-top: 6vh; }
    .home-more { right: 50%; transform: translateX(50%); }
    .site-nav { flex-basis: 100%; order: 3; }
    .page-content, .breadcrumbs { padding-left: 16px; padding-right: 16px; }
    .level-card { flex-direction: column; align-items: stretch; }
    .fact-table { grid-template-columns: 1fr; gap: 2px; }
    .fact-table dd { margin-bottom: 8px; }
}

/* Advertising slots (docs/ADVERTISING.md): a fixed-height box, so an ad that loads late, is blocked or isn't
   filled never moves the content around it. */
.ad-slot { max-width: 960px; margin: 20px auto; padding: 0 20px; box-sizing: border-box; }
.page-content .ad-slot { padding: 0; }
.ad-label { display: block; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: #9a8f8f; margin-bottom: 4px; }
.ad-slot .ad-unit { display: block; width: 100%; height: 250px; overflow: hidden; }
.ad-placeholder { min-height: 0; }
.ad-placeholder .ad-label { display: flex; align-items: center; justify-content: center; height: 250px; border: 2px dashed #5a5252; border-radius: 10px; color: #bfb3b3; text-transform: none; }
@media (max-width: 640px) {
    .ad-slot .ad-unit, .ad-placeholder .ad-label { height: 280px; }
}
