@font-face {
  font-family: 'NotoSansMalayalam';
  src: url('fonts/NotoSansMalayalam.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-main: #0a0f14;
  --bg-card: #121922;
  --bg-card-hover: #182230;
  --border-color: #223042;
  --primary: #f59e0b;
  --primary-hover: #d97706;
  --accent: #10b981;
  --danger: #ef4444;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --meter-bg: #05080c;
  --meter-glow: #22c55e;
  --font-family: 'NotoSansMalayalam', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header */
.main-header {
  background: rgba(18, 25, 34, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo-icon {
  font-size: 32px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.brand-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.5px;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pill-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-family);
}

.pill-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
}

.accent-btn {
  background: var(--primary);
  color: #000;
  border: none;
}

.accent-btn:hover {
  background: var(--primary-hover);
}

.stars-counter {
  background: #1e293b;
  border: 1px solid #334155;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: bold;
  color: #fbbf24;
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  background: #0d141d;
  border-bottom: 1px solid var(--border-color);
  padding: 0 16px;
  overflow-x: auto;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: var(--font-family);
}

.nav-tab:hover {
  color: var(--text-main);
}

.nav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(245, 158, 11, 0.05);
}

/* Content Container */
.content-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.tab-content {
  display: none;
  flex: 1;
  padding: 20px;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
}

/* TAB 1: 3D GAME */
#tab-game {
  padding: 0;
}

.game-wrapper {
  position: relative;
  width: 100%;
  height: calc(100vh - 170px);
  min-height: 500px;
  display: flex;
  flex-direction: column;
}

.canvas-container {
  position: relative;
  flex: 1;
  width: 100%;
  overflow: hidden;
  background: #111;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* IN-GAME HUD */
.in-game-hud {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}

.fare-meter-box {
  background: rgba(5, 8, 12, 0.88);
  border: 2px solid #22c55e;
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.2);
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  min-width: 240px;
  pointer-events: auto;
}

.meter-header {
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 1px;
  color: #4ade80;
  border-bottom: 1px solid #166534;
  padding-bottom: 4px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.meter-readings {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meter-fare, .meter-dist {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.meter-fare .label, .meter-dist .label {
  font-size: 12px;
  color: #94a3b8;
}

.meter-fare .value {
  font-size: 22px;
  font-weight: 900;
  color: #22c55e;
  text-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.meter-dist .value {
  font-size: 16px;
  font-weight: bold;
  color: #38bdf8;
}

.meter-rate .sub {
  font-size: 10px;
  color: #64748b;
  margin-top: 4px;
  display: block;
}

.hud-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: auto;
}

.minimap-box {
  background: rgba(18, 25, 34, 0.9);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px;
  text-align: center;
}

#minimap-canvas {
  border-radius: 4px;
  display: block;
}

.minimap-legend {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 4px;
}

.speed-box {
  background: rgba(18, 25, 34, 0.85);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: bold;
  color: var(--primary);
}

/* Passenger Toast */
.passenger-toast {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  max-width: 90%;
  width: 550px;
  z-index: 50;
  transition: all 0.3s ease;
}

.passenger-toast.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
}

.passenger-avatar {
  font-size: 32px;
}

.passenger-body {
  flex: 1;
}

.passenger-name {
  font-size: 12px;
  color: var(--primary);
  font-weight: bold;
}

.passenger-msg {
  font-size: 14px;
  color: #fff;
  margin-top: 2px;
}

/* Controls Hint Overlay */
.controls-overlay {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  pointer-events: none;
}

.ctrl-tag {
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  color: #e2e8f0;
}

/* Touch Controls */
.touch-controls {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
}

@media (pointer: coarse) {
  .touch-controls {
    display: flex;
  }
  .controls-overlay {
    display: none;
  }
}

.touch-joystick-zone {
  width: 120px;
  height: 120px;
  pointer-events: auto;
  position: relative;
}

.joystick-base {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  position: relative;
  touch-action: none;
}

.joystick-stick {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  position: absolute;
  top: 30px;
  left: 30px;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.touch-action-buttons {
  display: flex;
  gap: 12px;
  pointer-events: auto;
}

.action-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: bold;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  touch-action: none;
}

.horn-btn {
  background: #3b82f6;
}

.brake-btn {
  background: var(--danger);
}

.gas-btn {
  background: var(--accent);
}

/* Quick Mission Bar */
.quick-mission-bar {
  background: #0f1620;
  border-top: 1px solid var(--border-color);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
}

.quick-title {
  font-size: 13px;
  font-weight: bold;
  color: var(--text-muted);
  white-space: nowrap;
}

.mission-chips {
  display: flex;
  gap: 8px;
}

.chip-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font-family);
  transition: all 0.2s ease;
}

.chip-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
}

.chip-btn.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--primary);
  color: var(--primary);
}

.chip-btn.highlight {
  border-color: #f59e0b;
  font-weight: bold;
}

/* TAB 2: MISSIONS RUNNER */
.missions-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 900px) {
  .missions-layout {
    grid-template-columns: 1fr;
  }
}

.mission-card, .numpad-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.mission-selector-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.sub-tab-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-family);
}

.sub-tab-btn.active {
  background: var(--primary);
  color: #000;
  border-color: var(--primary);
}

.mission-header-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.mission-badge {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid #166534;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: bold;
}

.diff-selector select {
  background: #0f172a;
  border: 1px solid #334155;
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
}

.mission-title {
  font-size: 20px;
  color: var(--primary);
  margin-bottom: 4px;
}

