/* GeoGames — Sınıf Düellosu (oyuna özel stiller; ortak parçalar /shared/gs-game.css) */

:root {
    --gs-a: #7c3aed;
    --gs-b: #ef4444;
    --team-a: #ef4444;
    --team-a-dark: #991b1b;
    --team-b: #3b82f6;
    --team-b-dark: #1e3a8a;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- Giriş: takım adları ---------- */
.sd-teams-input { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.sd-team-field { display: block; min-width: 0; }
#login-screen.gg-intro .sd-team-field .gg-input { width: 100% !important; }
#login-screen.gg-intro .sd-team-field.sd-a .gg-input { border-color: #fca5a5 !important; background: #fef2f2 !important; }
#login-screen.gg-intro .sd-team-field.sd-b .gg-input { border-color: #93c5fd !important; background: #eff6ff !important; }
.sd-vs { font: 700 15px var(--display); color: #7c3aed; }

/* ---------- Oyun alanı ---------- */
.sd-game {
    background:
        radial-gradient(circle at 0% 50%, rgba(239, 68, 68, .35), transparent 45%),
        radial-gradient(circle at 100% 50%, rgba(59, 130, 246, .4), transparent 45%),
        linear-gradient(160deg, #1e1b4b 0%, #312e81 55%, #1e3a8a 100%);
}
.sd-topbar { padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: 6px; }
.sd-brand { font: 700 16px var(--display); white-space: nowrap; }

.sd-arena {
    position: relative;
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    padding: 10px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
}

.sd-half {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    min-height: 0;
    padding: 12px;
    border-radius: 24px;
    border: 3px solid rgba(255, 255, 255, .25);
    color: #fff;
    transition: box-shadow .25s, opacity .25s, transform .25s;
}
.sd-half.sd-a { background: linear-gradient(160deg, var(--team-a) 0%, var(--team-a-dark) 100%); }
.sd-half.sd-b { background: linear-gradient(160deg, var(--team-b) 0%, var(--team-b-dark) 100%); }
.sd-half.won { box-shadow: 0 0 0 5px #fde047, 0 0 40px rgba(253, 224, 71, .6); }
.sd-half.lost { opacity: .78; }

.sd-half-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sd-team-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font: 700 18px var(--display);
    text-shadow: 0 2px 0 rgba(0, 0, 0, .25);
}
.sd-score {
    flex: none;
    min-width: 52px;
    padding: 2px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .95);
    color: var(--navy);
    font: 700 26px/1.2 var(--display);
    text-align: center;
    box-shadow: 0 4px 0 rgba(0, 0, 0, .2);
}
.sd-score.bump { animation: bump .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes bump { 40% { transform: scale(1.35); background: #fde047; } }

.sd-question {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
}
.sd-prompt { font-weight: 900; font-size: 17px; opacity: .95; }
.sd-subject { display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 0; }
.sd-subject-text {
    padding: 6px 18px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .95);
    color: var(--navy);
    font: 700 clamp(22px, 3.2vw, 34px)/1.15 var(--display);
    box-shadow: 0 5px 0 rgba(0, 0, 0, .2);
}
.sd-type-plate .sd-subject-text {
    padding: 4px 22px 4px 40px;
    border: 3px solid #0f172a;
    border-radius: 10px;
    background: linear-gradient(90deg, #1d4ed8 0 26px, #fff 26px);
    font-family: 'Arial Black', var(--display);
    letter-spacing: .08em;
}
.sd-flag {
    display: block;
    width: auto;
    height: clamp(64px, 16vh, 150px);
    max-width: 100%;
    border-radius: 10px;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .9), 0 8px 18px rgba(0, 0, 0, .3);
}
.sd-note { font-size: 12px; font-weight: 800; opacity: .85; }

.sd-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sd-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    padding: 8px 10px;
    border: 3px solid transparent;
    border-radius: 16px;
    background: #fff;
    color: var(--navy);
    font: 700 clamp(15px, 1.7vw, 20px)/1.15 var(--display);
    box-shadow: 0 5px 0 rgba(0, 0, 0, .25);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    transition: transform .1s, background .15s;
}
.sd-option:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.sd-option.ok { background: #dcfce7; border-color: #22c55e; color: #14532d; }
.sd-option.no { background: #fee2e2; border-color: #f43f5e; color: #9f1239; text-decoration: line-through; }
.sd-option:disabled:not(.ok):not(.no) { opacity: .6; }
.sd-key {
    display: none;
    position: absolute;
    top: 4px;
    left: 6px;
    min-width: 18px;
    padding: 0 4px;
    border-radius: 5px;
    background: #e2e8f0;
    color: #475569;
    font: 800 11px/16px var(--ui);
}
@media (hover: hover) and (pointer: fine) { .sd-key { display: block; } }

.sd-half.locked .sd-options { filter: grayscale(.7); }
.sd-status {
    min-height: 2.6em;
    font-weight: 800;
    font-size: 14px;
    line-height: 1.3;
    text-align: center;
}

/* Orta şerit: soru sayacı ve süre */
.sd-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 64px;
    color: #fff;
}
.sd-counter { font: 700 18px var(--display); white-space: nowrap; }
.sd-timer {
    position: relative;
    flex: 1;
    width: 12px;
    max-height: 260px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .2);
    overflow: hidden;
}
.sd-timer i {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(0deg, #f97316, #fde047);
    transform-origin: bottom;
}
.sd-timer i.run { animation: drainY 15s linear forwards; }
.sd-timer i.paused { animation-play-state: paused; }
@keyframes drainY { from { transform: scaleY(1); } to { transform: scaleY(0); } }
@keyframes drainX { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.sd-center-mascot { width: 56px; height: auto; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .35)); }

.sd-countdown {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.sd-countdown[hidden] { display: none; }
.sd-countdown span {
    color: #fde047;
    font: 700 clamp(64px, 14vw, 140px) var(--display);
    text-shadow: 0 6px 0 #0b2a5b;
}
.sd-countdown.tick span { animation: popIn .5s cubic-bezier(.2, 1.4, .5, 1); }

/* Dikey ekran: takımlar karşılıklı oturur, üstteki yarı ters döner */
@media (orientation: portrait) {
    .sd-arena { grid-template-columns: 1fr; grid-template-rows: 1fr auto 1fr; gap: 6px; padding: 6px; }
    .sd-half { padding: 10px; gap: 6px; border-radius: 20px; }
    .sd-half.sd-a { transform: rotate(180deg); }
    .sd-center { flex-direction: row; width: auto; height: 34px; gap: 10px; padding: 0 4px; }
    .sd-timer { width: auto; height: 10px; max-height: none; }
    .sd-timer i { background: linear-gradient(90deg, #f97316, #fde047); transform-origin: left; }
    .sd-timer i.run { animation-name: drainX; }
    .sd-center-mascot { width: 34px; }
    .sd-counter { font-size: 15px; }
    .sd-flag { height: clamp(52px, 10vh, 120px); }
    .sd-subject-text { font-size: clamp(20px, 6vw, 30px); }
    .sd-option { min-height: 48px; font-size: clamp(14px, 4.2vw, 19px); }
    .sd-prompt { font-size: 15px; }
    .sd-status { font-size: 12.5px; min-height: 2.4em; }
    .sd-brand { display: none; }
}

/* ---------- Sonuç ---------- */
.sd-final { display: flex; align-items: stretch; justify-content: center; gap: 10px; margin: 14px 0 6px; }
.sd-final-vs { align-self: center; font: 700 22px var(--display); color: var(--muted); }
.sd-final-team {
    flex: 1;
    max-width: 220px;
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: 12px;
    border-radius: 18px;
    color: #fff;
}
.sd-final-team.sd-a { background: linear-gradient(160deg, var(--team-a), var(--team-a-dark)); }
.sd-final-team.sd-b { background: linear-gradient(160deg, var(--team-b), var(--team-b-dark)); }
.sd-final-team.winner { box-shadow: 0 0 0 4px #fde047; }
.sd-final-team.winner .sd-final-name::before { content: '👑 '; }
.sd-final-name { font-weight: 900; font-size: 14px; text-align: center; overflow-wrap: anywhere; }
.sd-final-score { font: 700 40px/1 var(--display); }

.sd-review li { grid-template-columns: 18px 1fr; }
.sd-review .gs-review-cap { grid-column: 2; }
.sd-review-dot { width: 14px; height: 14px; border-radius: 50%; align-self: center; }
.sd-review-dot.sd-a { background: var(--team-a); }
.sd-review-dot.sd-b { background: var(--team-b); }
.sd-review-dot.sd-none { background: #cbd5e1; }
