:root {
  --orange: #f2a900;
  --orange-d: #d99500;
  --ink: #1c1c1e;
  --ink-2: #2c2c2e;
  --gray: #6b7280;
  --gray-l: #9ca3af;
  --line: #e5e7eb;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --wa: #25d366;
  --wa-d: #128c7e;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .12);
}

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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  overscroll-behavior: none;
}

body { display: flex; flex-direction: column; min-height: 100dvh; }

img { max-width: 100%; display: block; }

/* ── ÜST BAR ───────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--ink);
  color: #fff;
  flex-shrink: 0;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--orange), var(--orange-d));
  color: var(--ink); font-weight: 900; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: -.5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 15px; font-weight: 800; }
.brand-text span { font-size: 11px; color: var(--gray-l); }
.topbar-call {
  width: 40px; height: 40px; border-radius: 10px;
  background: rgba(255, 255, 255, .1); color: #fff;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; transition: .15s;
}
.topbar-call:active { background: rgba(255, 255, 255, .2); }

/* ── EKRAN YÖNETİMİ ────────────────────── */
.screen { display: none; flex: 1; flex-direction: column; min-height: 0; }
.screen.active { display: flex; }

/* ── BAŞLANGIÇ ─────────────────────────── */
.screen-start { align-items: center; justify-content: center; padding: 24px; text-align: center; }
.start-inner { max-width: 460px; width: 100%; }
.screen-start h1 { font-size: 30px; font-weight: 900; line-height: 1.15; letter-spacing: -.5px; }
.screen-start h1 span { color: var(--orange); }
.start-sub { margin-top: 14px; color: var(--gray); font-size: 15px; line-height: 1.55; }
.start-actions { margin-top: 28px; display: flex; flex-direction: column; gap: 12px; }
.start-steps {
  margin-top: 30px; display: flex; flex-direction: column; gap: 10px;
  text-align: left; background: var(--surface); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: 0 4px 16px rgba(0, 0, 0, .05);
}
.start-steps .step { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.step-no {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: var(--orange); color: var(--ink); font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}

/* ── BUTONLAR ──────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border: none; border-radius: 12px; cursor: pointer;
  font-family: inherit; font-weight: 700; font-size: 15px;
  padding: 13px 20px; transition: transform .1s, background .15s, box-shadow .15s;
}
.btn:active { transform: scale(.97); }
.btn-lg { padding: 16px 22px; font-size: 16px; }
.btn-primary { background: var(--orange); color: var(--ink); box-shadow: 0 6px 18px rgba(242, 169, 0, .35); }
.btn-primary:active { background: var(--orange-d); }
.btn-soft { background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); }
.btn-soft:active { background: #f0f0f0; }

/* ── EDİTÖR ────────────────────────────── */
.screen-editor { background: #111; position: relative; }
.editor-hint {
  position: absolute; top: 12px; left: 12px; right: 12px; z-index: 20;
  background: rgba(28, 28, 30, .92); color: #fff; border-radius: 12px;
  padding: 11px 14px; font-size: 13px; line-height: 1.4;
  display: flex; align-items: center; gap: 10px; backdrop-filter: blur(8px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
}
.editor-hint strong { color: var(--orange); }
.editor-hint span { flex: 1; }
.hint-close { background: rgba(255, 255, 255, .15); border: none; color: #fff; width: 26px; height: 26px; border-radius: 7px; cursor: pointer; font-size: 13px; flex-shrink: 0; }
.editor-hint.hidden { display: none; }

.canvas-stage {
  flex: 1; min-height: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 50% 40%, #2a2a2e, #111);
  overflow: hidden;
  touch-action: none;
}
#canvas { display: block; max-width: 100%; max-height: 100%; touch-action: none; }

/* ── ALT TOOLBAR ───────────────────────── */
.toolbar {
  flex-shrink: 0; background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 9px;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, .08);
}
.toolbar-row { display: flex; align-items: center; gap: 8px; }

.toolbar-led { justify-content: space-between; gap: 14px; }
.led-group { display: flex; align-items: center; gap: 8px; min-width: 0; }
.led-bright { flex: 1; }
.led-label { font-size: 11px; font-weight: 700; color: var(--gray); white-space: nowrap; text-transform: uppercase; letter-spacing: .3px; }
.led-colors { display: flex; gap: 6px; }
.led-dot {
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: .12s; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
}
.led-dot.active { border-color: var(--ink); transform: scale(1.12); }
#led-intensity { flex: 1; min-width: 0; accent-color: var(--orange); height: 24px; }

.tb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: none; border-radius: 11px; cursor: pointer;
  font-family: inherit; font-weight: 700; font-size: 14px;
  padding: 12px 14px; background: #f0f1f3; color: var(--ink);
  transition: transform .1s, background .15s; flex: 1;
}
.tb-btn:active { transform: scale(.96); }
.tb-design { background: var(--orange); color: var(--ink); flex: 2; box-shadow: 0 4px 14px rgba(242, 169, 0, .3); }
.tb-icon { flex: 0 0 auto; width: 46px; padding: 12px; }
.tb-share { font-size: 13px; padding: 11px 10px; }
.tb-wa { background: var(--wa); color: #fff; }
.tb-quote { background: var(--ink); color: #fff; }

/* ── TASARIM SEÇ PANELİ (BOTTOM SHEET) ─── */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, .5); backdrop-filter: blur(3px);
  display: none; align-items: flex-end; justify-content: center;
}
.sheet-overlay.open { display: flex; }
.sheet {
  background: var(--surface); width: 100%; max-width: 640px;
  border-radius: 20px 20px 0 0; max-height: 88dvh;
  display: flex; flex-direction: column;
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-header {
  display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line); position: relative;
}
.sheet-header h3 { flex: 1; font-size: 17px; font-weight: 800; text-align: center; }
.sheet-back, .sheet-close {
  background: #f0f1f3; border: none; cursor: pointer; border-radius: 9px;
  font-family: inherit; font-weight: 600; color: var(--ink-2);
  padding: 7px 12px; font-size: 14px;
}
.sheet-close { width: 34px; height: 34px; padding: 0; font-size: 16px; }
.sheet-search { padding: 12px 18px; }
.sheet-search input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 11px;
  padding: 12px 14px; font-family: inherit; font-size: 16px; background: var(--bg);
}
.sheet-search input:focus { outline: none; border-color: var(--orange); }
.sheet-body { flex: 1; overflow-y: auto; padding: 4px 14px 20px; -webkit-overflow-scrolling: touch; }
.sheet-loading { text-align: center; color: var(--gray); padding: 40px 0; font-weight: 600; }

.album-grid, .image-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding-top: 8px;
}
.album-card, .image-card {
  border-radius: 13px; overflow: hidden; cursor: pointer; position: relative;
  background: #e9eaec; aspect-ratio: 4 / 3; border: 2px solid transparent;
  transition: transform .1s, border-color .15s;
}
.album-card:active, .image-card:active { transform: scale(.97); }
.image-card.selected { border-color: var(--orange); }
.album-card img, .image-card img { width: 100%; height: 100%; object-fit: cover; }
.album-card .album-name {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, .8));
  color: #fff; font-size: 13px; font-weight: 700; padding: 18px 10px 9px;
}
.card-skeleton { background: linear-gradient(100deg, #e9eaec 30%, #f3f4f6 50%, #e9eaec 70%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (min-width: 520px) {
  .album-grid, .image-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── MODAL ─────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; padding: 18px;
}
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); width: 100%; max-width: 420px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-header h3 { font-size: 17px; font-weight: 800; }
.modal-close { background: #f0f1f3; border: none; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 15px; }
.modal-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.modal-note { font-size: 13px; color: var(--gray); line-height: 1.5; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field span { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.field input, .field textarea {
  border: 1.5px solid var(--line); border-radius: 10px; padding: 12px;
  font-family: inherit; font-size: 16px; background: var(--bg); resize: none;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--orange); }
.modal-footer { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }
.modal-footer .btn { flex: 1; }

/* ── TOAST ─────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 30px;
  font-size: 14px; font-weight: 600; z-index: 100; opacity: 0; pointer-events: none;
  transition: .25s; box-shadow: var(--shadow); max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── BUSY ──────────────────────────────── */
.busy { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, .35); display: none; align-items: center; justify-content: center; }
.busy.show { display: flex; }
.spinner { width: 44px; height: 44px; border: 4px solid rgba(255, 255, 255, .3); border-top-color: var(--orange); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 700px) {
  .screen-editor { background: #18181b; }
  .toolbar { max-width: 760px; margin: 0 auto; width: 100%; border-radius: 0; }
  .canvas-stage { padding: 16px; }
}