.mission-concept {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.mission-scenario-box {
  background: #0d141e;
  border: 1px solid #1e293b;
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.scenario-icon {
  font-size: 28px;
}

.scenario-text {
  font-size: 14px;
  line-height: 1.5;
}

.ap-parameters-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  background: #090e15;
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.param-item {
  display: flex;
  flex-direction: column;
  text-align: center;
}

.param-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.param-val {
  font-size: 18px;
  font-weight: bold;
  color: #38bdf8;
}

/* Hint Section */
.hint-section {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
}

.hint-btn {
  background: rgba(234, 179, 8, 0.1);
  border: 1px dashed #eab308;
  color: #facc15;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  font-family: var(--font-family);
  transition: all 0.2s;
}

.hint-btn:hover {
  background: rgba(234, 179, 8, 0.2);
}

.hint-display {
  background: #1e1b10;
  border: 1px solid #713f12;
  border-radius: 6px;
  padding: 10px;
  margin-top: 10px;
  font-size: 13px;
}

.hint-level {
  font-weight: bold;
  color: #facc15;
  margin-bottom: 4px;
}

.concept-video-box {
  margin-top: 12px;
}

.video-btn {
  background: #b91c1c;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: bold;
  width: 100%;
  cursor: pointer;
  font-family: var(--font-family);
}

/* Numpad Card */
.numpad-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: bold;
  color: var(--text-muted);
}

.currency-tag {
  background: #1e293b;
  color: #38bdf8;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
}

.display-screen {
  background: #05080c;
  border: 2px solid #334155;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.display-symbol {
  font-size: 24px;
  color: var(--primary);
  font-weight: bold;
  margin-right: 8px;
}

.display-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 28px;
  font-weight: bold;
  font-family: monospace;
  outline: none;
}

.btn-clear {
  background: #334155;
  border: none;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
}

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.key-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #fff;
  font-size: 22px;
  font-weight: bold;
  padding: 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.1s;
}

.key-btn:hover {
  background: #334155;
  border-color: var(--primary);
}

.key-btn:active {
  transform: scale(0.96);
}

.key-zero {
  grid-column: span 2;
}

.key-c {
  background: #471b1b;
  color: #f87171;
  border-color: #7f1d1d;
}

.submit-answer-btn {
  background: var(--accent);
  color: #000;
  border: none;
  padding: 14px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  width: 100%;
  font-family: var(--font-family);
  transition: background 0.2s;
}

.submit-answer-btn:hover {
  background: #059669;
}

/* Feedback Result Box */
.feedback-result-box {
  margin-top: 16px;
  background: #0f241d;
  border: 2px solid var(--accent);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  transition: all 0.3s;
}

.feedback-result-box.incorrect {
  background: #2a1215;
  border-color: var(--danger);
}

.feedback-result-box.hidden {
  display: none;
}

.feedback-icon {
  font-size: 32px;
}

.feedback-details h4 {
  font-size: 16px;
  color: #fff;
  margin-bottom: 4px;
}

.feedback-details p {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.4;
}

.fb-stars {
  margin-top: 4px;
  font-size: 16px;
}

/* TAB 3: SHAPER VERIFICATION */
.shaper-container {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.shaper-header {
  margin-bottom: 24px;
}

.shaper-header h2 {
  font-size: 22px;
  color: var(--primary);
  margin-bottom: 8px;
}

.shaper-header p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

.test-phrases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.phrase-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.phrase-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-num {
  background: #1e293b;
  color: var(--primary);
  font-weight: bold;
  font-size: 13px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.phrase-ml {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}

.phrase-en {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
}

.phrase-tech {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  background: #0d141e;
  padding: 8px;
  border-radius: 6px;
}

.phrase-status.pass {
  color: #4ade80;
  font-size: 12px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 4px;
}

.interactive-sandbox {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 24px;
}

.interactive-sandbox h3 {
  font-size: 18px;
  color: var(--text-main);
  margin-bottom: 6px;
}

.interactive-sandbox p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.sandbox-input-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.sandbox-input-row input {
  flex: 1;
  background: #0a0f14;
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 16px;
  font-family: var(--font-family);
  outline: none;
}

.sandbox-output {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.glyph-chips-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.glyph-chip {
  background: #1e293b;
  border: 1px solid #334155;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.glyph-chip .char {
  font-size: 20px;
  color: #fff;
}

.glyph-chip .code {
  font-size: 10px;
  color: var(--primary);
}

.image-proof-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 20px;
}

.image-proof-box h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--text-muted);
}

.proof-img {
  width: 100%;
  max-width: 900px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  display: block;
}

/* TAB 4: ANALYTICS */
.analytics-card {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
}

.analytics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.analytics-header h2 {
  font-size: 20px;
  color: var(--primary);
  margin-bottom: 4px;
}

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

.table-responsive {
  overflow-x: auto;
}

.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.analytics-table th {
  background: #0c1219;
  color: var(--text-muted);
  padding: 10px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
}

.analytics-table td {
  padding: 10px;
  border-bottom: 1px solid #1a2533;
  color: #e2e8f0;
}

/* TAB 5: ABOUT */
.about-card {
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
}

.about-card h2 {
  font-size: 24px;
  color: var(--primary);
  margin-bottom: 20px;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 768px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
}

.about-col h3 {
  font-size: 16px;
  color: #38bdf8;
  margin-bottom: 12px;
}

.about-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.about-col li {
  font-size: 14px;
  line-height: 1.6;
  color: #cbd5e1;
}

.about-col strong {
  color: #fff;
}
