@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap");

* { box-sizing: border-box; transition: all 0.3s ease; }

:root {
  --bg-color: #0d1117;
  --card-bg: #010409;
  --text-color: #c9d1d9;
  --accent-color: #58a6ff;
  --border-color: #21262d;
  --placeholder-color: #8b949e;
  --primary-button: #238636;
  --input-bg: #010409;
  --nav-bg: #010409;
  --nav-text: #8b949e;
}

body {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  background: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  overscroll-behavior: none;
}

/* Header - clean and responsive */
header {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  gap: 16px;
  flex-wrap: wrap;
  justify-content: space-between;
}

/* Back button (sub-pages only) */
#homeBtn {
  font-size: 28px;
  color: var(--accent-color);
  text-decoration: none;
  opacity: 0.8;
  flex-shrink: 0;
}

#homeBtn:hover {
  opacity: 1;
}

/* Page title (sub-pages only) */
.page-title {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 1.2px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* APK Download Button */
.apk-download-btn {
  background: var(--primary-button);
  color: white;
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.apk-download-btn:hover {
  opacity: 0.9;
}

/* Right group - Lars + Gear */
#headerRight {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

/* Lars Logo - big and bold */
#larsButton {
  cursor: pointer;
}

#larsLogoImg {
  height: 56px;
  width: auto;
  border-radius: 60px;
  padding: 12px 32px;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  transition: transform 0.2s;
}

#larsButton:hover #larsLogoImg {
  transform: scale(1.05);
}

/* Gear */
#actualSettingsBtn {
  font-size: 26px;
  width: 48px;
  height: 48px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Homepage ONLY: Lars menu opens left (next to left button) */
.homepage-container #larsMenu {
  left: 16px !important;
  right: auto !important;
}

/* Mobile */
@media (max-width: 480px) {
  header {
    padding: 12px 16px;
    gap: 12px;
  }

  .page-title {
    font-size: 17px;
  }

  .apk-download-btn {
    font-size: 13px;
    padding: 8px 16px;
  }

  #larsLogoImg {
    height: 50px;
    padding: 10px 28px;
  }

  #actualSettingsBtn {
    width: 44px;
    height: 44px;
    font-size: 24px;
  }
}

.container {
  padding: 20px;
  padding-bottom: 100px;
  max-width: 600px;
  margin: 0 auto;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

input, textarea, select {
  width: 100%;
  padding: 12px 14px;
  margin: 10px 0;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-color);
  font-family: inherit;
  font-size: 15px;
}

input::placeholder, textarea::placeholder {
  color: var(--placeholder-color);
}

button {
  font-family: "JetBrains Mono", monospace !important;
  width: 100%;
  padding: 14px;
  margin-top: 12px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

button:not(.secondary) {
  background: var(--primary-button);
  color: white;
  font-weight: 600;
}

button.secondary {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-color);
  color: var(--text-color);
}

button:hover {
  opacity: 0.9;
}

.scanner-card {
  position: relative;
  overflow: hidden;
  padding-bottom: 80px;
}

#torchBtn, #cameraSwitch, #continuousBtn {
  position: absolute;
  bottom: 16px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 26px;
  background: rgba(0,0,0,0.7);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.6);
  z-index: 10;
  cursor: pointer;
}

#torchBtn { right: 92px; }
#cameraSwitch { right: 160px; }
#continuousBtn { right: 24px; }

.qr-output-card {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 320px;
}

#qrcode {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.4s ease;
}

#qrcode.animate-in {
  opacity: 1;
  transform: scale(1);
}

#qrcode canvas {
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

input[type="color"] {
  width: 100%;
  height: 50px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--input-bg);
  cursor: pointer;
}

nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--nav-bg);
  border-top: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  padding-bottom: env(safe-area-inset-bottom);
}

nav a {
  flex: 1;
  padding: 16px 8px;
  text-align: center;
  color: var(--nav-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

nav a.active {
  color: var(--accent-color);
}

/* Menus - default right, homepage Lars menu left */
#larsMenu, #actualSettingsPanel {
  display: none;
  position: fixed;
  top: 76px;
  right: 16px;
  width: 280px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.6);
  z-index: 1000;
}

#larsMenu button, #actualSettingsPanel button {
  width: 100%;
  margin: 8px 0;
  padding: 16px;
  background: transparent;
  color: var(--text-color);
  border: none;
  border-radius: 12px;
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

#larsMenu button:hover, #actualSettingsPanel button:hover {
  background: rgba(255,255,255,0.1);
}

#feedbackOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

#feedbackOverlay .card {
  width: 100%;
  max-width: 420px;
  padding: 28px;
  text-align: center;
}

#feedbackOverlay textarea {
  height: 140px;
  resize: vertical;
  margin: 16px 0;
}

.homepage-container {
  padding: 40px 20px;
  text-align: center;
}

.homepage-container h1 {
  font-size: 32px;
  margin: 0 0 12px 0;
  font-weight: 500;
}

.tagline {
  color: var(--placeholder-color);
  font-size: 16px;
  margin-bottom: 60px;
}

.feature-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
  max-width: 500px;
  margin: 0 auto;
}

@media (min-width: 600px) {
  .feature-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.feature-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 32px 20px;
  text-decoration: none;
  color: var(--text-color);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
}

.feature-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.feature-card h2 {
  margin: 0 0 12px 0;
  font-size: 22px;
  color: var(--accent-color);
}

.feature-card p {
  margin: 0;
  color: var(--placeholder-color);
  font-size: 15px;
}

.homepage-footer {
  margin-top: 100px;
  color: var(--placeholder-color);
  font-size: 14px;
  line-height: 1.6;
}
