/*
 * GeoGames — ortak oyun ekranı stilleri (gs-*)
 * Üst bar, puan göstergeleri, Geogo konuşma balonu, tur sonu kartı, sonuç ekranı,
 * modallar, butonlar ve konfeti. Oyuna özel renkler --gs-a / --gs-b ile verilir.
 * Kullanan oyunlar: adam-asmaca, sirala (ve sonraki oyunlar)
 */

:root {
    --navy: #0b2a5b;
    --ink: #0f172a;
    --muted: #64748b;
    --orange: #f97316;
    --sky: #0ea5e9;
    --green: #22c55e;
    --red: #ef4444;
    --card: #ffffff;
    --gs-a: #ea580c;
    --gs-b: #db2777;
    --ui: 'Nunito', ui-rounded, 'Segoe UI', system-ui, sans-serif;
    --display: 'DynaPuff', ui-rounded, 'Segoe UI', system-ui, sans-serif;
}

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

html, body {
    height: 100%;
    overflow: hidden;
    font-family: var(--ui);
    color: var(--ink);
    background: linear-gradient(160deg, #1e3a8a 0%, #0369a1 55%, #0ea5e9 100%);
    -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
    outline: 3px solid #fde047;
    outline-offset: 2px;
}

.screen { display: none; }
.screen.active { display: flex; }

.pop-in { animation: popIn .45s cubic-bezier(.2, 1.3, .5, 1); }
@keyframes popIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { transform: scale(1.06); } }
@keyframes sway {
    0%, 100% { transform: rotate(-4deg); }
    50% { transform: rotate(4deg); }
}

/* ---------- Giriş kartı eklemeleri (ortak game-intro.css üzerine) ---------- */
#login-screen.gg-intro .gg-title { font-size: 27px !important; }
#login-screen.gg-intro .gs-best {
    margin: 0 !important;
    padding: 10px 12px !important;
    border-radius: 12px !important;
    background: #fff7ed !important;
    color: #9a3412 !important;
    font: 800 13.5px/1.2 var(--ui) !important;
    text-align: center !important;
}
#login-screen.gg-intro .gs-best[hidden] { display: none !important; }
#login-screen.gg-intro .gs-link {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 0 !important;
    background: none !important;
    border: 0 !important;
    color: var(--gg-muted) !important;
    font: inherit !important;
}
#login-screen.gg-intro .gs-link:hover { color: var(--gg-a) !important; }

