/* Simitçi Koşusu — arayüz stilleri (dikey ekran, dokunmatik) */
:root {
    --ad-top: 0px;
    --ad-bottom: 0px;
    --ink: #2b1d12;
    --cream: #fff6e6;
    --cream-2: #f6e6c8;
    --simit: #c9822f;
    --simit-dark: #8c5419;
    --red: #d1263a;
    --teal: #157a87;
    --teal-dark: #0c5560;
    --gold: #ffc93c;
    --green: #2fbf71;
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --font: "Trebuchet MS", "Segoe UI", Roboto, system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background: #9fd6ec;
    color: var(--ink);
    font-family: var(--font);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    overscroll-behavior: none;
}

#scene {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

button { font-family: inherit; }
[hidden] { display: none !important; }

/* ---------------- Ekranlar ---------------- */

.screen {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: none;
    pointer-events: none;
}
.screen.is-on { display: flex; }
.screen > * { pointer-events: auto; }

#loading {
    z-index: 40;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: linear-gradient(#5fb6ea, #cdeefa);
    font-weight: 800;
    color: var(--teal-dark);
}
.ring-spin {
    width: 70px; height: 70px;
    border-radius: 50%;
    border: 18px solid var(--simit);
    border-top-color: #e8a956;
    animation: spin 1s linear infinite;
    box-shadow: inset 0 0 0 3px #a8651f;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Simit simgesi (CSS) */
.ico-simit {
    display: inline-block;
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 5px solid var(--simit);
    box-shadow: inset 0 0 0 1px var(--simit-dark), 0 0 0 1px var(--simit-dark);
    background: transparent;
    vertical-align: -3px;
    position: relative;
}
.ico-simit::after {
    content: "";
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 20%, #fff7 1px, transparent 1.6px),
        radial-gradient(circle at 70% 30%, #fff7 1px, transparent 1.6px),
        radial-gradient(circle at 80% 70%, #fff7 1px, transparent 1.6px),
        radial-gradient(circle at 25% 75%, #fff7 1px, transparent 1.6px);
}
.ico-simit.sm { width: 13px; height: 13px; border-width: 4px; vertical-align: -2px; }
.ico-simit.sm::after { inset: -4px; }
.ico-simit.big { width: 0.78em; height: 0.78em; border-width: 0.2em; vertical-align: -0.04em; margin: 0 0.02em; }
.ico-simit.big::after { inset: -0.2em; }

/* ---------------- Ortak parçalar ---------------- */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px 6px 8px;
    border-radius: 999px;
    background: rgba(255, 246, 230, .94);
    box-shadow: 0 3px 0 rgba(0, 0, 0, .18);
    font-weight: 900;
    font-size: 17px;
}
.chip-level { background: var(--gold); padding: 6px 12px; }

.btn {
    border: 0;
    border-radius: 16px;
    padding: 12px 18px;
    font-size: 17px;
    font-weight: 900;
    color: var(--ink);
    background: var(--cream);
    cursor: pointer;
    box-shadow: 0 5px 0 rgba(0, 0, 0, .25);
    transition: transform .08s;
    letter-spacing: .3px;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-main { background: var(--green); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .2); }
.btn-gold { background: var(--gold); }
.btn-ghost { background: rgba(255, 255, 255, .7); }
.btn-small { padding: 7px 12px; font-size: 14px; border-radius: 12px; box-shadow: 0 3px 0 rgba(0, 0, 0, .22); white-space: nowrap; }

.btn-round {
    width: 44px; height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 246, 230, .94);
    font-size: 16px;
    font-weight: 900;
    color: var(--ink);
    box-shadow: 0 3px 0 rgba(0, 0, 0, .2);
    cursor: pointer;
}

.muted { opacity: .72; }
.small { font-size: 13px; }
.pad { padding: 0 16px; }

.bar {
    height: 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, .14);
    overflow: hidden;
}
.bar i {
    display: block;
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--simit), var(--gold));
}

/* ---------------- Menü ---------------- */

#menu {
    flex-direction: column;
    justify-content: space-between;
    padding: calc(var(--safe-t) + 12px) 16px calc(var(--ad-bottom) + var(--safe-b) + 14px);
    background: linear-gradient(rgba(0, 0, 0, 0) 55%, rgba(12, 40, 48, .35));
}
.menu-top { display: flex; justify-content: space-between; }

