/* Project4 UI layer: shared look, motion and phone layout for every page.
   Loaded after main.css; keep site-wide visual changes here instead of editing main.css. */
/* Project4 look: obsidian panels, thin gold frames, Cinzel headings, Inter text (fonts/ is self-hosted). */
:root {
    --p4-accent: #d4a85a;
    --p4-accent-2: #a87a35;
    --p4-gold-light: #f6e2b3;
    --p4-glow: rgba(226, 183, 102, .32);
    --p4-bg: #0b0d12;
    --p4-surface: #12151c;
    --p4-card: #161a24;
    --p4-line: rgba(212, 168, 90, .22);
    --p4-frame-line: rgba(212, 168, 90, .38);
    --p4-text: #e9e4d8;
    --p4-muted: #a39c8c;
    --p4-pill: linear-gradient(180deg, #1a1e29, #11141b);
    --p4-pill-active: linear-gradient(180deg, #f0cf8a, #c9974a);
    --p4-panel: linear-gradient(180deg, #161a24, #0f121a);
    --p4-serif: 'Cinzel', Georgia, serif;
    --p4-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --p4-ease: cubic-bezier(.2, .7, .2, 1);
}

@font-face { font-family: 'Inter'; font-weight: 100 900; font-display: swap; src: url('../fonts/inter-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-weight: 100 900; font-display: swap; src: url('../fonts/inter-greek.woff2') format('woff2');
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; }
@font-face { font-family: 'Cinzel'; font-weight: 400 900; font-display: swap; src: url('../fonts/cinzel-latin.woff2') format('woff2'); }
/* main.css asks everywhere for "BPG ExtraSquare Mtavruli", a font the site never shipped (text fell back to Times New Roman). */
@font-face { font-family: 'BPG ExtraSquare Mtavruli'; font-weight: 100 900; font-display: swap; src: url('../fonts/inter-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'BPG ExtraSquare Mtavruli'; font-weight: 100 900; font-display: swap; src: url('../fonts/inter-greek.woff2') format('woff2');
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; }

@keyframes p4-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes p4-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes p4-slide { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
@keyframes p4-zoom { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }

/* ---------- Top menu ---------- */
.nav__links-item a { position: relative; }
@media (min-width: 1025px) {
    .nav__links-item a::after {
        content: ''; position: absolute; left: 0; right: 0; bottom: -10px; height: 2px; border-radius: 2px;
        background: var(--p4-accent); transform: scaleX(0); transition: transform .3s var(--p4-ease);
    }
    .nav__links-item a:hover::after, .nav__links-item a.is-current::after { transform: scaleX(1); }
}
.nav__links-item a.is-current { color: var(--p4-accent); }
/* Phone menu: items slide in one after another. */
.nav:has(.nav__open-links.active) .nav__links-item { animation: p4-slide .35s var(--p4-ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
/* The page content overlaps the header (.inner-page has a negative margin and a higher z-index):
   lift the header while the phone menu is open so the menu stays on top. */
.header:has(.nav__open-links.active) { z-index: 3; }

/* ---------- Header ---------- */
.header__content-logo-center img { animation: p4-zoom 1.1s var(--p4-ease) both; }
.header__content-timer:not([hidden]) { animation: p4-up .8s .3s var(--p4-ease) both; }
/* Countdown digits on a drum: the turn axis lies behind the digit (transform-origin z). The old digit breaks into a shadow, the new one forms out of it.
   Fixed width: the digits of Cinzel have different widths and the neighbour would move. */
.p4-digit { display: inline-grid; width: .66em; justify-items: center; perspective: 4em; }
.p4-digit > span { grid-area: 1 / 1; transform-origin: 50% 50% -.7em; backface-visibility: hidden; }
.p4-digit__in { animation: p4-digit-in .45s cubic-bezier(.3, .1, .2, 1) both; }
.p4-digit__out { animation: p4-digit-out .45s cubic-bezier(.3, .1, .2, 1) both; }
@keyframes p4-digit-in {
    from { transform: rotateX(100deg) scaleX(1.25); opacity: 0; filter: blur(.16em) brightness(.25); text-shadow: 0 -.2em .12em, 0 -.45em .22em; }
    55% { opacity: .8; filter: blur(.05em) brightness(.6); }
    to { transform: none; filter: blur(0) brightness(1); text-shadow: 0 0 0 transparent, 0 0 0 transparent; }
}
@keyframes p4-digit-out {
    from { filter: blur(0) brightness(1); text-shadow: 0 0 0 transparent, 0 0 0 transparent; }
    35% { opacity: .8; filter: blur(.06em) brightness(.45); }
    to { transform: rotateX(-100deg) scaleX(1.25); opacity: 0; filter: blur(.2em) brightness(.15); text-shadow: 0 -.2em .12em, 0 -.45em .22em; }
}
.button { transition: box-shadow .3s, transform .3s var(--p4-ease); }
.button:hover { box-shadow: 0 0 18px var(--p4-glow), 0 0 1px 0 #ff9d00 inset; transform: translateY(-1px); }

/* ---------- Pills: race selector and tabs share one look ---------- */
.race-btn, .wiki__nav-item {
    transition: background .3s, border-color .3s, color .3s, box-shadow .3s, transform .25s var(--p4-ease);
}
/* Race selector (Gameplay pages): native swipeable strip, centred when it fits, edges fade out. */
.race-strip {
    position: relative; display: flex; gap: 12px; margin-top: 14px; padding: 8px 24px 12px; overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
}
/* The strip scrolls inside its own box: never wider than the screen (10 races do not fit on a phone). */
.race-container { min-width: 0; max-width: 100%; flex: 1 1 100%; }
.race-strip { max-width: 100%; }
.race-strip .race-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 0; padding: 0 20px; line-height: 1; }
/* Race pages: the classes sit right under the race strip (the section's bottom padding made a big gap). */
.inner-page:has(.race-strip) { padding-bottom: 0; }
.race-strip::-webkit-scrollbar { display: none; }
.race-strip .race-btn:first-of-type { margin-left: auto; }
.race-strip .race-btn:last-of-type { margin-right: auto; }
.race-btn {
    position: relative; overflow: hidden; flex: 0 0 auto; width: auto; min-width: 150px; height: 52px; padding: 0 24px;
    scroll-snap-align: center; background: var(--p4-pill); border: 1px solid rgba(255, 153, 51, .6); border-radius: 14px;
    font-family: BPG ExtraSquare Mtavruli, serif; font-size: 17px; letter-spacing: .5px; text-transform: uppercase;
}
.race-btn:hover { transform: translateY(-2px); border-color: var(--p4-accent); box-shadow: 0 8px 18px rgba(0, 0, 0, .55), 0 0 12px var(--p4-glow); }
.race-btn:active { transform: scale(.97); }
.race-btn.active { background: var(--p4-pill-active); color: #111; border-color: transparent; box-shadow: 0 6px 20px var(--p4-glow); }
/* With ui.js the orange comes from one glider that slides under the picked race (segmented control). */
.race-strip.has-glider .race-btn { z-index: 1; }
.race-strip.has-glider .race-btn.active { background: transparent; box-shadow: none; transition-delay: .1s; }
.race-strip__glider {
    position: absolute; left: 0; top: 0; z-index: 0; overflow: hidden; border-radius: 14px; pointer-events: none;
    background: var(--p4-pill-active); box-shadow: 0 6px 20px var(--p4-glow);
    transition: transform .5s cubic-bezier(.3, 1.3, .4, 1), width .5s cubic-bezier(.2, .7, .2, 1);
}
/* Slow light sweep across the selected race. */
.race-strip__glider::after, .race-strip:not(.has-glider) .race-btn.active::after {
    content: ''; position: absolute; inset: 0; transform: translateX(-120%);
    background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%);
    animation: p4-sheen 4.5s 1s ease-in-out infinite;
}
@keyframes p4-sheen { 0%, 70% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }

/* Swapping the classes of another race in place (ui.js). */
.wiki.p4-leave { opacity: 0; transform: translateY(10px); transition: opacity .2s ease, transform .2s ease; }
.wiki.p4-enter { animation: p4-fade .45s cubic-bezier(.2, .7, .2, 1) both; }

/* Other page changes: cross-fade where the browser supports cross-document View Transitions. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .3s; }

/* Desktop tab list: accent bar grows on the active/hovered item. */
.wiki__nav-item { position: relative; }
.wiki__nav-item::before {
    content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px;
    background: var(--p4-accent); transform: scaleY(0); transition: transform .3s var(--p4-ease);
}
.wiki__nav-item:hover::before { transform: scaleY(.5); }
.wiki__nav-item.active::before { transform: scaleY(1); }
.wiki__nav-item:hover .wiki__nav-item-info { transform: translateX(3px); }
.wiki__nav-item-info { transition: transform .3s var(--p4-ease); }

/* Tablets and phones: tabs become one sticky, swipeable strip of pills right above the content. */
@media (max-width: 1024px) {
    .wiki__nav {
        position: sticky; top: 8px; z-index: 5; display: flex; flex-wrap: nowrap; gap: 8px;
        overflow-x: auto; overflow-y: hidden; padding: 10px; border: 1px solid var(--p4-line); border-radius: 16px;
        /* No backdrop-filter and an own layer: iOS Safari makes a blurred sticky bar jump while its toolbar hides/shows. */
        background: rgba(24, 24, 24, .97); box-shadow: 0 10px 24px rgba(0, 0, 0, .35);
        -webkit-transform: translateZ(0); transform: translateZ(0); will-change: transform;
        scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
    }
    .wiki__nav::-webkit-scrollbar { display: none; }
    .wiki__nav-item, .wiki__nav-item:last-child {
        flex: 0 0 auto; width: auto; margin: 0; padding: 10px 16px; scroll-snap-align: center;
        background: var(--p4-pill); border: 1px solid rgba(255, 153, 51, .45); border-radius: 12px;
    }
    .wiki__nav-item::before, .wiki__nav-item-icon, .wiki__nav-item-desc { display: none; }
    .wiki__nav-item-info { width: auto; padding-left: 0; white-space: nowrap; }
    .wiki__nav-item:hover .wiki__nav-item-info { transform: none; }
    .wiki__nav-item-name { margin-top: 0; font-size: 14px; }
    .wiki__nav-item:hover { background: var(--p4-pill); border-color: var(--p4-accent); }
    .wiki__nav-item.active { background: var(--p4-pill-active); border-color: transparent; box-shadow: 0 4px 14px var(--p4-glow); }
    .wiki__nav-item.active .wiki__nav-item-name { color: #111; }
    .wiki__box { margin-top: 14px; }
    /* Tab title: drop the empty icon column so the text starts at the edge. */
    .wiki__content-title-icon { display: none; }
    .wiki__content-title-info { width: 100%; padding-left: 0; }
    .race-btn { min-width: 128px; height: 46px; padding: 0 18px; font-size: 15px; }
}
/* ui.js pins the strip with position:fixed (html.p4-pin); without it the strip stays sticky. */
.p4-nav-sentinel, .p4-nav-spacer { display: none; }
@media (max-width: 1024px) {
    .p4-nav-sentinel, .p4-nav-spacer { display: block; width: 100%; flex: 0 0 100%; }
    /* No clipping ancestors on phones: with overflow clip/hidden around it, iOS Safari still shook the pinned strip
       (the Gameplay pages, where .wiki sits outside .wrapper, never did). Nothing on these pages is wider than the screen. */
    .p4-pin .wrapper, .p4-pin .section { overflow: visible; }
    .p4-pin .wiki__nav { position: relative; top: auto; }
    .p4-pin .wiki__nav.is-pinned { position: fixed; top: 8px; z-index: 50; margin: 0; }
}
/* Sticky needs no clipping ancestor: clip only sideways where the browser supports it. */
@supports (overflow-x: clip) {
    .wrapper, .section { overflow: visible; overflow-x: clip; }
}

/* ---------- Tab content ---------- */
.wiki__content.active { animation: p4-fade .4s var(--p4-ease) both; }
.wiki__content.active .p4-stagger { animation: p4-up .5s var(--p4-ease) both; animation-delay: calc(var(--i, 0) * 45ms + 80ms); }
.p4-row { border-radius: 10px; padding: 6px; margin-left: -6px; margin-right: -6px; transition: background .25s; }
.p4-row:hover { background: rgba(255, 255, 255, .03); }

/* Cards on the generated pages (items.html, skills.html). */
.p4-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; padding: 20px; }
.p4-card {
    position: relative; padding: 16px 18px; border-radius: 14px; color: #fff; font-family: Arial, sans-serif; font-size: 14px; line-height: 1.55;
    background: linear-gradient(160deg, #303030, #242424); border: 1px solid rgba(255, 153, 51, .35);
    transition: transform .3s var(--p4-ease), box-shadow .3s, border-color .3s;
}
.p4-card:hover { transform: translateY(-4px); border-color: var(--p4-accent); box-shadow: 0 14px 30px rgba(0, 0, 0, .5), 0 0 16px var(--p4-glow); }
.p4-card__title { font-size: 18px; font-weight: bold; color: var(--p4-text); border-bottom: 2px solid var(--p4-accent); padding-bottom: 4px; display: inline-block; }
.p4-card__sub { color: #ffcc66; font-size: 13px; margin-top: 6px; }
.p4-card__body p { margin: 8px 0 0; color: #d9d2cc; }
.p4-card__stats { color: var(--p4-muted); font-size: 13px; }
.p4-card__label { color: var(--p4-accent); font-weight: bold; margin-top: 12px; }
.p4-list { margin: 6px 0 0; padding-left: 18px; }
.p4-list li { margin: 2px 0; }
@media (max-width: 680px) { .p4-grid { grid-template-columns: 1fr; padding: 14px; gap: 12px; } }

/* ---------- Scroll reveal (class added by ui.js, so pages stay visible without JS) ---------- */
.p4-reveal { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--p4-ease), transform .8s var(--p4-ease); }
.p4-reveal.in { opacity: 1; transform: none; }

/* Icon rows (wiki): icon and its text centred on one line, text wraps beside the icon. */
.wiki-icon-container.p4-icon-row { display: flex; align-items: center; gap: 16px; margin: 6px 0; }
.p4-icon-row > img { flex: 0 0 auto; margin: 0; vertical-align: middle; }
.p4-icon-text { flex: 1 1 auto; min-width: 0; line-height: 1.5; }
.p4-icon-text table { margin-top: 10px; }

/* Client icons (icons/*.png from Icon.utx): a dark slot with a thin gold edge, like the in-game inventory. */
.p4-ico-32, .p4-ico-40, .p4-ico-48 { flex: 0 0 auto; display: block; border-radius: 4px; border: 1px solid #5d4a28; background: #0b0d12;
    box-shadow: inset 0 0 0 1px #000; image-rendering: auto; }
.p4-ico-32 { width: 32px; height: 32px; } .p4-ico-40 { width: 40px; height: 40px; } .p4-ico-48 { width: 48px; height: 48px; }
.p4-ico-none { background: radial-gradient(circle at 50% 35%, #2a2416, #12141b); }
.p4-card__head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.p4-card__head .p4-card__sub { margin-top: 4px; }
.p4-list .p4-piece { list-style: none; display: flex; align-items: center; gap: 10px; margin: 6px 0 6px -18px; }

/* Gameplay: every skill of a class, one row each (icon, name, level, New badge, description). */
.p4-class-about { margin: 18px 20px 0; color: #ddd6c6; line-height: 1.6; }
.p4-skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; padding: 18px 20px 20px; }
.p4-skills[hidden] { display: none; }
.p4-skills:not([hidden]) { animation: p4-fade .35s var(--p4-ease) both; }
.p4-skill { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 6px; border: 1px solid rgba(212, 168, 90, .16);
    background: rgba(11, 13, 18, .55); transition: border-color .25s, background .25s; }
.p4-skill:hover { border-color: rgba(226, 183, 102, .55); background: rgba(212, 168, 90, .05); }
.p4-skill.is-new { border-color: rgba(226, 183, 102, .45); background: linear-gradient(180deg, rgba(212, 168, 90, .08), rgba(11, 13, 18, .55)); }
.p4-skill__body { min-width: 0; }
.p4-skill__name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; color: var(--p4-gold-light); font-weight: 700; font-size: 15px; }
.p4-skill__lv { font-size: 12px; font-weight: 600; color: var(--p4-muted); }
.p4-badge { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    background: var(--p4-pill-active); color: #1a1206; }
.p4-skill__how { margin-top: 2px; font-size: 12px; color: #e8c070; }
.p4-skill__desc { margin-top: 4px; font-size: 13.5px; line-height: 1.5; color: #bdb6a6; overflow-wrap: anywhere; }
@media (max-width: 680px) {
    .p4-skills { grid-template-columns: 1fr; padding: 14px; gap: 8px; }
    .p4-class-about { margin: 14px 14px 0; font-size: 15px; }
}

/* Segment buttons inside a tab (items: Right / Left slot), same pills as the race picker. */
.p4-seg { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 20px 20px 0; }
.p4-seg button {
    min-height: 44px; padding: 0 22px; border-radius: 999px; cursor: pointer; border: 1px solid rgba(212, 168, 90, .35);
    background: var(--p4-pill); color: #cfc8b8; font: 700 15px var(--p4-serif); letter-spacing: .06em;
    transition: background .3s, color .3s, border-color .3s, transform .25s var(--p4-ease);
}
.p4-seg button:hover { border-color: var(--p4-accent); color: var(--p4-gold-light); transform: translateY(-1px); }
.p4-seg button.active { background: var(--p4-pill-active); color: #1a1206; border-color: transparent; box-shadow: 0 6px 20px var(--p4-glow); }
.p4-grid[hidden] { display: none; }
.p4-grid[data-seg-panel]:not([hidden]) { animation: p4-fade .35s var(--p4-ease) both; }
.p4-stage { margin: 0 20px 24px; }

/* Step cards (wiki Killing Spree): the gold gets stronger at every step (--t = 1..4). */
.p4-tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 14px 0 22px; }
.p4-tier {
    position: relative; display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 8px;
    border: 1px solid rgba(226, 183, 102, calc(.2 + var(--t) * .18));
    background: linear-gradient(180deg, rgba(212, 168, 90, calc(var(--t) * .06)), rgba(11, 13, 18, .6));
    box-shadow: 0 0 calc(var(--t) * 7px) rgba(226, 183, 102, calc(var(--t) * .08));
}
.p4-tier__kills { font: 700 40px/1 var(--p4-serif); color: var(--p4-gold-light); }
.p4-tier__kills span { margin-left: 6px; font: 600 12px var(--p4-sans); letter-spacing: .12em; text-transform: uppercase; color: var(--p4-muted); }
.p4-tier__name { font: 700 16px var(--p4-serif); letter-spacing: .04em; color: #e8c070; }
.p4-tier__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.p4-tier__chips span { padding: 4px 9px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--p4-text);
    background: rgba(212, 168, 90, .12); border: 1px solid rgba(212, 168, 90, .25); }
@media (max-width: 680px) {
    .p4-tiers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .p4-tier { padding: 12px; }
    .p4-tier__kills { font-size: 32px; }
    .p4-tier__name { font-size: 14px; }
    .p4-tier__chips span { font-size: 11.5px; line-height: 1.3; padding: 4px 8px; white-space: nowrap; }
}

/* Wiki line icons (wiki-page/icons/*.svg): gold ring like the home feature cards. */
.p4-icon-row > img.p4-ico, .wiki-icon-container > img.p4-ico {
    width: 48px; height: 48px; padding: 11px; box-sizing: border-box; border-radius: 50%;
    border: 1px solid rgba(212, 168, 90, .45); background: radial-gradient(circle at 50% 35%, #2a2416, #12141b);
}

/* Enchant tables: side by side on wide screens, stacked on phones. */
.p4-enchant { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 24px; margin-top: 8px; }
.p4-enchant h3 { margin: 16px 0 8px; color: var(--p4-accent); }

/* Tables (tablesizer.js turns them into .table divs): keep real columns on phones instead of
   "Level: / Chance:" lines, so rows read across like in the game. */
@media (max-width: 840px) {
    .table__tr, .table__tr:first-child { display: flex; flex-wrap: nowrap; }
    .table__td { width: auto !important; flex: 1 1 0; min-width: 0; padding: 10px 12px; text-align: left; overflow-wrap: anywhere; }
    .table__td:last-child { text-align: right; }
    .table__td:not(:last-child) { border-bottom: 0; }
    .table__td:before { content: none; }
}

/* Font Awesome's font files are not in the site: draw the two icons it is used for as plain glyphs. */
.fas.fa-info, .fas.fa-exclamation-circle { font: 700 20px/1 Georgia, serif; font-style: normal; }
.fas.fa-info::before { content: 'i'; }
.fas.fa-exclamation-circle::before { content: '!'; }

/* ---------- Phone fixes ---------- */
@media (max-width: 680px) {
    .p4-icon-row .wiki-icon-image2 { width: 48px; height: 48px; }
    .p4-icon-row { gap: 12px; }
    /* Wide tables scroll inside their box. */
    .wiki__content-main table { display: block; max-width: 100%; overflow-x: auto; }
    .wiki__content-main img { max-width: 100%; height: auto; }
    .progress-wrap { right: 16px; bottom: 16px; }
}

/* ---------- Project4 theme (all pages) ---------- */
html, body.body { background: var(--p4-bg); }
body.body { color: var(--p4-text); font-family: var(--p4-sans); }
.wrapper:after { display: none; } /* grey side fades of the old layout */
::selection { background: rgba(212, 168, 90, .35); }

/* Game-window panel: thin gold line, gold corner marks. */
.p4-frame { position: relative; border: 1px solid var(--p4-frame-line); background: var(--p4-panel); border-radius: 4px; }
.p4-frame::before, .p4-frame::after { content: ''; position: absolute; width: 14px; height: 14px; pointer-events: none; }
.p4-frame::before { top: -1px; left: -1px; border-top: 2px solid #e2b766; border-left: 2px solid #e2b766; }
.p4-frame::after { bottom: -1px; right: -1px; border-bottom: 2px solid #e2b766; border-right: 2px solid #e2b766; }

/* Headings in the client's serif. */
.section__title-center-big, .header__content-timer-title, .header__content-timer-time-num, .wiki__content-title-name,
.start__box-title, .race-btn, .p4-card__title, .footer__cpr-title, .p4-enchant h3, .wiki__content-main h3 { font-family: var(--p4-serif); }
.section__title-center-big { color: var(--p4-gold-light); font-weight: 700; letter-spacing: .03em; background: none; padding: 0 20px; font-size: 44px; line-height: 1.15; }
.section__title-left, .section__title-right { height: 1px; align-self: center; background: linear-gradient(90deg, transparent, var(--p4-accent)); max-width: 220px; }
.section__title-right { background: linear-gradient(270deg, transparent, var(--p4-accent)); }
.section__title-left::after, .section__title-right::after { content: none !important; }
.section__title-small { color: var(--p4-muted); font-size: 15px; letter-spacing: .1em; }
.section__title-small a { color: var(--p4-accent); }
.features, .inner-page { background: none; }

/* Top menu */
.nav { background: rgba(11, 13, 18, .78); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--p4-line); }
.nav__links-item a { color: #cfc8b8; font-weight: 600; letter-spacing: .08em; }
.nav__links-item a:hover, .nav__links-item a.is-current { color: var(--p4-gold-light); }
.button { border: 1px solid var(--p4-frame-line); box-shadow: none; border-radius: 6px; }
.button:after { background: var(--p4-pill-active); border-radius: 4px; }
.button:hover:after { background: linear-gradient(180deg, #f6dca0, #d6a656); }
.button:before { content: none; }
.button span { color: #1a1206; font-weight: 700; letter-spacing: .08em; }
.button img { filter: brightness(0) saturate(0); opacity: .75; }
.button.gray:after { background: var(--p4-pill); }
.button.gray span { color: var(--p4-gold-light); }

/* Buttons for new markup */
.p4-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 28px; border-radius: 6px;
    border: 1px solid rgba(212, 168, 90, .6); background: rgba(11, 13, 18, .45); color: #f0d49a;
    font: 700 14px/1 var(--p4-sans); letter-spacing: .1em; text-transform: uppercase; text-decoration: none;
    transition: transform .25s var(--p4-ease), box-shadow .25s, filter .25s, background .25s;
}
.p4-btn:hover { transform: translateY(-2px); background: rgba(212, 168, 90, .12); color: #fff; }
.p4-btn--gold { border-color: #7a5a26; background: var(--p4-pill-active); color: #1a1206; box-shadow: 0 8px 28px rgba(226, 183, 102, .28); }
.p4-btn--gold:hover { background: var(--p4-pill-active); color: #1a1206; filter: brightness(1.08); box-shadow: 0 10px 34px rgba(226, 183, 102, .42); }

/* ---------- Home hero ---------- */
.header.p4-hero {
    height: auto; min-height: min(100svh, 900px); padding: 120px 20px 90px; display: flex; align-items: flex-end; justify-content: center;
    background: linear-gradient(180deg, rgba(11, 13, 18, .55) 0%, rgba(11, 13, 18, .3) 35%, rgba(11, 13, 18, .85) 78%, var(--p4-bg) 100%),
        url('../main-page/1.jpg') center 30% / cover no-repeat;
}
.header.p4-hero .nav { position: absolute; top: 0; left: 0; right: 0; }
.p4-hero__box { width: 100%; max-width: 900px; display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; position: relative; z-index: 2; }
.p4-hero__eyebrow {
    display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px; border-radius: 999px; background: rgba(11, 13, 18, .7);
    border: 1px solid rgba(212, 168, 90, .4); font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #f0d49a;
    animation: p4-up .7s var(--p4-ease) both;
}
.p4-hero__eyebrow span { width: 8px; height: 8px; border-radius: 50%; background: #e2b766; box-shadow: 0 0 10px #e2b766; }
.p4-hero__logo img { width: min(560px, 88vw); height: auto; filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .7)); animation: p4-zoom 1.1s var(--p4-ease) both; }
.p4-hero__lead { margin: 0; max-width: 640px; font-size: 19px; line-height: 1.6; color: #ddd6c6; animation: p4-up .8s .15s var(--p4-ease) both; }
.p4-hero__cta { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; animation: p4-up .8s .45s var(--p4-ease) both; }
.p4-hero__cta .p4-btn { min-height: 54px; padding: 0 32px; font-size: 15px; }
/* Countdown inside the hero */
.p4-hero .header__content-timer { width: auto; padding: 20px 26px 24px; background: rgba(15, 18, 26, .82); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.p4-hero .header__content-timer-title { font-size: 14px; font-weight: 700; letter-spacing: .28em; text-transform: uppercase; color: #e2b766; margin-bottom: 14px; }
.p4-hero .header__content-timer-time { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.p4-hero .header__content-timer-time-box { width: 96px; margin: 0; padding: 12px 0 10px; border: 1px solid rgba(212, 168, 90, .3); border-radius: 4px; background: var(--p4-bg); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.p4-hero .header__content-timer-time-num { width: auto; height: auto; font-size: 42px; font-weight: 700; line-height: 1; color: var(--p4-gold-light); font-variant-numeric: tabular-nums; background: none; }
.p4-hero .header__content-timer-time-desc { font-size: 11px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--p4-muted); }
.p4-hero .header__content-timer-time-end { font: 700 24px var(--p4-serif); color: var(--p4-gold-light); padding: 10px 20px; }

/* Status bar under the hero */
.p4-status { width: calc(100% - 40px); max-width: 1280px; margin: -28px auto 0; z-index: 3; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.p4-status__cell { display: flex; align-items: center; gap: 14px; padding: 20px 24px; border-right: 1px solid rgba(212, 168, 90, .16); }
.p4-status__cell:last-child { border-right: 0; }
.p4-status__cell[hidden] { display: none; }
.p4-status__k { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--p4-muted); }
.p4-status__v { font: 700 21px/1.3 var(--p4-serif); color: var(--p4-gold-light); }
.p4-dot { flex: 0 0 auto; width: 12px; height: 12px; border-radius: 50%; background: #7d7768; }
.p4-dot.is-up { background: #6fdc8c; box-shadow: 0 0 0 0 rgba(111, 220, 140, .6); animation: p4-pulse 2s infinite; }
.p4-dot.is-down { background: #e0475a; }
@keyframes p4-pulse { 70% { box-shadow: 0 0 0 10px rgba(111, 220, 140, 0); } 100% { box-shadow: 0 0 0 0 rgba(111, 220, 140, 0); } }

/* Feature cards */
.features { margin-top: 0; padding-top: 100px; }
.p4-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 44px; max-width: 1280px; }
.p4-feature { display: flex; flex-direction: column; gap: 12px; padding: 28px; color: var(--p4-text); text-decoration: none; transition: transform .3s var(--p4-ease), border-color .3s, box-shadow .3s; }
.p4-feature:hover { transform: translateY(-4px); border-color: rgba(226, 183, 102, .85); box-shadow: 0 16px 36px rgba(0, 0, 0, .45); }
.p4-feature h3 { margin: 0; font: 700 21px var(--p4-serif); color: var(--p4-gold-light); }
.p4-feature p { margin: 0; color: #bdb6a6; font-size: 15px; line-height: 1.6; }
.p4-feature__icon { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 1px solid rgba(212, 168, 90, .45); background: radial-gradient(circle at 50% 35%, #2a2416, #12141b); color: #e2b766; }
.p4-feature__icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Epic bosses (live) */
.p4-bosses { padding: 40px 0 20px; }
.p4-bosses[hidden] { display: none; }
.p4-bosses__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 36px; max-width: 1280px; }
.p4-boss { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; }
.p4-boss__name { font: 700 17px var(--p4-serif); color: var(--p4-gold-light); }
.p4-boss__state { flex: 0 0 auto; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.p4-boss__state.is-alive { background: rgba(111, 220, 140, .14); color: #8fe8a8; }
.p4-boss__state.is-dead { background: rgba(224, 71, 90, .16); color: #ff9aa6; }
.p4-boss__state.is-busy { background: rgba(212, 168, 90, .16); color: #f0d49a; }

/* Races band */
.p4-band-wrap { padding: 60px 0 100px; }
.p4-band-wrap .content-area { max-width: 1280px; }
.p4-band {
    min-height: 380px; display: flex; align-items: center; padding: 56px;
    background: linear-gradient(90deg, var(--p4-bg) 0%, rgba(11, 13, 18, .82) 45%, rgba(11, 13, 18, .2) 100%), url('../main-page/classes.jpg') center / cover no-repeat;
}
.p4-band__text { max-width: 480px; display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.p4-band__eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: #e2b766; }
.p4-band h2 { margin: 0; font: 700 40px/1.15 var(--p4-serif); color: var(--p4-gold-light); }
.p4-band p { margin: 0; color: #cfc8b8; font-size: 16px; line-height: 1.6; }

/* ---------- Inner pages: wiki, gameplay, items, skills, start game ---------- */
.wiki__nav, .wiki__content, .start__box { background: var(--p4-panel); border: 1px solid var(--p4-frame-line); border-radius: 4px; }
.start__box:first-child, .start__box:nth-child(2), .start__box:nth-child(3) { background: var(--p4-panel); }
.start__box:before { background: var(--p4-pill-active); color: #1a1206; font-weight: 700; font-family: var(--p4-serif); }
.wiki__nav-item { border-bottom-color: rgba(212, 168, 90, .12); }
.wiki__nav-item:hover, .wiki__nav-item.active { background: rgba(212, 168, 90, .1); }
.wiki__nav-item-name { color: #e9e4d8; font-weight: 600; }
.wiki__nav-item.active .wiki__nav-item-name { color: var(--p4-gold-light); }
.wiki__nav-item-desc, .wiki__content-title-desc, .grey-text { color: var(--p4-muted); }
.wiki__content-title { border-bottom: 1px solid var(--p4-line); }
.wiki__content-title-name { color: var(--p4-gold-light); font-weight: 700; }
.wiki__content-main { color: #ddd6c6; line-height: 1.6; }
.wiki__content-main h3, .p4-enchant h3 { color: var(--p4-gold-light); }
.start__box-title { color: var(--p4-gold-light); font-weight: 700; }
.table { border: 1px solid var(--p4-line); border-radius: 4px; overflow: hidden; }
.table__tr:first-child { background: rgba(212, 168, 90, .1); color: var(--p4-gold-light); }
.table__tr:nth-child(even) { background: rgba(255, 255, 255, .025); }
.table__td { border-color: rgba(212, 168, 90, .1); }
/* Columns line up: every cell has the same width, the first (the label) is double. */
@media (min-width: 769px) {
    .table__tr { width: 100%; }
    .table__td { flex: 1 1 0; width: auto; min-width: 0; }
    .table__td:first-child { flex-grow: 2; }
}
@media (max-width: 1024px) {
    .wiki__nav { background: rgba(15, 18, 26, .97); }
    .wiki__nav-item, .wiki__nav-item:last-child { border: 1px solid rgba(212, 168, 90, .3); border-radius: 999px; }
    .wiki__nav-item:hover { background: var(--p4-pill); }
    .wiki__nav-item.active { background: var(--p4-pill-active); border-color: transparent; }
    .wiki__nav-item.active .wiki__nav-item-name { color: #1a1206; }
}
.race-btn { border: 1px solid rgba(212, 168, 90, .35); border-radius: 999px; color: #cfc8b8; letter-spacing: .06em; font-weight: 700; }
.race-btn.active { color: #1a1206; }
.race-strip__glider { border-radius: 999px; }
/* Item / skill cards: in-game tooltip look. */
.p4-card { border-radius: 6px; border: 1px solid #5d4a28; background: linear-gradient(180deg, rgba(24, 22, 18, .97), rgba(12, 12, 14, .97)); font-family: var(--p4-sans); }
.p4-card__title { color: var(--p4-gold-light); border-bottom-color: rgba(212, 168, 90, .5); }
.p4-card__sub { color: #e8c070; }
.p4-card__label { color: #e8c070; }
.footer33 { background: #08090d; border-top: 1px solid var(--p4-line); }
.footer__cpr-title { color: var(--p4-gold-light); }
.footer__cpr-links-item a { color: #cfc8b8; }
.footer__cpr-links-item a:hover { color: var(--p4-gold-light); }
/* Back to top: the 4 of the logo fills from the bottom as the page scrolls (--p 0..1, top.js). */
.progress-wrap { width: 48px; height: 48px; background: rgba(10, 11, 16, .85); box-shadow: inset 0 0 0 2px rgba(212, 168, 90, .25); }
.progress-wrap::before, .progress-wrap::after { content: ''; position: absolute; inset: 8px; background: url('../main-page/4only.png') center / contain no-repeat; }
.progress-wrap::before { opacity: .3; filter: grayscale(1) brightness(2); }
.progress-wrap::after { clip-path: inset(calc(96% - var(--p, 0) * 92%) 0 0 0); }
.progress-wrap svg.progress-circle path { stroke: var(--p4-accent); }

@media (max-width: 680px) {
    .header.p4-hero { padding: 100px 16px 60px; }
    .p4-hero__lead { font-size: 16px; }
    .p4-hero .header__content-timer { width: 100%; padding: 14px; }
    .p4-hero .header__content-timer-time { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
    .p4-hero .header__content-timer-time-box { width: auto; }
    .p4-hero .header__content-timer-time-num { font-size: 28px; }
    .p4-hero .header__content-timer-time-desc { font-size: 10px; letter-spacing: .1em; }
    .p4-hero .header__content-timer-title { font-size: 11px; letter-spacing: .18em; }
    .p4-hero__cta { width: 100%; flex-direction: column; }
    .p4-status { width: calc(100% - 32px); grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .p4-status__cell { padding: 14px; border-bottom: 1px solid rgba(212, 168, 90, .16); }
    .p4-status__v { font-size: 16px; }
    .section__title-center-big { font-size: 30px; }
    .p4-features { grid-template-columns: 1fr; }
    .p4-features, .p4-bosses__grid, .p4-band-wrap .content-area { width: calc(100% - 32px); }
    .p4-band { padding: 28px; min-height: 0; }
    .p4-band h2 { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
    @view-transition { navigation: none; }
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
    .p4-reveal { opacity: 1; transform: none; }
}

/* Closed tabs are only invisible (position: absolute): without this the tallest one stretches the page below the footer on phones. */
.wiki__content:not(.active) { max-height: 0; overflow: hidden; }
/* The side margins are part of the width (100% + margins made the page scroll sideways on phones). */
.p4-stage { width: calc(100% - 40px); }

/* Start page: numbered steps of the beta, coming-soon box of the live server */
.p4-steps, .p4-notes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 34px 20px; list-style: none; margin: 34px auto 0; padding: 0 20px; counter-reset: step; }
.p4-notes { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 34px auto 60px; }
.p4-step { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 34px 28px 28px; color: #bdb6a6; font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.p4-step h3 { margin: 0; font: 700 20px/1.25 var(--p4-serif); color: var(--p4-gold-light); }
.p4-steps .p4-step h3::before { counter-increment: step; content: counter(step); position: absolute; top: -20px; left: 24px; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--p4-pill-active); color: #1a1206; font: 700 18px/1 var(--p4-serif); }
.p4-step p, .p4-soon p { margin: 0; }
.p4-step b { color: #e9e4d8; }
.p4-step .p4-btn { margin-top: auto; }
.p4-soon { margin: 34px 20px 80px; padding: 56px 28px; text-align: center; color: #bdb6a6; line-height: 1.6; }
.p4-soon__big { font: 700 40px/1.2 var(--p4-serif); color: var(--p4-gold-light); margin-bottom: 12px; }
@media (max-width: 1024px) { .p4-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
    .p4-steps, .p4-notes { grid-template-columns: minmax(0, 1fr); }
    .p4-soon__big { font-size: 30px; }
    .p4-step .p4-btn { width: 100%; }
}

/* Tab menu icons */
.p4-menu-ico, .wiki__nav-item-icon img.p4-menu-ico, .wiki__content-title-icon img.p4-menu-ico { width: 24px; height: 24px; border-radius: 0; }
