/**
 * MTXGAMES.LK — Tactical Tile Guide Stylesheet
 * Cyberpunk Terminal Mobile-Scaled UI for In-App WebView & Web Browsers
 */

:root {
  --bg-primary: #050508;
  --bg-surface: #0a0a14;
  --bg-card: #10101f;
  --cyan-bright: #00f3ff;
  --cyan-accent: #3dffff;
  --cyan-dim: #024555;
  --purple-accent: #a78bfa;
  --green-pass: #10b981;
  --red-fail: #ef4444;
  --yellow-warn: #eab308;
  --text-white: #f8fafc;
  --text-muted: #94a3b8;
  --border-dim: rgba(255, 255, 255, 0.08);
  --border-cyan: rgba(61, 255, 255, 0.25);
  --font-mono: 'Consolas', 'Courier New', monospace;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background-color: var(--bg-primary);
  color: var(--text-white);
  font-family: var(--font-sans);
  min-height: 100%;
  width: 100%;
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
}

/* Header & Identity */
.guide-header {
  border-bottom: 1px solid var(--border-cyan);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.guide-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(61, 255, 255, 0.1);
  border: 1px solid var(--cyan-accent);
  color: var(--cyan-accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.guide-title {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--text-white);
  letter-spacing: 0.05em;
  line-height: 1.2;
}

.guide-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--purple-accent);
  text-transform: uppercase;
  margin-top: 3px;
}

/* GIF & Animation Visual Container */
.media-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--border-cyan);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.15);
}

.media-container img,
.media-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* GIF Placeholder Animation (Shown until Skia GIFs are produced) */
.gif-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  background: radial-gradient(circle, rgba(0, 243, 255, 0.08) 0%, rgba(5, 5, 8, 0.95) 75%);
  width: 100%;
  height: 100%;
}

.simulated-grid {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.simulated-cell {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: bold;
  border: 1.5px solid var(--cyan-accent);
  background: rgba(0, 26, 42, 0.8);
  box-shadow: 0 0 10px rgba(61, 255, 255, 0.2);
}

.simulated-arrow {
  color: var(--cyan-accent);
  font-size: 18px;
  animation: pulse-arrow 1.2s infinite ease-in-out;
}

@keyframes pulse-arrow {
  0%, 100% { opacity: 0.4; transform: translateX(0); }
  50% { opacity: 1; transform: translateX(4px); }
}

.placeholder-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--cyan-accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Content & Operational Breakdown */
.content-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-dim);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.guide-text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
}

.guide-text strong {
  color: var(--text-white);
}

/* Tactical Highlights */
.tactical-rule {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  font-family: var(--font-mono);
}

.rule-success {
  background: rgba(16, 185, 129, 0.1);
  border-left: 3px solid var(--green-pass);
  color: #34d399;
}

.rule-alert {
  background: rgba(239, 68, 68, 0.1);
  border-left: 3px solid var(--red-fail);
  color: #f87171;
}

.rule-info {
  background: rgba(167, 139, 250, 0.1);
  border-left: 3px solid var(--purple-accent);
  color: #c4b5fd;
}

/* Footer Status */
.guide-footer {
  margin-top: auto;
  padding-top: 14px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ==========================================================================
   5x5 / 9x9 Interactive / Animated Board Simulation
   ========================================================================== */

.media-container.board-5x5,
.media-container.board-9x9 {
  aspect-ratio: 1 / 1;
  max-width: 360px;
  margin: 0 auto 16px auto;
  position: relative;
  overflow: hidden;
  background: #02050b;
  border: 1px solid var(--border-cyan);
  border-radius: 12px;
  box-shadow: 0 0 25px rgba(0, 243, 255, 0.12);
}

.board-grid-5x5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  width: 100%;
  height: 100%;
  gap: 5px;
  padding: 10px;
  box-sizing: border-box;
  position: relative;
  background: radial-gradient(circle at 50% 90%, rgba(0, 255, 102, 0.08) 0%, rgba(2, 5, 11, 0.95) 75%);
}

.board-grid-9x9 {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  width: 100%;
  height: 100%;
  gap: 3px;
  padding: 8px;
  box-sizing: border-box;
  position: relative;
  background: radial-gradient(circle at 20% 80%, rgba(0, 255, 102, 0.05) 0%, rgba(2, 5, 11, 0.95) 70%);
}

