/* Pizza Unblocked — toby-web style layout */
@font-face {
    font-family: 'ptsmall';
    src: url('../assets/fonts/pizza-tower-small.ttf') format('truetype');
}

:root {
    --bg: #1e1a16;
    --text: #fff4e0;
    --yellow: #ffd75e;
    --muted: #b8a89a;
}

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

html, body { min-height: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'ptsmall', 'Courier New', monospace;
    min-height: 100vh;
    overflow: hidden;
}

/* ---------- background gif ---------- */
.bgimg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    image-rendering: pixelated;
    z-index: -2;
    pointer-events: none;
}
/* theme variants (applied to .bgimg) */
.bgimg.theme-black      { display: none; }

/* ---------- theme picker ---------- */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}
.theme-card {
    background: #000;
    border: 2px solid #555;
    cursor: pointer;
    padding: 4px 4px 2px;
    text-align: center;
}
.theme-card.sel { border-color: var(--yellow); }
.theme-card .tprev {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    object-position: center;
    image-rendering: pixelated;
    display: block;
    background: #000;
    border: 1px solid #333;
}
.theme-card .tprev.theme-black { display: block; }
.theme-card .tname {
    color: #fff;
    font-size: .8rem;
    padding: 5px 0;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.theme-card.sel .tname { color: var(--yellow); }



/* ---------- chrome ---------- */
.logo {
    position: fixed;
    top: 10px; left: 14px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
}
.logo img {
    display: block;
    height: clamp(110px, 21vh, 190px);
    width: auto;
}
.byline {
    color: #ff3b3b;
    font-size: 1.3rem;
    letter-spacing: .03em;
    white-space: nowrap;
    padding-top: 22px;
}

.topicons {
    position: fixed;
    top: 12px; right: 14px;
    display: flex;
    gap: 8px;
    z-index: 10;
}
.icon-btn {
    display: grid;
    place-items: center;
    width: 74px; height: 66px;
    padding: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
}
.icon-btn img {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
}
.icon-btn:hover img { filter: brightness(1.25); }
.icon-btn:active { transform: translateY(2px); }

/* ---------- menu ---------- */
.menu {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-content: center;
    align-items: center;
    gap: 1vh 4vw;
    padding: 14vh 8vw 8vh;
}
.menu .gbtn:first-child { justify-self: start; }
.menu .gbtn:nth-child(2) { justify-self: end; }
.menu .gbtn:last-child { grid-column: 1 / -1; justify-self: center; }

.gbtn { display: block; }
.gbtn img {
    display: block;
    width: clamp(261px, 29.6vw, 487px);
    height: auto;
    transition: transform .1s;
}
.gbtn:hover img { transform: scale(1.05); }
.gbtn:active img { transform: scale(.97); }

/* ---------- pizza icon bottom-left ---------- */
.pizza-icon {
    position: fixed;
    bottom: 14px; left: 14px;
    width: 100px;
    z-index: 5;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.pizza-icon img { width: 100%; display: block; }
.pizza-icon:hover img { filter: brightness(1.2); }

/* ---------- popups ---------- */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, .6);
    display: grid;
    place-items: center;
}
.overlay[hidden] { display: none; }
.menu[hidden], .page[hidden] { display: none; }

.pop {
    position: relative;
    width: min(860px, 94vw);
    max-height: 92vh;
    overflow-y: auto;
    background: #000;
    border: 2px solid #fff;
    padding: 16px 22px 22px;
}
.pop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.pop-title {
    font-size: 1.6rem;
    color: var(--yellow);
    letter-spacing: .05em;
}
.xbtn {
    width: 34px; height: 34px;
    background: #000;
    color: #fff;
    border: 2px solid #fff;
    font-family: inherit;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}
.xbtn:hover { background: var(--yellow); color: #000; border-color: var(--yellow); }

/* settings popup */
.set-block { margin-bottom: 18px; }
.set-label {
    color: var(--yellow);
    font-size: 1.05rem;
    margin-bottom: 8px;
}
.opt-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 8px;
}
.sbtn {
    font-family: inherit;
    font-size: .95rem;
    color: #fff;
    background: #000;
    border: 2px solid #fff;
    padding: 8px 14px;
    cursor: pointer;
    min-width: 150px;
    text-align: left;
}
.sbtn:hover { border-color: var(--yellow); color: var(--yellow); }
.sbtn.sel { color: var(--yellow); border-color: var(--yellow); }
.crashlog {
    max-height: 160px;
    overflow-y: auto;
    margin: 0 0 8px;
    padding: 8px;
    background: rgba(0,0,0,.6);
    border: 1px solid #555;
    font-family: 'Courier New', monospace;
    font-size: .8rem;
    color: #ccc;
    white-space: pre-wrap;
    word-break: break-all;
}
.sel {
    font-family: inherit;
    font-size: .95rem;
    color: #fff;
    background: #000;
    border: 2px solid #fff;
    padding: 8px;
    min-width: 200px;
}
.sel:focus { outline: none; border-color: var(--yellow); }
.vol {
    -webkit-appearance: none;
    appearance: none;
    width: 180px;
    height: 10px;
    background: #333;
    border: 1px solid #fff;
}
.vol::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px;
    background: var(--yellow);
    border: 1px solid #fff;
    cursor: pointer;
}
.vol::-moz-range-thumb {
    width: 16px; height: 16px;
    background: var(--yellow);
    border: 1px solid #fff;
    cursor: pointer;
}

