/* Crystal Isles: page layout, HUD, screens and touch controls. Daylight glass over a pastel sky. */
:root {
  --ink: #1e2a4a;
  --deep: #2b2a5e;
  --white: #ffffff;
  --cyan: #5ff3ff;
  --magenta: #ff6fd8;
  --amber: #ffd25f;
  --coral: #ff7f5c;
  --glass: rgba(255, 255, 255, 0.34);
  --glass-dark: rgba(30, 36, 80, 0.32);
  --ui: var(--kit-rounded);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.defs { position: absolute; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

html, body {
  margin: 0;
  height: 100%;
  background: #9ccaff;
  color: var(--white);
  font: 600 15px/1.35 var(--ui);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

#app { position: relative; width: 100vw; height: 100vh; height: 100dvh; }
#game { position: absolute; inset: 0; }
#game canvas { display: block; width: 100%; height: 100%; cursor: grab; }
#game canvas:active { cursor: grabbing; }

.hud {
  position: absolute;
  top: max(2.2vh, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.55em;
  pointer-events: none;
  font-size: clamp(14px, 1.5vw, 27px);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  height: 2.15em;
  padding: 0 0.95em;
  border-radius: 999px;
  background: var(--glass-dark);
  backdrop-filter: blur(12px) saturate(1.4);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45), 0 0.4em 1.4em rgba(40, 50, 110, 0.22);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px rgba(20, 24, 60, 0.45);
}
.chip b { font-weight: 700; font-size: 0.62em; letter-spacing: 0.12em; text-transform: uppercase; color: #fff2c4; }
.chip .num { font-weight: 800; }
.chip .icon { width: 0.95em; height: 1.3em; filter: drop-shadow(0 0 0.35em rgba(95, 243, 255, 0.9)); }
.chip .clock { width: 1.05em; height: 1.05em; color: #fff2c4; filter: none; }
.timer .num { min-width: 2.6em; }
.chip.warn { background: rgba(200, 50, 90, 0.5); }

.screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.2vh;
  padding: 24px;
  text-align: center;
  text-shadow: 0 2px 14px rgba(30, 40, 100, 0.45);
}
.screen p { margin: 0; }
.screen-title {
  background:
    radial-gradient(ellipse 60% 52% at 50% 44%, rgba(40, 50, 120, 0.42), rgba(40, 50, 120, 0.1) 70%, rgba(40, 50, 120, 0) 100%),
    linear-gradient(to bottom, rgba(40, 60, 140, 0.25), rgba(40, 60, 140, 0) 35%);
}
.kicker { font-size: clamp(12px, 1.05vw, 18px); letter-spacing: 0.3em; text-transform: uppercase; color: #fff2c4; font-weight: 700; }
.screen-title h1 {
  margin: 0 0 0.6vh;
  font-size: clamp(54px, 8.4vw, 148px);
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #ffffff;
  text-shadow: 0 0.04em 0 #9fe8ff, 0 0.08em 0 #5fb8e8, 0 0.12em 0 #3a6fb8, 0 0.25em 0.5em rgba(30, 40, 110, 0.45), 0 0 1em rgba(95, 243, 255, 0.45);
}
.tagline { font-size: clamp(15px, 1.4vw, 23px); font-weight: 600; max-width: 30em; }
.keys { color: rgba(255, 255, 255, 0.88); font-size: clamp(12px, 0.95vw, 15px); font-weight: 600; }
.meta { color: #fff2c4; font-size: clamp(12px, 0.9vw, 14px); letter-spacing: 0.08em; text-transform: uppercase; }
.meta span + span::before { content: "· "; color: rgba(255, 255, 255, 0.7); }
.meta span:empty, .meta span:empty + span::before { display: none; }
.loading { font-size: 18px; letter-spacing: 0.04em; color: var(--ink); text-shadow: none; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }

#app > .panel {
  inset: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: min(440px, 88vw);
  padding: 32px 40px 30px;
  border-radius: 28px;
  background: linear-gradient(to bottom, rgba(70, 90, 190, 0.62), rgba(40, 46, 120, 0.72));
  backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5), 0 30px 70px rgba(30, 40, 110, 0.4);
}
.panel h2 { margin: 0 0 4px; font-size: clamp(30px, 3.4vw, 54px); font-weight: 900; letter-spacing: -0.01em; }
.big { font-size: clamp(20px, 2vw, 30px); font-weight: 800; font-variant-numeric: tabular-nums; color: #fff2c4; }

.cta {
  margin-top: 1.4vh;
  font: inherit;
  font-size: clamp(15px, 1.2vw, 20px);
  font-weight: 800;
  color: #1e2a4a;
  background: linear-gradient(to bottom, #ffffff, #c9f6ff);
  border: 0;
  border-radius: 999px;
  padding: 0.85em 2em;
  cursor: pointer;
  text-shadow: none;
  box-shadow: 0 0.3em 0 #6fb6e0, 0 0.7em 1.6em rgba(30, 40, 110, 0.4), 0 0 1.4em rgba(95, 243, 255, 0.55);
  animation: bob 1.6s ease-in-out infinite;
}
.cta:focus-visible { outline: 3px solid var(--amber); outline-offset: 5px; }
@keyframes bob { 50% { transform: translateY(-3px); } }

.status {
  position: absolute;
  left: 50%;
  bottom: max(2vh, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  margin: 0;
  padding: 0.45em 1.2em;
  max-width: calc(100% - 24px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 999px;
  font-size: clamp(12px, 0.95vw, 16px);
  background: var(--glass-dark);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  pointer-events: none;
}
.is-capturing .status, .status:empty { display: none; }

.flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, rgba(255, 120, 150, 0) 40%, rgba(255, 120, 150, 0.6)); }
.flash.on { animation: flash 0.45s ease-out; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

.combo {
  position: absolute;
  top: 34%;
  left: 50%;
  transform: translate(-50%, 0);
  font-size: clamp(22px, 2.8vw, 46px);
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 0.06em 0 #3a6fb8, 0 0 0.6em rgba(95, 243, 255, 0.9);
  opacity: 0;
  pointer-events: none;
}
.combo.on { animation: combo 0.9s ease-out; }
@keyframes combo { 0% { opacity: 0; transform: translate(-50%, 10px) scale(0.8); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.1); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -24px) scale(1); } }

.touch { position: absolute; inset: 0; pointer-events: none; }
.stick { pointer-events: auto; position: absolute; left: 28px; bottom: 40px; width: 128px; height: 128px; border-radius: 50%; background: rgba(30, 36, 80, 0.3); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55); touch-action: none; }
.knob { position: absolute; left: 34px; top: 34px; width: 60px; height: 60px; border-radius: 50%; background: rgba(255, 255, 255, 0.7); }
.touch button { pointer-events: auto; position: absolute; border: 0; border-radius: 50%; color: var(--ink); font: inherit; touch-action: none; }
.touch-jump { right: 30px; bottom: 54px; width: 92px; height: 92px; font-size: 32px; background: rgba(255, 255, 255, 0.8); }
.touch-pause { right: 20px; top: 84px; width: 46px; height: 46px; font-size: 14px; background: rgba(255, 255, 255, 0.6); }

@media (prefers-reduced-motion: reduce) { .cta, .loading { animation: none; } }
