/* =========================================================
   ERLYQ — oyun kütüphanesi (koyu) ve açılış ekranı
   ========================================================= */
.lib-page {
  --l-bg: #0d1016;
  --l-panel: #161b24;
  --l-panel-2: #1d2430;
  --l-panel-3: #262e3c;
  --l-line: rgba(255, 255, 255, .07);
  --l-text: #f2f4f8;
  --l-muted: #9aa3b2;
  --l-dim: #636c7b;
  --l-accent: #4c8dff;
  --l-play: #2fd06b;
  background: var(--l-bg);
  color: var(--l-text);
}
html:has(.lib-page) { background: #0d1016; }
.lib-page ::selection { background: rgba(76, 141, 255, .35); }
body.is-booting { overflow: hidden; }
body.is-booting .nav { opacity: 0; transform: translateY(-24px); pointer-events: none; }

/* ---------- açılış ekranı ---------- */
.boot { position: fixed; inset: 0; z-index: 300; overflow: hidden; background: #010208; color: #e8f1ff; }
.boot__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.boot.no-3d { background: radial-gradient(60% 50% at 50% 50%, #0b2a6b 0%, #020716 60%, #010208 100%); }
.boot__power { position: absolute; inset: 0; z-index: 5; background: #000; pointer-events: none; }
.boot__power::after { content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 2px; margin-top: -1px; background: #e6efff; box-shadow: 0 0 22px 6px rgba(140, 185, 255, .85); transform: scaleX(0); }
.boot.is-on .boot__power { animation: powerOn .8s ease-out forwards; }
.boot.is-on .boot__power::after { animation: powerLine .8s ease-out forwards; }
@keyframes powerOn { 0%, 42% { opacity: 1; } 100% { opacity: 0; } }
@keyframes powerLine { 0% { transform: scaleX(0); opacity: 1; } 38% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1) scaleY(90); opacity: 0; } }

.boot__flash { position: absolute; inset: 0; z-index: 3; opacity: 0; background: radial-gradient(circle at 50% 50%, #ffffff 0%, #d7e7ff 30%, rgba(110, 160, 255, .35) 60%, rgba(60, 110, 255, 0) 80%); pointer-events: none; }
.boot__scan { position: absolute; inset: 0; z-index: 3; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .22) 0 1px, transparent 1px 3px); opacity: .55; }

.boot__logo { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 20px; text-align: center; pointer-events: none; opacity: 0; transform: scale(1.14); filter: blur(16px);
  transition: opacity 1.1s var(--ease-out), transform 1.8s var(--ease-out), filter 1.1s var(--ease-out); }
.boot.show-logo .boot__logo { opacity: 1; transform: none; filter: blur(0); }
.boot__mark { position: relative; margin: 0; padding-left: .16em; font-size: clamp(64px, 13vw, 176px); font-weight: 800; line-height: 1; letter-spacing: .16em; color: #f4f8ff; text-shadow: 0 0 18px rgba(120, 170, 255, .75), 0 0 60px rgba(70, 130, 255, .55); }
.boot__mark::before, .boot__mark::after { content: attr(data-text); position: absolute; inset: 0; padding-left: .16em; mix-blend-mode: screen; text-shadow: none; }
.boot__mark::before { color: #ff2d6f; animation: glitchA 2.6s infinite steps(1); }
.boot__mark::after { color: #2ef4ff; animation: glitchB 2.1s infinite steps(1); }
@keyframes glitchA {
  0%, 100% { clip-path: inset(0 0 100% 0); transform: none; }
  5% { clip-path: inset(14% 0 62% 0); transform: translate(-7px, 0); }
  8% { clip-path: inset(56% 0 22% 0); transform: translate(6px, 0); }
  11% { clip-path: inset(0 0 100% 0); }
  46% { clip-path: inset(30% 0 46% 0); transform: translate(-5px, 0); }
  49% { clip-path: inset(0 0 100% 0); }
  77% { clip-path: inset(70% 0 6% 0); transform: translate(8px, 0); }
  80% { clip-path: inset(0 0 100% 0); }
}
@keyframes glitchB {
  0%, 100% { clip-path: inset(0 0 100% 0); transform: none; }
  13% { clip-path: inset(62% 0 18% 0); transform: translate(6px, 0); }
  16% { clip-path: inset(8% 0 70% 0); transform: translate(-6px, 0); }
  19% { clip-path: inset(0 0 100% 0); }
  58% { clip-path: inset(40% 0 38% 0); transform: translate(5px, 0); }
  61% { clip-path: inset(0 0 100% 0); }
  88% { clip-path: inset(18% 0 58% 0); transform: translate(-8px, 0); }
  91% { clip-path: inset(0 0 100% 0); }
}
.boot__sub { margin: 28px 0 0; padding-left: .55em; color: rgba(214, 230, 255, .82); font-size: clamp(12px, 1.3vw, 15px); font-weight: 600; letter-spacing: .55em; text-transform: uppercase; }

.boot__hud { position: absolute; left: 28px; bottom: 26px; z-index: 4; display: flex; flex-direction: column; gap: 8px; color: rgba(190, 214, 255, .72); font: 500 11px/1.3 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .14em; text-transform: uppercase; }
.boot__status::before { content: "▸ "; color: #9cc3ff; }
.boot__bar { width: 190px; height: 2px; overflow: hidden; background: rgba(156, 195, 255, .18); }
.boot__bar span { display: block; width: 0; height: 100%; background: #9cc3ff; box-shadow: 0 0 10px #9cc3ff; transition: width .5s var(--ease-out); }
.boot__skip { position: absolute; right: 24px; bottom: 22px; z-index: 6; height: 36px; padding: 0 18px; border: 1px solid rgba(156, 195, 255, .32); border-radius: 999px; background: rgba(5, 12, 30, .45); color: rgba(220, 232, 255, .9); font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: background .2s, border-color .2s; }
.boot__skip:hover { background: rgba(30, 60, 130, .55); border-color: rgba(156, 195, 255, .65); }

/* son glitch ve tüp TV gibi kapanarak kütüphaneye geçiş */
.boot.is-glitching .boot__mark { animation: shake .09s steps(2) infinite; }
.boot.is-glitching .boot__mark::before, .boot.is-glitching .boot__mark::after { animation-duration: .3s; }
@keyframes shake { 0% { transform: translate(3px, -2px); } 50% { transform: translate(-4px, 2px); } 100% { transform: translate(2px, 1px); } }
.boot.is-out { animation: crtOff .62s cubic-bezier(.55, 0, .3, 1) forwards; pointer-events: none; }
@keyframes crtOff {
  0% { transform: none; filter: none; }
  42% { transform: scale(1, .006); filter: brightness(3.5) saturate(.4); }
  72% { transform: scale(.02, .006); filter: brightness(5); opacity: 1; }
  100% { transform: scale(0, .006); filter: brightness(5); opacity: 0; }
}
.library.is-entering { animation: libIn 1s ease-out both; }
@keyframes libIn {
  0% { opacity: 0; filter: brightness(2.2) saturate(0) blur(4px); transform: scale(1.02); }
  20% { opacity: 1; filter: brightness(1.5) saturate(.5) blur(1px); transform: none; }
  30% { filter: brightness(1.15) hue-rotate(25deg); transform: translateX(-6px); }
  34% { transform: translateX(5px); }
  38% { filter: none; transform: none; }
  100% { opacity: 1; filter: none; transform: none; }
}

/* ---------- kütüphane yerleşimi ---------- */
.library { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; padding-top: 78px; }
.lib-side { position: sticky; top: 78px; align-self: start; height: calc(100vh - 78px); overflow-y: auto; padding: 18px 14px 28px 22px; border-right: 1px solid var(--l-line); scrollbar-width: thin; scrollbar-color: var(--l-panel-3) transparent; }
.lib-home { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--l-muted); font-size: 14px; font-weight: 600; transition: background .2s, color .2s; }
.lib-home:hover { background: var(--l-panel); color: var(--l-text); }
.lib-home.is-active { background: var(--l-panel-2); color: #fff; }
.lib-home svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lib-search { position: relative; display: flex; align-items: center; margin: 14px 0 20px; }
.lib-search svg { position: absolute; left: 12px; width: 15px; height: 15px; fill: none; stroke: var(--l-dim); stroke-width: 2; stroke-linecap: round; }
.lib-search input { width: 100%; height: 38px; padding: 0 12px 0 36px; border: 1px solid var(--l-line); border-radius: 10px; background: var(--l-panel); color: var(--l-text); font: 400 14px var(--font); outline: none; transition: border-color .2s, background .2s; }
.lib-search input::placeholder { color: var(--l-dim); }
.lib-search input:focus { border-color: rgba(76, 141, 255, .6); background: var(--l-panel-2); }
.lib-search--mobile { display: none; margin: 0 0 18px; }
.lib-label { display: flex; justify-content: space-between; margin: 0 0 8px; padding: 0 12px; color: var(--l-dim); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.lib-list { margin: 0; padding: 0; list-style: none; }
.lib-item { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 8px; color: var(--l-muted); font-size: 14px; transition: background .2s, color .2s; }
.lib-item:hover { background: var(--l-panel); color: var(--l-text); }
.lib-item.is-active { background: var(--l-panel-2); color: #fff; box-shadow: inset 3px 0 0 var(--l-accent); }
.lib-item__thumb { position: relative; display: grid; flex: 0 0 auto; place-items: center; width: 28px; height: 28px; overflow: hidden; border-radius: 6px; }
.lib-item__thumb img { width: 100%; height: 100%; object-fit: cover; }
.lib-item__thumb .art-ph svg { width: 60%; }
.lib-item__state { margin-left: auto; color: var(--l-dim); font-size: 11px; }
.lib-empty { padding: 10px 12px; color: var(--l-dim); font-size: 14px; }
.lib-content { min-width: 0; padding: 22px 36px 60px; }

/* öne çıkan */
.lib-hero { position: relative; height: clamp(320px, 40vw, 460px); overflow: hidden; border-radius: 20px; background: var(--l-panel); isolation: isolate; }
.lib-hero__art { position: absolute; inset: 0; z-index: -2; transform: scale(1.03); transition: transform 8s linear; }
.lib-hero:hover .lib-hero__art { transform: scale(1.09); }
.lib-hero__art img { width: 100%; height: 100%; object-fit: cover; }
.lib-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(9, 11, 16, .92) 0%, rgba(9, 11, 16, .5) 42%, rgba(9, 11, 16, 0) 74%), linear-gradient(0deg, rgba(9, 11, 16, .75), rgba(9, 11, 16, 0) 46%); }
.lib-hero__content { position: absolute; left: 40px; bottom: 36px; max-width: 470px; }
.lib-eyebrow { margin: 0 0 10px; color: #9cc3ff; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.lib-hero h1 { margin: 0; font-size: clamp(36px, 4.6vw, 58px); font-weight: 800; line-height: 1.02; letter-spacing: -.035em; }
.lib-hero p:not(.lib-eyebrow) { margin: 12px 0 0; color: rgba(255, 255, 255, .76); }
.lib-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

.play-btn { display: inline-flex; align-items: center; gap: 10px; height: 50px; padding: 0 30px; border: 0; border-radius: 12px; background: linear-gradient(180deg, #3fe07c, #22b45a); color: #04140a; font-size: 15px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; cursor: pointer;
  box-shadow: 0 12px 30px -12px rgba(47, 208, 107, .75), inset 0 1px 0 rgba(255, 255, 255, .35); transition: transform .3s var(--ease-out), filter .2s, box-shadow .3s; }
.play-btn svg { width: 15px; height: 15px; fill: currentColor; }
.play-btn:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 18px 36px -12px rgba(47, 208, 107, .85), inset 0 1px 0 rgba(255, 255, 255, .35); }
.play-btn:active:not(:disabled) { transform: scale(.97); }
.play-btn:disabled { background: var(--l-panel-3); color: var(--l-muted); box-shadow: none; cursor: not-allowed; }
.ghost-btn { display: inline-flex; align-items: center; gap: 8px; height: 50px; padding: 0 22px; border-radius: 12px; background: rgba(255, 255, 255, .1); color: #fff; font-size: 15px; font-weight: 600; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: background .2s; }
.ghost-btn:hover { background: rgba(255, 255, 255, .18); }
.ghost-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* raflar ve kapaklar */
.lib-shelf { margin-top: 44px; }
.lib-shelf__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.lib-shelf__head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.lib-shelf__head h2 span { color: var(--l-dim); font-weight: 500; }
.lib-sort { height: 36px; padding: 0 34px 0 12px; border: 1px solid var(--l-line); border-radius: 10px; color: var(--l-text); font: 500 13px var(--font); cursor: pointer; appearance: none;
  background: var(--l-panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa3b2' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 14px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 30px 22px; }
.lib-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(176px, 200px); gap: 22px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }

.cap { display: block; perspective: 900px; animation: capIn .8s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 55ms + .1s); }
.library:not(.is-ready) .cap { animation-play-state: paused; }
@keyframes capIn { from { opacity: 0; transform: translateY(28px) scale(.95); } }
.cap__inner { position: relative; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 12px; background: var(--l-panel); box-shadow: 0 14px 30px -16px rgba(0, 0, 0, .85);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--ty, 0px)); transition: transform .55s var(--ease-out), box-shadow .5s; }
.cap:hover .cap__inner { --ty: -6px; transition: transform .14s linear, box-shadow .5s; box-shadow: 0 34px 50px -22px rgba(0, 0, 0, .95), 0 0 0 1.5px rgba(156, 195, 255, .5), 0 0 44px -8px rgba(76, 141, 255, .45); }
.cap__art { position: absolute; inset: 0; }
.cap__art > img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s var(--ease-out); }
.cap:hover .cap__art > img { transform: scale(1.06); }
.cap__glare { position: absolute; inset: 0; opacity: 0; background: radial-gradient(circle at var(--gx, 50%) var(--gy, 0%), rgba(255, 255, 255, .34), rgba(255, 255, 255, 0) 55%); mix-blend-mode: screen; pointer-events: none; transition: opacity .35s; }
.cap:hover .cap__glare { opacity: 1; }
.cap__play { position: absolute; right: 12px; bottom: 12px; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--l-play); color: #04140a; box-shadow: 0 8px 22px -6px rgba(47, 208, 107, .85); opacity: 0; transform: scale(.6) translateY(8px); transition: opacity .3s, transform .45s var(--ease-out); }
.cap:hover .cap__play { opacity: 1; transform: none; }
.cap__play svg { width: 16px; height: 16px; margin-left: 2px; fill: currentColor; }
.cap__soon { position: absolute; top: 10px; left: 10px; padding: 4px 9px; border-radius: 6px; background: rgba(8, 10, 16, .6); color: rgba(255, 255, 255, .85); font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.cap__title { margin: 12px 0 2px; color: var(--l-text); font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.cap__meta { margin: 0; color: var(--l-dim); font-size: 12.5px; }

/* görseli olmayan oyunlar için kapak */
.art-ph { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; background: radial-gradient(120% 80% at 25% 0%, var(--ph1), transparent 62%), linear-gradient(160deg, var(--ph1), var(--ph2)); }
.art-ph::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255, 255, 255, .055) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .055) 1px, transparent 1px); background-size: 16px 16px; -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%); mask-image: linear-gradient(180deg, #000, transparent 85%); }
.art-ph svg { position: relative; width: 34%; max-width: 92px; fill: none; stroke: rgba(255, 255, 255, .3); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.art-ph__title { position: absolute; left: 14px; right: 14px; bottom: 14px; color: rgba(255, 255, 255, .92); font-size: 18px; font-weight: 800; letter-spacing: -.02em; text-shadow: 0 2px 12px rgba(0, 0, 0, .4); }

/* oyun sayfası */
.lib-back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 16px; color: var(--l-muted); font-size: 14px; transition: color .2s; }
.lib-back:hover { color: #fff; }
.lib-back svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.game { overflow: hidden; border-radius: 20px; background: var(--l-panel); animation: capIn .7s var(--ease-out) both; }
.game__hero { position: relative; height: clamp(260px, 34vw, 420px); }
.game__hero > img { width: 100%; height: 100%; object-fit: cover; }
.game__hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(9, 11, 16, .85), rgba(9, 11, 16, 0) 55%); }
.game__title { position: absolute; left: 36px; bottom: 26px; z-index: 1; margin: 0; font-size: clamp(36px, 5vw, 64px); font-weight: 800; line-height: 1; letter-spacing: -.035em; text-shadow: 0 6px 30px rgba(0, 0, 0, .5); }
.game__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 22px 34px; padding: 18px 24px; background: var(--l-panel-2); }
.game__stats { display: flex; flex-wrap: wrap; gap: 14px 34px; margin: 0; }
.game__stats dt { color: var(--l-dim); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.game__stats dd { margin: 4px 0 0; font-size: 14px; font-weight: 600; }
.game__bar .ghost-btn { height: 42px; margin-left: auto; font-size: 14px; }
.game__body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; margin-top: 24px; }
.lib-panel { padding: 24px 26px; border-radius: 16px; background: var(--l-panel); }
.lib-panel h2 { margin: 0 0 12px; color: var(--l-muted); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.lib-panel p { margin: 0; color: #c9cfda; line-height: 1.65; white-space: pre-line; }
.info-list { margin: 0; }
.info-list div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--l-line); font-size: 14px; }
.info-list div:last-child { border-bottom: 0; }
.info-list dt { color: var(--l-dim); }
.info-list dd { margin: 0; text-align: right; }
.lib-foot { margin-top: 70px; padding-top: 20px; border-top: 1px solid var(--l-line); color: var(--l-dim); font-size: 12px; }

/* oynatıcı */
.player { position: fixed; inset: 0; z-index: 400; display: flex; flex-direction: column; background: #000; }
.player[hidden] { display: none; }
.player__bar { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 12px; background: #0a0c11; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.player__title { flex: 1; margin: 0; overflow: hidden; font-size: 15px; font-weight: 600; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.player__btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .08); color: #fff; font-size: 14px; font-weight: 500; cursor: pointer; transition: background .2s; }
.player__btn:hover { background: rgba(255, 255, 255, .15); }
.player__btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.player__screen { position: relative; flex: 1; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.player__crt { position: absolute; inset: 0; z-index: 2; background: #000; pointer-events: none; }
.player__crt::after { content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 2px; margin-top: -1px; background: #e6efff; box-shadow: 0 0 22px 6px rgba(140, 185, 255, .85); transform: scaleX(0); }
.player.is-on .player__crt { animation: powerOn .7s ease-out forwards; }
.player.is-on .player__crt::after { animation: powerLine .7s ease-out forwards; }
body.is-playing { overflow: hidden; }

@media (max-width: 1000px) {
  .game__body { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .library { grid-template-columns: 1fr; padding-top: 74px; }
  .lib-side { display: none; }
  .lib-search--mobile { display: flex; }
  .lib-content { padding: 16px 16px 50px; }
  .lib-hero { height: 420px; }
  .lib-hero::after { background: linear-gradient(0deg, rgba(9, 11, 16, .95) 0%, rgba(9, 11, 16, .6) 45%, rgba(9, 11, 16, .1) 100%); }
  .lib-hero__content { left: 22px; right: 22px; bottom: 24px; }
  .lib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
  .game__title { left: 20px; bottom: 18px; }
  .game__bar { padding: 16px; }
  .game__bar .ghost-btn { margin-left: 0; }
  .boot__hud { left: 18px; bottom: 76px; }
  .boot__skip { right: 50%; transform: translateX(50%); bottom: 22px; }
  .player__btn span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cap { animation: none; }
}
