/* ==============================================================================
   VNUF K72 - Game 2D Nhiệm Vụ Nhập Học (VNUF GO)
   Design System: Human-Crafted UI Standards
   ============================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&display=swap');

:root {
  /* Slate Neutral Color Scale */
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --slate-950: #020617;

  /* VNUF Forest & Emerald Accent Scale */
  --vnuf-50: #ecfdf5;
  --vnuf-100: #d1fae5;
  --vnuf-200: #a7f3d0;
  --vnuf-400: #34d399;
  --vnuf-500: #10b981;
  --vnuf-600: #059669;
  --vnuf-700: #047857;
  --vnuf-800: #065f46;
  --vnuf-900: #064e3b;

  /* Functional Alert Colors */
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --amber-900-15: rgba(245, 158, 11, 0.12);
  --amber-border: rgba(245, 158, 11, 0.25);

  --red-400: #f87171;
  --red-500: #ef4444;
  --red-900-15: rgba(239, 68, 68, 0.14);
  --red-border: rgba(239, 68, 68, 0.28);

  --blue-400: #60a5fa;
  --blue-500: #3b82f6;

  /* Surfaces & Glassmorphism */
  --card-bg: rgba(15, 23, 42, 0.88);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-border-hover: rgba(16, 185, 129, 0.25);
  --card-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4), 0 2px 6px -1px rgba(0, 0, 0, 0.25);
  --card-shadow-lg: 0 12px 36px -4px rgba(0, 0, 0, 0.6), 0 4px 12px -2px rgba(0, 0, 0, 0.35);

  /* Typography */
  --font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition-smooth: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================= BASE RESETS ================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  min-height: -webkit-fill-available;
  overflow: hidden;
  background-color: var(--slate-950);
  font-family: var(--font-family);
  color: var(--slate-200);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ================= VIEWPORT CONTAINER ================= */
.game-viewport {
  position: relative;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  min-height: -webkit-fill-available;
  overflow: hidden;
  background-color: var(--slate-950);
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ================= SVG ICON SIZING & HARD CONSTRAINTS ================= */
svg {
  box-sizing: border-box;
  vertical-align: middle;
}

.ui-icon {
  width: 20px !important;
  height: 20px !important;
  max-width: 20px !important;
  max-height: 20px !important;
  flex-shrink: 0;
}
.ui-icon-xs {
  width: 14px !important;
  height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
  flex-shrink: 0;
}
.ui-icon-sm {
  width: 16px !important;
  height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  flex-shrink: 0;
}
.ui-icon-lg {
  width: 28px !important;
  height: 28px !important;
  max-width: 28px !important;
  max-height: 28px !important;
  flex-shrink: 0;
}
.ui-icon-xl {
  width: 44px !important;
  height: 44px !important;
  max-width: 44px !important;
  max-height: 44px !important;
  flex-shrink: 0;
}
.brand-icon {
  width: 26px !important;
  height: 26px !important;
  max-width: 26px !important;
  max-height: 26px !important;
  flex-shrink: 0;
}
.btn-primary svg {
  width: 16px !important;
  height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  flex-shrink: 0;
}
.cert-emblem-badge svg {
  width: 28px !important;
  height: 28px !important;
  max-width: 28px !important;
  max-height: 28px !important;
  flex-shrink: 0;
}
.ui-icon-emerald {
  color: var(--vnuf-400);
}
.ui-icon-amber {
  color: var(--amber-400);
}

/* ================= HUD LAYER ================= */
.hud-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

.hud-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: var(--card-shadow);
  pointer-events: auto;
  transition: var(--transition-smooth);
}

.hud-card:hover {
  border-color: var(--card-border-hover);
}

/* Header Info Bar */
.hud-top-bar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

/* Profile Card */
.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
}

.avatar-frame {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--vnuf-800), var(--vnuf-600));
  border: 1px solid var(--vnuf-400);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate-50);
}

