/*
 * Sade, açık renkli bir sihirbaz: her ekranda tek adım, tek ana buton.
 * Vurgu rengi Instagram renk geçişi; çekiliş ekranı ayrı ve tam ekran.
 * Sistem karanlık moddaysa tokenlar otomatik olarak koyu temaya döner.
 */

/* ================================================================ Tokenlar */

:root {
  color-scheme: light dark;
  --bg: light-dark(#f6f6f9, #0e0e13);
  --surface: light-dark(#ffffff, #17171f);
  --surface-2: light-dark(#f1f1f6, #21212b);
  --ink: light-dark(#14141b, #f1f1f5);
  --muted: light-dark(#6b6b7b, #a0a0b2);
  --line: light-dark(#e5e5ee, #2c2c38);
  --ok: light-dark(#0b8f55, #3ddc97);
  --ok-bg: light-dark(#e9f8f0, #12271e);
  --err: light-dark(#d42a48, #ff6b85);
  --err-bg: light-dark(#fdecef, #2c1419);
  --warn-bg: light-dark(#fff6e5, #2a2312);
  --warn: light-dark(#9a6200, #f5c25b);
  /* Marka rengi: varsayılan Instagram geçişi; [data-theme] ile araç başına değişir. */
  --accent: #dd2a7b;
  --accent-rgb: 221 42 123;
  --brand: linear-gradient(120deg, #f58529 0%, #dd2a7b 45%, #8134af 75%, #515bd4 100%);
  --glow-1: #f58529;
  --glow-2: #dd2a7b;
  --glow-3: #515bd4;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(16, 16, 40, 0.04), 0 12px 32px -12px rgba(16, 16, 40, 0.14);
  --font: "Plus Jakarta Sans", "Noto Sans", "Noto Sans Arabic", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", Inter, system-ui,
    -apple-system, "Segoe UI", sans-serif;
}

/* Kullanıcının seçtiği tema (üst çubuktaki ☀/☾ butonu) cihaz ayarını geçersiz kılar;
   light-dark() renkleri color-scheme'e göre seçtiği için bu iki satır yeterli. */
:root[data-color-scheme="light"] {
  color-scheme: light;
}

:root[data-color-scheme="dark"] {
  color-scheme: dark;
}

/* ================================================================ Platform temaları */

[data-theme="facebook"] {
  --accent: #1877f2;
  --accent-rgb: 24 119 242;
  --brand: linear-gradient(120deg, #1877f2 0%, #0a5bd3 100%);
  --glow-1: #4f9bff;
  --glow-2: #1877f2;
  --glow-3: #0a5bd3;
}

[data-theme="youtube"] {
  --accent: #e62117;
  --accent-rgb: 230 33 23;
  --brand: linear-gradient(120deg, #ff4e45 0%, #e62117 55%, #b3120b 100%);
  --glow-1: #ff7a6b;
  --glow-2: #e62117;
  --glow-3: #b3120b;
}

[data-theme="multi"] {
  --accent: #8134af;
  --accent-rgb: 129 52 175;
  --brand: linear-gradient(120deg, #dd2a7b 0%, #e62117 40%, #8134af 70%, #1877f2 100%);
  --glow-1: #dd2a7b;
  --glow-2: #e62117;
  --glow-3: #1877f2;
}

[data-theme="list"] {
  --accent: #0d9488;
  --accent-rgb: 13 148 136;
  --brand: linear-gradient(120deg, #10b981 0%, #0d9488 50%, #0284c7 100%);
  --glow-1: #10b981;
  --glow-2: #0d9488;
  --glow-3: #0284c7;
}

[data-theme="image"] {
  --accent: #ea580c;
  --accent-rgb: 234 88 12;
  --brand: linear-gradient(120deg, #f59e0b 0%, #ea580c 50%, #e11d48 100%);
  --glow-1: #f59e0b;
  --glow-2: #ea580c;
  --glow-3: #e11d48;
}

/* ================================================================ Temel */

*,
*::before,
*::after {
  box-sizing: border-box;
  min-width: 0;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

h1,
h2 {
  margin: 0 0 6px;
  font-size: clamp(22px, 5vw, 28px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1:focus,
h2:focus {
  outline: none;
}

button,
input {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
}

svg {
  flex: none;
}

/* ================================================================ Butonlar */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s, background-color 0.15s;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 20px -8px rgb(var(--accent-rgb) / 0.55);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -8px rgb(var(--accent-rgb) / 0.6);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid var(--line);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--muted);
}

.btn-sm {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 13.5px;
}

/* İndirme simgesi (Excel yeşili) */
.icon-download {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--ok);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-xl {
  min-height: 60px;
  padding: 0 40px;
  border-radius: 18px;
  font-size: 18px;
}

.btn-back {
  display: block;
  margin: 14px auto 0;
  padding: 10px 14px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-back:hover {
  color: var(--ink);
}

/* ================================================================ Üst çubuk + adımlar */

.appbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 10px 20px;
  align-items: center;
  justify-content: space-between;
  padding: 12px max(16px, calc((100vw - 1160px) / 2));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  flex: none;
  gap: 10px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand-logo {
  display: block;
  flex: none;
  width: 32px;
  height: 32px;
}

/* Dil menüsü */
.lang-menu {
  position: relative;
  flex: none;
}

.lang-menu summary {
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 36px;
  padding: 0 10px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}

.lang-menu summary::-webkit-details-marker {
  display: none;
}

.lang-menu summary:hover {
  color: var(--ink);
}

.lang-menu svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.lang-menu ul {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-end: 0;
  z-index: 20;
  min-width: 150px;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  list-style: none;
}

.lang-menu a {
  display: block;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.lang-menu a:hover {
  background: var(--surface-2);
}

.lang-menu a[aria-current="page"] {
  color: var(--accent);
}

/* Ana menü: üst çubukta logo ile dil menüsü arasında; her bağlantı kendi aracının renginde ([data-theme]).
   Sığmazsa (telefon ya da uzun dil) ☰ butonuna dönüşür: .appbar.collapsed (public/js/nav.js). */
.mainnav {
  flex: 1 1 auto;
  min-width: 0;
}

.mainnav ul {
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  list-style: none;
}

.mainnav li {
  flex: none;
}

/* Sığarsa ortalı; sığmazsa taşma yalnızca sona doğru olur (nav.js ölçebilsin) */
.mainnav li:first-child {
  margin-inline-start: auto;
}

.mainnav li:last-child {
  margin-inline-end: auto;
}

.mainnav a {
  display: flex;
  gap: 7px;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.mainnav svg {
  flex: none;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mainnav a:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.mainnav a[aria-current="page"] {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 16px -8px rgb(var(--accent-rgb) / 0.7);
}

.mainnav a[aria-current="page"] svg {
  stroke: #fff;
}

/* Tema butonu: açık temada ay (koyuya geç), koyu temada güneş (açığa geç) */
.theme-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.theme-btn:hover {
  color: var(--ink);
}

.theme-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-btn .icon-sun,
:root[data-color-scheme="dark"] .theme-btn .icon-moon {
  display: none;
}

:root[data-color-scheme="dark"] .theme-btn .icon-sun {
  display: block;
}

/* ☰ butonu: yalnızca menü daraltılınca görünür */
.menu-btn {
  display: none;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: none;
  color: var(--ink);
  cursor: pointer;
}

.menu-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.menu-btn .icon-close,
.appbar.menu-open .menu-btn .icon-open {
  display: none;
}

.appbar.menu-open .menu-btn .icon-close {
  display: block;
}

.appbar.collapsed .menu-btn {
  display: grid;
}

.appbar.collapsed .lang-menu {
  margin-inline-start: auto;
}

/* Daraltılmış menü: çubuğun altında açılan panel */
.appbar.collapsed .mainnav {
  display: none;
  position: absolute;
  top: 100%;
  inset-inline: 0;
  padding: 8px 16px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  box-shadow: 0 18px 30px -18px rgba(16, 16, 40, 0.35);
}

.appbar.collapsed.menu-open .mainnav {
  display: block;
}

.appbar.collapsed .mainnav ul {
  flex-direction: column;
  gap: 4px;
  width: min(560px, 100%);
  margin: 0 auto;
}

.appbar.collapsed .mainnav li {
  margin: 0;
}

.appbar.collapsed .mainnav a {
  min-height: 46px;
  padding: 0 14px;
  border-radius: 14px;
  font-size: 15px;
}

/* Adımlar: araç sayfalarında üst çubuğun altında, ortalı */
.stepbar {
  display: flex;
  justify-content: center;
  padding: 14px 16px 0;
}

body.rec .stepbar {
  display: none;
}

/* Kullanıcı adları (@ad) Arapça sayfada da soldan sağa, bozulmadan görünür. */
/* Adların yönü içeriğinden belirlenir: "@ayse" soldan sağa, Arapça bir isim sağdan sola. */
.username,
.reel-name,
.winner-name {
  unicode-bidi: plaintext;
}

[dir="rtl"] .post-card-arrow {
  transform: scaleX(-1);
}

.stepper {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stepper li {
  display: flex;
  align-items: center;
}

/* Adımlar arası bağlantı çizgisi */
.stepper li + li::before {
  content: "";
  width: clamp(10px, 3vw, 28px);
  height: 2px;
  margin: 0 4px;
  border-radius: 2px;
  background: var(--line);
}

.stepper li.done + li::before {
  background: var(--accent);
}

.stepper button {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.stepper button:disabled {
  cursor: default;
}

.stepper .dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 700;
}

.stepper li.current button {
  color: var(--ink);
}

.stepper li.current .dot,
.stepper li.done .dot {
  background: var(--brand);
  color: #fff;
}

.stepper li.done .dot {
  font-size: 0;
}

.stepper li.done .dot::after {
  content: "✓";
  font-size: 14px;
}

/* Dar ekranda yalnızca etkin adımın adı görünür. */
@media (max-width: 640px) {
  .stepper li:not(.current) .label {
    display: none;
  }
}

/* ================================================================ Sihirbaz */

.hero {
  margin: 8px 0 22px;
  text-align: center;
}

.hero h1 {
  margin: 0 0 8px;
  background: var(--brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: clamp(30px, 8vw, 44px);
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

/* 1. adım: "Instagram'a bağlan" / "Listeyi yapıştır" */
.source-tabs {
  margin-bottom: 20px;
}

.card:has(input[name="source"][value="token"]:checked) [data-source="paste"],
.card:has(input[name="source"][value="paste"]:checked) [data-source="token"] {
  display: none;
}

.help.center {
  margin-top: 12px;
  text-align: center;
}

/* Çoklu gönderi: sekmeler, paneller, eklenen kaynaklar */
.multi-tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.multi-panel {
  margin-bottom: 18px;
  padding: 16px;
  border: 1.5px dashed var(--line);
  border-radius: 16px;
}

.multi-panel > .lead {
  margin-bottom: 14px;
  font-size: 14px;
}

.multi-added {
  margin-bottom: 18px;
}

.multi-added .post-card {
  margin-bottom: 8px;
}

/* Kaynak kartlarında platform rengi (çoklu çekilişte hangi kaynak nereden belli olsun) */
.post-card[data-platform="instagram"] .avatar {
  background: linear-gradient(120deg, #f58529, #dd2a7b 50%, #515bd4);
}

.post-card[data-platform="youtube"] .avatar {
  background: linear-gradient(120deg, #ff4e45, #b3120b);
}

.post-card[data-platform="facebook"] .avatar {
  background: linear-gradient(120deg, #1877f2, #0a5bd3);
}

.post-card[data-platform="list"] .avatar {
  background: linear-gradient(120deg, #10b981, #0284c7);
}

/* Facebook: gönderi seçme listesi */
.post-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.post-item {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.post-item:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.post-item img {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
}

.post-item-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  color: var(--muted);
  font-size: 12.5px;
}

.post-item-text b {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* "Instagram ile giriş yap" */
.btn-brand {
  gap: 10px;
  min-height: 54px;
  background: var(--brand);
  color: #fff;
  font-size: 16px;
  text-decoration: none;
  box-shadow: 0 8px 20px -8px rgb(var(--accent-rgb) / 0.55);
}

.btn-brand:hover {
  transform: translateY(-1px);
}

.btn-brand svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.ig-login .help {
  margin-top: 10px;
}

/* "veya" ayırıcısı */
.or {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 18px 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.or::before,
.or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* Bağlı hesap kartı */
.ig-connected {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 2px solid transparent;
  border-radius: 16px;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--brand) border-box;
}

.ig-connected-text {
  flex: 1;
  color: var(--muted);
  font-size: 14px;
}

.ig-connected-text b {
  color: var(--ink);
  font-size: 15px;
}

.link-btn {
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--err);
  background: var(--err-bg);
}

/* "Token'ı elle gir": giriş açıkken açılır bölüm, kapalıyken başlıksız düz alan */
.manual > summary {
  display: none;
}

.manual.collapsible {
  margin-bottom: 16px;
}

.manual.collapsible > summary {
  display: block;
  padding: 10px 0;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  list-style: none;
}

.manual.collapsible > summary::-webkit-details-marker {
  display: none;
}

.manual.collapsible[open] > summary {
  margin-bottom: 8px;
}

/* Alt bilgi */
.site-footer {
  padding: 8px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.site-footer a {
  color: inherit;
}

.wizard {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.view {
  animation: view-in 0.3s ease-out;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.card {
  padding: clamp(20px, 5vw, 32px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.lead {
  margin: 0 0 22px;
  color: var(--muted);
}

.footnote {
  margin: 14px 8px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.stack {
  display: grid;
  gap: 10px;
}

/* ================================================================ Form alanları */

.field {
  margin-bottom: 16px;
}

label,
.label {
  display: block;
  margin-bottom: 6px;
  font-size: 13.5px;
  font-weight: 700;
}

.optional {
  margin-inline-start: 4px;
  color: var(--muted);
  font-weight: 500;
}

.help {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

select,
textarea,
input[type="text"],
input[type="url"],
input[type="password"],
input[type="number"],
input[type="datetime-local"] {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 16px; /* iOS'ta odaklanınca yakınlaştırmayı önler */
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

textarea {
  display: block;
  resize: vertical;
  min-height: 160px;
  font: 14px/1.5 ui-monospace, "Cascadia Mono", Menlo, monospace;
}

textarea:focus,
input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}

input::placeholder {
  color: color-mix(in srgb, var(--muted) 70%, transparent);
}

/* Simgeli giriş alanı */
.input-wrap {
  position: relative;
}

.input-wrap input {
  padding-inline-start: 44px;
}

.input-wrap .input-icon {
  position: absolute;
  top: 50%;
  inset-inline-start: 14px;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.input-wrap input#token {
  padding-inline-end: 84px;
}

.reveal {
  position: absolute;
  top: 50%;
  inset-inline-end: 6px;
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  transform: translateY(-50%);
  cursor: pointer;
}

.reveal:hover {
  color: var(--ink);
}

/* "Token nasıl alınır?" rehberi */
.guide {
  margin-top: 10px;
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 13.5px;
}

.guide summary {
  padding: 12px 14px;
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

.guide ol {
  margin: 0;
  padding-block: 0;
  padding-inline: 34px 14px;
}

.guide li {
  margin-bottom: 8px;
}

.guide a {
  color: var(--accent);
  font-weight: 600;
}

.guide code {
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--surface);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.guide-tabs {
  margin: 0 14px 12px;
}

.guide-panel > .help {
  margin: 0 14px 10px;
}

/* Seçili sekmenin rehberi görünür */
.guide:has(input[value="facebook"]:checked) [data-guide="instagram"],
.guide:has(input[value="instagram"]:checked) [data-guide="facebook"] {
  display: none;
}

.guide-foot {
  margin: 0;
  padding: 4px 14px 14px;
}

#tokenHint[data-kind="facebook"],
#tokenHint[data-kind="instagram"] {
  color: var(--ok);
  font-weight: 600;
}

/* Durum mesajı */
.alert {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.alert[data-kind="ok"] {
  background: var(--ok-bg);
  color: var(--ok);
}

.alert[data-kind="error"] {
  background: var(--err-bg);
  color: var(--err);
}

/* ================================================================ 2. adım: gönderi kartı ve ilerleme */

.post-card {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface-2);
  color: inherit;
  text-decoration: none;
}

.post-card-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  color: var(--muted);
  font-size: 13px;
}

.post-card-text b {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.post-card-arrow {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
}

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.progress {
  margin-bottom: 18px;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
}

.progress-row b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 0.3s ease-out;
}

/* ================================================================ 3. adım: kurallar */

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 22px;
  padding: 16px 18px;
  border: 2px solid transparent;
  border-radius: 16px;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--brand) border-box;
}

.summary-main {
  font-size: 15px;
  font-weight: 600;
}

.summary-main b {
  display: block;
  background: var(--brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.summary-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

/* Sayı seçiciler: [−] 1 [+] */
.counters {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.counter {
  flex: 1 1 0;
  min-width: 0;
}

/* Araç desteklemediği kural ayarlarını gizler (bkz. public/js/tools.js). */
[data-rule][hidden] {
  display: none !important;
}

/* Uzun etiketler (bazı dillerde) iki satıra sarılır; kutular yine aynı hizada kalır. */
.counter label {
  font-size: 13px;
  line-height: 1.25;
}

.counter-box {
  display: flex;
  align-items: center;
  height: 50px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  overflow: hidden;
}

.counter-box:focus-within {
  border-color: var(--accent);
}

.counter-box button {
  flex: none;
  width: 38px;
  height: 100%;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
}

.counter-box button:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 5%, transparent);
}

.counter-box input[type="number"] {
  width: 100%;
  min-height: 0;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  font-weight: 700;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.counter-box input::-webkit-outer-spin-button,
.counter-box input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Gelişmiş ayarlar (açılır) */
.advanced {
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.advanced summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.advanced summary::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-3px);
  transition: transform 0.2s;
}

.advanced[open] summary::after {
  transform: rotate(-135deg) translateY(-3px);
}

/* Bölünmüş seçim (segmented control) */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-2);
}

.segmented label {
  margin: 0;
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 6px 8px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
  transition: background-color 0.15s, color 0.15s;
}

.segmented input:checked + span {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.segmented input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
}

/* Aç / kapa anahtarı */
.toggle {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  font-weight: 600;
  cursor: pointer;
}

.toggle input {
  position: relative;
  flex: none;
  width: 46px;
  height: 28px;
  margin: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 45%, transparent);
  appearance: none;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle input::after {
  content: "";
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s;
}

.toggle input:checked {
  background: var(--brand);
}

.toggle input:checked::after {
  transform: translateX(18px);
}

[dir="rtl"] .toggle input:checked::after {
  transform: translateX(-18px);
}

/* Uyarı kutusu */
.callout {
  display: flex;
  gap: 12px;
  margin: 8px 0 20px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 13.5px;
  font-weight: 500;
}

.callout svg {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.callout p {
  margin: 0;
}

/* ================================================================ 4. adım: çekiliş ekranı */

.stage {
  position: relative;
  min-height: calc(100dvh - 120px);
  padding: clamp(24px, 5vw, 56px) 16px 40px;
  overflow: hidden;
  /* Köşelerde yumuşak Instagram renkleri */
  background:
    radial-gradient(40rem 28rem at 0% 0%, color-mix(in srgb, var(--glow-1) 16%, transparent), transparent 70%),
    radial-gradient(36rem 30rem at 100% 10%, color-mix(in srgb, var(--glow-2) 14%, transparent), transparent 70%),
    radial-gradient(40rem 30rem at 50% 110%, color-mix(in srgb, var(--glow-3) 14%, transparent), transparent 70%),
    var(--bg);
}

#confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

.stage-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  width: min(880px, 100%);
  margin: 0 auto;
  text-align: center;
}

.stage-head h2 {
  margin: 10px 0 4px;
  font-size: clamp(30px, 6vw, 56px);
  overflow-wrap: anywhere;
}

.chip {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 700;
}

.chip:empty {
  display: none;
}

/* Dönen isim penceresi: renk geçişli çerçeveli büyük kart */
.reel {
  display: grid;
  place-items: center;
  width: 100%;
  height: clamp(120px, 20vw, 190px);
  border: 3px solid transparent;
  border-radius: 28px;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--brand) border-box;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.reel-name {
  max-width: 94%;
  padding: 0 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: clamp(28px, 7vw, 68px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.reel-name.idle {
  background: none;
  color: var(--muted);
  font-size: clamp(16px, 2.6vw, 22px);
  font-weight: 600;
  letter-spacing: 0;
}

.reel.hit {
  animation: hit 0.6s ease-out;
}

@keyframes hit {
  35% {
    transform: scale(1.03);
    box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 22%, transparent), var(--shadow);
  }
}

.stage-count {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}

.stage-count b {
  color: var(--ink);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

/* Kazanan kartları */
.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: 12px;
  width: 100%;
  text-align: start;
}

.results:empty {
  display: none;
}

.winner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: view-in 0.4s ease-out both;
}

.winner.main {
  border: 2px solid transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--brand) border-box;
}

.winner.backup .avatar {
  background: var(--surface-2);
  color: var(--muted);
}

.winner-body {
  flex: 1;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.winner.backup .badge {
  background: var(--surface-2);
  color: var(--muted);
}

.winner-name {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
}

a.winner-name:hover {
  text-decoration: underline;
}

.winner p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.proof {
  max-width: 640px;
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}

.proof:empty {
  display: none;
}

.stage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

/* ================================================================ Kayıt modu */

.exit {
  display: none;
  position: fixed;
  inset-inline-end: 12px;
  bottom: 12px;
  z-index: 30;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 12%, transparent);
  color: var(--ink);
  font-size: 12px;
  opacity: 0.4;
  cursor: pointer;
}

.exit:hover,
.exit:focus-visible {
  opacity: 1;
}

body.rec .appbar,
body.rec .stage-actions {
  display: none;
}

body.rec .exit {
  display: block;
}

/* Sahne tüm ekranı kaplar; dikey ve yatay ekranda ortalanır, taşarsa içeride kayar. */
body.rec .stage {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: safe center;
  min-height: 0;
  height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  overflow-y: auto;
}

/* Dikey telefon (ekran kaydı): daha büyük isim penceresi */
@media (orientation: portrait) {
  body.rec .reel {
    height: clamp(140px, 34vw, 220px);
  }

  body.rec .reel-name {
    font-size: clamp(30px, 10vw, 72px);
  }
}

/* Yatay telefon: alçak ekrana sığdır */
@media (orientation: landscape) and (max-height: 520px) {
  body.rec .stage-inner {
    gap: 12px;
  }

  body.rec .stage-head h2 {
    margin: 4px 0 0;
    font-size: 26px;
  }

  body.rec .reel {
    height: 96px;
  }

  body.rec .btn-xl {
    min-height: 48px;
  }
}

/* ================================================================ Küçük ekranlar */

@media (max-width: 480px) {
  .counters {
    gap: 8px;
  }

  .counter-box button {
    width: 32px;
  }

  .btn-xl {
    width: 100%;
  }
}

/* ================================================================ Telefon: kazananlar kaydırmadan görünsün */

@media (max-width: 600px) {
  .appbar {
    padding: 10px 16px;
  }

  .stepbar {
    padding-top: 10px;
  }

  /* Çekiliş başlayınca: küçük isim penceresi, hemen altında kazananlar,
     sayaç ve butonlar en altta. */
  .stage.has-results {
    padding-top: 16px;
  }

  .stage.has-results .stage-inner {
    gap: 12px;
  }

  .stage.has-results .proof {
    order: 1;
  }

  .stage.has-results .stage-count,
  .stage.has-results #drawBtn {
    order: 2;
  }

  .stage.has-results .stage-actions {
    order: 3;
  }

  .stage.has-results .stage-head h2 {
    margin: 6px 0 0;
    font-size: 24px;
  }

  .stage.has-results .reel {
    height: 84px;
    border-radius: 20px;
  }

  .stage.has-results .reel-name {
    font-size: 30px;
  }

  /* Kompakt kazanan kartları: iki sütun, yorum metni yok */
  .stage.has-results .results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .stage.has-results .winner {
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: 14px;
  }

  .stage.has-results .winner .avatar {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }

  .stage.has-results .winner p {
    display: none;
  }

  .stage.has-results .winner-name {
    margin-top: 2px;
    font-size: 14px;
  }

  .stage.has-results .badge {
    padding: 1px 8px;
    font-size: 11px;
  }
}

/* ================================================================ Bilgi bölümleri (SEO) */

.about {
  display: grid;
  gap: 36px;
  margin-top: 48px;
}

.about h2 {
  margin-bottom: 14px;
  font-size: 22px;
}

.how {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: how;
}

.how li {
  position: relative;
  padding-block: 14px;
  padding-inline: 56px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--muted);
  counter-increment: how;
}

.how li::before {
  content: counter(how);
  position: absolute;
  top: 14px;
  inset-inline-start: 16px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.how b {
  color: var(--ink);
}

.features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.features li {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13.5px;
}

.features b {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 15px;
}

.faq {
  border-bottom: 1px solid var(--line);
}

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  flex: none;
  color: var(--muted);
  font-size: 20px;
  font-weight: 500;
}

.faq[open] summary::after {
  content: "−";
}

.faq p {
  margin: 0 0 14px;
  color: var(--muted);
}

@media (max-width: 480px) {
  .features {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Listeyle gelindiğinde 2. adım atlanmış görünür */
.stepper li.skipped .dot {
  background: var(--surface-2);
  color: var(--muted);
  text-decoration: line-through;
}

/* ================================================================ Çekiliş görseli oluşturucu */

.image-page {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.image-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

@media (min-width: 900px) {
  .image-editor {
    grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  }

  .image-preview {
    position: sticky;
    top: 84px;
  }
}

/* Görsel metinleri yazılıyor: yapıştırma kutularındaki eş aralıklı yazı yerine normal yazı tipi */
.image-form textarea {
  min-height: 0;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
}

.image-preview {
  display: grid;
  gap: 14px;
}

.image-preview canvas {
  display: block;
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: var(--shadow);
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.swatches label {
  margin: 0;
  cursor: pointer;
}

.swatches input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.swatches span {
  display: block;
  width: 40px;
  height: 40px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px var(--line);
}

.swatches input:checked + span {
  box-shadow: 0 0 0 3px var(--ink);
}

.swatches input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 3px;
}

[data-swatch="instagram"] { background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af, #515bd4); }
[data-swatch="youtube"] { background: linear-gradient(135deg, #ff6a5f, #e62117, #8f0d07); }
[data-swatch="facebook"] { background: linear-gradient(135deg, #4f9bff, #1877f2, #0a4fb8); }
[data-swatch="green"] { background: linear-gradient(135deg, #10b981, #0d9488, #0369a1); }
[data-swatch="sunset"] { background: linear-gradient(135deg, #fbbf24, #ea580c, #be123c); }
[data-swatch="dark"] { background: linear-gradient(135deg, #374151, #111827, #030712); }

.photo-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.photo-row input[type="file"] {
  flex: 1;
  min-width: 0;
  font-size: 14px;
}

/* ================================================================ Ana sayfa */

.home {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.home-tools h2 {
  margin-bottom: 16px;
  font-size: 22px;
  text-align: center;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 14px;
}

.tool-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s, border-color 0.15s;
}

.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.tool-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--brand);
}

.tool-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--muted);
  font-size: 13.5px;
}

.tool-text b {
  color: var(--ink);
  font-size: 16px;
}

/* Alt bilgi: tüm araçlara bağlantılar */
.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  justify-content: center;
  margin: 0;
  padding: 8px 0 0;
  list-style: none;
}

/* ================================================================ Geliştirici imzası

   Goose Trouble Studio marka kılavuzu: yatay ana logo koyu zemin için çizilmiştir; bu yüzden
   şerit açık ve koyu temada da Midnight Black zemin, Goose Cream metin, Trouble Orange vurgu. */

.studio {
  margin-top: 8px;
  border-top: 2px solid #d35400;
  background: #0d0d0f;
  color: #fff4e6;
}

.studio-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 32px;
  align-items: center;
  justify-content: space-between;
  width: min(1160px, 100%);
  margin: 0 auto;
  padding: 26px 16px calc(26px + env(safe-area-inset-bottom));
}

.studio-logo {
  display: block;
  width: auto;
  height: 40px;
}

.studio-text {
  margin: 0;
  color: rgb(255 244 230 / 0.7);
  font-size: 13px;
  line-height: 1.6;
  text-align: end;
}

@media (max-width: 600px) {
  .studio-inner {
    flex-direction: column;
  }

  .studio-logo {
    height: 34px;
  }

  .studio-text {
    text-align: center;
  }
}

body.rec .studio {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
