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

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: #000000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.camera-viewport {
  position: relative;
  width: 100vw;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: #000000;
}

#camera-stream {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.torch-button {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top, 16px));
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background-color: rgba(18, 18, 18, 0.85);
  border: 2.5px solid #FFCC00;
  color: #FFCC00;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: all 0.15s ease;
}

.torch-button.active {
  background-color: #FFCC00;
  color: #000000;
  box-shadow: 0 0 16px rgba(255, 204, 0, 0.8);
}

.torch-button:active {
  transform: scale(0.92);
}

.torch-button:focus-visible {
  outline: 4px solid #FFFFFF;
}

.controls-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 16px));
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.shutter-button {
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 4px solid #FFFFFF;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.1s ease;
}

.shutter-inner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #FFFFFF;
  display: block;
  transition: transform 0.1s ease;
}

.shutter-button:active .shutter-inner {
  transform: scale(0.9);
}

.shutter-button:focus-visible {
  outline: 4px solid #FFCC00;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100%;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 50;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 6px solid rgba(255, 255, 255, 0.25);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  margin-top: 24px;
  font-size: 22px;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: 1px;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100%;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.result-card {
  width: 90%;
  max-width: 500px;
  max-height: 80%;
  max-height: 80dvh;
  background-color: #121212;
  border: 3px solid #FFCC00;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 2px solid rgba(255, 204, 0, 0.3);
}

.card-title {
  color: #FFCC00;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.card-body {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
  user-select: text;
  -webkit-overflow-scrolling: touch;
  outline: none;
}

.card-body:focus-visible {
  outline: 3px solid #FFCC00;
  outline-offset: -3px;
}

.result-line {
  color: #FFFFFF;
  font-size: 26px;
  line-height: 1.6;
  font-weight: 500;
  margin-bottom: 14px;
  word-break: break-all;
}

.result-line:last-child {
  margin-bottom: 0;
}

.empty-state {
  color: #AAAAAA;
  font-size: 24px;
  text-align: center;
  padding: 30px 0;
}

.card-footer {
  padding: 16px 20px;
  background-color: #121212;
  border-top: 2px solid rgba(255, 204, 0, 0.3);
}

.action-button {
  width: 100%;
  min-height: 58px;
  background-color: #FFCC00;
  color: #000000;
  border: none;
  border-radius: 8px;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.1s ease;
}

.action-button:active {
  opacity: 0.85;
}

.action-button:focus-visible {
  outline: 4px solid #FFFFFF;
}

.hidden-canvas {
  display: none;
}

.hidden {
  display: none !important;
}
