:root {
    color-scheme: dark;
    --bg: #101116;
    --surface: #191a22;
    --surface-hover: #22242e;
    --text: #f0f0f5;
    --muted: #9294a3;
    --accent: #a78bfa;
    --border: #292a35;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, sans-serif;
}

.header {
    height: 68px;
    padding: 0 6%;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.logo {
    color: var(--text);
    text-decoration: none;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -1px;
}

.logo span { color: var(--accent); }

.container {
    width: min(1100px, 88%);
    margin: auto;
}

.intro { padding: 43px 0 25px; }

.eyebrow {
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
}

.intro h1 {
    margin: 8px 0;
    font-size: clamp(25px, 5vw, 36px);
    letter-spacing: -1.3px;
}

.subtitle {
    color: var(--muted);
    margin: 0;
    font-size: 14px;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 48px;
    padding: 0 15px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.menu-button {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    color: var(--accent);
    background: transparent;
    border: 0;
    border-radius: 8px;
    font-size: 21px;
    cursor: pointer;
}

.menu-button:hover { background: var(--surface-hover); }

.search-wrapper input {
    width: 100%;
    height: 100%;
    color: var(--text);
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 14px;
}

.search-icon {
    flex-shrink: 0;
    color: var(--muted);
    font-size: 25px;
}

.console-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 20;
    width: 100%;
    padding: 8px;
    background: #20212b;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 35px #0008;
}

.console-menu button {
    display: block;
    width: 100%;
    padding: 12px;
    color: var(--text);
    background: transparent;
    border: 0;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
}

.console-menu button:hover { background: var(--surface-hover); }
.hidden { display: none !important; }

.catalog-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 32px 0 22px;
}

.catalog-heading h2 { margin: 0; font-size: 18px; }

.catalog-heading span {
    color: var(--muted);
    font-size: 12px;
}

.catalog-sections {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.console-section { min-width: 0; }

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.section-heading h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.see-all-button {
    flex-shrink: 0;
    padding: 5px 0 5px 10px;
    color: var(--accent);
    background: transparent;
    border: 0;
    font-size: 12px;
    cursor: pointer;
}

.see-all-button:hover { color: var(--text); }

.game-row {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 2px 13px;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: #414250 transparent;
}

.game-row::-webkit-scrollbar { height: 5px; }
.game-row::-webkit-scrollbar-track { background: transparent; }
.game-row::-webkit-scrollbar-thumb {
    background: #414250;
    border-radius: 10px;
}

/* Grid saat daftar lengkap konsol dibuka */
.game-row.expanded-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
    gap: 18px 12px;
    overflow: visible;
    padding: 2px;
    scroll-snap-type: none;
}

.game-row.expanded-grid .game-card {
    width: 100%;
    min-width: 0;
    flex: none;
}

.game-card {
    flex: 0 0 125px;
    min-width: 0;
    cursor: pointer;
    scroll-snap-align: start;
}

.game-poster {
    width: 100%;
    aspect-ratio: 2 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #666879;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 34px;
    transition: border-color .2s, transform .2s;
}

.game-card:hover .game-poster {
    border-color: var(--accent);
    transform: translateY(-3px);
}

