* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Noto Sans Thai", "Sarabun", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  background: #f3f4f6;
  color: #111827;
  font-size: 18px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: #1f2937; color: #fff;
  padding-top: max(12px, env(safe-area-inset-top));
}
.top h1 { font-size: 22px; margin: 0; }
.lang button {
  background: transparent; color: #d1d5db; border: 1px solid #4b5563;
  border-radius: 8px; padding: 4px 8px; font-size: 14px; margin-left: 4px;
}
.lang button.active { background: #fff; color: #1f2937; border-color: #fff; }

main { max-width: 520px; margin: 0 auto; padding: 16px; }
.view { display: flex; flex-direction: column; gap: 14px; }
.view[hidden] { display: none; }
.center { align-items: center; justify-content: center; min-height: 60vh; }
.subtitle { text-align: center; margin: 8px 0; color: #374151; }

.btn {
  display: block; width: 100%; text-align: center; text-decoration: none;
  border: none; border-radius: 14px; padding: 16px; font-size: 20px; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.btn-huge { padding: 26px 16px; font-size: 26px; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-secondary { background: #fff; color: #1f2937; border: 2px solid #d1d5db; }
.btn-dark { background: #1f2937; color: #fff; }
.btn:active { transform: scale(0.98); }
.btn-mini {
  border: 1px solid #9ca3af; background: #fff; border-radius: 8px;
  padding: 2px 10px; font-size: 15px; margin-left: 6px; font-family: inherit;
}

.msg { color: #b91c1c; font-weight: 700; text-align: center; white-space: pre-line; margin: 0; min-height: 1em; }

.manual {
  margin-top: 12px; padding: 14px; background: #fff; border-radius: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.manual-label { margin: 0; color: #4b5563; }
.manual input, .manual select {
  font-size: 20px; padding: 12px; border-radius: 10px; border: 2px solid #d1d5db; width: 100%;
  font-family: inherit; background: #fff;
}
.manual input { letter-spacing: 1px; }

.recent h2 { font-size: 16px; color: #4b5563; margin: 8px 0; }
.recent ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.recent li button {
  width: 100%; display: flex; justify-content: space-between; gap: 8px;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px 12px;
  font-size: 16px; font-family: inherit; text-align: left;
}
.recent .dot { font-weight: 700; white-space: nowrap; }

.video-wrap { position: relative; width: 100%; aspect-ratio: 1; background: #000; border-radius: 16px; overflow: hidden; }
.video-wrap video { width: 100%; height: 100%; object-fit: cover; }
.frame {
  position: absolute; inset: 15%; border: 4px solid rgba(255,255,255,.85); border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.35);
}

.spinner {
  width: 64px; height: 64px; border: 8px solid #d1d5db; border-top-color: #2563eb;
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.big-text { font-size: 24px; font-weight: 700; }

.result-card {
  border-radius: 20px; padding: 28px 16px; text-align: center; color: #fff;
}
.result-card.ok { background: #16a34a; }
.result-card.ng { background: #dc2626; }
.result-card.wait { background: #d97706; }
.result-card.gray { background: #6b7280; }
.result-icon { font-size: 88px; line-height: 1; }
.result-head { font-size: 44px; font-weight: 800; margin-top: 8px; }
.result-head-ja { font-size: 20px; opacity: .9; }
.result-desc { font-size: 19px; margin: 14px 0 0; white-space: pre-line; }

.tip { background: #eff6ff; border-radius: 10px; padding: 10px 12px; font-size: 15px; white-space: pre-line; margin: 0; }

.info {
  background: #fff; border-radius: 14px; padding: 12px 16px; margin: 0;
  display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 16px;
}
.info dt { color: #6b7280; }
.info dd { margin: 0; font-weight: 600; word-break: break-all; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 18px; }
.link { text-align: center; color: #2563eb; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.stack[hidden] { display: none; }
.req-title { font-size: 26px; margin: 4px 0 0; text-align: center; }
.req-summary { margin: 0; text-align: center; color: #4b5563; }
.req-label { font-size: 18px; margin: 8px 0 0; }
.chips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.chip-btn {
  border: 2px solid #d1d5db; background: #fff; border-radius: 12px; padding: 12px 6px;
  font-size: 17px; font-family: inherit; font-weight: 600; color: #1f2937; line-height: 1.3;
}
.chip-btn small { display: block; font-weight: 400; color: #6b7280; font-size: 13px; }
.chip-btn[aria-pressed="true"] { border-color: #2563eb; background: #2563eb; color: #fff; }
.chip-btn[aria-pressed="true"] small { color: #dbeafe; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 16px; color: #4b5563; }
.field input, .field textarea {
  font-size: 18px; padding: 10px; border-radius: 10px; border: 2px solid #d1d5db; font-family: inherit;
}
.result-head.small { font-size: 30px; }
.btn-line { background: #06c755; color: #fff; }
.sent-text {
  background: #fff; border-radius: 12px; padding: 12px; margin: 0; font-size: 14px;
  white-space: pre-wrap; word-break: break-all; font-family: inherit; color: #374151;
}

[hidden] { display: none !important; }
