/* ==========================================================
   Load N Stuff - styles
   Everything is Comic Sans EXCEPT the download button (.sketchy-btn).
   Colors / font live in :root so you can tweak them in one place.
   ========================================================== */
:root {
  --bg1: #14073a;
  --bg2: #0a2a66;
  --ink: #ffffff;
  --yellow: #ffe600;
  --lime: #7dff3b;
  --pink: #ff4fd8;
  --cyan: #3ff3ff;
  --red: #ff4d4d;
  --comic: "Comic Sans MS", "Comic Sans", "Comic Neue", "Chalkboard SE", cursive, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { font-family: var(--comic); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--comic);
  font-size: 17px;
  line-height: 1.45;
  background-color: var(--bg1);
  /* PHOTO SLOT 3: page background -> put static/img/bg.jpg (silently ignored if missing) */
  /* --bg-img is set by the admin panel (background photo); falls back to static/img/bg.jpg */
  background-image:
    var(--bg-img, url("/static/img/bg.jpg")),
    radial-gradient(rgba(255,255,255,.18) 1px, transparent 1.6px),
    linear-gradient(160deg, var(--bg1), var(--bg2));
  background-size: cover, 28px 28px, auto;
  background-attachment: fixed, scroll, fixed;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: var(--cyan); }

