@import url(fonts.css);

/* =========================================================
   ATESKids — çocuk arayüzü
   ======================================================= */
:root {
  --bg: #FFF7E8;
  --bg2: #FFFDF7;
  --ink: #2B2D42;
  --ink-soft: #6C6F86;
  --card: #FFFFFF;
  --red: #FF6B6B;
  --orange: #FF9F1C;
  --yellow: #FFC93C;
  --teal: #2EC4B6;
  --blue: #4D96FF;
  --purple: #9B5DE5;
  --pink: #F15BB5;
  --green: #06C07F;
  --radius: 22px;
  --shadow: 0 6px 0 rgba(43, 45, 66, .07), 0 10px 24px rgba(43, 45, 66, .08);
  --font: 'Fredoka', 'Baloo 2', 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%;
  font-family: var(--font); color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(255, 107, 107, .10) 0 70px, transparent 71px),
    radial-gradient(circle at 92% 30%, rgba(77, 150, 255, .10) 0 90px, transparent 91px),
    radial-gradient(circle at 15% 78%, rgba(46, 196, 182, .10) 0 80px, transparent 81px),
    radial-gradient(circle at 85% 88%, rgba(255, 201, 60, .14) 0 70px, transparent 71px),
    var(--bg);
  background-attachment: fixed;
  overscroll-behavior-y: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
