/* Rackoban — hang & fény technikai Sokoban, Vizuál Tipp brand */

@font-face {
  font-family: "Machineltc";
  src: url("../fonts/MachineltcDEE.woff2") format("woff2");
  font-display: swap;
}

:root {
  --void: #050508;
  --stage: #0b0d12;
  --panel: #121018;
  --slate: #1c1824;
  --primary: #f4f5f7;
  --secondary: #9aa3b2;
  --muted: #5c6578;
  --accent: #00e5ff;
  --signal: #2ee59d;
  --amber: #ffb020;
  --magenta: #e040a0;
  --wall: #0d0a10;
  --floor: #14111a;
  --grid-line: rgba(255, 176, 32, 0.05);
  --target: rgba(255, 176, 32, 0.55);
  --target-glow: rgba(255, 176, 32, 0.12);
  --rack-frame: #2a2630;
  --rack-edge: #4a4458;
  --rack-on-target: #2a2418;
  --font-display: "Segoe UI", system-ui, sans-serif;
  --font-body: "Segoe UI", system-ui, sans-serif;
  --font-logo: "Machineltc", var(--font-display);
  --cell-size: clamp(2.25rem, 6.5vw, 3.25rem);
  --transition-move: 120ms cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  background: var(--void);
  color: var(--secondary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 45% at 50% -15%, rgba(255, 176, 32, 0.09), transparent),
    radial-gradient(ellipse 50% 35% at 0% 80%, rgba(224, 64, 160, 0.06), transparent),
    radial-gradient(ellipse 50% 35% at 100% 60%, rgba(0, 229, 255, 0.05), transparent);
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}

/* —— Header & logo —— */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.logo {
  font-family: var(--font-logo);
  font-size: clamp(1.5rem, 4vw, 2.125rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--primary);
  text-decoration: none;
  line-height: 1;
  transition: color 0.2s;
}

.logo:hover {
  color: var(--accent);
}

.logo span {
  color: var(--accent);
}

.game-title {
  text-align: right;
}