.logo {
    position: absolute;
    left: 0; right: 0;
    top: calc(var(--safe-t) + 70px);
    text-align: center;
    pointer-events: none;
    line-height: .92;
    transform: rotate(-3deg);
    animation: logoIn .6s cubic-bezier(.2, 1.6, .4, 1) both;
}
@keyframes logoIn { from { transform: rotate(-3deg) scale(.6); opacity: 0; } }
.logo-top, .logo-bottom {
    font-size: clamp(42px, 13vw, 70px);
    font-weight: 900;
    color: #fff;
    letter-spacing: 1px;
    -webkit-text-stroke: 2px var(--ink);
    text-shadow: 0 5px 0 var(--red), 0 9px 0 var(--ink);
}
.logo-bottom { color: var(--gold); text-shadow: 0 5px 0 var(--simit-dark), 0 9px 0 var(--ink); }
.logo-bottom .ico-simit { -webkit-text-stroke: 0; box-shadow: inset 0 0 0 2px var(--ink), 0 0 0 2px var(--ink), 0 5px 0 var(--ink); border-color: var(--simit); }
.logo-tag {
    display: inline-block;
    margin-top: 16px;
    padding: 6px 14px;
    border-radius: 10px;
    background: var(--teal);
    color: #fff;
    font-weight: 900;
    font-size: 15px;
    letter-spacing: 2px;
    box-shadow: 0 4px 0 var(--teal-dark);
    transform: rotate(3deg);
}

.menu-bottom { display: flex; flex-direction: column; gap: 12px; align-items: stretch; max-width: 460px; width: 100%; margin: 0 auto; }
.btn-play {
    font-size: 32px;
    padding: 16px;
    border-radius: 22px;
    background: var(--red);
    color: #fff;
    text-shadow: 0 3px 0 rgba(0, 0, 0, .25);
    box-shadow: 0 7px 0 #8a1020;
    animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.04); } }
