/* ==========================================================================
   screens.css — Menü, ayarlar, görünüm, geçmiş ve modal içerikleri
   ========================================================================== */

/* ---------- Ortak üst çubuklar ---------- */
.top-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 6px;
    flex: 0 0 auto;
}

.sub-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px 6px;
    flex: 0 0 auto;
}
.sub-top h2 { flex: 1; text-align: center; font-size: 20px; }
.sub-top .spacer { width: 38px; }

.sub-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px 14px 24px;
    max-width: 560px;
    width: 100%;
    margin: 0 auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.sub-body::-webkit-scrollbar { display: none; }

/* ---------- Profil çipi ---------- */
.profile-chip {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: 18px;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--border), 0 6px 14px rgba(0, 0, 0, 0.2);
    text-align: left;
    transition: transform 0.1s;
}
.profile-chip:active { transform: scale(0.98); }
.profile-chip .avatar { flex: 0 0 auto; width: 46px; height: 46px; font-size: 24px; }
.profile-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.profile-meta b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-line { display: flex; align-items: center; gap: 6px; }
.rank-line .rank-badge { --rank-size: 20px; }
.rank-line em { font-style: normal; font-size: 12px; font-weight: 800; color: var(--text-dim); letter-spacing: 0.04em; }

.lives-chip { flex: 0 0 auto; flex-direction: column; gap: 0; padding: 4px 12px; min-height: 50px; justify-content: center; }
.lives-chip .heart { font-size: 14px; line-height: 1; }
.lives-chip b { font-size: 17px; line-height: 1.1; }
.lives-chip small { font-size: 10px; color: var(--text-dim); min-height: 12px; font-weight: 700; }
.lives-chip.is-empty { box-shadow: inset 0 0 0 2px var(--bad); }

/* ---------- Menü ---------- */
.menu-body {
    flex: 1 1 auto;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    padding: 6px 18px 12px;
    scrollbar-width: none;
}
.menu-body::-webkit-scrollbar { display: none; }
.menu-body > * { flex-shrink: 0; }

.hero-cards {
    --cw: 58px;
    position: relative;
    width: 180px;
    height: calc(var(--cw) * 1.42 + 8px);
    margin: 2px 0 6px;
}
.hero-cards .pcard { position: absolute; left: 50%; top: 4px; margin-left: calc(var(--cw) / -2); transform-origin: 50% 120%; }
.hero-cards .pcard:nth-child(1) { transform: translateX(-52px) rotate(-18deg); }
.hero-cards .pcard:nth-child(2) { transform: translateY(-6px); z-index: 2; }
.hero-cards .pcard:nth-child(3) { transform: translateX(52px) rotate(18deg); }
.hero-cards .pcard { animation: heroFloat 4s ease-in-out infinite; }
.hero-cards .pcard:nth-child(2) { animation-delay: -1.3s; }
.hero-cards .pcard:nth-child(3) { animation-delay: -2.6s; }
@keyframes heroFloat {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -5px; }
}

.select-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.select-label {
    flex: 0 0 48px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.select-row .seg { flex: 1; }

.tile-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    width: 100%;
    margin-top: 4px;
}
.tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 2px 8px;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--border), 0 4px 0 rgba(0, 0, 0, 0.2);
    font-size: 12px;
    font-weight: 800;
    transition: transform 0.08s;
}
.tile span { font-size: 24px; line-height: 1; }
.tile:active { transform: translateY(3px); box-shadow: inset 0 0 0 1px var(--border); }

.credits {
    flex: 0 0 auto;
    text-align: center;
    font-size: 11px;
    padding: 4px 8px 6px;
    color: var(--text-dim);
    opacity: 0.8;
}

/* ---------- Kartlar (bölüm kutuları) ---------- */
.panel {
    padding: 14px;
    margin-bottom: 12px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--border);
}
.panel > h3 {
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-dim);
}

/* ---------- Ayarlar ---------- */
.set-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
}
.set-row + .set-row { border-top: 1px solid var(--border); }
.set-label { display: flex; flex-direction: column; gap: 1px; font-weight: 700; font-size: 15px; }
.set-label small { font-weight: 500; font-size: 12px; color: var(--text-dim); }
.set-control { flex: 0 0 auto; }
.set-control.grow { flex: 1; max-width: 190px; }

