/* AyulduzLabs — Games panel (Oracle + Snake). Uses the variables from style.css */

/* ---------- floating button (always bottom-right) ---------- */
.games-fab {
  position: fixed;
  right: 1.25rem;
  left: auto;
  bottom: 1.25rem;
  z-index: 190;
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  min-height: 46px;
  padding: .55rem 1.1rem;
  border-radius: 100px;
  border: 1px solid var(--accent);
  background: rgba(10, 17, 21, .92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--color-text);
  font: 600 .82rem var(--ff);
  cursor: pointer;
  box-shadow: 0 0 24px rgba(163, 255, 79, .25);
  transition: transform .2s, box-shadow .2s, background .2s;
}
.games-fab:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px var(--color-glow), 0 0 24px rgba(163, 255, 79, .3);
  background: rgba(16, 25, 29, .96);
}
.games-fab .fab-dot {
  width: 8px; height: 8px; border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: fabBlink 1.6s steps(2) infinite;
}
@keyframes fabBlink { 50% { opacity: .3; } }
.games-fab .fab-sub { color: var(--accent); font-weight: 700; }
@media (max-width: 480px) {
  .games-fab { right: .9rem; bottom: .9rem; padding: .5rem .9rem; font-size: .76rem; }
  .games-fab .fab-long { display: none !important; }
}

/* ---------- modal ---------- */
.games-modal {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  background: rgba(5, 9, 12, .78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.games-modal.open { opacity: 1; visibility: visible; }

.games-box {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  background: linear-gradient(160deg, #111b20, #0a1115);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 60px var(--color-glow);
  transform: translateY(16px) scale(.98);
  transition: transform .25s;
}
.games-modal.open .games-box { transform: none; }

.games-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: .8rem 1.1rem;
  border-bottom: 1px solid var(--color-border);
}
.games-top .games-title {
  font: .72rem var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--accent);
  direction: ltr;
}
.games-close {
  width: 36px; height: 36px; border-radius: 8px;
  background: none; border: 1px solid var(--color-border);
  color: var(--color-text); font-size: 1.1rem; cursor: pointer;
  transition: border-color .2s, color .2s;
}
.games-close:hover { border-color: var(--accent); color: var(--accent); }

.games-tabs { display: flex; gap: .5rem; padding: 1rem 1.1rem 0; }
.games-tab {
  flex: 1; min-height: 42px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text-secondary);
  font: 600 .85rem var(--ff);
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.games-tab:hover { border-color: var(--accent); color: var(--color-text); }
.games-tab.active {
  border-color: var(--accent); color: var(--accent);
  background: rgba(163, 255, 79, .07);
}

.game-pane { display: none; padding: 1.2rem 1.1rem 1.4rem; }
.game-pane.active { display: block; }

.game-eye { font: .7rem var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--accent); margin-bottom: .4rem; text-align: center; direction: ltr; }
.game-title { text-align: center; font-size: 1.6rem; font-weight: 800; color: var(--color-text); line-height: 1.2; margin-bottom: .5rem; }
.game-title .ac { color: var(--accent); text-shadow: 0 0 30px rgba(163, 255, 79, .25); }
.game-intro { text-align: center; color: var(--color-text-secondary); font-size: .88rem; line-height: 1.9; margin-bottom: 1.2rem; }

/* ---------- oracle ---------- */
.oq { margin-bottom: 1rem; }
.oq label { display: block; margin-bottom: .4rem; font-size: .82rem; color: var(--color-text); }
.oq input {
  width: 100%; padding: .8rem .9rem;
  background: var(--bg); color: var(--color-text);
  border: 1px solid var(--color-border); border-radius: 8px;
  font: .9rem var(--ff); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.oq input:focus { border-color: var(--accent); box-shadow: 0 0 14px rgba(163, 255, 79, .15); }
.oq input::placeholder { color: var(--color-muted); }

.g-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  width: 100%; min-height: 46px; padding: .7rem 1.4rem; margin-top: .4rem;
  border: 0; border-radius: 100px;
  background: var(--accent); color: #05090c;
  font: 700 .92rem var(--ff); cursor: pointer;
  box-shadow: 0 0 24px rgba(163, 255, 79, .3);
  transition: background .2s, transform .15s, box-shadow .2s;
}
.g-btn:hover { background: var(--color-primary-hover); transform: translateY(-2px); box-shadow: 0 8px 28px var(--color-glow); }
.g-btn.ghost {
  background: rgba(255, 255, 255, .03); color: var(--color-text);
  border: 1px solid var(--color-border); box-shadow: none;
}
.g-btn.ghost:hover { border-color: var(--accent); color: var(--accent); }