/* ---------- ticker ---------- */
.ticker { overflow: hidden; white-space: nowrap; background: #000; border-bottom: 3px solid var(--yellow); color: var(--lime); }
.ticker-track { display: inline-block; padding: 6px 0; animation: scroll 40s linear infinite; }
.ticker-track span { padding-right: 3rem; }
@keyframes scroll { to { transform: translateX(-50%); } }

/* ---------- header ---------- */
.top { text-align: center; padding: 1.4rem 1rem .4rem; position: relative; }
.langsw { position: absolute; top: .5rem; right: .7rem; display: flex; gap: .25rem; z-index: 2; }
.langsw a {
  padding: .1rem .55rem; border: 2px dashed var(--cyan); border-radius: 999px;
  text-decoration: none; color: var(--cyan); font-weight: bold; font-size: .8rem;
}
.langsw a:hover { background: var(--cyan); color: #000; }
.langsw a.on { background: var(--yellow); border-color: var(--yellow); color: #000; }
@media (max-width: 560px) { .top { padding-top: 2.4rem; } }
.logo { display: block; max-height: 110px; margin: 0 auto .4rem; }
.title {
  margin: 0;
  font-size: clamp(2.6rem, 10vw, 4.8rem);
  line-height: 1.05;
  background: linear-gradient(90deg, #ff3b3b, #ffe600, #7dff3b, #3ff3ff, #ff4fd8, #ff3b3b);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  filter: drop-shadow(3px 3px 0 #000);
  animation: rainbow 5s linear infinite;
}
.title:hover { animation: rainbow 1.2s linear infinite, wiggle .3s linear infinite; }
@keyframes rainbow { to { background-position: 200% center; } }
@keyframes wiggle { 0%,100% { rotate: -1.5deg; } 50% { rotate: 1.5deg; } }
.tagline { margin: .2rem 0 .8rem; color: var(--yellow); font-weight: bold; }
.nav { display: flex; justify-content: center; gap: .6rem; flex-wrap: wrap; }
.nav a {
  padding: .25rem .9rem; border: 2px dashed var(--cyan); border-radius: 999px;
  text-decoration: none; color: var(--cyan); font-weight: bold;
}
.nav a:hover { background: var(--cyan); color: #000; }
.nav a.active { background: var(--yellow); border-color: var(--yellow); color: #000; }

/* ---------- layout ---------- */
.wrap { max-width: 780px; margin: 1rem auto 2rem; padding: 0 1rem; }
.panel {
  background: rgba(10, 4, 35, .84);
  border: 3px dashed var(--yellow);
  border-radius: 14px;
  padding: 1.2rem 1.2rem 1.6rem;
  box-shadow: 0 0 0 4px #000, 0 0 28px rgba(255, 230, 0, .25);
}
h2 { margin: 1rem 0 .5rem; font-size: 1.25rem; color: var(--yellow); }
h2:first-child { margin-top: 0; }
h3 { margin: 0 0 .25rem; font-size: 1.1rem; word-break: break-word; }
.sites { margin: .6rem 0 .2rem; font-size: .9rem; color: #cfd8ff; }
.legal { text-align: center; font-size: .8rem; color: #9fb0ff; margin-top: 1rem; }

/* ---------- inputs ---------- */
input[type="text"] {
  width: 100%; padding: .7rem .9rem;
  border: 3px solid var(--cyan); border-radius: 10px;
  background: #fff; color: #111;
  outline: none;
}
input[type="text"]:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(255,230,0,.35); }
.shake { animation: shake .4s linear; }
@keyframes shake { 20% { translate: -8px 0; } 40% { translate: 8px 0; } 60% { translate: -6px 0; } 80% { translate: 6px 0; } }

.status { min-height: 1.4em; margin-top: .4rem; font-weight: bold; }
.status.info { color: var(--cyan); }
.status.ok { color: var(--lime); }
.status.error { color: var(--red); }

/* ---------- result card ---------- */
.result { display: flex; gap: 1rem; align-items: center; margin-top: .8rem; padding: .7rem; border: 2px solid rgba(255,255,255,.25); border-radius: 10px; background: rgba(255,255,255,.05); }
.result img { width: 160px; max-width: 38%; aspect-ratio: 16 / 9; object-fit: cover; border: 3px solid #fff; border-radius: 6px; rotate: -1.5deg; background: #000; }
.result p { margin: 0; font-size: .9rem; color: #cfd8ff; }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  cursor: pointer; padding: .4rem .9rem;
  color: #fff; background: rgba(255,255,255,.08);
  border: 2px dashed #fff; border-radius: 10px; font-weight: bold;
}
.chip:hover { background: rgba(255,255,255,.2); }
.chip.on { background: var(--yellow); color: #000; border-style: solid; border-color: var(--yellow); rotate: -2deg; }
.chip.audio.on { background: var(--pink); border-color: var(--pink); }
.chip.gif.on { background: var(--yellow, #ffd23f); border-color: var(--yellow, #ffd23f); color: #111; }

/* ---------- album picker (Erome) ---------- */
.album-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.album-bar span { margin-right: auto; font-weight: bold; color: var(--cyan); }
.album-bar .chip { padding: .2rem .7rem; font-size: .85rem; }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: .5rem; max-height: 22rem; overflow-y: auto; padding: .2rem; }
.tile { position: relative; display: block; cursor: pointer; aspect-ratio: 1; border: 3px dashed rgba(255,255,255,.5); border-radius: 8px; overflow: hidden; background: #0b0b24; }
.tile input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2rem; }
.tile .badge { position: absolute; left: 4px; bottom: 4px; padding: 0 .4rem; font-size: .7rem; font-weight: bold; color: #000; background: var(--cyan); border-radius: 4px; }
.tile .num { position: absolute; right: 4px; top: 4px; padding: 0 .35rem; font-size: .7rem; font-weight: bold; color: #fff; background: rgba(0,0,0,.65); border-radius: 4px; }
.tile.on { border: 3px solid var(--yellow); box-shadow: 0 0 10px var(--yellow); rotate: -1deg; }
.tile:focus-within { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ---------- THE sketchy download button ---------- */
.dl-zone {
  position: relative;
  display: flex; justify-content: center; align-items: center;
  min-height: 240px; margin-top: .2rem;
}
.sketchy-btn {
  position: relative; z-index: 2; cursor: pointer;
  min-width: min(78vw, 390px);
  padding: .55em 1.1em .5em;
  color: #fff;
  font-family: Impact, "Arial Black", Haettenschweiler, Arial, sans-serif;  /* NOT comic sans, on purpose */
  text-transform: uppercase; letter-spacing: .04em;
  border: 4px solid #0b5c00; border-radius: 12px;
  background: linear-gradient(#a6ff5e 0%, #3cc800 48%, #1f9a00 52%, #157a00 100%);
  box-shadow:
    inset 0 3px 0 rgba(255,255,255,.75),
    inset 0 -4px 0 rgba(0,0,0,.25),
    0 0 0 4px #fff200,
    0 9px 0 4px #8a6d00,
    0 0 34px 10px rgba(125,255,59,.65);
  text-shadow: 0 3px 0 #064000, 0 0 12px rgba(0,0,0,.4);
  animation: throb 1.1s ease-in-out infinite;
}
.sketchy-btn .big { display: block; font-size: clamp(2.3rem, 10vw, 3.5rem); line-height: 1; font-weight: 400; }
.sketchy-btn .sub {
  display: block; margin-top: .4em;
  font-family: Arial, Helvetica, sans-serif; font-weight: 900; font-size: .78rem; letter-spacing: .08em;
  color: #fff200; text-shadow: 1px 1px 0 #000;
}
.sketchy-btn:hover { filter: brightness(1.12); animation: jitter .3s linear infinite; }
.sketchy-btn:active { animation: none; transform: translateY(7px); box-shadow: inset 0 3px 0 rgba(255,255,255,.5), 0 0 0 4px #fff200, 0 2px 0 4px #8a6d00, 0 0 34px 10px rgba(125,255,59,.65); }
.sketchy-btn:disabled { animation: none; filter: grayscale(.85) brightness(.8); cursor: progress; }
@keyframes throb { 0%,100% { transform: scale(1); } 50% { transform: scale(1.045); } }
@keyframes jitter { 0%,100% { transform: scale(1.06) rotate(-1.2deg); } 50% { transform: scale(1.06) rotate(1.2deg); } }

/* glowing arrows. --rot decides the direction; the nudge moves them toward the button */
.arrow {
  position: absolute; z-index: 1; width: 62px; height: 62px;
  fill: #fff200; stroke: #ff2a00; stroke-width: 5; stroke-linejoin: round;
  filter: drop-shadow(0 0 6px #fff200) drop-shadow(0 0 16px #ff8c00);
  animation: nudge .7s ease-in-out infinite, blink 1.4s steps(1) infinite;
}
.ar-l1 { --rot: 0deg;   left: 1%;  top: 14%; }
.ar-l2 { --rot: 0deg;   left: 1%;  bottom: 14%; animation-delay: .25s; }
.ar-r1 { --rot: 180deg; right: 1%; top: 14%;    animation-delay: .1s; }
.ar-r2 { --rot: 180deg; right: 1%; bottom: 14%; animation-delay: .35s; }
.ar-t  { --rot: 90deg;  left: calc(50% - 31px); top: -6px; }
.ar-b  { --rot: -90deg; left: calc(50% - 31px); bottom: -6px; animation-delay: .2s; }
@keyframes nudge {
  0%,100% { transform: rotate(var(--rot)) translateX(0); }
  50%     { transform: rotate(var(--rot)) translateX(14px); }
}
@keyframes blink { 0%,60% { opacity: 1; } 61%,100% { opacity: .3; } }

/* starburst badge */
.burst {
  position: absolute; z-index: 3; top: 6px; right: 8%;
  width: 88px; height: 88px; display: grid; place-items: center;
  rotate: 14deg; animation: spin 6s linear infinite;
  font: 400 1.25rem Impact, "Arial Black", Arial, sans-serif; color: #d40000;
}
.burst span { position: relative; z-index: 1; }
html[lang="tr"] .burst { font-size: .98rem; }       /* "BEDAVA!!" is longer than "FREE!!" */
.burst::before, .burst::after { content: ""; position: absolute; inset: 10px; background: var(--yellow); border: 3px solid #d40000; }
.burst::after { rotate: 45deg; }
@keyframes spin { to { rotate: 374deg; } }

.fine { margin: .2rem 0 0; text-align: center; font-size: .65rem; color: #8896d6; }

/* ---------- progress ---------- */
.progress { margin-top: 1rem; }
.bar { position: relative; height: 36px; border: 3px solid #fff; border-radius: 6px; background: #000; overflow: hidden; }
.bar-fill {
  height: 100%; width: 0%;
  background: repeating-linear-gradient(45deg, #7dff3b 0 14px, #4fd11a 14px 28px);
  background-size: 40px 40px;
  animation: stripes 1s linear infinite;
  transition: width .4s ease;
}
.bar-fill.err { background: repeating-linear-gradient(45deg, #ff4d4d 0 14px, #c92b2b 14px 28px); }
.bar span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: bold; text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000; }
@keyframes stripes { to { background-position: 40px 0; } }
.quip { margin: .5rem 0 0; text-align: center; color: var(--yellow); }
.save-link { display: block; margin-top: .3rem; text-align: center; font-weight: bold; }

/* ---------- footer ---------- */
.foot { text-align: center; padding: 1rem 1rem 5rem; display: grid; gap: .6rem; justify-items: center; color: #cfd8ff; }
.counter { padding: 2px 8px; letter-spacing: .25em; color: #3f3; background: #000; border: 2px inset #888; }
.seal {
  cursor: pointer; color: #000; font-weight: bold;
  padding: .35rem 1rem; border: 3px double #b8860b; border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #fff6a8, #ffd000 60%, #d49b00);
  rotate: -3deg;
}
.seal:hover { rotate: 3deg; }
.small { font-size: .8rem; color: #8896d6; }

.mascot { position: fixed; right: 10px; bottom: 10px; width: 120px; pointer-events: none; z-index: 5; }
.admin-link { font-size: .72rem; color: #6d7bbd; opacity: .7; }
.admin-link:hover { opacity: 1; }

/* ---------- custom blocks (added in the admin panel) ---------- */
.blocks { display: grid; gap: 1rem; margin-top: 1rem; }
.blocks:empty { display: none; }
.block {
  padding: 1rem 1.2rem; text-align: center;
  background: rgba(10, 4, 35, .84); border: 3px dashed var(--pink); border-radius: 14px;
  box-shadow: 0 0 0 4px #000;
}
.block h2 { margin-top: 0; }
.block p { margin: .4rem 0; }
.block img { max-width: 100%; height: auto; border: 3px solid #fff; border-radius: 8px; }
.block .caption { font-size: .85rem; color: #cfd8ff; }
a.btn { display: inline-block; text-decoration: none; margin-top: .4rem; }

/* ---------- trim + crop box ---------- */
.editbox { margin-top: .4rem; }
.check.toggle { display: flex; align-items: center; gap: .6rem; cursor: pointer; font-weight: bold; }
.check.toggle input { width: 20px; height: 20px; accent-color: var(--pink); }
.editpanel { margin-top: .8rem; padding: .9rem; border: 2px dashed var(--pink); border-radius: 12px; background: rgba(255, 79, 216, .06); }
.edit-title { margin: 0 0 .5rem; font-weight: bold; color: var(--cyan); }
#cropWrap { margin-bottom: 1rem; }

.crop-stage {
  --ar: 1.7778;
  position: relative; margin: 0 auto; overflow: hidden; user-select: none; touch-action: none;
  width: min(100%, calc(380px * var(--ar)));
  aspect-ratio: var(--ar);
  border: 3px solid #fff; border-radius: 6px; background: #000;
}
.crop-stage > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.crop-box {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  border: 2px solid var(--yellow); cursor: move; touch-action: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .6);
  background-image:
    linear-gradient(rgba(255,255,255,.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.35) 1px, transparent 1px);
  background-size: 100% 33.333%, 33.333% 100%;
}
.crop-box .h { position: absolute; width: 16px; height: 16px; background: var(--yellow); border: 2px solid #000; border-radius: 3px; }
.crop-box .nw { left: -9px; top: -9px; cursor: nwse-resize; }
.crop-box .ne { right: -9px; top: -9px; cursor: nesw-resize; }
.crop-box .sw { left: -9px; bottom: -9px; cursor: nesw-resize; }
.crop-box .se { right: -9px; bottom: -9px; cursor: nwse-resize; }
.crop-box .n  { left: calc(50% - 8px); top: -9px; cursor: ns-resize; }
.crop-box .s  { left: calc(50% - 8px); bottom: -9px; cursor: ns-resize; }
.crop-box .w  { left: -9px; top: calc(50% - 8px); cursor: ew-resize; }
.crop-box .e  { right: -9px; top: calc(50% - 8px); cursor: ew-resize; }
.crop-stage.locked .crop-box .n, .crop-stage.locked .crop-box .s,
.crop-stage.locked .crop-box .w, .crop-stage.locked .crop-box .e { display: none; }
.crop-loading { position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 6px; background: rgba(0,0,0,.75); font-size: .8rem; }
.editpanel .presets { justify-content: center; margin-top: .7rem; }
.editpanel .small { margin: .4rem 0 0; color: #cfd8ff; font-size: .8rem; }

.trim-row { display: flex; align-items: center; gap: .6rem; margin: .3rem 0; }
.trim-name { width: 3.2rem; font-weight: bold; }
html[lang="tr"] .trim-name { width: 5.6rem; }       /* "Başlangıç" is longer than "Start" */
.trim-row input[type="range"] { flex: 1; min-width: 0; accent-color: var(--lime); }
input.time { width: 6.2rem; padding: .3rem .4rem; text-align: center; border: 2px solid var(--cyan); border-radius: 8px; background: #fff; color: #111; }

/* ---------- stretch page ---------- */
.drop {
  display: grid; place-items: center; text-align: center; cursor: pointer;
  min-height: 130px; padding: 1rem;
  border: 3px dashed var(--cyan); border-radius: 12px; background: rgba(63, 243, 255, .06);
  font-weight: bold;
}
.drop:hover, .drop.over { background: rgba(63, 243, 255, .18); border-color: var(--yellow); }
.stage {
  display: flex; justify-content: center; align-items: center;
  margin-top: 1rem; padding: .8rem; overflow: auto;
  border: 3px solid #fff; border-radius: 10px;
  background: repeating-conic-gradient(#2b2b44 0% 25%, #1c1c30 0% 50%) 50% / 24px 24px;
}
.stage img, .stage video { display: block; max-width: none; object-fit: fill; background: #000; }
.controls { display: grid; gap: .8rem; margin-top: 1rem; }
.controls label { display: block; font-weight: bold; }
.controls output { float: right; color: var(--yellow); }
.controls input[type="range"] { width: 100%; accent-color: var(--lime); }
.controls .check { display: flex; align-items: center; gap: .5rem; }
.presets { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.export { margin-top: 1.2rem; padding-top: 1rem; border-top: 2px dashed rgba(255,255,255,.3); display: grid; gap: .7rem; }
.export-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
select { padding: .4rem .6rem; border: 2px solid var(--cyan); border-radius: 8px; background: #fff; color: #111; }
.btn {
  cursor: pointer; padding: .6rem 1.2rem; font-weight: bold; color: #000;
  border: 3px solid #000; border-radius: 10px; background: var(--lime);
  box-shadow: 0 4px 0 #000;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #000; }
.btn:disabled { filter: grayscale(1); cursor: not-allowed; }
.btn.ghost { background: transparent; color: #fff; border-color: #fff; box-shadow: none; }

/* ---------- small screens ---------- */
@media (max-width: 560px) {
  body { font-size: 16px; }
  .arrow { width: 44px; height: 44px; }
  .ar-l2, .ar-r2 { display: none; }
  .burst { width: 70px; height: 70px; right: 2%; font-size: 1rem; }
  html[lang="tr"] .burst { font-size: .76rem; }
  .dl-zone { min-height: 220px; }
  .result { flex-direction: column; align-items: flex-start; }
  .result img { max-width: 100%; width: 100%; }
  .mascot { display: none; }
  .trim-row { flex-wrap: wrap; }
  .trim-row input[type="range"] { flex-basis: 100%; order: 3; }
}
@media (prefers-reduced-motion: reduce) {
  .arrow, .burst, .sketchy-btn, .title, .ticker-track { animation: none; }
}


/* ---------- "report a problem" ---------- */
.report-link { font-size: .78rem; color: #8896d6; text-decoration: underline dotted; }
.report-link:hover { color: #fff; }
.report-btn {
  display: block; margin: .35rem auto 0; padding: .2rem .7rem; font: inherit; font-size: .85rem; cursor: pointer;
  color: #fff; background: transparent; border: 2px dashed var(--red); border-radius: 999px;
}
.report-btn:hover { background: rgba(255, 77, 77, .18); }
dialog.rep {
  width: min(92vw, 460px); padding: 1.1rem 1.2rem; color: var(--ink); font-family: var(--comic);
  background: #1a1250; border: 3px solid var(--yellow); border-radius: 14px; box-shadow: 8px 8px 0 #000;
}
dialog.rep::backdrop { background: rgba(5, 2, 25, .72); }
dialog.rep h2 { margin: 0 0 .6rem; font-size: 1.25rem; color: var(--yellow); }
dialog.rep textarea, dialog.rep input[type=email] {
  width: 100%; margin-bottom: .5rem; padding: .55rem .7rem; font: inherit; color: #fff;
  background: rgba(255, 255, 255, .08); border: 2px solid rgba(255, 255, 255, .35); border-radius: 10px; resize: vertical;
}
dialog.rep textarea:focus, dialog.rep input[type=email]:focus { outline: none; border-color: var(--cyan); }
.rep-actions { display: flex; gap: .6rem; margin-top: .6rem; }
.rep-msg { min-height: 1.3em; margin: .3rem 0 0; font-weight: bold; color: var(--cyan); }
.rep-msg.ok { color: var(--lime); }
.rep-msg.bad { color: var(--red); }
.rep-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- support button (Buy Me a Coffee) ---------- */
.support { display: grid; gap: .45rem; justify-items: center; margin-bottom: .4rem; }
.support-line { font-size: .85rem; color: #cfd8ff; }
.support-btn { display: inline-flex; gap: .4rem; align-items: center; padding: .55rem 1.1rem; border-radius: 999px;
  background: var(--yellow); color: #000; font-weight: 700; text-decoration: none; border: 3px dashed #000; rotate: -1.5deg;
  box-shadow: 3px 3px 0 var(--pink); transition: rotate .15s, transform .15s; }
.support-btn:hover { rotate: 1.5deg; transform: scale(1.06); }
.support-btn:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }

/* ---------- GIF maker page ---------- */
.or { text-align: center; margin: .6rem 0; opacity: .8; }
.gif-out { margin-top: 1rem; text-align: center; }
.gif-out img { max-width: 100%; border: 3px dashed var(--yellow); border-radius: 8px; background: #000; }
