/* AI Level Architect - graffiti-tagger platformer. Uses the sitewide tokens. */

.ar-tagline { max-width: 52ch; }
.ar-p0-note { color: var(--muted-2); font-size: 0.9em; }

.ar-app {
  max-width: 720px;
  margin: 0 auto;
  /* nothing in the play area should ever be selectable - a long-press on a
     control was popping the iOS text-selection callout (Copy / Look Up ...). */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* -- HUD -- */
.ar-hud {
  display: flex;
  justify-content: center;
  gap: 1.75rem;
  margin: 1rem 0 0.75rem;
}
.ar-stat { display: flex; flex-direction: column; align-items: center; }
.ar-stat-num {
  font-family: var(--font-display);
  font-size: 1.5rem;
  background: var(--graffiti-gradient);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}
.ar-stat-label {
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* -- stage -- */
.ar-stage {
  position: relative;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius, 12px);
  overflow: hidden;
  background: var(--ink);
  touch-action: none; /* the game handles all touch; never scroll/zoom the page here */
}
.ar-canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  position: relative;
  z-index: 1; /* the 2D game sits above the WebGL atmosphere, which shows through its transparent sky */
}
.ar-gl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* -- overlays (start / win) -- */
.ar-overlay {
  position: absolute;
  inset: 0;
  z-index: 3; /* above the game canvas (z-index 1) so the input/buttons are clickable */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(10, 9, 16, 0.72);
  backdrop-filter: blur(2px);
}
.ar-overlay[hidden] { display: none; }
.ar-overlay-card {
  text-align: center;
  max-width: 26rem;
}
.ar-overlay-title {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: clamp(1.6rem, 7vw, 2.4rem);
  color: var(--paper);
  margin: 0 0 0.5rem;
}
.ar-overlay-line {
  color: var(--muted);
  line-height: 1.5;
  margin: 0 auto 1.1rem;
}
.ar-overlay-score {
  font-family: var(--font-display);
  color: var(--spray-yellow);
  font-variant-numeric: tabular-nums;
  margin: 0 auto 1.1rem;
  line-height: 1.6;
}
.ar-overlay-score[hidden] { display: none; }

.ar-highline {
  margin: 0 auto 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.ar-highline[hidden] { display: none; }
.ar-highline strong { color: var(--spray-yellow); font-variant-numeric: tabular-nums; }
.ar-initials {
  margin: 0 auto 0.85rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface);
  border: 1px solid rgba(255, 210, 63, 0.4);
  border-radius: var(--radius, 12px);
  max-width: 22rem;
}
.ar-initials[hidden] { display: none; }
.ar-initials-label { display: block; font-size: 0.82rem; color: var(--spray-yellow); margin-bottom: 0.45rem; }
.ar-initials-row { display: flex; gap: 0.5rem; justify-content: center; }
.ar-initials-input {
  width: 5.5rem;
  font-family: var(--font-display);
  font-size: 16px; /* >= 16px so iOS doesn't zoom on focus */
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius, 12px);
  color: var(--paper);
  padding: 0.3rem 0.5rem;
}

.ar-build-form {
  display: flex;
  flex-direction: column; /* input on its own full-width row, Build button below it */
  gap: 0.55rem;
  margin: 0 auto 0.85rem;
  max-width: 30rem;
}
.ar-build-form .ar-build { width: 100%; }
.ar-theme-input {
  width: 100%;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius, 12px);
  color: var(--paper);
  padding: 0.5rem 0.85rem;
  /* MUST stay >= 16px: iOS Safari auto-zooms the whole page when you focus an
     input with a smaller font, which zoomed the game into an unusable view. */
  font-size: 16px;
}
.ar-theme-input::placeholder { color: var(--muted-2); }
.ar-overlay-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}
.ar-status {
  margin: 0.75rem 0 0;
  min-height: 1.1em;
  font-size: 0.85rem;
  color: var(--spray-yellow);
}
.ar-status[hidden] { display: none; }