.board-cell {
  background: rgba(3, 18, 30, 0.6);
  border: 1px solid rgba(0, 243, 255, 0.09);
  border-radius: 4px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.board-cell::after {
  content: '';
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(0, 243, 255, 0.16);
  pointer-events: none;
}

/* Grid coordinate hint */
.board-cell .coord-tag {
  position: absolute;
  top: 2px;
  left: 2px;
  font-family: var(--font-mono);
  font-size: 7px;
  color: rgba(0, 243, 255, 0.35);
  letter-spacing: -0.05em;
  pointer-events: none;
}

/* Traversed packet track highlight */
.board-cell.cell-traversed {
  background: rgba(0, 243, 255, 0.22);
  border-color: rgba(0, 243, 255, 0.6);
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.35);
}

/* Starter Node Cell */
.board-cell.start-node-cell {
  background: rgba(0, 36, 16, 0.85);
  border: 1.5px solid #00ff66;
  box-shadow: 0 0 14px rgba(0, 255, 102, 0.35);
  z-index: 2;
  overflow: visible;
}

.board-cell.start-node-cell::after {
  display: none;
}

.board-cell.start-node-cell.node-tapped {
  animation: node-flash 0.4s ease-out;
}

@keyframes node-flash {
  0% {
    background: rgba(0, 255, 102, 0.5);
    box-shadow: 0 0 25px #00ff66, 0 0 45px #3dffff;
    transform: scale(0.95);
  }
  100% {
    background: rgba(0, 36, 16, 0.85);
    box-shadow: 0 0 14px rgba(0, 255, 102, 0.35);
    transform: scale(1);
  }
}

/* Approach 1 Replaceable SVG Icon */
.node-icon-img {
  width: 82%;
  height: 82%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(0, 255, 102, 0.8));
}

/* Tap Ripple Effect */
.tap-ripple {
  position: absolute;
  inset: -4px;
  border-radius: 8px;
  border: 2px solid #00ff66;
  box-shadow: 0 0 18px #00ff66;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.8);
}

.tap-ripple.ripple-cyan {
  border-color: #00f3ff;
  box-shadow: 0 0 18px #00f3ff;
}

.tap-ripple.active {
  animation: ripple-expand 0.6s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes ripple-expand {
  0% {
    opacity: 1;
    transform: scale(0.8);
  }
  100% {
    opacity: 0;
    transform: scale(2.6);
  }
}

/* Packet Object */
.packet-object {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 10px #00f3ff, 0 0 22px #00f3ff, 0 0 35px #38bdf8;
  pointer-events: none;
  z-index: 10;
  transform: translate(-50%, -50%);
  opacity: 0;
  will-change: transform, opacity;
}

/* Packet Trail */
.packet-trail {
  position: absolute;
  width: 5px;
  height: 24px;
  background: linear-gradient(to top, transparent, #00f3ff);
  border-radius: 3px;
  pointer-events: none;
  z-index: 9;
  transform: translate(-50%, 0);
  opacity: 0;
  will-change: transform, opacity;
}

/* Hand Pointer */
.hand-pointer {
  position: absolute;
  top: 0;
  left: 0;
  width: 48px;
  height: 48px;
  pointer-events: none;
  z-index: 30;
  opacity: 0;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.85));
  will-change: transform, opacity;
  transform-origin: 21.5px 4.5px; /* Exact tip of index finger */
}

.hand-pointer img {
  width: 100%;
  height: 100%;
  display: block;
}

/* Simple Explanation / No-Jargon Card */
.simple-card {
  background: rgba(10, 16, 26, 0.85);
  border: 1px solid rgba(0, 243, 255, 0.2);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.simple-lead {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.simple-finger {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
  animation: gentle-tap 1.8s infinite ease-in-out;
}

@keyframes gentle-tap {
  0%, 100% { transform: scale(1) translate(0, 0); }
  50% { transform: scale(0.92) translate(-2px, 2px); }
}

.simple-title {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-white);
  line-height: 1.35;
}

.simple-title .highlight-green {
  color: #00ff66;
  text-shadow: 0 0 10px rgba(0, 255, 102, 0.5);
}

.simple-sub {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
  padding-left: 36px;
}

/* ==========================================================================
   Drag & Drop Tile Placement Simulation
   ========================================================================== */

.media-container.drag-demo {
  aspect-ratio: auto;
  min-height: 440px;
  max-width: 360px;
  margin: 0 auto 16px auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  overflow: hidden;
  background: #02050b;
  border: 1px solid var(--border-cyan);
  border-radius: 12px;
  box-shadow: 0 0 25px rgba(0, 243, 255, 0.12);
}

.drag-demo .board-grid-5x5 {
  width: 100%;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
}

/* Target cell highlighting */
.board-cell.target-cell-indicator {
  border: 1.5px dashed rgba(0, 243, 255, 0.45);
  background: rgba(0, 243, 255, 0.05);
}

.board-cell.target-cell-indicator.snap-ready {
  border-color: #00f0ff;
  border-style: solid;
  background: rgba(0, 243, 255, 0.25);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.45);
}

