:root {
    --bg: #f3f5f8;
    --bg-alt: #ffffff;
    --card: #ffffff;
    --card-alt: #eef1f5;
    --border: #dde3ea;
    --text: #12161c;
    --text-muted: #5c6b7a;
    --accent: #17a558;
    --accent-dark: #128a48;
    --accent2: #d98a00;
    --pitch1: #2f8a4d;
    --pitch2: #277a43;
    --radius: 14px;
    --maxw: 1180px;
}

html.dark-mode {
    --bg: #0b0f14;
    --bg-alt: #101720;
    --card: #151d28;
    --card-alt: #1b2530;
    --border: #253244;
    --text: #eef2f6;
    --text-muted: #8fa0b3;
    --accent: #33d17a;
    --accent-dark: #1fa85f;
    --accent2: #ffb020;
    --pitch1: #1d6b3a;
    --pitch2: #185b31;
}

body { transition: background .2s ease, color .2s ease; }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, -apple-system, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
}

a { color: var(--accent); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 18px; }

/* ---------- HEADER ---------- */
header.site-header {
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { height: 42px; width: auto; display: block; }
.brand .logo-dark { display: none; }
html.dark-mode .brand .logo-light { display: none; }
html.dark-mode .brand .logo-dark { display: block; }
.site-header nav { display: flex; gap: 22px; font-size: 14px; }
.site-header nav a { color: var(--text-muted); text-decoration: none; font-weight: 600; }
.site-header nav a:hover { color: var(--text); }
.theme-toggle {
    background: var(--card-alt); border: 1px solid var(--border); border-radius: 999px;
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 17px; margin-left: 16px; flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle .icon-moon { display: none; }
html.dark-mode .theme-toggle .icon-sun { display: none; }
html.dark-mode .theme-toggle .icon-moon { display: inline; }

/* ---------- HERO / INTRO ---------- */
.hero { padding: 38px 0 10px; text-align: center; }
.hero h1 { font-size: clamp(26px, 4vw, 38px); margin: 0 0 12px; font-weight: 800; }
.hero h1 span { color: var(--accent); }
.hero p.lead { color: var(--text-muted); max-width: 720px; margin: 0 auto; font-size: 16px; }
.hero .stats-row { display: flex; justify-content: center; gap: 34px; margin-top: 22px; flex-wrap: wrap; }
.hero .stats-row div { text-align: center; }
.hero .stats-row b { display: block; font-size: 22px; color: var(--accent); }
.hero .stats-row span { font-size: 12px; color: var(--text-muted); }

/* ---------- TOOLBAR ---------- */
.toolbar {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin: 26px 0 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-end;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.field select, .field input[type=text] {
    background: var(--card-alt); border: 1px solid var(--border); color: var(--text);
    border-radius: 9px; padding: 9px 12px; font-size: 14px; min-width: 150px;
}
.mode-tabs { display: flex; background: var(--card-alt); border-radius: 9px; padding: 3px; gap: 3px; }
.mode-tabs button {
    border: none; background: transparent; color: var(--text-muted); font-weight: 700; font-size: 13px;
    padding: 8px 12px; border-radius: 7px; cursor: pointer;
}
.mode-tabs button.active { background: var(--accent); color: #06210f; }
.style-tabs { display: flex; gap: 3px; background: var(--card-alt); border-radius: 9px; padding: 3px; }
.style-tabs button { border: none; background: transparent; color: var(--text-muted); font-size: 13px; font-weight: 700; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.style-tabs button.active { background: var(--accent2); color: #2b1c00; }
.toolbar .spacer { flex: 1; }
.jersey-color-field input[type=color] { width: 44px; height: 38px; border: none; border-radius: 8px; background: none; cursor: pointer; padding: 0; }

.btn {
    display: inline-flex; align-items: center; gap: 7px; border: none; border-radius: 9px;
    padding: 10px 16px; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--accent); color: #06210f; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: var(--card-alt); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* ---------- PITCH ---------- */
.pitch-outer {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.pitch-wrap {
    position: relative;
    width: 100%;
    max-width: 620px;
    margin: 0 auto;
    aspect-ratio: 68 / 100;
    background-image: url('saha.webp');
    background-size: cover;
    background-position: center;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(0,0,0,.25);
}


.slot {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    cursor: pointer;
    width: 80px;
}
.slot .avatar {
    width: 72px; height: 72px; border-radius: 50%;
    background: linear-gradient(160deg, #2a3a55, #131b26);
    box-shadow: 0 0 0 3px var(--accent2) inset, 0 3px 8px rgba(0,0,0,.4);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 21px; overflow: hidden;
    position: relative;
}
.slot .avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.slot.filled .avatar { box-shadow: 0 0 0 3px #ffffff inset, 0 3px 10px rgba(0,0,0,.5); }
.slot .name-tag {
    font-size: 13px; font-weight: 800; text-align: center; color: #0b3d1e;
    background: #bdf0c9; border-radius: 7px; padding: 4px 10px; max-width: 130px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    box-shadow: 0 2px 4px rgba(0,0,0,.25);
}
.slot .plus { font-size: 20px; opacity: .8; }

/* forma (jersey) görünüm modu */
.slot.style-jersey .avatar {
    border-radius: 8px 8px 14px 14px;
    clip-path: polygon(20% 0%, 80% 0%, 100% 18%, 78% 30%, 78% 100%, 22% 100%, 22% 30%, 0% 18%);
}
/* daire (circle) görünüm modu -- varsayılan .avatar zaten dairesel */

/* ---------- 3 SÜTUNLU DÜZEN: sol panel / saha / sağ panel ---------- */
.builder-layout {
    display: grid;
    grid-template-columns: 220px 1fr 220px;
    gap: 18px;
    align-items: start;
}
.team-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    max-height: 720px;
    overflow-y: auto;
}
.team-panel-title { font-weight: 800; font-size: 14px; margin-bottom: 10px; }
.team-panel-group-title { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 700; margin: 12px 0 6px; }
.team-panel-list { display: flex; flex-direction: column; gap: 4px; }
.team-panel-item {
    display: flex; align-items: center; gap: 8px;
    background: var(--card-alt); border: 1px solid transparent; border-radius: 8px;
    padding: 7px 9px; font-size: 12.5px; font-weight: 600; color: var(--text);
    cursor: pointer; text-align: left; width: 100%;
}
.team-panel-item:hover { border-color: var(--accent); }
.team-panel-item.active { border-color: var(--accent); background: rgba(23,165,88,.12); color: var(--accent); }
.team-panel-item .tp-icon { width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; object-fit: contain; background: var(--border); }

/* saha köşesindeki seçili takım logosu */
.team-logo-corner {
    position: absolute; bottom: 10px; right: 12px; z-index: 6;
    width: 42px; height: 42px; object-fit: contain;
    background: rgba(255,255,255,.92); border-radius: 50%;
    padding: 4px; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}

/* ---------- boş pozisyon: şeffaf futbol topu + artı ---------- */
.slot .avatar.empty {
    background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.5), rgba(255,255,255,.15) 60%), rgba(20,30,45,.35);
    box-shadow: 0 0 0 3px rgba(255,255,255,.55) inset, 0 3px 8px rgba(0,0,0,.25);
}
.slot .avatar.empty::before {
    content: "";
    position: absolute; inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><circle cx='50' cy='50' r='47' fill='white' fill-opacity='0.55'/><polygon points='50,28 66,39 60,58 40,58 34,39' fill='black' fill-opacity='0.45'/><path d='M50 3 L50 28 M15 25 L34 39 M85 25 L66 39 M22 80 L40 58 M78 80 L60 58' stroke='black' stroke-opacity='0.4' stroke-width='3' fill='none'/></svg>");
    background-size: cover;
    opacity: .8;
}
.slot .avatar.empty .plus {
    position: relative; z-index: 2;
    color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.bench-title { margin: 22px 0 10px; font-size: 15px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.bench-row { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; padding: 6px 0 4px; }

/* ---------- SEARCH MODAL ---------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(6,10,14,.72); backdrop-filter: blur(2px);
    display: none; align-items: flex-start; justify-content: center; z-index: 200; padding: 8vh 16px;
}
.modal-overlay.open { display: flex; }
.modal-box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); width: 100%; max-width: 440px; max-height: 74vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-box .modal-head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.modal-box input[type=text] { flex: 1; background: var(--card-alt); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.modal-box .modal-close { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; }
.modal-list { overflow-y: auto; padding: 6px; }
.modal-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.modal-row:hover { background: var(--card-alt); }
.modal-row img, .modal-row .ph { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--card-alt); display:flex;align-items:center;justify-content:center;font-size:12px;color:var(--text-muted); }
.modal-row .r-name { font-weight: 700; font-size: 14px; }
.modal-row .r-sub { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.modal-divider { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: 10px 10px 4px; }
.modal-manual { padding: 10px 14px 14px; font-size: 12.5px; color: var(--text-muted); }

/* ---------- CONTENT / SEO ---------- */
section.content-block { max-width: 820px; margin: 54px auto 0; }
section.content-block h2 { font-size: 24px; margin: 0 0 14px; }
section.content-block p { color: #cdd8e3; font-size: 15px; }
.how-steps { list-style: none; counter-reset: step; padding: 0; margin: 18px 0; display: grid; gap: 12px; }
.how-steps li { counter-increment: step; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px 14px 50px; position: relative; font-size: 14.5px; color: #dbe4ee; }
.how-steps li::before { content: counter(step); position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; background: var(--accent); color: #06210f; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; }

.faq-item { border-bottom: 1px solid var(--border); padding: 16px 0; }
.faq-item summary { cursor: pointer; font-weight: 700; font-size: 15px; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--accent); font-size: 20px; }
.faq-item[open] summary::after { content: "–"; }
.faq-item p { margin: 10px 0 0; color: var(--text-muted); font-size: 14.5px; }

.team-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.team-links a { background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 7px 14px; font-size: 13px; text-decoration: none; color: var(--text); }
.team-links a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- FOOTER ---------- */
footer.site-footer { border-top: 1px solid var(--border); margin-top: 60px; padding: 28px 0 40px; color: var(--text-muted); font-size: 13px; text-align: center; }
footer.site-footer a { color: var(--text-muted); }

/* ---------- TOAST ---------- */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); background: var(--card-alt); border: 1px solid var(--accent); color: var(--text); padding: 11px 18px; border-radius: 9px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 300; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
    .builder-layout { grid-template-columns: 1fr; }
    .pitch-outer { order: 1; }
    .team-panel { order: 2; max-height: 260px; }
    #panelWorld { order: 3; }
}

@media (max-width: 640px) {
    .site-header nav { display: none; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar .spacer { display: none; }
    #teamResults { position: static !important; max-width: none !important; margin-top: 6px !important; }
}

@media (max-width: 480px) {
    .slot { width: 58px; }
    .slot .avatar { width: 52px; height: 52px; font-size: 16px; }
    .slot .name-tag { max-width: 90px; font-size: 10.5px; padding: 3px 8px; }
    .brand img { height: 34px; }
    .hero .stats-row { gap: 20px; }
}
