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

html,
body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI",
    "Meiryo", system-ui, sans-serif;
  background: #f5f5f7;
  color: #1a1a1a;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100%;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.app__header {
  text-align: center;
}

.app__title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.app__status {
  font-size: 13px;
  color: #666;
}

.scanner {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

.scanner__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scanner__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.scanner__frame {
  width: 60%;
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.25);
}

.handy {
  position: relative;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.handy[hidden] {
  display: none;
}

.handy__indicator {
  text-align: center;
  color: #666;
}

.handy__sub {
  font-size: 13px;
}

.handy__receiving {
  display: none;
  text-align: center;
  color: #fff;
}

.handy__receiving-text {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.08em;
  animation: handy-text-fade 1.4s ease-in-out infinite;
}

@keyframes handy-text-fade {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.handy--receiving {
  background: #1a1a1a;
  border-color: #1a1a1a;
}

.handy--receiving .handy__indicator { display: none; }
.handy--receiving .handy__receiving { display: block; }

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

.results {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 12px 16px;
}

.results__heading {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #444;
}

.results__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.results__list li {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  background: #f5f5f7;
  border-radius: 6px;
  padding: 6px 10px;
  word-break: break-all;
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.btn {
  flex: 1;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn:active {
  opacity: 0.7;
}

.btn--primary {
  background: #2c2c2c;
  color: #fff;
}

.btn--ghost {
  background: transparent;
  color: #2c2c2c;
  border-color: #c5c5c5;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
