/*==================================================
    Gamaybe
==================================================*/

:root {
    --bg: #0b1220;
    --panel: #131c31;
    --panel-2: #1c2742;
    --line: rgba(255, 255, 255, 0.1);
    --text: #eef4ff;
    --muted: #93a3c4;
    --accent: #22d3ee;
    --accent-2: #818cf8;
    --hit: #22c55e;
    --part: #eab308;
    --miss: #be123c;
    --font-display: "Fredoka", "Nunito", system-ui, sans-serif;
    --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(900px 400px at 10% -10%, rgba(34, 211, 238, 0.18), transparent 60%),
        radial-gradient(800px 400px at 100% 0%, rgba(129, 140, 248, 0.16), transparent 60%),
        var(--bg);
    color: var(--text);
    font-family: var(--font-body);
}

button,
input {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-2);
    padding: 8px 16px;
    font-weight: 800;
}

button:hover {
    border-color: rgba(34, 211, 238, 0.6);
}

button.primary {
    border-color: var(--accent);
    background: linear-gradient(180deg, #06b6d4, #0e7490);
}

a {
    color: var(--accent-2);
}

/* Top bar and tabs */
.gm-top {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 980px;
    margin: 0 auto;
    padding: 16px 16px 8px;
}

.gm-home {
    color: var(--muted);
    font-size: 1.4rem;
    text-decoration: none;
}

.gm-logo {
    flex: 1;
    margin: 0;
    font-family: var(--font-display);
    font-size: 2rem;
    letter-spacing: 0.01em;
}

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

.gm-play-kind {
    display: flex;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
}

.gm-play-kind button {
    border: 0;
    background: transparent;
    padding: 6px 14px;
}

.gm-play-kind button.active {
    background: var(--accent);
    color: #06202a;
}

.gm-icon-button {
    padding: 6px 10px;
    font-size: 1.1rem;
}

.gm-modes {
    display: flex;
    gap: 6px;
    max-width: 980px;
    margin: 0 auto;
    padding: 4px 16px 10px;
    overflow-x: auto;
    scrollbar-width: none;
}

.gm-modes button {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 6px;
    background: var(--panel);
}

.gm-modes button.active {
    border-color: var(--accent);
    background: rgba(34, 211, 238, 0.18);
}

.gm-modes button.done::after {
    content: "✓";
    color: var(--hit);
}

/* Main column */
.gm-main {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 16px 24px;
}

.gm-intro h2 {
    margin: 6px 0 2px;
    font-family: var(--font-display);
    font-size: 1.5rem;
}

.gm-intro h2 small {
    color: var(--muted);
    font-size: 0.9rem;
}

.gm-intro p {
    margin: 0 0 12px;
    color: var(--muted);
}

/* Endless difficulty */
.gm-difficulty {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0 0 12px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
}

.gm-difficulty button {
    border: 0;
    background: transparent;
    padding: 6px 14px;
}

.gm-difficulty button small {
    color: var(--muted);
    font-weight: 700;
}

.gm-difficulty button.active {
    background: var(--accent-2);
    color: #0b1a33;
}

.gm-difficulty button.active small {
    color: #1e3a5f;
}

.gm-empty,
.gm-guess-note {
    color: var(--muted);
    font-size: 0.9rem;
}

.gm-guess-note {
    margin: 6px 4px 0;
}

/* Guess box */
.gm-guess {
    position: relative;
    z-index: 5;
    margin: 12px 0;
}

.gm-guess[hidden] {
    display: none;
}

.gm-guess-row {
    display: flex;
    gap: 8px;
}

.gm-search {
    position: relative;
    flex: 1;
}

.gm-search input {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    font-size: 1.05rem;
    outline: none;
}

.gm-search input:focus {
    border-color: var(--accent);
}

.gm-ghost {
    background: transparent;
}

.gm-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    margin: 0;
    padding: 4px;
    list-style: none;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #16213a;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

.gm-suggestions li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 10px;
    cursor: pointer;
}

.gm-suggestions li.active,
.gm-suggestions li:hover {
    background: rgba(34, 211, 238, 0.18);
}

.gm-suggestions img,
.gm-suggestions .gm-no-art {
    width: 30px;
    height: 42px;
    border-radius: 5px;
    object-fit: cover;
}