.student-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-headline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--slate-50);
  letter-spacing: -0.01em;
}

.player-major {
  font-size: 11px;
  font-weight: 500;
  color: var(--slate-400);
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.mode-moto {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--amber-400);
}

.mode-walk {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--blue-400);
}

/* Progress Tracker Card */
.progress-card {
  min-width: 220px;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.progress-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-400);
}

.progress-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--vnuf-400);
}

.progress-track {
  width: 100%;
  height: 6px;
  background: var(--slate-800);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.progress-thumb {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--vnuf-600), var(--vnuf-400));
  border-radius: 999px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Actions Bar */
.hud-actions {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  color: var(--slate-300);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  transition: var(--transition-smooth);
}

.icon-button:hover {
  background: var(--slate-800);
  color: var(--slate-50);
  border-color: var(--card-border-hover);
  transform: translateY(-1px);
}

.icon-button:active {
  transform: scale(0.96);
}

.icon-button:focus-visible {
  outline: 2px solid var(--vnuf-500);
  outline-offset: 2px;
}

/* Minimap Panel */
.minimap-panel {
  position: absolute;
  top: 84px;
  left: 16px;
  width: 148px;
  height: 196px;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  pointer-events: none;
  transition: var(--transition-smooth);
}

.minimap-panel:hover {
  border-color: var(--card-border-hover);
}

#minimap-canvas {
  width: 100%;
  height: calc(100% - 24px);
  display: block;
}

.minimap-caption {
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--slate-300);
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid var(--card-border);
}

/* Zoom Control Panel */
.zoom-control-panel {
  position: absolute;
  top: 290px;
  left: 16px;
  width: 148px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  gap: 4px;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  z-index: 20;
  pointer-events: auto;
  transition: var(--transition-smooth);
}

.zoom-control-panel:hover {
  border-color: var(--card-border-hover);
}

.zoom-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: var(--slate-200);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}

.zoom-btn:hover {
  background: var(--emerald-600);
  color: #ffffff;
  border-color: var(--emerald-500);
  transform: translateY(-1px);
}

.zoom-btn:active {
  transform: translateY(1px);
}

.zoom-level-btn {
  flex: 1;
  width: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--emerald-400);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  padding: 0 4px;
}

.zoom-level-btn:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: var(--emerald-500);
  color: var(--emerald-300);
}

/* Quest Tracker Aside */
.quest-panel {
  position: absolute;
  top: 84px;
  right: 16px;
  width: 290px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quest-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.quest-category {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-400);
}

.quest-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--slate-50);
  line-height: 1.4;
}

.quest-description {
  font-size: 11px;
  font-weight: 400;
  color: var(--slate-400);
  line-height: 1.5;
}

.quest-target-box {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--vnuf-200);
  background: rgba(5, 150, 105, 0.14);
  border: 1px solid rgba(5, 150, 105, 0.25);
  padding: 6px 10px;
  border-radius: 8px;
}

/* Controls Hint */
.controls-hint {
  position: absolute;
  bottom: 20px;
  left: 176px;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--card-shadow);
  pointer-events: auto;
  z-index: 55;
}

.hint-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hint-separator {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.1);
}

.hint-text {
  font-size: 11px;
  font-weight: 500;
  color: var(--slate-400);
}

.key-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  background: var(--slate-800);
  border: 1px solid var(--slate-600);
  border-radius: 4px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-100);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ================= WARNING BANNER ================= */
.warning-banner {
  position: absolute;
  top: -160px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--amber-border);
  border-left: 4px solid var(--amber-500);
  padding: 10px 18px;
  border-radius: 12px;
  box-shadow: var(--card-shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 90;
  max-width: 90%;
  width: 520px;
  transition: top 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.warning-banner.show {
  top: 14px;
  transform: translateX(-50%);
}

.warning-icon-wrapper {
  color: var(--amber-400);
  background: var(--amber-900-15);
  border-radius: 8px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.warning-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.warning-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--amber-400);
}

