/* GeoGames — Bayraklı Adam Asmaca (oyuna özel stiller; ortak parçalar /shared/gs-game.css) */

.hm-stage {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(250px, 34%) 1fr;
    gap: 14px;
    padding: 14px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
}

/* ---------- Gökyüzü sahnesi ---------- */
.hm-sky {
    position: relative;
    min-height: 0;
    border-radius: 26px;
    overflow: hidden;
    background:
        radial-gradient(circle at 80% 14%, #fef9c3 0 22px, rgba(254, 249, 195, .45) 23px 40px, transparent 41px),
        linear-gradient(180deg, #7dd3fc 0%, #bae6fd 60%, #e0f2fe 100%);
    border: 4px solid rgba(255, 255, 255, .85);
    box-shadow: 0 16px 36px -14px rgba(2, 20, 60, .6), inset 0 -40px 60px -40px rgba(255, 255, 255, .8);
}

.hm-sky svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.hm-ground { fill: #4ade80; }

.hm-cloud {
    position: absolute;
    width: 90px;
    height: 28px;
    border-radius: 999px;
    background: #fff;
    opacity: .85;
    animation: drift 26s linear infinite;
}
.hm-cloud::before, .hm-cloud::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: inherit;
}
.hm-cloud::before { width: 42px; height: 42px; left: 14px; top: -20px; }
.hm-cloud::after { width: 32px; height: 32px; left: 44px; top: -13px; }
.hm-cloud.c1 { top: 16%; left: -20%; }
.hm-cloud.c2 { top: 40%; left: -30%; transform: scale(.7); animation-duration: 34s; animation-delay: -12s; }
.hm-cloud.c3 { top: 62%; left: -25%; transform: scale(.85); animation-duration: 30s; animation-delay: -22s; opacity: .7; }
@keyframes drift { to { left: 120%; } }

#rig {
    transform: translateY(var(--drop, 0px));
    transition: transform .9s cubic-bezier(.34, 1.4, .5, 1);
}

.hm-balloon {
    transform-box: fill-box;
    transform-origin: 50% 100%;
    animation: bob 3.2s ease-in-out infinite;
    animation-delay: var(--d, 0s);
}
@keyframes bob {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-5px) rotate(2deg); }
}
.hm-balloon.popped {
    animation: popBalloon .35s ease-out forwards;
    transform-origin: 50% 50%;
}
@keyframes popBalloon {
    0% { transform: scale(1); opacity: 1; }
    40% { transform: scale(1.35); opacity: .9; }
    100% { transform: scale(.2); opacity: 0; }
}

.hm-string { fill: none; stroke: #334155; stroke-width: 1.3; opacity: .75; transition: opacity .4s; }
.hm-string.cut { opacity: 0; }


#geogo {
    transform-box: fill-box;
    transform-origin: 50% 20%;
    animation: sway 3.6s ease-in-out infinite;
}

.danger #geogo { animation: shake .5s ease-in-out infinite; }
@keyframes shake {
    0%, 100% { transform: rotate(-6deg); }
    50% { transform: rotate(6deg); }
}
.landed #geogo { animation: land .6s ease-out forwards; transform-origin: 50% 100%; }
@keyframes land {
    0% { transform: scale(1, 1); }
    40% { transform: scale(1.12, .82); }
    100% { transform: scale(1, 1); }
}
.cheer #rig { animation: cheer .7s ease-out; }
@keyframes cheer {
    40% { transform: translateY(calc(var(--drop, 0px) - 14px)); }
}


.hm-lives {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .92);
    color: var(--navy);
    font-weight: 900;
    font-size: 13px;
    z-index: 2;
}
.hm-lives.low { background: var(--red); color: #fff; animation: pulse .8s ease-in-out infinite; }

/* ---------- Oyun alanı ---------- */
.hm-play {
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    padding: 2px;
}

.hm-flag-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px;
    border-radius: 24px;
    background: var(--card);
    box-shadow: 0 6px 0 rgba(11, 42, 91, .25), 0 16px 30px -18px rgba(2, 20, 60, .6);
}

.hm-flag-frame {
    flex: none;
    display: grid;
    place-items: center;
    width: clamp(120px, 34%, 230px);
    aspect-ratio: 3 / 2;
    border-radius: 14px;
    background:
        linear-gradient(45deg, #f1f5f9 25%, transparent 25%, transparent 75%, #f1f5f9 75%) 0 0 / 16px 16px,
        linear-gradient(45deg, #f1f5f9 25%, #fff 25%, #fff 75%, #f1f5f9 75%) 8px 8px / 16px 16px;
    overflow: hidden;
    box-shadow: inset 0 0 0 2px #e2e8f0;
}
.hm-flag-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transform: scale(.94);
    transition: opacity .3s, transform .3s;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .18));
}
.hm-flag-frame img.loaded { opacity: 1; transform: none; }

