:root {
  --bg: #0e1116;
  --panel: #151a21;
  --panel-2: #1c222b;
  --border: #2a313c;
  --text: #e6e9ee;
  --muted: #8b95a5;
  --accent: #5aa9ff;
  --img: #4c9aff;
  --txt: #ff9d42;
  --query: #ffffff;
  --radius: 8px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  display: grid;
  grid-template-columns: 290px 1fr 360px;
  overflow: hidden;
}

.panel {
  background: var(--panel);
  overflow-y: auto;
  padding: 12px 14px 24px;
}
#left { border-right: 1px solid var(--border); }
#right { border-left: 1px solid var(--border); }

.brand { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.brand-links { display: flex; gap: 10px; align-items: baseline; font-size: 12px; }
.brand-links a { color: var(--accent); text-decoration: none; font-weight: 600; }
.brand-links a:hover { text-decoration: underline; }
h1 { font-size: 15px; margin: 0; font-weight: 650; letter-spacing: .2px; }
h2 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); margin: 0 0 8px; font-weight: 600;
}
section { padding: 12px 0; border-bottom: 1px solid var(--border); }
section:last-child { border-bottom: 0; }

label { display: block; margin: 8px 0; color: var(--muted); }
label > select, label > .row { margin-top: 4px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); margin: 6px 0; cursor: pointer; }
.row { display: flex; align-items: center; gap: 8px; }
.row > input[type=range] { flex: 1; }
output { min-width: 34px; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }

select, input[type=search], button {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 9px;
  font: inherit;
}
input[type=search]:focus, select:focus { outline: none; border-color: var(--accent); }
input[type=range] { accent-color: var(--accent); }
button { cursor: pointer; margin-top: 6px; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #06121f; font-weight: 600; }

.seg { display: flex; gap: 0; margin: 6px 0; }
.seg button {
  margin: 0; border-radius: 0; border-right-width: 0; padding: 6px 4px;
}
.seg button:first-child { border-radius: 6px 0 0 6px; }
.seg button:last-child { border-radius: 0 6px 6px 0; border-right-width: 1px; }
.seg button.on { background: #24364d; border-color: var(--accent); color: #fff; }
.seg button.on + button { border-left-color: var(--accent); }

.params { display: none; }
.params.on { display: block; }
.hint { color: var(--muted); font-size: 11.5px; margin: 6px 0 0; }
.muted { color: var(--muted); }
kbd {
  font: 11px ui-monospace, monospace; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 4px; padding: 0 4px;
}

/* Sahne */
#stage { position: relative; overflow: hidden; }
#canvas-wrap, #canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#canvas-wrap { cursor: crosshair; }
.label3d {
  font-size: 11px; color: #fff; background: rgba(0,0,0,.55);
  padding: 2px 6px; border-radius: 4px; white-space: nowrap; pointer-events: none;
}

#legend {
  position: absolute; left: 12px; top: 12px; display: flex; flex-wrap: wrap; gap: 4px 12px;
  max-width: 60%; font-size: 12px; pointer-events: none;
  background: rgba(14,17,22,.7); padding: 6px 10px; border-radius: var(--radius);
}
#legend span { display: inline-flex; align-items: center; gap: 6px; }
#legend i { width: 10px; height: 10px; display: inline-block; border-radius: 50%; }
#legend i.diamond { border-radius: 1px; transform: rotate(45deg) scale(.85); }

#infobar {
  position: absolute; left: 12px; bottom: 10px; font-size: 11.5px;
  background: rgba(14,17,22,.7); padding: 4px 10px; border-radius: var(--radius); pointer-events: none;
}

#tooltip {
  position: absolute; pointer-events: none; z-index: 5; max-width: 280px;
  background: rgba(21,26,33,.96); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px; box-shadow: 0 6px 24px rgba(0,0,0,.45);
}
#tooltip img { display: block; max-width: 180px; max-height: 180px; border-radius: 4px; }
#tooltip .t { padding: 2px 4px; }
#tooltip .meta { color: var(--muted); font-size: 11px; padding: 4px 4px 0; }

#busy {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 12px;
  background: rgba(14,17,22,.6); font-size: 14px; z-index: 10;
}
#busy[hidden] { display: none; }
.spinner {
  width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Sağ panel */
.sel-head { display: flex; gap: 10px; align-items: flex-start; }
.sel-head img { width: 120px; height: 120px; object-fit: cover; border-radius: 6px; flex: none; }
.sel-head .caption { font-size: 14px; line-height: 1.4; }
.badge {
  display: inline-block; font-size: 10.5px; padding: 1px 6px; border-radius: 10px;
  border: 1px solid var(--border); color: var(--muted); margin: 0 4px 4px 0;
}
.badge.img { color: var(--img); border-color: var(--img); }
.badge.txt { color: var(--txt); border-color: var(--txt); }
.badge.q { color: #fff; border-color: #fff; }

h3 { font-size: 12px; margin: 14px 0 6px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
h3 .seg { margin: 0; width: 170px; }
h3 .seg button { padding: 2px 4px; font-size: 11px; font-weight: 400; }

.list { display: flex; flex-direction: column; gap: 2px; }
.li {
  display: grid; grid-template-columns: 44px 1fr 52px; gap: 8px; align-items: center;
  padding: 4px; border-radius: 6px; cursor: pointer;
}
.li:hover { background: var(--panel-2); }
.li img { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; }
.li .tx {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  color: var(--txt); font-size: 18px; background: var(--panel-2); border-radius: 4px;
}
.li .body { overflow: hidden; font-size: 12px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.li .score { text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; }
.li .bar { height: 3px; background: var(--border); border-radius: 2px; margin-top: 3px; overflow: hidden; }
.li .bar > div { height: 100%; background: var(--accent); }
.li .rank { color: var(--muted); font-size: 10.5px; }
.li.same { box-shadow: inset 2px 0 0 #41c98a; }

table.metrics { width: 100%; border-collapse: collapse; font-size: 12px; }
table.metrics td { padding: 4px 0; border-bottom: 1px dashed var(--border); }
table.metrics td:last-child { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
table.metrics td:first-child { color: var(--muted); }
.note { font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.err { color: #ff6b6b; }

@media (max-width: 1100px) {
  body { grid-template-columns: 260px 1fr; }
  #right { position: fixed; right: 0; top: 0; bottom: 0; width: 320px; z-index: 20; box-shadow: -8px 0 24px rgba(0,0,0,.4); }
}

/* Statik (GitHub Pages) sürümü: sunucu gerektiren kontroller gizlenir */
body.static .server-only { display: none !important; }

#method-notes .hint { margin: 2px 0 8px; }
