/* activity/styles/troglodi.css */
/* Troglodi — Sokoban puzzle game (faithful to original UI) */

/* ── Overlay backdrop ── */
.trog-overlay {
  position: fixed;
  inset: 0;
  background: #1a0a00;
  background-image: radial-gradient(ellipse at 50% 0%, rgba(80,20,0,0.5) 0%, transparent 70%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 11000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 10px;
  font-family: 'Press Start 2P', 'Courier New', Courier, monospace;
  color: #fff;
}
.trog-overlay.trog-overlay-visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── Entry card ── */
.trog-card {
  background: linear-gradient(135deg, #1a0a00, #0a0400);
  border: 2px solid rgba(200, 80, 20, 0.35);
  border-radius: 16px;
  padding: 32px 28px;
  max-width: 460px;
  width: 95vw;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 60px rgba(200, 80, 0, .15);
  animation: trog-pop-in .3s cubic-bezier(.34,1.56,.64,1);
  margin: auto;
}
@keyframes trog-pop-in {
  from { transform: scale(.88); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.trog-title {
  font-family: 'Press Start 2P', 'Courier New', Courier, monospace;
  font-size: clamp(18px, 4vw, 28px);
  color: #ffe84e;
  text-shadow: 2px 2px 0 #7a0000, 0 0 20px rgba(255,100,0,0.5);
  letter-spacing: 4px;
  margin-bottom: 6px;
}
.trog-subtitle {
  font-family: 'Press Start 2P', 'Courier New', Courier, monospace;
  font-size: 11px;
  color: #d09060;
  letter-spacing: 2px;
  margin-bottom: 18px;
  text-transform: uppercase;
}
.trog-story {
  color: #c09060;
  font-size: 14px;
  font-family: sans-serif;
  margin-bottom: 6px;
  text-align: center;
  line-height: 1.6;
}
.trog-controls {
  font-size: 13px;
  font-family: sans-serif;
  color: #806040;
  margin-bottom: 14px;
  line-height: 1.8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.trog-progress {
  font-family: 'Press Start 2P', 'Courier New', Courier, monospace;
  font-size: 10px;
  color: #ffe84e;
  margin-bottom: 18px;
  letter-spacing: 1px;
}

/* Entry buttons */
.trog-btn {
  display: block;
  width: 100%;
  margin: 8px 0;
  padding: 14px 28px;
  border-radius: 8px;
  font-family: 'Press Start 2P', 'Courier New', Courier, monospace;
  font-size: 13px;
  cursor: pointer;
  letter-spacing: 2px;
  transition: all 0.2s;
  border: none;
}
.trog-btn-primary {
  background: linear-gradient(135deg, #c05000, #e08020);
  color: #ffe84e;
  box-shadow: 0 4px 15px rgba(200, 80, 0, 0.4);
}
.trog-btn-primary:hover {
  background: linear-gradient(135deg, #d06000, #f09030);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(200, 80, 0, 0.5);
}
.trog-btn-ghost {
  background: transparent;
  color: #806040;
  border: 1px solid rgba(200, 80, 20, 0.3);
}
.trog-btn-ghost:hover {
  color: #ffe84e;
  border-color: #ffe84e;
}

/* ═══════════════════════════════════════════════
   GAME SCREEN — original layout
   ═══════════════════════════════════════════════ */

/* ── Header above play area ── */
.trog-h1 {
  font-family: 'Press Start 2P', 'Courier New', Courier, monospace;
  font-size: clamp(16px, 3vw, 26px);
  color: #ffe84e;
  text-shadow: 2px 2px 0 #7a0000, 0 0 20px rgba(255,100,0,0.5);
  letter-spacing: 5px;
  margin-bottom: 4px;
  text-align: center;
  font-weight: bold;
}
.trog-sub {
  font-family: 'Press Start 2P', 'Courier New', Courier, monospace;
  font-size: 10px;
  color: #d09060;
  letter-spacing: 3px;
  margin-bottom: 4px;
  text-align: center;
}
.trog-subdesc {
  font-family: 'Press Start 2P', 'Courier New', Courier, monospace;
  font-size: 10px;
  color: #a07040;
  letter-spacing: 1px;
  margin-bottom: 14px;
  text-align: center;
}

/* ── Main layout: panel + game area side by side ── */
.trog-layout {
  display: flex;
  gap: 6px;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  max-width: 1040px;
}

/* ── Side panel ── */
.trog-panel {
  background: rgba(30, 10, 0, 0.85);
  border: 2px solid rgba(200, 80, 20, 0.35);
  border-radius: 4px;
  padding: 14px 12px;
  width: 210px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.trog-ptitle {
  font-family: 'Press Start 2P', 'Courier New', Courier, monospace;
  font-size: 10px;
  color: #ffe84e;
  border-bottom: 1px solid rgba(200, 80, 20, 0.35);
  padding-bottom: 6px;
  letter-spacing: 2px;
  text-align: center;
}
.trog-stat {
  display: flex;
  justify-content: space-between;
  font-family: 'Press Start 2P', 'Courier New', Courier, monospace;
  font-size: 10px;
  color: #c09060;
}
.trog-stat span:last-child {
  color: #ffe84e;
}

/* ── Game buttons ── */
.trog-bgrp {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.trog-btn-game {
  font-family: 'Press Start 2P', 'Courier New', Courier, monospace;
  font-size: 9px;
  padding: 9px 6px;
  width: 100%;
  border: 1px solid rgba(200, 80, 20, 0.4);
  background: rgba(80, 20, 0, 0.5);
  color: #e0a060;
  cursor: pointer;
  border-radius: 3px;
  text-align: center;
  transition: all .12s;
  line-height: 1.6;
}
.trog-btn-game:hover {
  background: rgba(255, 120, 20, 0.25);
  border-color: #ffe84e;
  color: #ffe84e;
}
.trog-btn-game:active {
  transform: scale(.97);
}
.trog-exit-btn {
  margin-top: auto;
  border-color: rgba(200, 80, 20, 0.25);
  color: #806040;
}

/* ── Level grid ── */
.trog-lgrid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.trog-lbtn {
  font-family: 'Press Start 2P', 'Courier New', Courier, monospace;
  font-size: 9px;
  padding: 6px 3px;
  background: rgba(30, 10, 0, 0.7);
  border: 1px solid rgba(150, 50, 10, 0.3);
  color: #806040;
  cursor: pointer;
  text-align: center;
  transition: all .1s;
  border-radius: 2px;
}
.trog-lbtn:hover,
.trog-lbtn.trog-active {
  background: rgba(255, 180, 20, 0.2);
  color: #ffe84e;
  border-color: #ffe84e;
}
.trog-lbtn.trog-solved {
  background: rgba(20, 120, 20, 0.25);
  color: #60d060;
  border-color: #30a030;
}
.trog-lbtn.trog-solved.trog-active {
  background: rgba(20, 120, 20, 0.45);
}

.trog-hint {
  font-family: 'Press Start 2P', 'Courier New', Courier, monospace;
  font-size: 8px;
  color: #907060;
  line-height: 2.4;
  text-align: center;
}

/* ── Game area (right side) ── */
.trog-garea {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.trog-glabel {
  font-family: 'Press Start 2P', 'Courier New', Courier, monospace;
  font-size: 14px;
  color: #ffe84e;
  letter-spacing: 3px;
  text-shadow: 0 0 12px rgba(255, 120, 0, 0.6);
}

/* ── Canvas wrapper ── */
.trog-cwrap {
  position: relative;
  line-height: 0;
  border: 3px solid rgba(180, 60, 10, 0.5);
  border-radius: 2px;
  box-shadow: 0 0 40px rgba(0,0,0,0.8), 0 0 60px rgba(150,30,0,0.2);
  overflow: hidden;
  touch-action: none;
}
.trog-cwrap canvas {
  display: block;
  image-rendering: pixelated;
  cursor: default;
}

/* ── Win overlay (inside canvas wrapper) ── */
.trog-ov {
  position: absolute;
  inset: 0;
  background: rgba(10, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s;
}
.trog-ov.trog-show {
  opacity: 1;
  pointer-events: all;
}
.trog-ov-title {
  font-family: 'Press Start 2P', 'Courier New', Courier, monospace;
  font-size: clamp(12px, 2.5vw, 20px);
  color: #ffe84e;
  text-align: center;
  line-height: 1.8;
  animation: trog-glow 1s infinite alternate;
}
.trog-ov-msg {
  font-family: 'Press Start 2P', 'Courier New', Courier, monospace;
  font-size: 10px;
  color: #c09060;
  text-align: center;
  line-height: 1.8;
}
.trog-ov-btn {
  width: auto;
  padding: 12px 22px;
  font-size: 10px;
}
@keyframes trog-glow {
  from { text-shadow: 0 0 8px #ff8000; }
  to   { text-shadow: 0 0 25px #ff8000, 0 0 45px #ff4000; }
}

/* ── Mobile D-Pad ── */
.trog-dpad {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
}
.trog-dpad-mid {
  display: flex;
  gap: 4px;
  align-items: center;
}
.trog-dpad-btn {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  border: 2px solid rgba(200, 80, 20, 0.5);
  background: rgba(80, 20, 0, 0.6);
  color: #ffe84e;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: manipulation;
}
.trog-dpad-btn:active {
  background: rgba(255, 120, 20, 0.4);
  transform: scale(0.92);
}
.trog-dpad-center {
  background: rgba(40, 10, 0, 0.6);
  border-color: rgba(150, 50, 10, 0.4);
  color: #c09060;
  font-size: 20px;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE / MOBILE
   ═══════════════════════════════════════════════ */

/* Show D-Pad on touch devices */
@media (pointer: coarse), (max-width: 768px) {
  .trog-dpad {
    display: flex;
  }
  .trog-hint {
    display: none;
  }
}

/* On narrow screens: stack panel below game */
@media (max-width: 600px) {
  .trog-layout {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  .trog-panel {
    width: 100%;
    max-width: 400px;
    order: 2;
  }
  .trog-garea {
    order: 1;
    width: 100%;
  }
}

@media (max-width: 380px) {
  .trog-dpad-btn {
    width: 44px;
    height: 44px;
    font-size: 16px;
  }
  .trog-card {
    padding: 20px 16px;
  }
}
