*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-height: calc(100% + env(safe-area-inset-top) + 2px);
}

html,
body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  height: 100svh;
  height: -webkit-fill-available;
  min-height: 100.1vh;
  overflow: hidden;
  position: fixed;
  inset: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #fff;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  overscroll-behavior: none;
}

/* Full-screen unclosable image popup */
.image-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  width: 100vw;
  height: 100%;
  height: 100dvh;
  height: 100svh;
  height: -webkit-fill-available;
  background: #fff;
  overflow: hidden;
  z-index: 9999;
}

.image-popup:fullscreen,
.image-popup:-webkit-full-screen {
  width: 100%;
  height: 100%;
  background: #fff;
}

.image-popup img {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  width: 100%;
  min-width: 100%;
  height: 100%;
  min-height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  background: #fff;
}

body.is-fullscreen .image-popup,
body.is-fullscreen .image-popup img {
  width: 100%;
  height: 100%;
}

.popup-error {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-size: 16px;
  color: #666;
  text-align: center;
}

/* QR Generator page styles */
.generator-page {
  min-height: 100vh;
  overflow: auto;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 24px 16px;
}

.generator-container {
  max-width: 480px;
  margin: 0 auto;
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.generator-container h1 {
  font-size: 1.35rem;
  color: #1a1a1a;
  margin-bottom: 8px;
  text-align: center;
}

.generator-container .subtitle {
  text-align: center;
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.qr-wrapper {
  display: flex;
  justify-content: center;
  margin: 24px 0;
  padding: 20px;
  background: #fafafa;
  border-radius: 12px;
  border: 2px dashed #ddd;
}

#qrcode canvas,
#qrcode img {
  display: block;
  max-width: 100%;
}

.url-display {
  background: #f0f4ff;
  border: 1px solid #c5d4f7;
  border-radius: 8px;
  padding: 12px;
  font-size: 0.8rem;
  word-break: break-all;
  color: #333;
  margin-bottom: 20px;
}

.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

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

.btn-primary {
  background: #667eea;
  color: #fff;
  margin-bottom: 10px;
}

.btn-secondary {
  background: #f0f0f0;
  color: #333;
}

.image-preview {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.image-preview h2 {
  font-size: 0.95rem;
  color: #666;
  margin-bottom: 12px;
}

.image-preview img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #fafafa;
}

.image-preview .preview-path {
  margin-top: 8px;
  font-size: 0.8rem;
  color: #888;
  word-break: break-all;
}