.oracle-loading { text-align: center; padding: 1.6rem 0; }
.spinner {
  width: 56px; height: 56px; margin: 0 auto 1.1rem;
  border: 2px solid var(--color-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: gspin 1s linear infinite;
}
@keyframes gspin { to { transform: rotate(360deg); } }
.oracle-loading h3 { color: var(--color-text); font-size: 1rem; margin-bottom: .3rem; }
.oracle-loading p { color: var(--color-text-secondary); font-size: .82rem; }

.res-item {
  background: var(--bg); border: 1px solid var(--color-border);
  border-radius: 10px; padding: .9rem 1rem; margin-bottom: .8rem;
}
.res-item .res-q { font: .68rem var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: .3rem; }
.res-item p { color: var(--color-text-secondary); font-size: .88rem; line-height: 1.8; overflow-wrap: anywhere; }
.res-val { margin-top: .4rem; font: 800 1.4rem var(--mono); direction: ltr; text-align: start; }
.res-val.t { color: var(--accent); text-shadow: 0 0 20px rgba(163, 255, 79, .3); }
.res-val.f { color: #ff8a8a; }

.res-overall {
  text-align: center; padding: 1.2rem .8rem; margin: 1rem 0 .4rem;
  border: 1px solid var(--accent); border-radius: 12px;
  background: rgba(163, 255, 79, .05);
}
.res-overall small { display: block; font: .68rem var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--color-text-secondary); margin-bottom: .3rem; }
.res-overall h4 { font: 800 1.5rem var(--mono); direction: ltr; color: var(--color-text); margin-bottom: .3rem; }
.res-overall h4.t { color: var(--accent); text-shadow: 0 0 24px rgba(163, 255, 79, .3); }
.res-overall h4.f { color: #ff8a8a; }
.res-overall p { color: var(--color-text-secondary); font-size: .84rem; }

/* ---------- snake ---------- */
.snake-hud {
  display: flex; justify-content: space-between; align-items: center;
  font: .78rem var(--mono); color: var(--color-text-secondary);
  margin-bottom: .7rem; direction: ltr;
}
.snake-hud b { color: var(--accent); font-weight: 700; }
.snake-wrap {
  position: relative; width: 100%; max-width: 400px; margin: 0 auto;
  border: 1px solid var(--color-border); border-radius: 10px; overflow: hidden;
  background: #070d10;
  box-shadow: 0 0 40px var(--color-glow);
  touch-action: none;
}
#snake-canvas { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; }
.snake-dpad {
  display: grid; grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(2, 52px);
  gap: .4rem; justify-content: center; margin: 1rem auto 0; direction: ltr;
}
.snake-dpad button {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 10px; color: var(--accent); font-size: 1.1rem; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.snake-dpad button:active { background: rgba(163, 255, 79, .12); border-color: var(--accent); }
.snake-dpad .up { grid-column: 2; grid-row: 1; }
.snake-dpad .left { grid-column: 1; grid-row: 2; }
.snake-dpad .down { grid-column: 2; grid-row: 2; }
.snake-dpad .right { grid-column: 3; grid-row: 2; }
.snake-hint { text-align: center; color: var(--color-muted); font-size: .76rem; margin-top: .8rem; }
@media (hover: hover) and (pointer: fine) { .snake-dpad { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .games-fab .fab-dot, .spinner { animation-duration: .01ms !important; }
  .games-modal, .games-box { transition-duration: .01ms !important; }
}