.menu-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.btn-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; font-size: 14px; position: relative; }
.btn-tile span { font-size: 24px; }
.dot { position: absolute; top: 6px; right: 10px; width: 12px; height: 12px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px #fff; }
.menu-hint { margin: 0; text-align: center; color: #fff; font-weight: 800; font-size: 13px; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
#menu .menu-best {
    align-self: center;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(43, 29, 18, .72);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1px;
}
#menu .menu-best b { color: var(--gold); font-size: 15px; }

/* ---------------- HUD ---------------- */

#hud { padding: calc(var(--safe-t) + 10px) 12px 0; justify-content: space-between; align-items: flex-start; }
.hud-left { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; pointer-events: none; }
.hud-score {
    font-size: 34px;
    font-weight: 900;
    color: #fff;
    -webkit-text-stroke: 1.5px var(--ink);
    text-shadow: 0 3px 0 var(--ink);
    font-variant-numeric: tabular-nums;
}
.hud-mult { padding: 2px 10px; border-radius: 10px; background: var(--gold); font-weight: 900; box-shadow: 0 3px 0 rgba(0, 0, 0, .2); }
.hud-right { display: flex; align-items: center; gap: 8px; }
.hud-powers {
    position: absolute;
    left: 12px;
    top: calc(var(--safe-t) + 104px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.pw {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 6px;
    border-radius: 14px;
    background: rgba(255, 246, 230, .92);
    box-shadow: 0 3px 0 rgba(0, 0, 0, .18);
}
.pw span { font-size: 22px; width: 28px; text-align: center; }
.pw .bar { width: 76px; }
.pw-nazar { padding-right: 6px; }

#hint {
    position: fixed;
    left: 50%;
    top: 34%;
    z-index: 12;
    transform: translate(-50%, -50%) scale(.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    color: #fff;
    text-align: center;
    font-weight: 900;
    font-size: 20px;
    text-shadow: 0 2px 0 var(--ink), 0 0 12px rgba(0, 0, 0, .5);
    white-space: nowrap;
}
#hint.is-on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.hint-ico { font-size: 54px; animation: bob .7s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(-10px); } }

/* ---------------- Paneller ---------------- */

.panel-screen {
    align-items: center;
    justify-content: center;
    padding: 16px 16px calc(var(--ad-bottom) + 16px);
    background: rgba(20, 30, 40, .45);
}
.panel {
    width: min(400px, 100%);
    max-height: 100%;
    overflow-y: auto;
    padding: 20px 18px 18px;
    border-radius: 24px;
    background: var(--cream);
    box-shadow: 0 8px 0 var(--cream-2), 0 18px 40px rgba(0, 0, 0, .35);
    text-align: center;
    position: relative;
    animation: pop .25s cubic-bezier(.2, 1.4, .4, 1) both;
}
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.panel h2 { margin: 0 0 6px; font-size: 26px; font-weight: 900; color: var(--red); }
.panel-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.panel-actions.row { flex-direction: row; }
.panel-actions.row .btn { flex: 1; }

.countdown { position: relative; width: 120px; height: 120px; margin: 10px auto 4px; }
.countdown svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.cd-bg { fill: none; stroke: var(--cream-2); stroke-width: 10; }
.cd-fg { fill: none; stroke: var(--simit); stroke-width: 10; stroke-linecap: round; }
.countdown b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 44px; font-weight: 900; }

.badge-best {
    display: inline-block;
    margin: -4px 0 8px;
    transform: rotate(-4deg);
    padding: 6px 16px;
    border-radius: 10px;
    background: var(--gold);
    font-weight: 900;
    letter-spacing: 1px;
    box-shadow: 0 4px 0 var(--simit-dark);
    animation: pulse 1s ease-in-out infinite;
}
.over-score { font-size: 52px; font-weight: 900; color: var(--ink); font-variant-numeric: tabular-nums; }
.over-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 12px; }
.over-grid div { padding: 8px 4px; border-radius: 14px; background: var(--cream-2); }
.over-grid small { display: block; opacity: .7; font-weight: 700; font-size: 12px; }
.over-grid b { font-size: 18px; }
.over-level { margin: 0 0 12px; padding: 8px; border-radius: 12px; background: #dff5e7; font-weight: 800; font-size: 14px; }
#btn-double { width: 100%; }
.over-missions { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.mini-m { font-size: 12px; font-weight: 700; }
.mini-m span { display: block; margin-bottom: 3px; }
.mini-m.is-done { color: #198c50; }
.mini-m .bar { height: 6px; }

/* ---------------- Alt sayfalar ---------------- */

.sheet-screen { align-items: flex-end; padding-bottom: var(--ad-bottom); }
.sheet {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    max-height: 64%;
    display: flex;
    flex-direction: column;
    border-radius: 26px 26px 0 0;
    background: var(--cream);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, .25);
    animation: up .25s ease-out both;
    padding-bottom: var(--safe-b);
}
#settings .sheet, #missions .sheet { max-height: 75%; }
@keyframes up { from { transform: translateY(40%); opacity: 0; } }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 8px 18px; }
.sheet-head h2 { margin: 0; flex: 1; font-size: 24px; font-weight: 900; color: var(--red); }
.sheet-body { overflow-y: auto; padding: 8px 14px 16px; touch-action: pan-y; }
.tabs { display: flex; gap: 8px; padding: 0 14px 6px; }
.tab { flex: 1; padding: 9px; border: 0; border-radius: 12px; background: var(--cream-2); font-weight: 900; font-size: 15px; cursor: pointer; color: var(--ink); }
.tab.is-on { background: var(--teal); color: #fff; }

.char-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.char-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 10px 6px;
    border-radius: 16px;
    background: #fff;
    border: 3px solid transparent;
    cursor: pointer;
    text-align: center;
}
.char-card b { font-size: 14px; }
.char-card small { font-size: 11px; opacity: .65; min-height: 28px; }
.char-card.is-prev { border-color: var(--gold); }
.char-card.is-sel { border-color: var(--green); }
.tag { display: inline-block; padding: 6px 10px; border-radius: 10px; font-size: 13px; font-weight: 900; }
.tag-on { background: #dff5e7; color: #198c50; }

/* CSS ile küçük karakter figürü */
.fig { position: relative; width: 44px; height: 70px; margin-bottom: 4px; }
.fig i { position: absolute; left: 50%; transform: translateX(-50%); display: block; }
.f-head { top: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--skin); }
.f-body { top: 30px; width: 30px; height: 22px; border-radius: 8px 8px 4px 4px; background: var(--shirt); box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
.f-legs { top: 50px; width: 22px; height: 18px; background: linear-gradient(90deg, var(--pants) 45%, transparent 45%, transparent 55%, var(--pants) 55%); border-bottom: 4px solid var(--shoes); }
.f-hat { top: 4px; width: 26px; height: 13px; border-radius: 13px 13px 2px 2px; background: var(--hat); z-index: 1; }
.f-ponytail { width: 10px; height: 18px; top: 12px; left: 72%; border-radius: 50%; }
.f-scarf { width: 30px; height: 28px; top: 5px; border-radius: 50% 50% 40% 40%; background: var(--hat); clip-path: polygon(0 0, 100% 0, 100% 100%, 75% 100%, 75% 35%, 25% 35%, 25% 100%, 0 100%); }
.f-crown { width: 22px; height: 10px; top: 0; border-radius: 0; clip-path: polygon(0 100%, 0 0, 25% 60%, 50% 0, 75% 60%, 100% 0, 100% 100%); }
.f-kasket { width: 30px; height: 9px; top: 7px; border-radius: 8px 8px 2px 2px; }
.f-beanie { height: 15px; border-radius: 14px 14px 3px 3px; }

.up-row { display: flex; align-items: center; gap: 12px; padding: 10px; margin-bottom: 10px; border-radius: 16px; background: #fff; }
.up-ico { font-size: 30px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--cream-2); }
.up-info { flex: 1; min-width: 0; }
.up-info b { display: block; }
.up-info small { display: block; opacity: .7; font-size: 12px; margin: 2px 0 5px; }
.pips { display: flex; gap: 4px; }
.pips i { flex: 1; height: 7px; border-radius: 4px; background: rgba(0, 0, 0, .12); }
.pips i.on { background: var(--simit); }

.mission { display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 10px; border-radius: 16px; background: #fff; }
.m-check { width: 36px; height: 36px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; background: var(--cream-2); }
.mission.is-done .m-check { background: var(--green); color: #fff; }
.m-info { flex: 1; min-width: 0; }
.m-info b { display: block; font-size: 14px; margin-bottom: 5px; }
.m-info small { font-size: 11px; opacity: .65; }
.m-reward { text-align: center; padding: 8px; font-weight: 800; font-size: 14px; }

.toggles { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border: 0;
    border-radius: 14px;
    background: #fff;
    font-size: 16px;
    font-weight: 800;
    color: var(--ink);
    cursor: pointer;
}
.toggle i { width: 46px; height: 26px; border-radius: 13px; background: #cfc6b6; position: relative; transition: background .15s; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle.is-on i { background: var(--green); }
.toggle.is-on i::after { left: 23px; }
.panel .toggles { flex-direction: row; justify-content: center; }
.panel .toggle { flex: 1; flex-direction: column; gap: 6px; padding: 10px 4px; font-size: 13px; background: var(--cream-2); }

.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: #fff; font-weight: 800; }
.seg { display: flex; border-radius: 10px; overflow: hidden; background: var(--cream-2); }
.seg button { border: 0; padding: 8px 10px; background: transparent; font-weight: 800; font-size: 13px; cursor: pointer; color: var(--ink); }
.seg button.is-on { background: var(--teal); color: #fff; }
.credits { text-align: center; margin-top: 18px; }

/* ---------------- Reklam şeritleri ---------------- */

.ad-dock { position: fixed; left: 0; right: 0; z-index: 25; display: flex; justify-content: center; pointer-events: none; }
#ad-dock-top { top: 0; height: var(--ad-top); }
#ad-dock-bottom { bottom: 0; height: var(--ad-bottom); }
.ad-slot { display: none; width: 100%; height: var(--ad-h, 50px); pointer-events: auto; }
.ad-slot.is-on { display: block; }
.ad-mock {
    height: 100%;
    margin: 0 auto;
    max-width: 728px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: repeating-linear-gradient(45deg, #f1e3c7, #f1e3c7 10px, #eadab9 10px, #eadab9 20px);
    border-top: 2px dashed #c9b28a;
    color: #8c7550;
    font-weight: 900;
    font-size: 12px;
    letter-spacing: 1px;
}
.ad-mock small { opacity: .7; font-weight: 600; }

#ad-overlay, #modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(20, 14, 8, .8);
}
#ad-overlay.is-open, #modal.is-open { display: flex; }
.ad-mock-card, .sk-card {
    width: min(400px, 100%);
    padding: 20px;
    border-radius: 22px;
    background: var(--cream);
    text-align: center;
}
.ad-mock-card h3, .sk-card h2 { margin: 6px 0; font-size: 21px; color: var(--red); }
.ad-mock-card p, .sk-card p { margin: 0 0 12px; font-size: 14px; opacity: .8; }
.ad-mock-tag { font-size: 11px; font-weight: 800; opacity: .6; letter-spacing: 1px; }
.ad-mock-bar { height: 8px; margin: 4px 0 14px; border-radius: 4px; background: var(--cream-2); overflow: hidden; }
.ad-mock-bar i { display: block; width: 0; height: 100%; background: var(--simit); }
.ad-mock-actions, .sk-actions { display: flex; gap: 10px; justify-content: center; }
.sk-btn { min-width: 110px; padding: 10px 16px; border: 0; border-radius: 12px; font-weight: 900; font-size: 15px; cursor: pointer; color: var(--ink); box-shadow: 0 4px 0 rgba(0,0,0,.2); }
.sk-btn:disabled { opacity: .5; }
.sk-btn-main { background: var(--green); color: #fff; }
.sk-btn-gold { background: var(--gold); }
.sk-btn-ghost { background: var(--cream-2); }

#toast {
    position: fixed;
    left: 50%;
    top: calc(var(--safe-t) + 64px);
    z-index: 45;
    max-width: calc(100% - 32px);
    transform: translate(-50%, -20px);
    padding: 10px 16px;
    border-radius: 14px;
    background: rgba(43, 29, 18, .92);
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
}
#toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (min-aspect-ratio: 1/1) {
    .logo { top: calc(var(--safe-t) + 30px); }
    .logo-top, .logo-bottom { font-size: clamp(36px, 7vh, 64px); }
}
