/* ArcadeOwl — Adventure games shared shell (self-contained, premium look).
 * Per-game palette is injected by the engine as CSS variables:
 *   --ao-accent  (primary highlight)   --ao-accent2 (collectible/secondary)
 *   --ao-bg      (game background hue)
 * Every color-mix declaration is preceded by a plain fallback so older
 * browsers degrade gracefully instead of dropping the whole rule.
 */
:root {
  --ao-accent: #6ee7b7;
  --ao-accent2: #fbbf24;
  --ao-bg: #0b1117;
  --ao-ease: cubic-bezier(0.22, 1, 0.36, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  color: #e6edf3;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none; user-select: none;
  overflow: hidden;
  background: #070b0f; /* fallback */
  background:
    radial-gradient(120% 80% at 50% -10%, color-mix(in srgb, var(--ao-bg) 65%, transparent) 0%, transparent 60%),
    radial-gradient(90% 60% at 100% 0%, color-mix(in srgb, var(--ao-accent) 14%, transparent) 0%, transparent 55%),
    #070b0f;
}
.ao-root {
  display: flex; flex-direction: column; gap: 10px; height: 100%;
  padding: 12px; max-width: 720px; margin: 0 auto;
}

/* ---- top bar : glassy ---- */
.ao-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 13px; padding: 8px 12px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.ao-title {
  font-weight: 800; letter-spacing: 0.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: #fff; /* fallback */
  background: linear-gradient(90deg, #fff, var(--ao-accent)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.ao-stats { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.ao-stats b { color: #fff; }
.ao-best { color: var(--ao-accent) !important; }
.ao-btn {
  background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.1); color: #fff;
  padding: 6px 11px; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer;
  transition: transform 0.12s var(--ao-ease), background 0.18s, box-shadow 0.18s;
}
.ao-btn:hover { background: rgba(255, 255, 255, 0.2); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); }
.ao-btn:active { transform: translateY(0) scale(0.96); }
.ao-icon { padding: 6px 9px; line-height: 1; }
.ao-score-wrap { position: relative; display: inline-block; }
.ao-pop { position: absolute; left: 50%; top: -2px; transform: translateX(-50%); color: var(--ao-accent); font-weight: 800; opacity: 0; pointer-events: none; white-space: nowrap; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.ao-pop-go { animation: ao-pop-up 0.75s var(--ao-ease); }
@keyframes ao-pop-up { 0% { opacity: 1; transform: translate(-50%, 2px) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -22px) scale(1); } }

/* ---- story / objective ribbon ---- */
.ao-story {
  font-size: 12.5px; color: rgba(255, 255, 255, 0.82); text-align: center; padding: 7px 12px;
  border-radius: 11px; line-height: 1.4;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-left: 3px solid var(--ao-accent);
  animation: ao-fade-in 0.5s var(--ao-ease) both;
}
@keyframes ao-fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- stage / canvas ---- */
.ao-stage { position: relative; width: 100%; display: flex; justify-content: center; }
.ao-canvas {
  display: block; width: 100%; max-width: 640px; border-radius: 16px; touch-action: none;
  background: var(--ao-bg);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06); /* fallback */
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06),
              inset 0 0 60px color-mix(in srgb, var(--ao-accent) 8%, transparent);
}

/* ---- in-canvas status card (start / pause / game over) ---- */
.ao-status {
  position: absolute; inset: 0; display: none; place-items: center; pointer-events: none;
  font-weight: 700; color: #fff; padding: 18px; text-align: center; font-size: 16px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}
.ao-status:not(:empty) {
  display: grid;
  background: radial-gradient(60% 60% at 50% 45%, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.18) 70%, transparent);
  animation: ao-card-in 0.32s var(--ao-ease);
}
@keyframes ao-card-in { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }

.ao-hint { font-size: 11px; color: rgba(255, 255, 255, 0.5); text-align: center; min-height: 14px; }

/* ---- touch controls : tactile ---- */
.ao-pad { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.ao-dpad { display: grid; grid-template-columns: repeat(3, 46px); grid-template-rows: repeat(3, 46px); gap: 5px; }
.ao-key {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.12); color: #fff; border-radius: 12px; font: inherit; font-size: 19px;
  cursor: pointer; height: 46px; min-width: 46px; touch-action: none;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 0.08s var(--ao-ease), box-shadow 0.12s, background 0.12s;
}
.ao-key:active {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.32); /* fallback */
  background: linear-gradient(180deg, color-mix(in srgb, var(--ao-accent) 55%, rgba(255, 255, 255, 0.2)), rgba(255, 255, 255, 0.12));
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3); /* fallback */
  box-shadow: 0 0 14px color-mix(in srgb, var(--ao-accent) 60%, transparent), inset 0 2px 6px rgba(0, 0, 0, 0.3);
}
.ao-act {
  border-radius: 999px; width: 60px; height: 60px; font-size: 22px; color: #06210b;
  background: var(--ao-accent); /* fallback */
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--ao-accent) 70%, #fff), color-mix(in srgb, var(--ao-accent) 75%, #000));
}
.ao-wide { width: 190px; height: 50px; font-size: 15px; font-weight: 700; border-radius: 14px; }

/* ---- leaderboard ---- */
.ao-lb { font-size: 12px; color: rgba(255, 255, 255, 0.82); }
.ao-lb-h { font-weight: 700; margin-bottom: 5px; color: var(--ao-accent); }
.ao-lb ol { list-style: none; margin: 0; padding: 0; }
.ao-lb li {
  display: flex; justify-content: space-between; padding: 4px 10px; margin-bottom: 3px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.05);
  animation: ao-fade-in 0.4s var(--ao-ease) both;
}
.ao-lb b { color: var(--ao-accent); }

/* Show the pad only where touch is the primary input. */
@media (min-width: 700px) and (pointer: fine) { .ao-pad { display: none; } }

/* Respect users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
  .ao-pop-go, .ao-story, .ao-lb li, .ao-status:not(:empty), .ao-btn, .ao-key { animation: none !important; transition: none !important; }
}
