*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: #000;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

/* Screens */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.hidden {
  display: none !important;
}

/* Overlays */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
}

.dialog {
  background: #1a1a1a;
  border-radius: 16px;
  padding: 32px 24px;
  max-width: 360px;
  width: 90%;
  text-align: center;
}

.dialog h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.eula-content {
  text-align: left;
  font-size: 13px;
  line-height: 1.5;
  color: #ccc;
  margin-bottom: 24px;
}

.eula-content ul {
  padding-left: 20px;
  margin: 8px 0;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 8px;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn:active {
  opacity: 0.7;
}

.btn-primary {
  background: #fff;
  color: #000;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-icon {
  position: absolute;
  top: env(safe-area-inset-top, 12px);
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.btn-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
}

/* Landing Screen */
#grid-container {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
}

#grid-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ui-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 24px;
  padding-bottom: calc(env(safe-area-inset-bottom, 24px) + 24px);
  pointer-events: none;
  transition: opacity 0.3s;
}

.ui-overlay > * {
  pointer-events: auto;
}

.ui-overlay.ui-hidden {
  opacity: 0;
  pointer-events: none;
}

.title {
  position: absolute;
  top: calc(env(safe-area-inset-top, 12px) + 24px);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 8px;
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.subtitle {
  position: absolute;
  top: calc(env(safe-area-inset-top, 12px) + 72px);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

#join-btn {
  margin-bottom: 8px;
  min-width: 200px;
}

/* Info Dialog */
.info-dialog {
  position: relative;
}

.artist {
  font-size: 16px;
  color: #aaa;
  margin-bottom: 12px;
}

.info-dialog a {
  color: #fff;
  text-decoration: underline;
}

.qr-image {
  width: 160px;
  height: 160px;
  margin: 20px auto;
  border-radius: 8px;
  display: block;
}

.attributions {
  margin-top: 20px;
  font-size: 11px;
  color: #666;
  line-height: 1.6;
}

/* Camera Screen */
#camera-feed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

#debug-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.btn-capture {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 24px) + 32px);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  z-index: 10;
}

.btn-capture:active {
  background: #fff;
}

/* Result Screen */
#result-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.result-actions {
  display: flex;
  gap: 12px;
}