.warning-body {
  font-size: 12px;
  font-weight: 400;
  color: var(--slate-300);
  line-height: 1.4;
}

/* ================= DIALOGUE MODAL ================= */
.dialogue-modal {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 720px;
  display: none;
  z-index: 100;
  pointer-events: auto;
  animation: modalFadeIn 0.25s ease-out;
}

.dialogue-card {
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border-hover);
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: var(--card-shadow-lg);
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.dialogue-avatar-box {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--slate-800);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--vnuf-400);
  flex-shrink: 0;
}

.dialogue-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dialogue-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dialogue-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--slate-50);
}

.dialogue-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(5, 150, 105, 0.16);
  border: 1px solid rgba(5, 150, 105, 0.3);
  color: var(--vnuf-300);
  letter-spacing: 0.02em;
}

.dialogue-paragraph {
  font-size: 13px;
  font-weight: 400;
  color: var(--slate-200);
  line-height: 1.6;
  min-height: 42px;
}

.dialogue-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.dialogue-press-prompt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--slate-400);
}

.inline-kbd {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  background: var(--slate-800);
  border: 1px solid var(--slate-600);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  color: var(--slate-200);
}

/* ================= VIRTUAL ANALOG CONTROLLER (FLOATING JOYSTICK) ================= */
.virtual-controller {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 60;
}

.joystick-touch-zone {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  z-index: 55;
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
}

.joystick-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  z-index: 60;
  will-change: transform;
  opacity: 0.72;
  transition: opacity 0.2s ease;
}

.joystick-wrapper.active {
  opacity: 1;
}

.joystick-base {
  position: relative;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.98) 100%);
  border: 2.5px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.65), inset 0 0 20px rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.joystick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--vnuf-600), var(--vnuf-800));
  border: 3px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55), inset 0 2px 6px rgba(255, 255, 255, 0.4);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.joystick-guide-arrows {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.guide-arrow {
  position: absolute;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.3);
}
.guide-u { top: 10px; left: 50%; transform: translateX(-50%); }
.guide-d { bottom: 10px; left: 50%; transform: translateX(-50%); }
.guide-l { left: 12px; top: 50%; transform: translateY(-50%); }
.guide-r { right: 12px; top: 50%; transform: translateY(-50%); }

.joystick-caption {
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-300);
  letter-spacing: 0.05em;
  background: rgba(15, 23, 42, 0.85);
  padding: 3px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.touch-actions {
  position: absolute;
  bottom: max(32px, env(safe-area-inset-bottom, 26px));
  right: max(32px, env(safe-area-inset-right, 26px));
  display: flex;
  gap: 12px;
  pointer-events: auto;
  z-index: 70;
}

.btn-touch-action {
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--vnuf-700), var(--vnuf-600));
  border: 3.5px solid rgba(255, 255, 255, 0.5);
  color: var(--slate-50);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55), 0 0 16px rgba(16, 185, 129, 0.25);
  cursor: pointer;
  touch-action: manipulation;
  transition: var(--transition-smooth);
}

.btn-touch-action svg {
  width: 38px;
  height: 38px;
}

/* ================= GOLDEN RADIATING ACTION BUTTON EFFECT ================= */
.btn-touch-action.action-golden-radiate {
  animation: goldenPulse 1.25s infinite ease-in-out !important;
  border-color: #facc15 !important;
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: #0f172a !important;
  position: relative;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.75) !important;
}

.btn-touch-action.action-golden-radiate svg {
  stroke: #0f172a !important;
}

.btn-touch-action.action-golden-radiate .touch-action-label {
  color: #0f172a !important;
  font-weight: 800 !important;
}

.btn-touch-action.action-golden-radiate::before,
.btn-touch-action.action-golden-radiate::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2.5px solid rgba(251, 191, 36, 0.9);
  pointer-events: none;
  animation: goldenRaysAura 1.8s infinite cubic-bezier(0.15, 0.85, 0.35, 1);
}