.switch {
    position: relative;
    width: 52px;
    height: 30px;
    border-radius: 15px;
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--border);
    transition: background 0.2s;
}
.switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s;
}
.switch.is-on { background: var(--good); }
.switch.is-on::after { transform: translateX(22px); }

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--border);
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
}

.text-input {
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    border: 0;
    border-radius: 14px;
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--border);
    color: var(--text);
    font-size: 17px;
    font-weight: 700;
    outline: none;
}
.text-input:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.field-error { margin-top: 6px; font-size: 12px; color: var(--bad); min-height: 16px; }

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
    margin-top: 10px;
}
.avatar-grid button {
    aspect-ratio: 1;
    border-radius: 12px;
    background: var(--surface-2);
    font-size: 22px;
    box-shadow: inset 0 0 0 1px var(--border);
    transition: transform 0.1s;
}
.avatar-grid button.is-on { background: var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 4px 10px rgba(0, 0, 0, 0.3); transform: scale(1.1); }

/* ---------- Görünüm (şablon seçici) ---------- */
.tpl-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 12px;
}
.tpl-item {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--border);
    text-align: left;
    overflow: hidden;
    transition: transform 0.1s;
}
.tpl-item:active { transform: scale(0.97); }
.tpl-item.is-selected { box-shadow: inset 0 0 0 3px var(--accent), 0 6px 16px rgba(0, 0, 0, 0.25); }
.tpl-item .tpl-name { font-weight: 800; font-size: 14px; padding: 0 2px; }
.tpl-item .tpl-sub { font-size: 11px; color: var(--text-dim); padding: 0 2px; margin-top: -6px; }