.game-title h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3.5vw, 1.75rem);
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.game-title .tagline {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* —— Panels —— */
.panel {
  background: rgba(18, 16, 24, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  backdrop-filter: blur(8px);
}

/* —— Screens —— */
.screen {
  display: none;
  animation: fadeUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.screen.active {
  display: block;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* —— Menu —— */
.menu-panel {
  padding: 2.5rem 1.5rem;
  text-align: center;
  box-shadow: 0 0 80px rgba(255, 176, 32, 0.06);
}

.menu-hero {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.menu-hero__light,
.menu-hero__case {
  width: 2.5rem;
  height: 2.75rem;
  border-radius: 4px;
  position: relative;
}

.menu-hero__light {
  background: linear-gradient(180deg, #3a3548 0%, #1e1c28 100%);
  border: 1px solid var(--rack-edge);
  box-shadow: 0 0 16px rgba(255, 176, 32, 0.35);
}

.menu-hero__light::before {
  content: "";
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  width: 55%;
  height: 35%;
  background: radial-gradient(circle at 50% 30%, #fff8e0, var(--amber) 45%, transparent 70%);
  border-radius: 50% 50% 20% 20%;
}

.menu-hero__light::after {
  content: "";
  position: absolute;
  bottom: 8%;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  height: 8%;
  background: #111;
  border-radius: 2px;
}

.menu-hero__case {
  background: center / contain no-repeat url("images/flight-case.png");
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.menu-panel h2 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--primary);
}

.menu-panel p {
  margin: 0 auto 1.75rem;
  max-width: 28rem;
  color: var(--secondary);
  font-size: 0.95rem;
}

.menu-panel .rules {
  text-align: left;
  margin: 0 auto 1.75rem;
  max-width: 22rem;
  padding: 1rem 1.25rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.menu-panel .rules li {
  margin: 0.35rem 0;
}

/* —— Buttons —— */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s, border-color 0.2s, color 0.2s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--amber);
  color: var(--void);
}

.btn-primary:hover {
  box-shadow: 0 0 28px rgba(255, 176, 32, 0.45);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.02);
  color: var(--primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  border-color: rgba(255, 176, 32, 0.45);
  color: var(--amber);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* —— HUD —— */
.hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
}

.hud-block {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.hud-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.hud-value {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
}

.hud-value.accent {
  color: var(--amber);
}

.hud-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hud-actions .btn {
  padding: 0.5rem 0.9rem;
  font-size: 0.7rem;
}

/* —— Játéktér: pálya + irányítás —— */
.play-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
}

.board-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
  overflow-x: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  cursor: grab;
}

.board-wrap:active {
  cursor: grabbing;
}

.board {
  display: grid;
  gap: 2px;
  padding: 4px;
  background: #0a080e;
  border-radius: 8px;
  border: 1px solid rgba(255, 176, 32, 0.15);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 12px 40px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  position: relative;
  border-radius: 3px;
  transition: background-color var(--transition-move);
}

.cell--floor {
  background-color: var(--floor);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: calc(var(--cell-size) / 4) calc(var(--cell-size) / 4);
}

.cell--wall {
  background: linear-gradient(145deg, #16121c 0%, var(--wall) 100%);
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.02);
}

/* Célmező = szalag jelölés / rig pozíció */
.cell--target::after {
  content: "";
  position: absolute;
  inset: 16%;
  border: 2px dashed var(--target);
  border-radius: 3px;
  background: var(--target-glow);
  box-shadow: 0 0 10px var(--target-glow);
  pointer-events: none;
  z-index: 0;
}

.cell--target::before {
  content: "";
  position: absolute;
  inset: 38%;
  border: 1px solid rgba(255, 176, 32, 0.25);
  transform: rotate(45deg);
  pointer-events: none;
  z-index: 0;
}

.cell--target-filled::after {
  border-style: solid;
  border-color: var(--signal);
  background: rgba(46, 229, 157, 0.1);
  box-shadow: 0 0 14px rgba(46, 229, 157, 0.28);
}

.cell--target-filled::before {
  border-color: rgba(46, 229, 157, 0.35);
}

/* Entitások */
.entity {
  position: absolute;
  inset: 5%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-move), opacity 0.15s;
}

.entity.moving {
  z-index: 3;
}

/* AV technikus */
.technician {
  width: 70%;
  height: 82%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.technician__hat {
  width: 78%;
  height: 22%;
  background: linear-gradient(180deg, #f0c040 0%, var(--amber) 55%, #c88a10 100%);
  border-radius: 4px 4px 2px 2px;
  position: relative;
  z-index: 2;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}

.technician__hat::after {
  content: "";
  position: absolute;
  bottom: -3px;
  left: -8%;
  right: -8%;
  height: 5px;
  background: #c88a10;
  border-radius: 2px;
}

.technician__head {
  width: 42%;
  height: 18%;
  margin-top: -4%;
  background: #c9a88a;
  border-radius: 50%;
  z-index: 1;
}

.technician__body {
  width: 62%;
  flex: 1;
  margin-top: -2%;
  background: linear-gradient(180deg, #2a2830 0%, #1a1820 100%);
  border-radius: 4px 4px 2px 2px;
  position: relative;
  border: 1px solid #3a3848;
}

.technician__vest {
  position: absolute;
  inset: 8% 10% 28% 10%;
  background: repeating-linear-gradient(
    0deg,
    var(--amber) 0px,
    var(--amber) 4px,
    #1a1820 4px,
    #1a1820 8px
  );
  border-radius: 2px;
  opacity: 0.95;
}

.technician__tool {
  position: absolute;
  right: -18%;
  bottom: 22%;
  width: 28%;
  height: 8%;
  background: #8a9098;
  border-radius: 2px;
  transform: rotate(-25deg);
  box-shadow: 2px 0 0 #5a6068;
}

.technician__tool::after {
  content: "";
  position: absolute;
  right: -35%;
  top: 50%;
  transform: translateY(-50%);
  width: 140%;
  height: 180%;
  border: 2px solid #8a9098;
  border-radius: 0 3px 3px 0;
  border-left: none;
}

.technician__legs {
  width: 68%;
  height: 14%;
  display: flex;
  justify-content: space-between;
  gap: 12%;
  margin-top: -1px;
}

.technician__legs::before,
.technician__legs::after {
  content: "";
  flex: 1;
  height: 100%;
  background: #252228;
  border-radius: 0 0 3px 3px;
  border: 1px solid #3a3848;
}

/* Flight case (road case) — tolható láda */
.flight-case {
  width: 94%;
  height: 94%;
  background: center / contain no-repeat url("images/flight-case.png");
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.55));
  border-radius: 4px;
  transition: filter 0.2s ease;
}

.flight-case--on-target {
  filter:
    drop-shadow(0 0 14px rgba(46, 229, 157, 0.55))
    drop-shadow(0 0 6px rgba(0, 229, 255, 0.35))
    drop-shadow(0 3px 10px rgba(0, 0, 0, 0.55));
}

/* Mozgás animáció */
.entity.slide-up {
  animation: slideUp var(--transition-move) forwards;
}
.entity.slide-down {
  animation: slideDown var(--transition-move) forwards;
}
.entity.slide-left {
  animation: slideLeft var(--transition-move) forwards;
}
.entity.slide-right {
  animation: slideRight var(--transition-move) forwards;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}
@keyframes slideDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}
@keyframes slideLeft {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}
@keyframes slideRight {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

/* —— Win —— */
.win-panel {
  margin-top: 1rem;
  padding: 1.5rem;
  text-align: center;
}

.win-panel h3 {
  margin: 0 0 0.5rem;
  color: var(--amber);
  font-family: var(--font-display);
  font-size: 1.35rem;
}

.win-panel p {
  margin: 0 0 1rem;
  color: var(--secondary);
}

/* —— Iránygombok (mindig látható játék közben) —— */
.touch-controls {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  touch-action: manipulation;
}

.touch-controls__label {
  margin: 0;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.touch-controls__hint {
  margin: 0;
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
  max-width: 9rem;
  line-height: 1.35;
}

.touch-controls__pad {
  display: grid;
  grid-template-columns: repeat(3, 3.5rem);
  grid-template-rows: repeat(3, 3.5rem);
  gap: 0.35rem;
}

.touch-controls__pad .dpad-btn:nth-child(1) {
  grid-column: 2;
  grid-row: 1;
}

.touch-controls__pad .dpad-btn:nth-child(2) {
  grid-column: 1;
  grid-row: 2;
}

.touch-controls__pad .dpad-btn:nth-child(3) {
  grid-column: 2;
  grid-row: 2;
}

.touch-controls__pad .dpad-btn:nth-child(4) {
  grid-column: 3;
  grid-row: 2;
}

.dpad-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--primary);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition:
    background 0.12s,
    border-color 0.12s,
    transform 0.1s,
    box-shadow 0.12s;
}

.dpad-btn:hover {
  border-color: rgba(255, 176, 32, 0.5);
  color: var(--amber);
}

.dpad-btn:active {
  background: rgba(255, 176, 32, 0.2);
  border-color: var(--amber);
  color: var(--amber);
  transform: scale(0.94);
  box-shadow: 0 0 18px rgba(255, 176, 32, 0.3);
}

@media (min-width: 720px) {
  .play-zone {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
  }

  .board-wrap {
    flex: 0 1 auto;
  }

  .touch-controls {
    margin: 0;
  }

  .touch-controls__hint {
    max-width: 8rem;
  }
}

.load-warning {
  margin: 0 0 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #ffb020;
  background: rgba(255, 176, 32, 0.1);
  border: 1px solid rgba(255, 176, 32, 0.35);
  border-radius: 8px;
}

.load-warning[hidden] {
  display: none;
}

.level-hint {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
  text-align: center;
  padding: 0 0.5rem;
}

.footer-note {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}

.footer-note a {
  color: var(--accent);
  text-decoration: none;
}

.footer-note a:hover {
  text-decoration: underline;
}

@media (max-width: 520px) {
  :root {
    --cell-size: clamp(2.5rem, 14vw, 3rem);
  }

  .hud {
    flex-direction: column;
    align-items: stretch;
  }

  .hud-actions {
    justify-content: center;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .game-title {
    text-align: left;
  }

  .play-zone {
    padding: 0.65rem;
  }

  .touch-controls__pad {
    grid-template-columns: repeat(3, 3.75rem);
    grid-template-rows: repeat(3, 3.75rem);
    gap: 0.4rem;
  }

  .dpad-btn {
    width: 3.75rem;
    height: 3.75rem;
    font-size: 1.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .screen.active {
    animation: none;
  }

  .entity,
  .cell {
    transition: none;
  }

  .entity.slide-up,
  .entity.slide-down,
  .entity.slide-left,
  .entity.slide-right {
    animation: none;
  }
}