/* device line */
.devline { color: var(--muted); font-size: .85rem; margin-top: 6px; }

/* changelog popup */
.cl-head { margin: 14px 0 6px; }
.cl-title { color: var(--yellow); font-size: 1.2rem; }
.cl-date { color: var(--yellow); font-size: .95rem; opacity: .85; }
.cl-label { color: var(--yellow); font-size: 1rem; margin: 8px 0 4px; }
.cl-list { list-style: none; }
.cl-list li {
    color: #fff;
    font-size: .95rem;
    padding: 2px 0 2px 14px;
}
.cl-list li::before { content: '- '; color: var(--yellow); }

/* ---------- card pages (mods / extras) ---------- */
.page {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: 130px 6vw 90px;
    overflow-y: auto;
    max-height: 100vh;
}
.searchbox {
    display: block;
    width: min(480px, 80vw);
    margin: 0 auto 26px;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 1.15rem;
    color: var(--yellow);
    background: rgba(0,0,0,.75);
    border: 2px solid #fff;
    border-radius: 0;
    outline: none;
}
.searchbox::placeholder { color: var(--muted); }
.searchbox:focus { border-color: var(--yellow); }
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 22px;
    width: min(1000px, 94vw);
    margin: 0 auto;
}
.card {
    display: block;
    text-decoration: none;
    background: #000;
    border: 2px solid #fff;
}
.card:hover { border-color: var(--yellow); }
.card .thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    display: grid;
    place-items: center;
    background: #000;
    overflow: hidden;
}
.card .thumb img {
    max-width: 88%;
    max-height: 88%;
    image-rendering: pixelated;
}
.card .dots {
    position: absolute;
    top: 6px; right: 6px;
    width: 26px; height: 26px;
    background: rgba(0,0,0,.75);
    border: 1px solid #fff;
    color: #fff;
    font-family: inherit;
    cursor: pointer;
}
.card .cname {
    padding: 8px 10px;
    color: var(--yellow);
    font-size: 1rem;
    text-align: center;
    border-top: 2px solid #fff;
}
.empty-note {
    text-align: center;
    color: var(--muted);
    margin-top: 40px;
    font-size: 1rem;
}

@media (max-width: 720px) {
    .menu { grid-template-columns: 1fr; gap: 20px; padding: 120px 0 100px; }
    .menu .gbtn { justify-self: center !important; }
    .menu .gbtn:last-child { grid-column: auto; }
    .logo img { height: 110px; max-width: 62vw; object-fit: contain; }
    .byline { font-size: 1rem; padding-top: 14px; }
    .icon-btn { width: 58px; height: 52px; }
    .gbtn img { width: min(487px, 74vw); }
    .pizza-icon { width: 64px; }
    .sbtn { min-width: 0; flex: 1; }
    .sel { min-width: 0; width: 100%; }
    /* prevent iOS focus-zoom */
    .sel, .searchbox, input { font-size: 16px; }
    .pop { padding: 12px 14px 16px; }
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
    .vol { flex: 1; }
}

@media (max-width: 420px) {
    .logo img { height: 84px; }
    .icon-btn { width: 48px; height: 44px; }
    .topicons { gap: 4px; }
    .menu { padding: 96px 0 90px; }
    .pop-title { font-size: 1.25rem; }
    .card-grid { grid-template-columns: 1fr 1fr; }
}

/* save popup */
.pop-save { width: min(430px, 92vw); }
.pop-save .save-desc { font-size: .95rem; line-height: 1.55; margin: 0 0 14px; }
.pop-save .savebtns { display: grid; gap: 9px; }
.pop-save .savebtns .sbtn { width: 100%; }

/* game overlay — in-page iframe so game URLs never hit the address bar */
#gameOverlay { position: fixed; inset: 0; z-index: 500; background: #000; display: flex; flex-direction: column; }
#gameOverlay iframe { flex: 1; width: 100%; border: 0; display: block; background: #000; }
#gameOverlay .go-top { flex: 0 0 34px; display: flex; align-items: center; gap: 10px; padding: 0 10px; background: #14100c; font-family: 'PT Pig', monospace; }
#gameOverlay .go-top button { background: #2a211a; color: #f3e3c2; border: 1px solid #4a3a2a; border-radius: 6px; padding: 4px 12px; font: inherit; font-size: .85rem; cursor: pointer; }
#gameOverlay .go-top button:hover { filter: brightness(1.3); }
#gameOverlay .go-title { color: #c9a877; font-size: .85rem; flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#gameOverlay .go-fs { margin-left: auto; }
