:root {
  --bg: #0e0e12;
  --panel: rgba(22, 22, 28, .82);
  --line: rgba(255, 255, 255, .09);
  --text: #f4f4f6;
  --muted: #9a9aa6;
  --accent: #ff5a36;
  --ok: #3ecf8e;
  --err: #ff6b6b;
  --r: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }

#board {
  position: fixed; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: none; cursor: grab;
}
#board.dragging { cursor: grabbing; }
#board.pointer { cursor: pointer; }

/* --- Üst bar --- */
.top {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(12px + env(safe-area-inset-top)) 18px 12px;
  background: linear-gradient(var(--bg) 30%, transparent);
  pointer-events: none;
}
.brand { margin: 0; line-height: 0; }
.brand img { display: block; height: 30px; width: auto; }
@media (max-width: 400px) { .brand img { height: 24px; } }
.progress { min-width: 150px; text-align: right; }
.progress-text { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.progress-text b { color: var(--text); }
.bar { height: 4px; margin-top: 6px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .6s; }

/* --- Zoom butonları --- */
.zoomctl {
  position: fixed; right: 14px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 6px;
}
.zoomctl button {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-size: 20px; cursor: pointer;
}
@media (hover: none) {
  .zoomctl { top: auto; transform: none; bottom: calc(88px + env(safe-area-inset-bottom)); }
  .zoomctl #zIn, .zoomctl #zOut { display: none; }
}
body.picking .zoomctl { display: none; }

.hint {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  font-size: 12px; color: var(--muted); background: var(--panel);
  padding: 6px 12px; border-radius: 20px; pointer-events: none;
  transition: opacity .6s; white-space: nowrap;
}
.hint.gone { opacity: 0; }

/* --- Alt butonlar --- */
.actions {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex; gap: 8px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  max-width: calc(100vw - 20px);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 16px; border-radius: 12px; border: 0;
  background: rgba(255, 255, 255, .08); color: var(--text);
  font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, .14); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.icon { width: 44px; padding: 0; font-size: 22px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

/* --- Hover etiketi --- */
.tip {
  position: fixed; pointer-events: none; z-index: 5;
  background: #fff; color: #111; font-size: 12px; font-weight: 600;
  padding: 4px 8px; border-radius: 8px; transform: translate(-50%, calc(-100% - 10px));
  white-space: nowrap; max-width: 240px; overflow: hidden; text-overflow: ellipsis;
}

/* --- Modallar --- */
.modal {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .6); padding: 16px;
  animation: fade .18s;
}
.modal[hidden] { display: none; }
.sheet {
  position: relative; width: 100%; max-width: 440px; max-height: calc(100% - 20px);
  overflow-y: auto; background: #17171d; border: 1px solid var(--line);
  border-radius: 20px; padding: 22px; animation: up .22s;
}
@media (max-width: 520px) {
  .modal { align-items: flex-end; padding: 0; }
  .sheet { max-width: none; border-radius: 20px 20px 0 0; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
}
.x {
  position: absolute; top: 10px; right: 10px; width: 34px; height: 34px;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .08);
  font-size: 22px; line-height: 1; cursor: pointer;
}
h2 { margin: 0 0 12px; font-size: 21px; letter-spacing: -.3px; }
h3 { margin: 22px 0 8px; font-size: 15px; color: var(--muted); font-weight: 600; }

.steps { margin: 0 0 16px; padding-left: 20px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.steps a { color: var(--accent); font-weight: 600; }

form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
form input:not([type=checkbox]):not([type=file]) {
  display: block; width: 100%; margin-top: 6px; height: 46px; padding: 0 14px;
  background: #0f0f14; border: 1px solid var(--line); border-radius: 12px; font-size: 16px; outline: none;
}
form input:focus { border-color: var(--accent); }
.opt { opacity: .7; }

.file input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  min-height: 110px; border: 1.5px dashed rgba(255, 255, 255, .2); border-radius: 14px;
  text-align: center; color: var(--text); cursor: pointer; padding: 12px;
}
.drop small { color: var(--muted); }
.drop img { width: 86px; height: 86px; object-fit: cover; border-radius: 10px; }

.rules { font-size: 13px; color: var(--muted); margin: 4px 0 10px; }
.rules summary { cursor: pointer; color: var(--text); }
.rules ul { padding-left: 18px; line-height: 1.5; }
.check { display: flex !important; align-items: center; gap: 8px; color: var(--text) !important; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.msg { font-size: 14px; padding: 10px 12px; border-radius: 10px; margin: 10px 0; line-height: 1.45; background: rgba(255, 255, 255, .06); }
.msg.ok { background: rgba(62, 207, 142, .12); color: var(--ok); }
.msg.err { background: rgba(255, 107, 107, .12); color: var(--err); }

.inline { display: flex; gap: 8px; }
.inline input { margin-top: 0 !important; flex: 1; }

/* Kare detayı */
.square-sheet { padding: 0; overflow: hidden; }
.square-sheet img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #222; }
.square-sheet .x { background: rgba(0, 0, 0, .5); color: #fff; }
.sq-meta { padding: 16px 20px 6px; }
.sq-no { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sq-name { font-size: 20px; font-weight: 700; margin-top: 2px; word-break: break-word; }
.sq-link { display: inline-block; margin-top: 6px; color: var(--accent); font-size: 14px; word-break: break-all; }
.square-sheet > .btn { margin: 12px 20px 20px; width: calc(100% - 40px); }

@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(16px); opacity: 0; } }

/* --- Kenarlarda hafif bulanıklık + vinyet --- */
.lens {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  -webkit-mask-image: radial-gradient(ellipse 72% 68% at 50% 50%, transparent 58%, #000 100%);
          mask-image: radial-gradient(ellipse 72% 68% at 50% 50%, transparent 58%, #000 100%);
}
.lens::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 75% at 50% 50%, transparent 55%, rgba(0, 0, 0, .32) 100%);
}
.top, .zoomctl, .hint, .actions { z-index: 3; }
.tip { z-index: 4; }

/* --- Kare seçimi --- */
.field { margin-bottom: 12px; }
.lbl { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.pickbtn {
  display: flex; align-items: center; justify-content: space-between; width: 100%; height: 46px; padding: 0 14px;
  background: #0f0f14; border: 1px solid var(--line); border-radius: 12px; font-size: 16px; cursor: pointer; text-align: left;
}
.pickbtn.set { border-color: var(--accent); }
.pickbtn.set #pickText { color: var(--text); font-weight: 600; }
#pickText { color: var(--muted); }
.pickbar {
  position: fixed; z-index: 3; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: min(520px, calc(100vw - 20px));
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 16px;
  background: var(--panel); border: 1px solid var(--accent); border-radius: 18px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.pickbar[hidden] { display: none; }
.pick-info { display: flex; flex-direction: column; min-width: 0; }
.pick-info b { font-size: 15px; }
.pick-info span { font-size: 12px; color: var(--muted); }
.pick-btns { display: flex; gap: 6px; flex: none; }
body.picking .actions, body.picking .hint { display: none; }
.toast {
  position: fixed; z-index: 6; left: 50%; top: calc(70px + env(safe-area-inset-top)); transform: translateX(-50%);
  background: #fff; color: #111; font-size: 14px; font-weight: 600; padding: 9px 14px; border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.35); max-width: calc(100vw - 32px); text-align: center;
}
@media (max-width: 420px) {
  .pickbar { flex-direction: column; align-items: stretch; }
  .pick-btns .btn { flex: 1; }
}
.sq-link[hidden] { display: none; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