.btn-touch-action.action-golden-radiate::after {
  animation-delay: 0.9s;
}

@keyframes goldenPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.8),
                0 0 24px rgba(245, 158, 11, 0.7),
                inset 0 0 10px rgba(254, 240, 138, 0.6);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 0 16px rgba(245, 158, 11, 0),
                0 0 45px rgba(245, 158, 11, 1),
                inset 0 0 18px rgba(254, 240, 138, 0.9);
  }
}

@keyframes goldenRaysAura {
  0% {
    transform: scale(0.92);
    opacity: 0.95;
    border-color: rgba(251, 191, 36, 0.95);
    box-shadow: 0 0 14px rgba(251, 191, 36, 0.9);
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
    border-color: rgba(251, 191, 36, 0);
    box-shadow: 0 0 32px rgba(251, 191, 36, 0);
  }
}

.btn-touch-action:hover {
  background: linear-gradient(135deg, var(--vnuf-600), var(--vnuf-500));
  transform: scale(1.04);
}

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

.touch-action-label {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ================= MODAL & OVERLAYS ================= */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
  pointer-events: auto;
  animation: modalFadeIn 0.25s ease-out;
}

.modal-hidden,
#cert-modal-backdrop:not(.show) {
  display: none !important;
}

#cert-modal-backdrop.show {
  display: flex !important;
}

.modal-card {
  background: var(--slate-900);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--card-shadow-lg);
  max-width: 520px;
  width: 100%;
}

.start-modal {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 18px;
}

.brand-emblem {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--vnuf-800), var(--vnuf-600));
  border: 1px solid var(--vnuf-400);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate-50);
  flex-shrink: 0;
}

.brand-icon {
  width: 26px;
  height: 26px;
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--slate-50);
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-size: 12px;
  font-weight: 500;
  color: var(--slate-400);
  margin-top: 2px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-300);
}

.form-input, .form-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--slate-700);
  background: var(--slate-950);
  color: var(--slate-100);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: var(--transition-smooth);
}

.form-input:focus, .form-select:focus {
  border-color: var(--vnuf-500);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.form-select {
  cursor: pointer;
}

.callout-card {
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.callout-warning {
  background: var(--amber-900-15);
  border: 1px solid var(--amber-border);
}

.callout-icon-box {
  color: var(--amber-400);
  margin-top: 2px;
  flex-shrink: 0;
}

.callout-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.callout-heading {
  font-size: 12px;
  font-weight: 700;
  color: var(--amber-400);
}

.callout-list {
  padding-left: 18px;
  font-size: 11px;
  color: var(--slate-300);
  line-height: 1.5;
}

.btn-primary {
  width: 100%;
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--vnuf-600), var(--vnuf-700));
  color: var(--slate-50);
  border: 1px solid var(--vnuf-500);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
  transition: var(--transition-smooth);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--vnuf-500), var(--vnuf-600));
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.4);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--vnuf-400);
  outline-offset: 2px;
}

/* ================= CERTIFICATE / STUDENT CARD ================= */
.student-card-modal {
  max-width: 540px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.cert-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.cert-emblem-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--vnuf-400);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.cert-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--slate-50);
}

.cert-subtitle {
  font-size: 12px;
  font-weight: 400;
  color: var(--slate-400);
  max-width: 420px;
  line-height: 1.5;
}

.id-card-wrap {
  background: linear-gradient(145deg, #064e3b 0%, #022c22 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.id-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 10px;
}

.id-logo-box {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate-50);
}

.id-title-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.id-ministry {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--vnuf-200);
}

.id-institution {
  font-size: 13px;
  font-weight: 800;
  color: var(--slate-50);
}

.id-card-body {
  display: flex;
  gap: 16px;
  align-items: center;
}

.id-photo-frame {
  width: 84px;
  height: 104px;
  background: var(--slate-800);
  border-radius: 8px;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--slate-400);
  flex-shrink: 0;
}