.game-poster img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.game-title {
    margin: 9px 0 3px;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.game-console {
    color: var(--muted);
    font-size: 11px;
}

.empty-state {
    padding: 55px 15px 70px;
    color: var(--muted);
    text-align: center;
}

.empty-icon { color: #555766; font-size: 38px; }

.empty-state h3 {
    margin-bottom: 7px;
    color: var(--text);
    font-size: 16px;
}

.empty-state p { font-size: 13px; line-height: 1.6; }

.error-message {
    padding: 25px;
    color: #ff8e8e;
    text-align: center;
}

footer {
    margin-top: 35px;
    padding: 22px;
    color: var(--muted);
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 12px;
}

footer span { color: var(--accent); }

@media (min-width: 600px) {
    .game-card { flex-basis: 145px; }
    .game-row { gap: 17px; }
}

@media (min-width: 850px) {
    .game-card { flex-basis: 155px; }
    .game-row { gap: 19px; }
}


/* Ikon kategori */
.menu-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

.menu-button svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

/* Navigasi bawah */
body {
    padding-bottom: 85px;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    justify-content: center;
    gap: 45px;
    padding: 10px 20px calc(10px + env(safe-area-inset-bottom));
    background: #191a22;
    border-top: 1px solid var(--border);
}

.nav-item {
    min-width: 75px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--muted);
    background: transparent;
    border: 0;
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}

.nav-icon {
    font-size: 22px;
    line-height: 1.2;
}

.nav-item.active {
    color: var(--accent);
}

.list-page {
    min-height: 55vh;
}

.list-page h2 {
    font-size: 19px;
}

.list-empty {
    padding: 55px 15px;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
}


/* Menu tekan lama dan notifikasi */
.game-context-menu {
    position: fixed;
    z-index: 100;
    min-width: 190px;
    padding: 5px;
    background: #252632;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 28px #0009;
}

.game-context-menu button {
    width: 100%;
    padding: 12px;
    color: var(--text);
    background: transparent;
    border: 0;
    border-radius: 7px;
    text-align: left;
    font: inherit;
    font-size: 13px;
}

.game-context-menu button:disabled {
    color: var(--muted);
}

.gass-toast {
    position: fixed;
    z-index: 120;
    left: 50%;
    bottom: 85px;
    transform: translate(-50%, 12px);
    padding: 11px 17px;
    color: var(--text);
    background: #292a35;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    white-space: nowrap;
}

.gass-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.saved-game-list {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding-bottom: 30px;
}

.remove-list-button {
    margin-top: 8px;
    padding: 7px 9px;
    color: #ffaaaa;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 11px;
}


/* Pengaturan tampilan halaman List */
.list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.list-toolbar .catalog-heading {
    margin-bottom: 0;
}

.view-switcher {
    display: flex;
    gap: 5px;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
}

.view-switcher button {
    width: 36px;
    height: 32px;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 6px;
    font-size: 20px;
}

.view-switcher button.active {
    color: var(--text);
    background: #343541;
}

.saved-game-list.view-horizontal {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.saved-game-list.view-horizontal .game-card {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    align-items: center;
    column-gap: 13px;
    width: 100%;
    min-width: 0;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.saved-game-list.view-horizontal .game-poster {
    grid-column: 1;
    grid-row: 1 / 4;
    width: 72px;
    height: 92px;
    margin: 0;
    overflow: hidden;
    border-radius: 6px;
}

.saved-game-list.view-horizontal .game-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.saved-game-list.view-horizontal .game-title {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    font-size: 14px;
    text-align: left;
}

.saved-game-list.view-horizontal .game-console {
    grid-column: 2;
    grid-row: 2;
    margin-top: 5px;
    font-size: 11px;
    color: var(--muted);
}

.saved-game-list.view-horizontal .remove-list-button {
    grid-column: 2;
    grid-row: 3;
    justify-self: start;
}

.saved-game-list.view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    gap: 16px 12px;
}

.saved-game-list.view-grid .game-card {
    width: 100%;
    min-width: 0;
}


/* Halaman detail game */
.detail-page {
    padding-bottom: 30px;
}

.detail-back {
    margin: 0 0 20px;
    padding: 8px 12px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: 13px;
}

.detail-hero {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 28px;
}

.detail-poster {
    flex: 0 0 112px;
    width: 112px;
    height: 145px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 30px;
}

.detail-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-info {
    min-width: 0;
    padding-top: 5px;
}

.detail-info h1 {
    margin: 0 0 9px;
    font-size: 20px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.detail-console {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.detail-section {
    margin: 0 0 26px;
}

.detail-section h2 {
    margin: 0 0 12px;
    font-size: 16px;
}

.detail-section > p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.75;
}

.detail-screenshots {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.detail-screenshots img {
    flex: 0 0 80%;
    width: 80%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.detail-screenshots img {
    cursor: zoom-in;
}

.detail-lightbox[hidden] {
    display: none !important;
}

.detail-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 55px 14px 20px;
    background: rgba(0, 0, 0, .96);
}

.detail-lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.detail-lightbox-close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: #292929;
    color: white;
    font-size: 30px;
    cursor: pointer;
}

.detail-placeholder {
    color: var(--muted);
    font-size: 13px;
}

/* Tombol kembali halaman detail */
.detail-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0 0 20px -8px;
    padding: 0;
    color: #D6D6E0;
    background: transparent;
    border: none;
    border-radius: 50%;
    font-size: 0;
    cursor: pointer;
    transition: background .2s, color .2s;
}

.detail-back::before {
    content: "←";
    font-size: 27px;
    line-height: 1;
}

.detail-back:active {
    background: #292A35;
    color: #FFFFFF;
}

/* Desain ulang tombol kembali GassGame */
.detail-page .detail-back {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin: 0 0 22px;
    padding: 0;
    overflow: hidden;
    color: #AEB5D0;
    background: linear-gradient(145deg, #303241, #20212B);
    border: 1px solid #414354;
    border-radius: 13px;
    box-shadow:
        3px 3px 7px #0008,
        -2px -2px 6px #383A4A55,
        inset 0 1px 1px #FFFFFF12;
    font-size: 0;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
}

.detail-page .detail-back::before {
    content: "";
    display: block;
    width: 19px;
    height: 19px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 18-6-6 6-6'/%3E%3Cpath d='M20 12H9'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 18-6-6 6-6'/%3E%3Cpath d='M20 12H9'/%3E%3C/svg%3E") center / contain no-repeat;
}

.detail-page .detail-back:active {
    transform: translateY(1px) scale(.96);
    box-shadow:
        inset 2px 2px 5px #0008,
        inset -1px -1px 3px #45475A55;
    color: #D0C9FF;
}