.gm-suggestions span {
    display: grid;
    flex: 1;
    min-width: 0;
}

.gm-suggestions b,
.gm-suggestions small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gm-suggestions small,
.gm-suggestions em {
    color: var(--muted);
    font-size: 0.8rem;
    font-style: normal;
}

/* Guess pips */
.gm-pips {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 12px 0 4px;
}

.gm-pips i {
    width: 34px;
    height: 8px;
    border-radius: 999px;
    background: var(--panel-2);
}

.gm-pips i.miss { background: var(--miss); }
.gm-pips i.skip { background: #57534e; }
.gm-pips i.hit { background: var(--hit); }

.gm-misses {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
    padding: 0;
    list-style: none;
}

.gm-misses li {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 4px;
    border: 1px solid rgba(190, 18, 60, 0.5);
    border-radius: 999px;
    background: rgba(190, 18, 60, 0.15);
    font-size: 0.85rem;
}

.gm-misses li.skip {
    padding-left: 10px;
    border-color: var(--line);
    background: var(--panel);
    color: var(--muted);
}

.gm-misses img,
.gm-misses .gm-no-art {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
}

.gm-hint {
    margin: 8px 0 0;
    color: #fde68a;
    text-align: center;
    font-weight: 700;
}

/* Classic */
.gm-classic {
    display: grid;
    gap: 8px;
}

.gm-classic-row {
    display: grid;
    grid-template-columns: minmax(150px, 1.4fr) repeat(8, minmax(0, 1fr));
    gap: 4px;
    animation: gm-pop 0.35s ease-out;
}

.gm-classic-name {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 4px;
    border-radius: 10px;
    background: var(--panel);
    font-weight: 800;
    font-size: 0.85rem;
}

.gm-classic-name img,
.gm-classic-name .gm-no-art {
    width: 34px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
}

.gm-cell {
    display: grid;
    align-content: center;
    gap: 2px;
    min-height: 56px;
    padding: 4px;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 800;
    text-align: center;
    word-break: break-word;
}

.gm-cell small {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.gm-cell b {
    text-decoration: underline;
}

.gm-cell i {
    font-style: normal;
    font-size: 1rem;
}

.gm-cell.hit { background: #15803d; }
.gm-cell.part { background: #a16207; }
.gm-cell.miss { background: #881337; }

.gm-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted);
    font-size: 0.8rem;
}

.gm-legend span::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 5px;
    border-radius: 3px;
    background: var(--miss);
}

.gm-legend .hit::before { background: var(--hit); }
.gm-legend .part::before { background: var(--part); }

@keyframes gm-pop {
    from { opacity: 0; transform: translateY(-6px); }
}

/* Cover */
.gm-cover {
    display: grid;
    place-items: center;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel);
}

.gm-cover canvas,
.gm-cover img {
    display: block;
    width: auto;
    max-width: min(280px, 100%);
    height: 340px;
    max-height: 60vh;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    image-rendering: pixelated;
    animation: gm-pop 0.35s ease-out;
}

.gm-cover img {
    height: auto;
    image-rendering: auto;
}

/* Screenshot */
.gm-frame {
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 460px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #000;
}

.gm-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease, filter 0.6s ease;
    user-select: none;
    pointer-events: none;
}

/* Synopsis */
.gm-synopsis-from {
    margin: 0 0 6px;
    color: var(--muted);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8rem;
}


.gm-synopsis {
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel);
    font-size: 1.02rem;
    line-height: 1.75;
}

.gm-redacted {
    border-radius: 3px;
    background: #26355a;
    color: transparent;
    letter-spacing: -0.5px;
}

.gm-redacted.is-name {
    background: #155e75;
}

.gm-secret {
    border-radius: 3px;
    background: rgba(34, 211, 238, 0.25);
}

/* Emoji */
.gm-emoji {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 22px 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel);
}

.gm-emoji span {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 14px;
    background: var(--panel-2);
    font-size: 2.2rem;
    opacity: 0.35;
}

.gm-emoji span.shown {
    opacity: 1;
    animation: gm-pop 0.35s ease-out;
}

/* Closer */
.gm-closer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--muted);
}

.gm-closer-actions span {
    flex: 1;
}

.gm-closer,
.gm-closer-latest {
    display: grid;
    gap: 6px;
}