/* ---------- Oyun ekranı iskeleti ---------- */
.gs-game {
    position: fixed;
    inset: 0;
    flex-direction: column;
    height: 100%;
    background:
        radial-gradient(circle at 85% 0%, rgba(253, 224, 71, .25), transparent 40%),
        linear-gradient(160deg, #1e3a8a 0%, #0369a1 60%, #0284c7 100%);
}

.gs-topbar {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    padding-top: max(8px, env(safe-area-inset-top));
    background: rgba(8, 25, 60, .55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    color: #fff;
}

.gs-top-left, .gs-top-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.gs-top-right { gap: 6px; }

.gs-icon-btn {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 12px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 17px;
    line-height: 1;
    text-decoration: none;
    transition: background .15s, transform .15s;
}
.gs-icon-btn:hover { background: rgba(255, 255, 255, .24); transform: translateY(-1px); }
.gs-danger:hover { background: rgba(239, 68, 68, .7); }

.gs-player { display: grid; line-height: 1.1; min-width: 0; }
.gs-player-label { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }
.gs-player-name { font-weight: 900; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }

.gs-hud { display: flex; gap: 6px; }
.gs-hud-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .95);
    color: var(--navy);
    font-weight: 900;
    font-size: 16px;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 3px 0 rgba(0, 0, 0, .18);
}
.gs-hud-item small { font-size: 12px; opacity: .6; }
.gs-hud-score b { color: #c2410c; }
.gs-hud-streak.hot { background: linear-gradient(135deg, #fde047, #fb923c); animation: pulse 1.2s ease-in-out infinite; }

/* Geogo konuşma balonu (konumunu oyun belirler) */
.gs-bubble {
    position: absolute;
    top: 12px;
    left: 12px;
    max-width: calc(100% - 24px);
    padding: 8px 12px;
    border-radius: 16px 16px 16px 4px;
    background: #fff;
    color: var(--navy);
    font: 700 14px/1.25 var(--display);
    box-shadow: 0 6px 16px -6px rgba(2, 20, 60, .45);
    z-index: 2;
}
.gs-bubble.show { animation: bubble .35s cubic-bezier(.2, 1.4, .5, 1); }
@keyframes bubble { from { transform: scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }

.gs-chip {
    padding: 5px 10px;
    border-radius: 999px;
    background: #ecfeff;
    border: 1.5px solid #a5f3fc;
    color: #155e75;
    font-weight: 800;
    font-size: 13px;
    animation: popIn .3s ease-out;
}

/* ---------- Tur sonu kartı ---------- */
.gs-round-end {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2px;
    z-index: 5;
}
.gs-round-end[hidden] { display: none; }
.gs-round-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 6px 14px;
    padding: 16px 18px;
    border-radius: 24px;
    background: #fff;
    border: 4px solid var(--green);
    box-shadow: 0 20px 40px -12px rgba(2, 20, 60, .7);
    animation: slideUp .4s cubic-bezier(.2, 1.3, .5, 1);
}
.gs-round-end.lose .gs-round-card { border-color: #fb923c; }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.gs-round-card > img { width: 72px; height: 72px; object-fit: contain; grid-row: span 2; }
.gs-round-text { min-width: 0; }
.gs-round-title { font: 700 20px/1.1 var(--display); color: #15803d; }
.lose .gs-round-title { color: #c2410c; }
.gs-round-answer { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 20px; color: var(--navy); }
.gs-round-answer strong { font-weight: 900; }
.gs-round-card .gs-round-flag { width: 36px; height: 24px; object-fit: cover; border-radius: 4px; box-shadow: 0 0 0 1px #e2e8f0; }
.gs-round-meta { margin-top: 2px; font-size: 13px; font-weight: 700; color: var(--muted); }
.gs-round-points {
    font: 700 26px/1 var(--display);
    color: #15803d;
    grid-row: span 2;
}
.gs-round-points.zero { color: #94a3b8; }
.gs-next {
    grid-column: 1 / -1;
    height: 52px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--orange), #f59e0b);
    color: #fff;
    font: 700 18px/1 var(--display);
    box-shadow: 0 5px 0 #c2410c;
}
.gs-next:hover { filter: brightness(1.06); }
.gs-next:active { transform: translateY(3px); box-shadow: 0 2px 0 #c2410c; }

/* ---------- Sonuç ekranı ---------- */
.gs-result {
    position: fixed;
    inset: 0;
    align-items: flex-start;
    justify-content: center;
    padding: 20px 14px;
    overflow-y: auto;
}
.gs-result-card {
    width: 100%;
    max-width: 620px;
    margin: auto;
    padding: 22px;
    border-radius: 28px;
    background: #fff;
    box-shadow: 0 30px 60px -20px rgba(2, 20, 60, .6);
}
.gs-result-head { display: flex; align-items: center; gap: 14px; }
.gs-result-head img { width: 110px; height: 110px; object-fit: contain; flex: none; animation: sway 3.6s ease-in-out infinite; }
.gs-result-eyebrow { font-size: 12px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--orange); }
.gs-result-title { font: 700 26px/1.15 var(--display); color: var(--navy); margin: 2px 0 4px; }
.gs-result-sub { color: var(--muted); font-weight: 700; }

.gs-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 18px 0; }
.gs-stat {
    display: grid;
    gap: 2px;
    padding: 12px 6px;
    border-radius: 16px;
    background: #f0f9ff;
    text-align: center;
}
.gs-stat b { font: 700 24px/1 var(--display); color: var(--navy); }
.gs-stat span { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.gs-stat:first-child { background: #fff7ed; }
.gs-stat:first-child b { color: #c2410c; }

.gs-review-title { font-size: 14px; font-weight: 900; color: var(--navy); margin-bottom: 8px; }
.gs-review {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 2px;
}
.gs-review li {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 10px;
    padding: 7px 10px;
    border-radius: 12px;
    background: #f0fdf4;
}
.gs-review li.no { background: #fef2f2; }
.gs-review img, .gs-review .gs-review-icon { grid-row: span 2; width: 40px; height: 27px; object-fit: cover; border-radius: 4px; box-shadow: 0 0 0 1px #e2e8f0; }
.gs-review .gs-review-icon { display: grid; place-items: center; box-shadow: none; font-size: 20px; }
.gs-review-name { font-weight: 900; font-size: 14px; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-review-cap { grid-column: 2; font-size: 12px; font-weight: 700; color: var(--muted); }
.gs-review-mark { grid-column: 3; grid-row: 1 / span 2; font-weight: 900; font-size: 18px; color: #16a34a; }
.no .gs-review-mark { color: var(--red); }
.gs-source { margin-top: 12px; font-size: 11.5px; font-weight: 700; color: var(--muted); line-height: 1.4; }

.gs-result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.gs-btn {
    flex: 1 1 140px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 50px;
    padding: 0 16px;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    background: #fff;
    color: var(--navy);
    font-weight: 900;
    font-size: 15px;
    text-decoration: none;
    transition: transform .15s, border-color .15s;
}
.gs-btn:hover { transform: translateY(-1px); border-color: #cbd5e1; }
.gs-btn-primary {
    border: 0;
    background: linear-gradient(135deg, var(--gs-a), var(--gs-b));
    color: #fff;
    box-shadow: 0 10px 20px -10px rgba(249, 115, 22, .8);
}
.gs-btn-danger { border: 0; background: var(--red); color: #fff; }

/* ---------- Modal ---------- */
.gs-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(2, 12, 40, .6);
    backdrop-filter: blur(4px);
}
.gs-modal[hidden] { display: none; }
.gs-modal-box {
    position: relative;
    width: 100%;
    max-width: 460px;
    max-height: 100%;
    overflow-y: auto;
    padding: 22px;
    border-radius: 26px;
    background: #fff;
    text-align: center;
    animation: popIn .3s ease-out;
}
.gs-modal-small { max-width: 380px; }
.gs-modal-box h2 { font: 700 22px/1.2 var(--display); color: var(--navy); margin: 4px 0 12px; }
.gs-modal-box p { color: var(--muted); font-weight: 700; }
.gs-modal-mascot { width: 84px; height: 84px; object-fit: contain; }
.gs-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: #f1f5f9;
    color: var(--muted);
    font-weight: 900;
}
.gs-steps { display: grid; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; counter-reset: s; text-align: left; }
.gs-steps li {
    counter-increment: s;
    position: relative;
    padding: 10px 12px 10px 46px;
    border-radius: 14px;
    background: #f0f9ff;
    font-size: 14px;
    line-height: 1.4;
    color: #334155;
}
.gs-steps li::before {
    content: counter(s);
    position: absolute;
    left: 12px;
    top: 10px;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--sky);
    color: #fff;
    font-weight: 900;
    font-size: 13px;
}
.gs-steps b { color: var(--navy); }
.gs-scoring { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px; }
.gs-scoring span { padding: 8px; border-radius: 12px; background: #fff7ed; font-size: 12.5px; font-weight: 800; color: #7c2d12; }
.gs-modal-box .gs-btn { width: 100%; }

/* ---------- Konfeti ---------- */
.gs-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 300; overflow: hidden; }
.gs-confetti i {
    position: absolute;
    top: -12px;
    width: 9px;
    height: 14px;
    border-radius: 2px;
    animation: fall 1.6s ease-in forwards;
}
@keyframes fall {
    to { transform: translate(var(--x), 105vh) rotate(var(--r)); opacity: .8; }
}

/* ---------- Duyarlı düzen ---------- */
@media (max-width: 560px) {
    .gs-topbar { padding: 6px 8px; }
    .gs-player { display: none; }
    .gs-icon-btn { width: 34px; height: 34px; border-radius: 10px; font-size: 15px; }
    .gs-hud-item { height: 34px; padding: 0 9px; font-size: 14px; gap: 4px; border-radius: 10px; }
    .gs-fullscreen { display: none; }
    .gs-bubble { font-size: 12.5px; padding: 6px 10px; }
    .gs-round-card { padding: 12px; gap: 4px 10px; }
    .gs-round-card > img { width: 54px; height: 54px; }
    .gs-round-answer { font-size: 17px; }
    .gs-round-points { font-size: 22px; }
    .gs-stats { grid-template-columns: repeat(2, 1fr); }
    .gs-review { grid-template-columns: 1fr; }
    .gs-result-head img { width: 80px; height: 80px; }
    .gs-result-title { font-size: 21px; }
}

@media (max-height: 520px) and (orientation: landscape) {
    .gs-topbar { padding: 4px 10px; }
    .gs-icon-btn, .gs-hud-item { height: 32px; }
    .gs-icon-btn { width: 32px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
