/**
 * Cylindrical Tetris Arcade Stylesheet
 */

:root {
  --bg-dark: #070911;
  --panel-bg: rgba(14, 18, 30, 0.78);
  --panel-border: rgba(255, 255, 255, 0.1);
  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  --accent-cyan: #00f0f0;
  --accent-yellow: #f0f000;
  --accent-purple: #a000f0;
  --accent-green: #00f000;
  --accent-red: #f00000;
  --accent-blue: #0000f0;
  --accent-orange: #f0a000;
  --accent-glow: rgba(56, 189, 248, 0.35);
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: var(--font-sans);
  color: var(--text-primary);
  touch-action: none;
}

#canvasContainer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* ---------------- Top Navigation Bar ---------------- */
.top-nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.5rem;
  background: linear-gradient(180deg, rgba(7, 9, 17, 0.9) 0%, rgba(7, 9, 17, 0.3) 80%, transparent 100%);
  z-index: 20;
  pointer-events: none;
}

.nav-left, .nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  pointer-events: auto;
}

.nav-back-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border-radius: 9999px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}

.nav-back-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateX(-2px);
}

.title-wrap h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 30%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.title-wrap .subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.mode-toggle {
  display: flex;
  background: rgba(14, 18, 30, 0.85);
  border: 1px solid var(--panel-border);
  border-radius: 9999px;
  padding: 3px;
  backdrop-filter: blur(12px);
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn.active {
  background: #38bdf8;
  color: #070911;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.icon-btn {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* ---------------- HUD Panels ---------------- */
.hud-left {
  position: absolute;
  top: 80px;
  left: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 10;
  pointer-events: none;
}

.hud-right {
  position: absolute;
  top: 80px;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 10;
  pointer-events: none;
}

.hud-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 0.9rem;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
}

.mini-card {
  padding: 0.6rem 0.9rem;
}

.card-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 0.4rem;
}

.key-hint {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  font-family: var(--font-mono);
}

.mode-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  color: #38bdf8;
  letter-spacing: 0.05em;
}

.stats-card {
  align-items: flex-start;
  min-width: 140px;
  gap: 0.75rem;
}

.stat-group {
  width: 100%;
}

.stat-val {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

/* ---------------- Ring Clear Banner ---------------- */
.ring-banner {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  background: rgba(14, 165, 233, 0.9);
  border: 2px solid #ffffff;
  border-radius: 16px;
  padding: 1rem 2.5rem;
  text-align: center;
  z-index: 50;
  box-shadow: 0 0 40px rgba(56, 189, 248, 0.8);
  pointer-events: none;
  animation: bannerPop 0.8s ease-out forwards;
}

.ring-banner.hidden {
  display: none;
}

@keyframes bannerPop {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
  25% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
  75% { transform: translate(-50%, -50%) scale(1.0); opacity: 1; }
  100% { transform: translate(-50%, -60%) scale(0.9); opacity: 0; }
}

.banner-title {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #ffffff;
}

.banner-sub {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 800;
  color: #fef08a;
}

/* ---------------- Mobile Touch Controls ---------------- */
.mobile-controls {
  position: absolute;
  bottom: 1.5rem;
  left: 0;
  right: 0;
  display: none;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 25;
  pointer-events: none;
}

.dpad-cluster, .action-cluster {
  display: flex;
  gap: 0.6rem;
  pointer-events: auto;
}

.touch-btn {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: rgba(18, 24, 38, 0.85);
  border: 1px solid var(--panel-border);
  color: #ffffff;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  touch-action: manipulation;
  transition: transform 0.05s ease, background 0.1s ease;
}

.touch-btn:active {
  transform: scale(0.92);
  background: rgba(56, 189, 248, 0.3);
  border-color: #38bdf8;
}

.action-btn {
  background: rgba(30, 41, 59, 0.9);
  color: #38bdf8;
  font-weight: 800;
}

.drop-btn {
  background: rgba(220, 38, 38, 0.8);
  color: #ffffff;
}

.sub-btn {
  width: 44px;
  height: 44px;
  font-size: 1rem;
  align-self: center;
}

/* ---------------- Modals ---------------- */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 9, 17, 0.85);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  background: #0f1422;
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 2.5rem;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.modal-card h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #ffffff, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.modal-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.8rem;
}

.modal-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 1.2rem;
  margin-bottom: 2rem;
}

.mstat-lbl {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  font-family: var(--font-mono);
}

.mstat-val {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 800;
  color: #ffffff;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn {
  padding: 0.85rem 1.5rem;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.primary-btn {
  background: #38bdf8;
  color: #070911;
  box-shadow: 0 4px 20px rgba(56, 189, 248, 0.4);
}

.primary-btn:hover {
  background: #7dd3fc;
  transform: translateY(-2px);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border: 1px solid var(--panel-border);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* Help Modal specific */
.help-card {
  max-width: 520px;
  text-align: left;
}

.help-content {
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.help-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: #38bdf8;
}

.help-section p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.help-section ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.help-section strong {
  color: #ffffff;
}

/* ---------------- Responsive Media Queries ---------------- */
@media (max-width: 768px) {
  .subtitle {
    display: none !important;
  }

  .hud-left {
    top: 70px;
    left: 0.75rem;
  }

  .hud-right {
    top: 70px;
    right: 0.75rem;
  }

  .hud-card {
    padding: 0.6rem;
  }

  .stats-card {
    min-width: 100px;
  }

  .stat-val {
    font-size: 1rem;
  }

  .mobile-controls {
    display: flex;
  }

  .key-hint {
    display: none;
  }
}
