/* ==============================================================================
   PROJECT NOYAN - TABLET & MOBILE PWA ERGONOMIC STYLESHEET
   Patent Claim Reference: Patent Claim 39 (Ergonomic Tablet Touch Targets >= 48px)
   ============================================================================== */

:root {
  --primary-indigo: #4f46e5;
  --primary-hover: #4338ca;
  --cyan-accent: #06b6d4;
  --emerald-success: #10b981;
  --amber-warning: #f59e0b;
  --rose-danger: #f43f5e;
  --bg-slate: #0f172a;
  --card-slate: #1e293b;
  --text-light: #f8fafc;
  --text-muted: #94a3b8;
  --touch-min-target: 48px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

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

body {
  font-family: "Vazirmatn", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-slate);
  color: var(--text-light);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  direction: rtl;
}

/* Header & Status Bar */
.pwa-header {
  height: 64px;
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.brand-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #a5b4fc, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.network-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
  transition: all 0.3s ease;
}

.network-pill.offline {
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber-warning);
  border-color: rgba(245, 158, 11, 0.3);
}

.network-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Tablet Responsive Stage Container */
.tablet-container {
  flex: 1;
  display: flex;
  padding: 20px;
  gap: 20px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* Landscape Mode Layout (Tablet Default) */
@media (min-width: 768px) and (orientation: landscape) {
  .tablet-container {
    flex-direction: row;
    height: calc(100vh - 64px);
  }

  .nav-rail {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .stage-viewport {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }
}

/* Portrait Mode Layout (Stacked) */
@media (max-width: 767px), (orientation: portrait) {
  .tablet-container {
    flex-direction: column;
  }

  .nav-rail {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
}

/* Child Touch Cards (Min-height 48px, tactile active state) */
.touch-card {
  min-height: var(--touch-min-target);
  min-width: var(--touch-min-target);
  background: var(--card-slate);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}

.touch-card:active {
  transform: scale(0.96);
  border-color: var(--cyan-accent);
}

.touch-card.active {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.2), rgba(6, 182, 212, 0.2));
  border-color: var(--cyan-accent);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.25);
}

.card-icon-box {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: rgba(255, 255, 255, 0.06);
}

.card-info h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 2px;
}

.card-info p {
  font-size: 13px;
  color: var(--text-muted);
}

/* Active Game Stage Viewport */
.stage-panel {
  background: var(--card-slate);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.stage-title {
  font-size: 22px;
  font-weight: 800;
}

/* Touch Action Buttons */
.touch-btn {
  min-height: var(--touch-min-target);
  min-width: var(--touch-min-target);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.15s ease;
}

.touch-btn:active {
  transform: scale(0.95);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-indigo), #6366f1);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.btn-cyan {
  background: linear-gradient(135deg, #0284c7, var(--cyan-accent));
  color: #fff;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
}

.btn-emerald {
  background: linear-gradient(135deg, #059669, var(--emerald-success));
  color: #fff;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Game Canvas & Play Area */
.game-play-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  min-height: 380px;
}

/* Scaffolding Banner */
.scaffolding-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(79, 70, 229, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(79, 70, 229, 0.4);
}