button { font-family: inherit; color: inherit; }
img { -webkit-user-drag: none; }
[hidden] { display: none !important; }
svg { fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

.app { max-width: 1400px; margin: 0 auto; min-height: 100vh; }
body.player-open { overflow: hidden; }

/* ---------- Üst bölüm ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  padding: calc(10px + var(--safe-t)) calc(14px + var(--safe-r)) 8px calc(14px + var(--safe-l));
  background: linear-gradient(180deg, var(--bg) 82%, rgba(255, 247, 232, 0));
}
.top-row { display: flex; align-items: center; justify-content: center; position: relative; min-height: 48px; }
.logo {
  margin: 0; font-weight: 700; font-size: clamp(2rem, 8vw, 2.8rem); line-height: 1;
  letter-spacing: 1px; display: flex; gap: 1px; cursor: default;
  text-shadow: 0 3px 0 rgba(43, 45, 66, .12);
}
.logo span { display: inline-block; animation: hop 3.6s ease-in-out infinite; }
.logo span:nth-child(1) { color: var(--red); transform: rotate(-6deg); animation-delay: 0s; }
.logo span:nth-child(2) { color: var(--orange); transform: rotate(4deg); animation-delay: .12s; }
.logo span:nth-child(3) { color: var(--yellow); transform: rotate(-3deg); animation-delay: .24s; }
.logo span:nth-child(4) { color: var(--teal); transform: rotate(5deg); animation-delay: .36s; }
.logo span:nth-child(5) { color: var(--blue); transform: rotate(-4deg); animation-delay: .48s; }
.logo span:nth-child(6) { color: var(--purple); transform: rotate(6deg); animation-delay: .60s; }
.logo span:nth-child(7) { color: var(--pink); transform: rotate(-5deg); animation-delay: .72s; }
.logo span:nth-child(8) { color: var(--green); transform: rotate(3deg); animation-delay: .84s; }
@keyframes hop {
  0%, 80%, 100% { translate: 0 0; }
  88% { translate: 0 -6px; }
}

.icon-btn {
  position: absolute; left: 0; width: 48px; height: 48px; border-radius: 16px; border: 0;
  background: #fff; box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 26px; height: 26px; }

.search {
  position: relative; margin: 10px auto 0; max-width: 640px;
}
.search input {
  width: 100%; height: 56px; border-radius: 999px; border: 3px solid #fff;
  padding: 0 56px 0 54px; font: 500 1.15rem var(--font); color: var(--ink);
  background: #fff; box-shadow: var(--shadow); outline: none; -webkit-appearance: none; appearance: none;
  -webkit-user-select: text; user-select: text;
}
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus { border-color: var(--yellow); }
.search input::placeholder { color: #A9ABBD; }
.search-ico { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); font-size: 1.35rem; pointer-events: none; }
.search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: #F1F1F6; font-size: 1.05rem; cursor: pointer;
}

/* ---------- Kategori butonları ---------- */
.cats {
  display: flex; gap: 10px; overflow-x: auto; padding: 14px 4px 10px; margin: 0 -14px;
  padding-left: 14px; padding-right: 14px; scroll-snap-type: x proximity; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.cats::-webkit-scrollbar { display: none; }
.cat {
  --c: var(--blue);
  flex: none; scroll-snap-align: start;
  display: flex; align-items: center; gap: 8px;
  height: 56px; padding: 0 18px 0 8px; border-radius: 999px; border: 0; cursor: pointer;
  background: #fff; color: var(--ink); font: 600 1.05rem var(--font);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--c) 35%, transparent), 0 6px 16px rgba(43, 45, 66, .08);
  transition: transform .15s ease, background .2s, color .2s;
}
.cat .cat-ico {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 1.45rem;
  background: color-mix(in srgb, var(--c) 18%, #fff);
}
.cat:active { transform: scale(.94); }
.cat.active { background: var(--c); color: #fff; }
.cat.active .cat-ico { background: rgba(255, 255, 255, .28); }

/* ---------- İçerik ---------- */
.content { padding: 4px calc(14px + var(--safe-r)) calc(28px + var(--safe-b)) calc(14px + var(--safe-l)); outline: none; }
.section { margin: 14px 0 26px; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 2px 12px; }
.section-title {
  margin: 0; font-size: clamp(1.25rem, 4.6vw, 1.6rem); font-weight: 700; display: flex; align-items: center; gap: 8px;
  min-width: 0;
}
.section-title .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-title .badge {
  flex: none; width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; font-size: 1.3rem;
  background: var(--c, var(--red)); box-shadow: 0 3px 0 rgba(0, 0, 0, .08);
}
.see-all {
  flex: none; border: 0; cursor: pointer; height: 44px; padding: 0 16px; border-radius: 999px;
  background: #fff; font: 600 .98rem var(--font); color: var(--ink); box-shadow: var(--shadow);
  display: inline-flex; align-items: center; gap: 4px;
}
.see-all:active { transform: scale(.95); }

/* Video kart ızgarası: mobil 2, tablet 3–5 sütun */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.card {
  --c: var(--blue);
  display: block; width: 100%; text-align: left; padding: 0; border: 0; cursor: pointer;
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 40%, transparent), 0 10px 22px rgba(43, 45, 66, .08);
  transition: transform .15s ease;
  animation: pop .35s ease both;
}
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.card:active { transform: scale(.96); }
@media (hover: hover) { .card:hover { transform: translateY(-3px) rotate(-.4deg); } }
.thumb { display: block; position: relative; aspect-ratio: 16 / 9; background: color-mix(in srgb, var(--c) 18%, #fff); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .3s; }
.thumb img.ok { opacity: 1; }
.thumb .play {
  position: absolute; right: 8px; bottom: 8px; width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255, 255, 255, .95); display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}
.thumb .play::before {
  content: ""; margin-left: 4px; border-left: 13px solid var(--c); border-top: 8px solid transparent; border-bottom: 8px solid transparent;
}
.card .title {
  margin: 0; display: block; padding: 10px 12px 13px; font-size: clamp(.95rem, 3.6vw, 1.08rem); font-weight: 600; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: calc(2 * 1.25em + 23px);
}

/* Boş ve hata ekranları */
.empty {
  text-align: center; padding: 48px 20px; animation: rise .35s ease both;
}
.empty .big { font-size: 4.5rem; line-height: 1; display: block; margin-bottom: 12px; animation: wobble 2.4s ease-in-out infinite; }
.empty h2 { margin: 0 0 6px; font-size: 1.5rem; }
.empty p { margin: 0 0 18px; color: var(--ink-soft); font-size: 1.1rem; }
@keyframes wobble { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }

.big-btn {
  border: 0; cursor: pointer; height: 60px; padding: 0 24px; border-radius: 999px;
  font: 600 1.15rem var(--font); color: #fff; background: var(--blue);
  box-shadow: 0 5px 0 rgba(0, 0, 0, .15); display: inline-flex; align-items: center; gap: 8px;
  transition: transform .12s;
}
.big-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .15); }
.big-btn.green { background: var(--green); }
.big-btn.orange { background: var(--orange); }
.big-btn.blue { background: var(--blue); }

.skeleton .card { pointer-events: none; animation: none; }
.skeleton .thumb, .skeleton .title-skel { background: linear-gradient(90deg, #F3EEE3 25%, #FBF7EF 50%, #F3EEE3 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton .title-skel { height: 18px; margin: 12px; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.net-banner {
  position: fixed; left: 50%; bottom: calc(16px + var(--safe-b)); transform: translateX(-50%); z-index: 200;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}

/* =========================================================
   Oynatıcı ekranı
   ======================================================= */
.player-screen {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #23264A 0%, #1B1D3A 100%); color: #fff;
  padding: calc(8px + var(--safe-t)) calc(10px + var(--safe-r)) calc(8px + var(--safe-b)) calc(10px + var(--safe-l));
  overflow-y: auto; overscroll-behavior: contain;
  animation: slideUp .28s ease both;
}
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.player-top { display: flex; align-items: center; gap: 12px; padding: 4px 2px 10px; }
.round-btn {
  flex: none; width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  background: #fff; color: var(--ink); display: grid; place-items: center; box-shadow: 0 4px 0 rgba(0, 0, 0, .25);
}
.round-btn svg { width: 30px; height: 30px; stroke-width: 3; }
.round-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.player-title {
  margin: 0; font-size: clamp(1.05rem, 4.4vw, 1.45rem); font-weight: 600; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Sahne: video + kontroller (tam ekran yapılan öğe) */
.stage {
  position: relative; display: grid; gap: 12px;
  grid-template-columns: 1fr; grid-template-areas: "video" "controls";
  justify-items: center; align-items: center;
}
.video-wrap {
  grid-area: video; position: relative; width: 100%;
  max-width: min(100%, calc((100vh - 330px) * 16 / 9), 1100px);
  min-width: min(100%, 300px);
  aspect-ratio: 16 / 9; border-radius: 20px; overflow: hidden; background: #000;
  container-type: size; container-name: video;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .12), 0 16px 40px rgba(0, 0, 0, .35);
}
@supports (height: 100dvh) {
  .video-wrap { max-width: min(100%, calc((100dvh - 330px) * 16 / 9), 1100px); }
}
.video-box, .video-box iframe, #ytPlayer { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.controls { grid-area: controls; display: flex; align-items: center; justify-content: center; gap: clamp(18px, 6vw, 40px); padding: 4px 0; }
.ctrl, .side-btn {
  border: 0; cursor: pointer; border-radius: 50%; display: grid; place-items: center; color: #fff;
  box-shadow: 0 5px 0 rgba(0, 0, 0, .3); transition: transform .12s, opacity .2s;
}
.ctrl { width: 76px; height: 76px; }
.ctrl svg, .side-btn svg { width: 38px; height: 38px; stroke-width: 2.8; }
.ctrl.prev svg path:last-child, .ctrl.next svg path:last-child,
.side-btn.prev svg path:last-child, .side-btn.next svg path:last-child { fill: currentColor; }
.ctrl.prev, .side-btn.prev { background: var(--orange); }
.ctrl.next, .side-btn.next { background: var(--green); }
.ctrl.fs { width: 64px; height: 64px; background: var(--blue); }
.ctrl.fs svg { width: 30px; height: 30px; }
.ctrl:active, .side-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
.ctrl:disabled, .side-btn:disabled { opacity: .3; cursor: default; transform: none; }
.stage .side-btn { display: none; }
.ico-exit { display: none; }
.is-fs .ico-enter { display: none; }
.is-fs .ico-exit { display: block; }

/* Bitiş / hata panelleri — oynatıcının yerine geçer */
.panel {
  position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center;
  justify-content: safe center;
  gap: 8px; padding: 14px; text-align: center; overflow-y: auto;
  background: radial-gradient(circle at 50% 0%, #3B3F78 0%, #23264A 70%);
}
.panel-emoji { font-size: 3rem; margin: 0; line-height: 1; }
.panel-title { margin: 0; font-size: clamp(1.15rem, 4.5vw, 1.7rem); font-weight: 700; }
.panel-sub { margin: 0; color: #C9CBEA; font-size: clamp(.9rem, 3.2vw, 1.05rem); }
.panel-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 6px 0; }
.panel .big-btn { height: clamp(46px, 11vw, 60px); font-size: clamp(.95rem, 3.6vw, 1.15rem); padding: 0 18px; }
.end-next { display: flex; gap: 10px; justify-content: center; width: 100%; max-width: 760px; }
.mini {
  flex: 1 1 0; min-width: 0; max-width: 240px; border: 0; padding: 0; cursor: pointer; background: #fff; color: var(--ink);
  border-radius: 14px; overflow: hidden; text-align: left; box-shadow: 0 4px 0 rgba(0, 0, 0, .25);
}
.mini img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: #ddd; }
.mini span { display: block; padding: 6px 8px; font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini:active { transform: scale(.96); }
.end-next .mini { max-width: 30%; }
.end-next .mini:only-child { max-width: 46%; }
@media (max-width: 520px) { .end-next .mini:nth-child(3) { display: none; } .end-next .mini { max-width: 46%; } }
/* Video alanı alçaksa (dikey telefon) bitiş ekranını sıkıştır */
@container video (max-height: 300px) {
  .panel { gap: 6px; padding: 10px; }
  .panel-emoji { font-size: 2.1rem; }
  .end-next .mini img { display: none; }
  .end-next .mini span { padding: 10px 12px; font-size: .9rem; }
}

.loading { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; background: #000; pointer-events: none; }
.dots { display: flex; gap: 10px; }
.dots i { width: 16px; height: 16px; border-radius: 50%; background: var(--yellow); animation: bounce 1s infinite ease-in-out; }
.dots i:nth-child(2) { background: var(--teal); animation-delay: .15s; }
.dots i:nth-child(3) { background: var(--red); animation-delay: .3s; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }

/* Listedeki diğer videolar */
.upnext { margin-top: 14px; }
.upnext-title { margin: 0 4px 8px; font-weight: 600; color: #C9CBEA; }
.upnext-row { display: flex; gap: 12px; overflow-x: auto; padding: 4px 4px 12px; scrollbar-width: none; scroll-snap-type: x proximity; }
.upnext-row::-webkit-scrollbar { display: none; }
.upnext-row .mini { flex: 0 0 clamp(150px, 40vw, 220px); scroll-snap-align: start; }
.upnext-row .mini.current { outline: 4px solid var(--yellow); outline-offset: -4px; }

/* ---------- Yatay telefon ve tam ekran düzeni ---------- */
@media (orientation: landscape) and (max-height: 560px) {
  .player-screen { padding-top: calc(6px + var(--safe-t)); }
  .player-top { padding-bottom: 6px; }
  .round-btn { width: 46px; height: 46px; }
  .stage { grid-template-columns: auto 1fr auto; grid-template-areas: "prev video next"; gap: 12px; }
  .stage .side-btn { display: grid; width: 72px; height: 72px; }
  .side-btn.prev { grid-area: prev; }
  .side-btn.next { grid-area: next; }
  .video-wrap { max-width: min(100%, calc((100vh - 90px) * 16 / 9)); }
  @supports (height: 100dvh) { .video-wrap { max-width: min(100%, calc((100dvh - 90px) * 16 / 9)); } }
  .controls { position: absolute; right: 0; bottom: 0; padding: 0; }
  .controls .ctrl.prev, .controls .ctrl.next { display: none; }
  .controls .ctrl.fs { width: 56px; height: 56px; }
  .stage .side-btn.next { align-self: start; margin-top: 10px; }
}

/* Tam ekran (Fullscreen API) veya iOS için sözde tam ekran.
   Video kenardan kenara: oynatıcı tüm ekranı kaplar, YouTube videoyu kendisi ortalar (YouTube uygulaması gibi).
   Önceki/sonraki butonları ekranın kenarlarında, yarı saydam durur.
   :is() bağışlayıcı seçici listesi kullanır; tanınmayan sözde sınıf tüm kuralı geçersiz kılmaz. */
.stage:is(:fullscreen, :-webkit-full-screen, .pseudo-fs) {
  display: block; position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh;
  margin: 0; padding: 0; gap: 0; background: #000; z-index: 300;
}
.stage:is(:fullscreen, :-webkit-full-screen, .pseudo-fs) .video-wrap {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; min-width: 0;
  aspect-ratio: auto; border-radius: 0; box-shadow: none;
}
.stage:is(:fullscreen, :-webkit-full-screen, .pseudo-fs) .side-btn {
  display: grid; position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 64px; height: 64px; opacity: .55; box-shadow: 0 3px 0 rgba(0, 0, 0, .3);
}
.stage:is(:fullscreen, :-webkit-full-screen, .pseudo-fs) .side-btn:active { opacity: 1; transform: translateY(-50%) scale(.94); }
.stage:is(:fullscreen, :-webkit-full-screen, .pseudo-fs) .side-btn.prev { left: max(12px, var(--safe-l)); }
.stage:is(:fullscreen, :-webkit-full-screen, .pseudo-fs) .side-btn.next { right: max(12px, var(--safe-r)); margin: 0; }
.stage:is(:fullscreen, :-webkit-full-screen, .pseudo-fs) .side-btn svg { width: 30px; height: 30px; }
.stage:is(:fullscreen, :-webkit-full-screen, .pseudo-fs) .controls {
  position: absolute; top: max(12px, var(--safe-t)); right: max(12px, var(--safe-r)); bottom: auto; left: auto;
  z-index: 5; padding: 0;
}
.stage:is(:fullscreen, :-webkit-full-screen, .pseudo-fs) .controls .ctrl.prev,
.stage:is(:fullscreen, :-webkit-full-screen, .pseudo-fs) .controls .ctrl.next { display: none; }
.stage:is(:fullscreen, :-webkit-full-screen, .pseudo-fs) .controls .ctrl.fs {
  width: 48px; height: 48px; opacity: .55; background: rgba(0, 0, 0, .55); box-shadow: none;
}
.stage:is(:fullscreen, :-webkit-full-screen, .pseudo-fs) .controls .ctrl.fs svg { width: 24px; height: 24px; }

/* Tablet ve masaüstü */
@media (min-width: 900px) and (min-height: 600px) {
  .player-screen { padding-left: 24px; padding-right: 24px; }
  .upnext { max-width: 1100px; margin-left: auto; margin-right: auto; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
a.big-btn { text-decoration: none; }