.gm-closer-latest {
    margin: 10px 0 0;
}

.gm-closer-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    padding: 5px 12px 5px 5px;
    border-radius: 12px;
    background: var(--panel);
    font-weight: 800;
}

.gm-closer-row > i {
    position: absolute;
    inset: 0 auto 0 0;
    opacity: 0.35;
}

.gm-closer-row img,
.gm-closer-row span,
.gm-closer-row b {
    position: relative;
}

.gm-closer-row img,
.gm-closer-row .gm-no-art {
    width: 30px;
    height: 42px;
    border-radius: 6px;
    object-fit: cover;
}

.gm-closer-row span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gm-closer-row.is-latest {
    outline: 2px solid var(--text);
}

.gm-closer-row.hit > i { background: var(--hit); opacity: 0.8; }
.gm-closer-row.hot > i { background: #f97316; }
.gm-closer-row.warm > i { background: #eab308; }
.gm-closer-row.cool > i { background: #3b82f6; }
.gm-closer-row.cold > i { background: #64748b; }

/* Result */
.gm-result {
    margin-top: 16px;
}

.gm-result-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    border: 1px solid rgba(190, 18, 60, 0.5);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(190, 18, 60, 0.18), var(--panel));
    animation: gm-pop 0.4s ease-out;
}

.gm-result-card.won {
    border-color: rgba(34, 197, 94, 0.6);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.18), var(--panel));
}

.gm-genres {
    color: var(--muted);
    font-size: 0.92rem;
}

.gm-result-card > img,
.gm-result-card > .gm-no-art {
    width: 110px;
    height: 156px;
    flex: none;
    border-radius: 10px;
    object-fit: cover;
}

.gm-result-card small {
    color: var(--muted);
    font-weight: 800;
}

.gm-result-card h2 {
    margin: 2px 0;
    font-family: var(--font-display);
}

.gm-result-card p {
    margin: 4px 0;
}

.gm-result-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.gm-next {
    color: var(--muted);
}

/* Stats */
.gm-modal {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 16px;
}

.gm-modal[hidden] {
    display: none;
}

.gm-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 3, 12, 0.7);
}

.gm-modal-card {
    position: relative;
    width: min(440px, 100%);
    max-height: calc(100vh - 32px);
    overflow: auto;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel);
}

.gm-modal-card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gm-modal-card h2 {
    margin: 0;
    font-family: var(--font-display);
}

.gm-modal-card h3 {
    margin: 14px 0 8px;
    color: var(--muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.gm-stat-tiles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    text-align: center;
}

.gm-stat-tiles b {
    display: block;
    font-family: var(--font-display);
    font-size: 1.5rem;
}

.gm-stat-tiles small {
    color: var(--muted);
    font-size: 0.75rem;
}

.gm-dist {
    display: grid;
    gap: 3px;
    margin-top: 10px;
}

.gm-dist div {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
}

.gm-dist span {
    width: 18px;
    text-align: right;
}

.gm-dist i {
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--accent-2);
    color: #0b1a33;
    font-style: normal;
    font-weight: 800;
    text-align: right;
}

.gm-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    z-index: 30;
    padding: 10px 16px;
    border-radius: 12px;
    background: #eef4ff;
    color: #0b1a33;
    font-weight: 800;
    transform: translateX(-50%);
}

.gm-toast[hidden] {
    display: none;
}

.gm-footer {
    padding: 20px 16px 28px;
    color: var(--muted);
    font-size: 0.8rem;
    text-align: center;
}

@media (max-width: 760px) {
    .gm-logo {
        font-size: 1.5rem;
    }

    .gm-difficulty {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        border-radius: 16px;
    }

    .gm-difficulty button {
        display: grid;
        padding: 6px 4px;
        border-radius: 12px;
    }

    .gm-classic-row {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .gm-classic-name {
        grid-column: 1 / -1;
    }

    .gm-emoji span {
        width: 52px;
        height: 52px;
        font-size: 1.8rem;
    }

    .gm-result-card > img,
    .gm-result-card > .gm-no-art {
        width: 80px;
        height: 114px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* Games with no box art */
.gm-no-art {
    display: grid;
    place-items: center;
    flex: none;
    border-radius: 6px;
    background: var(--panel-2);
    font-style: normal;
}