.board-cell.cell-selected {
  border: 2px solid #3dffff;
  background: rgba(0, 243, 255, 0.28);
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.7), inset 0 0 10px rgba(61, 255, 255, 0.4);
  animation: cell-selected-pulse 1.2s infinite ease-in-out;
}

@keyframes cell-selected-pulse {
  0%, 100% {
    box-shadow: 0 0 16px rgba(0, 243, 255, 0.6), inset 0 0 8px rgba(61, 255, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 26px rgba(0, 243, 255, 0.9), inset 0 0 14px rgba(61, 255, 255, 0.55);
  }
}

.board-cell.swap-flash {
  animation: swap-cell-flash 0.55s ease-out;
}

@keyframes swap-cell-flash {
  0% {
    background: rgba(0, 243, 255, 0.45);
    box-shadow: 0 0 24px #00f3ff;
  }
  100% {
    background: rgba(3, 18, 30, 0.6);
    box-shadow: none;
  }
}

/* Floating Status Text */
.floating-text-label {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #00f3ff;
  text-shadow: 0 0 8px rgba(0, 243, 255, 0.9), 0 0 16px rgba(0, 243, 255, 0.5);
  pointer-events: none;
  z-index: 40;
  opacity: 0;
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

.floating-text-label.active {
  animation: float-up-fade 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes float-up-fade {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.85);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -10px) scale(1.05);
  }
  75% {
    opacity: 0.9;
    transform: translate(-50%, -24px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -36px) scale(0.95);
  }
}

/* Placed Tile on Board */
.placed-tile-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: rgba(0, 26, 42, 0.9);
  border: 1.5px solid #00f0ff;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.35);
  transition: opacity 0.45s ease;
  z-index: 2;
}

/* Inventory Tray */
.inventory-rack {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(2, 12, 22, 0.8);
  border: 1px solid rgba(0, 243, 255, 0.2);
  border-radius: 8px;
  box-sizing: border-box;
}

.inventory-rack-label {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  color: rgba(0, 243, 255, 0.6);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.inventory-slots-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.inventory-slot {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  background: rgba(0, 26, 42, 0.85);
  border: 1.5px solid #00f0ff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.25);
  transition: opacity 0.4s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.25s ease;
}

.inventory-slot.slot-selected {
  border-color: #3dffff;
  border-width: 2px;
  background: rgba(0, 45, 75, 0.95);
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.8), inset 0 0 12px rgba(61, 255, 255, 0.4);
  transform: scale(1.06);
}

.inventory-slot.slot-empty {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(2, 8, 14, 0.5);
  box-shadow: none;
  transform: none;
}

.inventory-slot.slot-empty::after {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}

.inventory-slot-tile {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.35s ease;
}

.slot-badge {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  color: #00f0ff;
  background: rgba(0, 0, 0, 0.85);
  padding: 1px 4px;
  border-radius: 3px;
  border: 0.5px solid rgba(0, 240, 255, 0.4);
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* Floating Drag Proxy */
.drag-proxy {
  position: absolute;
  top: 0;
  left: 0;
  width: 52px;
  height: 52px;
  border-radius: 6px;
  background: rgba(0, 26, 42, 0.95);
  border: 2px solid #00f0ff;
  box-shadow: 0 8px 24px rgba(0, 240, 255, 0.55), 0 0 14px rgba(0, 240, 255, 0.4);
  pointer-events: none;
  z-index: 25;
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.08);
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform, opacity;
}

.drag-proxy img {
  width: 82%;
  height: 82%;
  object-fit: contain;
}

/* Snap Shockwave Ring */
.snap-shockwave {
  position: absolute;
  inset: -6px;
  border-radius: 8px;
  border: 2px solid #00f0ff;
  box-shadow: 0 0 20px #00f0ff;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.8);
}

.snap-shockwave.active {
  animation: snap-ring 0.55s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes snap-ring {
  0% {
    opacity: 1;
    transform: scale(0.8);
  }
  100% {
    opacity: 0;
    transform: scale(2.4);
  }
}