.hm-flag-side { flex: 1; min-width: 0; display: grid; gap: 10px; }
.hm-question { font: 700 clamp(16px, 2.2vw, 22px)/1.2 var(--display); color: var(--navy); }

.hm-hints { display: flex; flex-wrap: wrap; gap: 8px; }
.hm-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    font-weight: 800;
    font-size: 13px;
    color: var(--navy);
    transition: border-color .15s, background .15s, transform .15s;
}
.hm-hint small {
    padding: 1px 6px;
    border-radius: 999px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 11px;
    font-weight: 900;
}
.hm-hint:hover:not(:disabled) { border-color: var(--orange); background: #fff7ed; transform: translateY(-1px); }
.hm-hint.used { opacity: .45; }
.hm-hint.used small { background: #e2e8f0; color: var(--muted); }

.hm-hint-info { display: flex; flex-wrap: wrap; gap: 6px; min-height: 0; }
.hm-hint-info:empty { display: none; }

/* Harf kutuları */
.hm-word {
    container-type: inline-size;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    gap: 10px 18px;
    padding: 16px 10px;
    border-radius: 24px;
    background: rgba(255, 255, 255, .14);
    border: 2px dashed rgba(255, 255, 255, .35);
    min-height: 92px;
    flex: 1 0 auto;
}
.hm-word-group { display: flex; gap: 5px; }
.hm-tile {
    --size: clamp(22px, calc(88cqw / var(--len, 8) - 5px), 50px);
    display: grid;
    place-items: center;
    width: var(--size);
    height: calc(var(--size) * 1.18);
    border-radius: 10px;
    background: rgba(255, 255, 255, .92);
    border-bottom: 4px solid #93c5fd;
    color: var(--navy);
    font: 700 calc(var(--size) * .62)/1 var(--display);
    text-transform: none;
}
.hm-tile.open { background: #fff; border-bottom-color: var(--navy); }
.hm-tile.hinted { background: #fef3c7; border-bottom-color: #d97706; }
.hm-tile.missed { background: #fee2e2; border-bottom-color: var(--red); color: #b91c1c; }
.hm-tile.sym { background: transparent; border-color: transparent; color: #fff; width: auto; min-width: 10px; }
.hm-tile.pop { animation: tilePop .4s cubic-bezier(.2, 1.6, .5, 1); }
@keyframes tilePop { 0% { transform: scale(.5) rotate(-8deg); } 100% { transform: none; } }

/* Klavye */
.hm-keyboard {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 7px;
    margin-top: auto;
    padding: 12px;
    border-radius: 24px;
    background: rgba(8, 25, 60, .35);
}
.hm-key {
    height: clamp(40px, 6.2dvh, 54px);
    border: 0;
    border-radius: 12px;
    background: #fff;
    color: var(--navy);
    font: 700 clamp(16px, 2.2vw, 22px)/1 var(--display);
    box-shadow: 0 4px 0 #94a3b8;
    transition: transform .08s, box-shadow .08s, background .15s;
    touch-action: manipulation;
}
.hm-key:hover:not(:disabled) { background: #fff7ed; }
.hm-key:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #94a3b8; }
.hm-key.hit { background: var(--green); color: #fff; box-shadow: 0 4px 0 #15803d; }
.hm-key.miss { background: #cbd5e1; color: #94a3b8; box-shadow: 0 4px 0 #94a3b8; text-decoration: line-through; opacity: .7; }
.hm-key:disabled { transform: none; }

/* ---------- Duyarlı düzen ---------- */

/* Dikey tablet ve telefon */
@media (max-width: 820px), (orientation: portrait) and (max-width: 1000px) {
    .hm-stage {
        grid-template-columns: 1fr;
        grid-template-rows: clamp(150px, 27dvh, 260px) 1fr;
        gap: 10px;
        padding: 10px;
    }
    .hm-sky { border-radius: 22px; }
    .hm-play { gap: 10px; }
    .hm-flag-card { padding: 10px; gap: 12px; border-radius: 20px; }
    .hm-word { padding: 12px 8px; min-height: 76px; border-radius: 20px; }
    .hm-keyboard { gap: 5px; padding: 8px; border-radius: 20px; }
}

@media (max-width: 560px) {
    .hm-hint { padding: 6px 8px; font-size: 12px; }
    .hm-hint small { display: none; }
    .hm-key { border-radius: 9px; box-shadow: 0 3px 0 #94a3b8; }
}

/* Yatay telefon */
@media (max-height: 520px) and (orientation: landscape) {
    .hm-stage { grid-template-columns: 30% 1fr; grid-template-rows: none; gap: 8px; padding: 8px; }
    .hm-play { gap: 8px; }
    .hm-flag-card { padding: 8px; }
    .hm-flag-frame { width: 110px; }
    .hm-question { font-size: 15px; }
    .hm-word { min-height: 0; padding: 8px; }
    .hm-keyboard { padding: 6px; gap: 4px; }
    .hm-key { height: 34px; font-size: 15px; }
}