.tpl-preview {
    position: relative;
    height: 96px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tpl-preview.cards { --cw: 44px; background: radial-gradient(ellipse at 50% 40%, #1b7a55, #0a3a29); }
.tpl-preview.cards .pcard { margin: 0 -9px; }
.tpl-preview.cards .pcard:nth-child(1) { transform: rotate(-10deg) translateY(2px); }
.tpl-preview.cards .pcard:nth-child(2) { transform: translateY(-3px); z-index: 2; }
.tpl-preview.cards .pcard:nth-child(3) { transform: rotate(10deg) translateY(2px); }
.tpl-preview.cards .pcard.facedown { margin-left: 4px; }

.tpl-preview.table-prev .tp-bg { position: absolute; inset: 0; }
.tpl-preview.table-prev .tp-fx { position: absolute; inset: 0; overflow: hidden; }
.tpl-preview.table-prev .pcard { --cw: 34px; position: relative; transform: rotate(-6deg); }

.lock-veil {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(5, 10, 25, 0.62);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}
.lock-veil span { font-size: 24px; }
.lock-veil .btn { margin-top: 2px; }

.tpl-check {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 900;
    line-height: 24px;
    text-align: center;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* ---------- Geçmiş ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}
.stat-box {
    padding: 10px 6px;
    border-radius: 14px;
    text-align: center;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--border);
}
.stat-box b { display: block; font-size: 20px; font-weight: 900; line-height: 1.1; }
.stat-box small { display: block; margin-top: 3px; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }

.winbar {
    display: flex;
    height: 10px;
    margin: 0 0 12px;
    border-radius: 5px;
    overflow: hidden;
    background: var(--surface-2);
}
.winbar i:nth-child(1) { background: var(--good); }
.winbar i:nth-child(2) { background: #94a3b8; }
.winbar i:nth-child(3) { background: var(--bad); }

.h-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.h-item {
    border-radius: 16px;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--border);
    overflow: hidden;
}
.h-head {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    text-align: left;
    border-left: 5px solid var(--text-dim);
}
.h-item.win .h-head { border-left-color: var(--good); }
.h-item.loss .h-head { border-left-color: var(--bad); }
.h-res { flex: 0 0 auto; font-size: 11px; font-weight: 900; letter-spacing: 0.1em; padding: 4px 8px; border-radius: 8px; background: var(--surface-2); }
.h-item.win .h-res { color: var(--good); }
.h-item.loss .h-res { color: var(--bad); }
.h-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.h-score { font-size: 18px; font-weight: 900; }
.h-score em { font-style: normal; color: var(--text-dim); font-weight: 600; font-size: 13px; margin-left: 6px; }
.h-meta { font-size: 11px; color: var(--text-dim); }
.h-xp { flex: 0 0 auto; font-size: 12px; font-weight: 900; color: var(--accent); }
.h-chev { flex: 0 0 auto; color: var(--text-dim); transition: transform 0.2s; }
.h-item.is-open .h-chev { transform: rotate(90deg); }

.h-detail { display: none; padding: 4px 12px 12px; border-top: 1px solid var(--border); }
.h-item.is-open .h-detail { display: block; }
.h-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.h-chip { padding: 4px 9px; border-radius: 999px; background: var(--surface-2); font-size: 12px; font-weight: 700; }
.h-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.h-table th { padding: 4px 2px; text-align: center; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
.h-table td { padding: 5px 2px; text-align: center; border-top: 1px solid var(--border); }
.h-table td:first-child, .h-table th:first-child { text-align: left; }
.empty-state { padding: 36px 12px; text-align: center; color: var(--text-dim); font-size: 14px; line-height: 1.6; }
.empty-state span { display: block; font-size: 46px; margin-bottom: 6px; }

/* ---------- Profil modalı ---------- */
.profile-head { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 14px; }
.profile-head .avatar { width: 84px; height: 84px; font-size: 44px; box-shadow: 0 0 0 4px var(--accent); }
.profile-head h2 { margin: 0; }
.profile-head .rank-badge { --rank-size: 40px; }
.profile-level { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.profile-head .xpbar { width: 100%; height: 18px; }
.profile-head .xpbar small { font-size: 11px; }

.rank-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.rank-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 12px;
    background: var(--surface-2);
    font-size: 14px;
    font-weight: 700;
}
.rank-row .rank-badge { --rank-size: 26px; }
.rank-row em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--text-dim); }
.rank-row.is-current { box-shadow: inset 0 0 0 2px var(--accent); }
.rank-row.is-locked { opacity: 0.55; }

/* ---------- El sonucu / Oyun sonu ---------- */
.result-title { font-family: var(--font-display); font-size: 26px; font-weight: 900; text-align: center; letter-spacing: 0.04em; }
.result-title.win { color: var(--good); }
.result-title.loss { color: var(--bad); }
.result-title.draw { color: var(--accent); }
.result-sub { text-align: center; color: var(--text-dim); font-size: 13px; margin: 2px 0 14px; }

.res-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.res-col { padding: 10px; border-radius: 14px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.res-col h4 { margin: 0 0 8px; font-size: 14px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-col.me h4 { color: var(--good); }
.res-col.bot h4 { color: #60a5fa; }
.res-line { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13px; color: var(--text-dim); }
.res-line b { color: var(--text); }
.res-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--border); }
.res-total span { font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); }
.res-total b { font-size: 26px; font-weight: 900; color: var(--accent); }
.res-sum { margin-top: 10px; text-align: center; font-size: 13px; color: var(--text-dim); }
.res-sum b { color: var(--text); font-size: 15px; }

.xp-block { margin-top: 14px; padding: 12px; border-radius: 14px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.xp-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-weight: 800; }
.xp-row .gain { color: var(--accent); font-size: 20px; }
.xp-block .xpbar { height: 18px; }
.xp-block .xpbar small { font-size: 11px; }
.levelup {
    margin-top: 10px;
    padding: 10px;
    border-radius: 12px;
    text-align: center;
    font-weight: 900;
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.25), rgba(249, 115, 22, 0.25));
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.6);
    animation: popIn 0.4s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.levelup .rank-badge { vertical-align: middle; margin-right: 6px; --rank-size: 28px; }

.ad-slot.inline { background: transparent; }

/* ---------- Kurallar modalı ---------- */
.rules-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rules-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); font-size: 14px; }
.rules-list li b { padding: 3px 9px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); white-space: nowrap; }
.rules-text { margin-top: 12px; font-size: 13px; line-height: 1.55; color: var(--text-dim); }

@media (max-height: 640px) {
    .hero-cards { display: none; }
}
@media (min-width: 700px) {
    .tpl-grid { grid-template-columns: repeat(3, 1fr); }
}