/* -- generation splash (shown while the AI builds a level) -- */
.ar-splash {
  position: absolute;
  inset: 0;
  z-index: 4; /* above the overlay */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  padding: 1.5rem;
  background: rgba(10, 9, 16, 0.82);
  backdrop-filter: blur(3px);
}
.ar-splash[hidden] { display: none; }
.ar-blocks {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 62px;
}
.ar-blocks span {
  width: 12px;
  height: 18px;
  border-radius: 3px 3px 0 0;
  background: var(--graffiti-gradient);
  background-size: 100% 320%;
  box-shadow: 0 0 10px rgba(47, 209, 255, 0.35);
  animation: ar-rise 1.05s ease-in-out infinite;
}
.ar-blocks span:nth-child(2) { animation-delay: 0.12s; }
.ar-blocks span:nth-child(3) { animation-delay: 0.24s; }
.ar-blocks span:nth-child(4) { animation-delay: 0.36s; }
.ar-blocks span:nth-child(5) { animation-delay: 0.48s; }
.ar-blocks span:nth-child(6) { animation-delay: 0.60s; }
.ar-blocks span:nth-child(7) { animation-delay: 0.72s; }
@keyframes ar-rise {
  0%, 100% { height: 18px; background-position: 0 100%; opacity: 0.55; }
  50% { height: 58px; background-position: 0 0; opacity: 1; }
}
.ar-splash-title {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: clamp(1.25rem, 6vw, 1.9rem);
  margin: 0;
  text-align: center;
  max-width: 100%;
  overflow-wrap: break-word;
  text-wrap: balance;
  background: var(--graffiti-gradient);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: ar-shimmer 3.5s linear infinite;
}
@keyframes ar-shimmer { to { background-position: 220% center; } }
.ar-splash-msg {
  margin: 0;
  min-height: 1.3em;
  color: var(--muted);
  font-size: 0.9rem;
}
.ar-progress {
  width: min(82%, 22rem);
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.ar-progress-bar {
  height: 100%;
  width: 6%;
  border-radius: 999px;
  background: var(--graffiti-gradient);
  background-size: 220% auto;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.25);
  transition: width 0.15s linear;
  animation: ar-shimmer 2.5s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .ar-blocks span, .ar-splash-title, .ar-progress-bar { animation: none; }
}

/* -- touch controls -- */
/* a bar BELOW the game canvas - keeps the controls out of the play area entirely */
.ar-touch {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  max-width: 560px;
  margin: 0.6rem auto 0;
  padding: 0 0.4rem;
}
.ar-touch[hidden] { display: none; }
.ar-touch-left { display: flex; gap: 0.5rem; }
/* The <button> itself is the (generous, invisible) tap target; the visible ring
   is a smaller ::before centred inside it. So a near-miss around the ring still
   registers - the whole square is clickable, not just the circle you see. */
.ar-btn {
  pointer-events: auto;
  width: 6.75rem;
  height: 6.75rem;
  padding: 0;
  border: none;
  background: transparent;
  color: rgba(243, 239, 230, 0.92);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  font-size: 1.55rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none; /* block the long-press selection menu */
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
.ar-btn::before { /* the visible ring - smaller than the tap target */
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 4.4rem;
  height: 4.4rem;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  pointer-events: none;
}
.ar-btn:active::before { background: rgba(47, 209, 255, 0.28); border-color: var(--spray-cyan); }
.ar-btn-jump { width: 8.25rem; height: 8.25rem; font-size: 1.85rem; }
.ar-btn-jump::before { width: 5.6rem; height: 5.6rem; border-color: rgba(43, 232, 154, 0.6); }
.ar-btn-jump:active::before { background: rgba(43, 232, 154, 0.22); border-color: var(--spray-mint); }

/* desktop with a precise pointer plays with the keyboard - hide the touch pad */
@media (hover: hover) and (pointer: fine) {
  .ar-touch { display: none !important; }
}

.ar-controls-hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted-2);
  margin: 0.75rem 0 0;
}
/* on touch devices the on-screen pad is enough - drop the keyboard hint */
@media (hover: none), (pointer: coarse) {
  .ar-controls-hint { display: none; }
}