.id-photo-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--vnuf-300);
  margin-top: 4px;
}

.id-details {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.id-row {
  display: flex;
  font-size: 11px;
  line-height: 1.4;
}

.id-label {
  width: 92px;
  color: var(--slate-300);
  font-weight: 500;
  flex-shrink: 0;
}

.id-value {
  color: var(--slate-50);
  font-weight: 700;
}

.id-barcode {
  margin-top: 6px;
  height: 16px;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.85),
    rgba(255, 255, 255, 0.85) 2px,
    transparent 2px,
    transparent 5px
  );
  border-radius: 2px;
  opacity: 0.7;
}

/* ================= MOBILE OPTIMIZATION & NATURAL RESPONSIVE ================= */
@media (max-width: 900px) {
  .touch-actions {
    bottom: max(44px, env(safe-area-inset-bottom, 38px)) !important;
    right: max(36px, env(safe-area-inset-right, 30px)) !important;
    gap: 12px;
  }
  .btn-touch-action {
    width: 120px !important;
    height: 120px !important;
  }
  .btn-touch-action svg {
    width: 36px !important;
    height: 36px !important;
  }
  .joystick-base {
    width: 170px !important;
    height: 170px !important;
  }
  .joystick-knob {
    width: 76px !important;
    height: 76px !important;
  }
  .modal-card {
    width: min(440px, 94vw) !important;
    max-height: 88vh !important;
    padding: 20px 16px !important;
    margin: auto !important;
  }
  .start-modal {
    gap: 14px !important;
  }
  .brand-header {
    gap: 12px !important;
    padding-bottom: 12px !important;
  }
  .brand-title {
    font-size: 15px !important;
  }
  .brand-subtitle {
    font-size: 11.5px !important;
  }
  .modal-form {
    gap: 12px !important;
  }
  .form-group {
    gap: 6px !important;
  }
  .form-input, .form-select {
    padding: 10px 12px !important;
    font-size: 14px !important;
  }
}

/* ================= RESPONSIVE DESIGN: MOBILE LANDSCAPE (MÀN HÌNH NGANG) ================= */
@media (orientation: landscape) and (max-height: 520px) {
  .hud-top-bar {
    top: 8px;
    left: 12px;
    right: 12px;
    gap: 8px;
  }
  .profile-card {
    padding: 4px 10px;
    gap: 8px;
  }
  .avatar-frame {
    width: 28px;
    height: 28px;
    border-radius: 6px;
  }
  .player-name {
    font-size: 12px;
  }
  .player-major {
    display: none;
  }
  .progress-card {
    min-width: 130px;
    padding: 6px 12px;
    gap: 4px;
  }
  .progress-label {
    font-size: 9px;
  }
  .progress-track {
    height: 4px;
  }
  .icon-button {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }
  .minimap-panel {
    top: 48px;
    left: 12px;
    width: 86px;
    height: 114px;
  }
  .zoom-control-panel {
    top: 168px;
    left: 12px;
    width: 86px;
    padding: 2px 4px;
    gap: 2px;
  }
  .zoom-btn {
    width: 24px;
    height: 24px;
  }
  .zoom-btn svg {
    width: 12px;
    height: 12px;
  }
  .zoom-level-btn {
    font-size: 9px;
  }
  .quest-panel {
    top: 48px;
    right: 12px;
    width: 200px;
    padding: 8px 10px;
    gap: 4px;
  }
  .quest-title {
    font-size: 11px;
  }
  .quest-description {
    display: none;
  }
  .quest-target-box {
    font-size: 10px;
    padding: 4px 8px;
  }
  .virtual-controller {
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    right: 0 !important;
    z-index: 95;
    pointer-events: none;
  }
  .joystick-base {
    width: 170px;
    height: 170px;
  }
  .joystick-knob {
    width: 76px;
    height: 76px;
  }
  .joystick-caption {
    display: none;
  }
  .btn-touch-action {
    width: 116px;
    height: 116px;
  }
  .btn-touch-action svg {
    width: 34px;
    height: 34px;
  }
  .dialogue-modal {
    bottom: 8px;
    width: min(440px, 58vw);
    z-index: 100;
  }
  .dialogue-card {
    padding: 8px 14px;
    gap: 10px;
  }
  .dialogue-avatar-box {
    width: 38px;
    height: 38px;
  }
  .dialogue-name {
    font-size: 13px;
  }
  .dialogue-paragraph {
    font-size: 11px;
    min-height: 28px;
    line-height: 1.4;
  }
}

