/* ============================================================
   InnoSisters — style.css
   Retro-dunkle UI, scharfe Canvas-Skalierung, Touch-Steuerung.
   Keine externen Schriften, keine externen Assets.
   Alle Pfade sind relativ (Unterverzeichnis-tauglich).
   ============================================================ */

:root {
  --bg-0: #0d0a20;
  --bg-1: #18113b;
  --bg-2: #241a4f;
  --ink: #f4f1ff;
  --ink-dim: #b9b3d9;
  --accent: #00f5d4;
  --accent-2: #f72585;
  --warn: #ffd166;
  --danger: #ff5d8f;
  --panel: rgba(13, 10, 32, 0.92);
  --panel-border: rgba(123, 47, 247, 0.45);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  background: radial-gradient(120% 120% at 50% 0%, var(--bg-1) 0%, var(--bg-0) 70%);
  color: var(--ink);
  font-family: "Courier New", ui-monospace, Menlo, Consolas, monospace;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ---------- Bühnen-Layout ---------- */

#app {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#stage {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  aspect-ratio: 16 / 9;
  max-height: 100vh;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: var(--bg-0);
  touch-action: none;
}

/* ---------- Overlays / Screens ---------- */

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 10px;
  text-align: center;
  background: var(--panel);
  backdrop-filter: blur(2px);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  z-index: 20;
}

.screen[hidden] {
  display: none;
}

.screen.overlay {
  background: rgba(13, 10, 32, 0.82);
}

.title {
  font-size: clamp(26px, 6vw, 46px);
  letter-spacing: 0.12em;
  color: var(--ink);
  text-shadow:
    0 0 8px rgba(0, 245, 212, 0.8),
    0 0 22px rgba(247, 37, 133, 0.6),
    2px 2px 0 rgba(247, 37, 133, 0.85);
}

.subtitle {
  color: var(--ink-dim);
  font-size: clamp(10px, 1.8vw, 14px);
  letter-spacing: 0.2em;
}

.screen-title {
  font-size: clamp(16px, 3vw, 26px);
  letter-spacing: 0.1em;
  margin-bottom: 0.3rem;
  color: var(--ink);
}

.menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.4rem;
}

.menu-btn {
  font: inherit;
  font-size: clamp(12px, 2vw, 16px);
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 0.5em 1.4em;
  min-width: 220px;
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: border-color 120ms, transform 120ms, box-shadow 120ms;
}

.menu-btn:hover,
.menu-btn:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(0, 245, 212, 0.45);
  outline: none;
}

.menu-btn:active {
  transform: translateY(1px);
}

.menu-btn.danger {
  border-color: rgba(255, 93, 143, 0.7);
}

.menu-btn.danger:hover,
.menu-btn.danger:focus-visible {
  border-color: var(--danger);
  box-shadow: 0 0 10px rgba(255, 93, 143, 0.5);
}

.menu-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.small {
  font-size: clamp(9px, 1.4vw, 12px);
}

.dim {
  color: var(--ink-dim);
  min-height: 1em;
}

.dialog-text {
  color: var(--ink-dim);
  max-width: 420px;
  line-height: 1.5;
}

.dialog-text.warning {
  color: var(--warn);
}

/* ---------- Einstellungen ---------- */

.settings {
  align-items: flex-start;
}

.setting-row {
  font-size: clamp(12px, 1.8vw, 15px);
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.15em 0;
}

.setting-slider {
  width: 260px;
  flex-wrap: wrap;
}

.setting-slider input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 28px;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---------- Levelauswahl ---------- */

.level-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(420px, 90%);
  max-height: 55vh;
  overflow-y: auto;
  padding: 0.2rem;
}

.level-card {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 0.8em;
  align-items: center;
  text-align: left;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 0.6em 0.8em;
  background: rgba(36, 26, 79, 0.5);
}

.level-card h3 {
  font-size: clamp(12px, 1.8vw, 15px);
}

.level-num {
  font-size: clamp(18px, 3vw, 26px);
  color: var(--accent);
  text-align: center;
}

.level-meta {
  font-size: clamp(9px, 1.3vw, 12px);
  color: var(--ink-dim);
  display: flex;
  flex-direction: column;
  gap: 0.1em;
}

.level-status {
  font-size: clamp(9px, 1.3vw, 12px);
  padding: 0.2em 0.6em;
  border-radius: 3px;
  border: 1px solid;
  white-space: nowrap;
}

.level-status.status-locked {
  color: var(--danger);
  border-color: rgba(255, 93, 143, 0.6);
}

.level-status.status-open {
  color: var(--warn);
  border-color: rgba(255, 209, 102, 0.6);
}

.level-status.status-done {
  color: var(--accent);
  border-color: rgba(0, 245, 212, 0.6);
}

.level-card .menu-btn {
  min-width: 110px;
  padding: 0.4em 1em;
}

/* ---------- Ergebnis ---------- */

.results-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: min(320px, 90%);
}

.results-list .row {
  display: flex;
  justify-content: space-between;
  gap: 1em;
  font-size: clamp(11px, 1.8vw, 15px);
  color: var(--ink-dim);
}

.results-list .row b {
  color: var(--ink);
}

.results-list .row.record b {
  color: var(--accent);
}

/* ---------- Hilfe / Anleitung ---------- */

.help-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
  width: min(640px, 94%);
  max-height: 58vh;
  overflow-y: auto;
  padding: 0.2rem;
  text-align: left;
}

.help-card {
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 0.6em 0.8em;
  background: rgba(36, 26, 79, 0.5);
  font-size: clamp(10px, 1.5vw, 13px);
  line-height: 1.45;
}

.help-card h3 {
  font-size: clamp(11px, 1.6vw, 14px);
  margin-bottom: 0.3em;
  color: var(--accent);
}

/* ---------- Touch-Steuerung ---------- */

#touch-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30;
  touch-action: none;
}

#touch-controls[hidden] {
  display: none;
}

.tc-group {
  position: absolute;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: 12px;
  align-items: flex-end;
  pointer-events: none;
}

.tc-left-group {
  left: 12px;
}

.tc-right-group {
  right: 12px;
}

.tc-btn {
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  font: inherit;
  font-size: 20px;
  color: var(--ink);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(244, 241, 255, 0.55);
  background: rgba(36, 26, 79, 0.45);
  backdrop-filter: blur(1px);
  cursor: pointer;
}

.tc-btn:active,
.tc-btn.pressed {
  background: rgba(0, 245, 212, 0.35);
  border-color: var(--accent);
}

.tc-jump {
  width: 76px;
  height: 76px;
  border-color: rgba(0, 245, 212, 0.7);
}

.tc-switch {
  border-color: rgba(247, 37, 133, 0.8);
  color: var(--accent-2);
}

.tc-sprint {
  font-size: 15px;
}

.tc-pause {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  font-size: 15px;
  pointer-events: auto;
  touch-action: none;
}

#touch-controls[hidden] .tc-pause {
  display: none;
}

@media (pointer: fine) {
  #touch-controls {
    display: none !important;
  }
}

/* ---------- Orientierungshinweis ---------- */

#orientation-hint {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  background: rgba(13, 10, 32, 0.85);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--ink-dim);
  max-width: 92%;
  text-align: center;
  pointer-events: none;
}

#orientation-hint[hidden] {
  display: none;
}

/* ---------- Sonstiges ---------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Reduzierte Bewegung: UI-Animationen abschalten */
@media (prefers-reduced-motion: reduce) {
  .menu-btn,
  .tc-btn {
    transition: none;
  }
}

body.reduced-motion .menu-btn,
body.reduced-motion .tc-btn {
  transition: none;
}