/* ================= RESPONSIVE DESIGN: MOBILE PORTRAIT FALLBACK ================= */
@media (max-width: 640px) and (orientation: portrait) {
  .hud-top-bar {
    top: 8px;
    left: 8px;
    right: 8px;
    gap: 6px;
  }
  .profile-card {
    padding: 4px 8px;
    gap: 6px;
  }
  .avatar-frame {
    width: 28px;
    height: 28px;
  }
  .player-name {
    font-size: 11px;
  }
  .player-major {
    display: none;
  }
  .progress-card {
    min-width: 100px;
    padding: 6px 8px;
    gap: 4px;
  }
  .progress-label {
    font-size: 8px;
  }
  .progress-track {
    height: 4px;
  }
  .icon-button {
    width: 32px;
    height: 32px;
  }
  .minimap-panel {
    top: 56px;
    left: 8px;
    width: 82px;
    height: 110px;
  }
  .quest-panel {
    top: 56px;
    left: 98px;
    right: 8px;
    width: auto;
    padding: 8px 10px;
    gap: 4px;
  }
  .quest-description {
    display: none;
  }
  .quest-title {
    font-size: 11px;
  }
  .virtual-controller {
    bottom: 16px;
    left: 14px;
    right: 14px;
    z-index: 95;
  }
  .dialogue-modal {
    bottom: 112px;
    width: calc(100% - 16px);
    z-index: 100;
  }
  .modal-card {
    padding: 20px 16px;
  }
}

/* ================= GENERAL MEDIA QUERIES ================= */
@media (max-width: 1024px), (max-height: 560px), (hover: none) and (pointer: coarse) {
  .controls-hint {
    display: none !important;
  }
}

/* ================= KEYFRAMES ================= */
@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ================= NO MOTORBIKE POPUP ================= */
.no-motor-popup {
  position: absolute;
  top: 75px;
  left: 50%;
  transform: translateX(-50%) translateY(-15px) scale(0.96);
  z-index: 150;
  width: calc(100% - 32px);
  max-width: 480px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.no-motor-popup.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
  pointer-events: auto;
}

.no-motor-card {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-left: 5px solid #ef4444;
  border-radius: 16px;
  padding: 14px 18px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.75), 0 0 24px rgba(239, 68, 68, 0.25);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.no-motor-badge-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.no-motor-icon-box {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ef4444;
}

.no-motor-header-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.no-motor-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: #f87171;
  text-transform: uppercase;
}

.no-motor-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
}

.no-motor-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.no-motor-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.no-motor-desc {
  margin: 0;
  font-size: 13px;
  color: #f1f5f9;
  font-weight: 500;
  line-height: 1.45;
}

.no-motor-action-row {
  display: flex;
  justify-content: flex-end;
  padding-top: 2px;
}

.no-motor-confirm-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border: 1px solid #f87171;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
  transition: all 0.15s ease;
}

.no-motor-confirm-btn:hover {
  background: linear-gradient(135deg, #f87171, #ef4444);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.45);
}

.no-motor-confirm-btn:active {
  transform: translateY(0);
}

@media (max-width: 640px) {
  .no-motor-popup {
    top: 60px;
    width: calc(100% - 20px);
  }
  .no-motor-card {
    padding: 12px 14px;
  }
  .no-motor-title {
    font-size: 13px;
  }
  .no-motor-desc {
    font-size: 12px;
  }
}

