/* Mobile app — ported from design-prototype/styles.css */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #059669;
  --success-soft: #ecfdf5;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --text: #0f172a;
  --text-muted: #2c394b;
  --text-field-placeholder: #a1adbe;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --app-width: 100%;
  --app-max-width: 400px;
}

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

html,
body {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

body {
  font-family: var(--font);
  background-color: #54a6b1;
  color: var(--text);
  display: flex;
  justify-content: center;
}

body.bg-idle,
body.bg-page {
  background-repeat: no-repeat;
  background-position: center top;
  background-size: auto 100%;
  background-attachment: fixed;
  background-color: #54a6b1;
}

body.bg-idle {
  background-image: url('/image/idle_page.png');
}

body.bg-page {
  background-image: url('/image/Bg_page.png');
}

#app-shell {
  width: var(--app-width);
  max-width: var(--app-max-width);
  min-height: 100dvh;
  background: transparent;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: visible;
}

.screen-page {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 100dvh;
  background: transparent;
}

.screen-page.active {
  display: flex;
}

.screen-page .screen-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.screen-page:not(#home-page) .screen-inner {
  overflow: visible;
}

#home-page .screen-inner {
  overflow: hidden;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.status-bar.light {
  background: transparent;
  border: none;
  color: #fff;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: none;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 1;
  /* background: rgba(255, 255, 255, 0.95); */
}

.nav-license {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  color: var(--text-muted);
}

.nav-logo {
  height: 45px;
  width: auto;
  flex-shrink: 0;
  display: block;
}

.event-title-banner {
  display: block;
  margin: -50px auto -30px auto;
  max-width: 256px;
  height: auto;
  flex-shrink: 0;
  padding-top: 8px;
}

.nav.nav-camera {
  /* background: rgba(15, 23, 42, 0.95); */
  z-index: 3;
}

.nav-camera .nav-license {
  color: var(--text-muted);
}

.camera-footer {
  flex-shrink: 0;
  padding: 16px 20px 32px;
  /* background: #0f172a; */
}

.camera-footer .btn {
  width: 100%;
}

.content {
  flex: 1;
  padding: 24px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  overflow-x: hidden;
}

.screen-page:not(#home-page) .content:not(.page-scroll-layout) {
  flex: 1 0 auto;
  overflow: visible;
}

.page-scroll-layout {
  overflow: hidden;
  min-height: 0;
  gap: 12px;
}

#qrcode-page .content.page-scroll-layout,
#records-page .content.page-scroll-layout {
  flex: 1 0 auto;
  overflow: visible;
  min-height: auto;
}

#qrcode-page .content.page-scroll-layout {
  --qrcode-section-gap: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--qrcode-section-gap);
}

#records-page .content.page-scroll-layout {
  --records-section-gap: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--records-section-gap);
}

#qrcode-page .scroll-panel {
  width: 100%;
}

#records-page .scroll-panel {
  width: 100%;
}

#qrcode-page .qrcode-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--qrcode-section-gap);
}

.page-scroll-header {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;

}

.page-scroll-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 10px;
}

.scroll-panel {
  height: 500px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background-color: #ffffff9d;
  flex-shrink: 0;
}

.scroll-panel.legal-panel {
  background: var(--surface);
}

.scroll-list {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
  background: transparent;
  padding: 10px;
  border: none;
  border-radius: 0;
}

.content.center {
  align-items: center;
  text-align: center;
  justify-content: center;
}

.home-content {
  justify-content: flex-end;

  padding-bottom: 6dvh;
}

.home-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

h1.hero {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

h1.hero.sm {
  font-size: 24px;
}

p.lead {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.5;
}

.icon-circle {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 8px;
}

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px 20px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {

  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn:disabled,
.btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  pointer-events: none;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
}

.btn-row {
  display: flex;
  gap: 12px;
  width: 100%;
}

.btn-row .btn {
  flex: 1;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.legal-iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
}

#pics-page .content > h1.hero.sm {
  text-align: center;
}

#pics-page .checkbox-row {
  justify-content: center;
}

#terms-page .checkbox-row {
  justify-content: center;
}
#terms-page .content > h1.hero.sm {
  text-align: center;
}

#login-page .register-header,
#register-page .register-header,
#register-confirm-page .register-header {
  text-align: center;
}

#qrcode-page .page-scroll-header > h3 {
  text-align: center;
}

#records-page .records-history-title {
  text-align: center;
  margin: 0;
}
.checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.checkbox.checked {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.field label {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.field input:not([type="radio"]):not([type="checkbox"]) {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
}
.field input:not([type="radio"]):not([type="checkbox"])::placeholder {
  color: var(--text-field-placeholder);
  opacity: 1; 
}

.field input:not([type="radio"]):not([type="checkbox"]):focus {
  outline: 2px solid var(--primary-soft);
  border-color: var(--primary);
}

.field select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  appearance: auto;
}

.field-remark {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

.radio-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.field label.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
}

.field label.radio-label input {
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  flex-shrink: 0;
  vertical-align: bottom;
  accent-color: var(--primary);
}

.register-form {
  padding-bottom: 48px;
  gap: 16px;
}

.register-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.register-subtitle {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text-muted);
  margin: 0;
}

.register-confirm-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 16px;
  font-size: 16px;
  margin-bottom: 20px;
}

.register-confirm-summary dt {
  color: var(--text-muted);
  font-weight: 600;
}

.register-confirm-summary dd {
  margin: 0;
  font-weight: 600;
}

.register-confirm-back {
  margin-top: 12px;
}

#register-page .register-form .field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

#register-page .register-form .field > label:not(.radio-label) {
  margin-bottom: 3px;
}

#register-page .register-form .field-remark {
  margin-top: 0;
}

#register-page .register-form .field-error {
  margin-top: 0;
}

.field-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: -8px;
}

.field.field-invalid > label {
  color: var(--danger);
}

#sub-location-field .sub-location-label {
  display: none;
}

#register-page .field.field-invalid > label {
  color: var(--danger);
}

#register-page .field.field-invalid select,
#register-page .field.field-invalid input:not([type="radio"]) {
  border-color: var(--danger);
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stats.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stats-single {
  display: flex;
  justify-content: center;
}

.stats-single .stat {
  text-align: center;
  min-width: 160px;
}

#records-page .stats-single .stat .lbl,
#qrcode-page .stats-single .stat .lbl {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.stat {
  border-radius: var(--radius);
  /* padding: 14px; */
}

.stat .val {
  font-size: 35px;
  font-weight: 700;
  color: var(--primary);
}

.stat .lbl {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.3;
}

.qrcode-user-name {
  font-size: 16px;
  margin: 0;
  text-align: center;
}

.qrcode-logout-btn {
  width: auto;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
}

.list-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.list-item .meta {
  color: var(--text-muted);
  font-size: 12px;
}

.list-item .ticket-badge {
  margin-left: auto;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
}

.list-item.new-scan {
  border-color: #93c5fd;
  background: #eff6ff;
}

.records-list,
.session-list {
  gap: 8px;
}

.session-list.session-list--empty,
.records-list.records-list--empty {
  justify-content: center;
  align-items: center;
}

.scroll-list-hint {
  margin: 0;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}

.record-item .record-details {
  flex: 1;
  min-width: 0;
}

.record-item .record-code {
  font-weight: 600;
  word-break: break-all;
}

.record-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

.list-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 24px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.camera-page {
  background: transparent;
  position: relative;
}

.camera-wrap {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  height: 600px;

  padding: 30px 12px;
}

.camera-frame {
  position: relative;
  width: 450px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 12px;
  background: #000;
}

#qr-reader {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
}

#qr-reader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

#qr-reader__scan_region {
  min-height: 0 !important;
  height: 100% !important;
}

.viewfinder-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.viewfinder {
  width: 240px;
  height: 240px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
}

.camera-hint {
  color: var(--text-muted);
  margin: 0;
  font-size: 15px;
  text-align: center;
  padding: 0 20px;
  flex-shrink: 0;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 20px;
  overflow: hidden;
}

.modal-overlay.show {
  display: flex;
}

.modal-overlay.modal-global {
  position: fixed;
  z-index: 100;
}

.modal-overlay.modal-fullscreen {
  background: var(--surface);
  padding: 32px 24px;
  z-index: 110;
  overflow: hidden;
}

.modal-overlay.modal-fullscreen.show {
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.register-success-screen.modal-fullscreen {
  background: url('/image/Bg_page.png');
  background-repeat: no-repeat;
  background-position: center top;
  background-size: auto 100%;
  background-attachment: fixed;
  background-color: #54a6b1;
  padding: 0;
  align-items: center;
  justify-content: flex-start;
}

.register-success-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--app-max-width);
  min-height: 100dvh;
  height: 100%;
}

.register-success-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  flex: 1;
  width: 100%;
  /* max-width: 320px; */
  margin: 0 auto;
  margin-top: 12px;
  padding: 24px 20px 32px;
  text-align: center;
  gap: 32px;
}

#register-success-message {
  /* font-size: 18px;
  line-height: 1.7;
  font-weight: 600; */
  color: var(--text);
  /* margin: 0; */
}

.register-success-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.register-success-time-label {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.register-success-time-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.3;
}

.register-success-panel .btn {
  min-width: 160px;
  width: 100%;
}

.modal {
  background: var(--surface);
  border-radius: 20px;
  padding: 28px 24px;
  width: 100%;
  max-width: 300px;
  text-align: center;
  box-shadow: var(--shadow);
  overflow: hidden;
  flex-shrink: 0;
  max-height: calc(100dvh - 40px);
}

.modal .check {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.modal .error-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.modal-wide {
  max-width: 340px;
  text-align: left;
}

.modal .btn-row {
  display: flex;
  gap: 8px;
}

.modal .btn-row .btn {
  flex: 1;
}

.alert-success {
  background: var(--success-soft);
  border: 1px solid #a7f3d0;
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  width: 100%;
}

.alert-success h3 {
  color: var(--success);
  font-size: 18px;
  margin-bottom: 12px;
}

.upload-summary {
  text-align: left;
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  font-size: 14px;
}

.upload-summary dt {
  color: var(--text-muted);
  font-weight: 600;
}

.upload-summary dd {
  margin: 0;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.alert-fail {
  background: var(--danger-soft);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  width: 100%;
}

.alert-fail h3 {
  color: var(--danger);
  font-size: 18px;
  margin-bottom: 6px;
}

.session-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.session-summary.session-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  text-align: center;
}

.session-summary.session-stats > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.session-summary.session-stats .lbl {
  font-size: 11px;
  color: var(--text-muted);
}

.session-summary strong {
  color: var(--primary);
  font-size: 22px;
  font-weight: 700;
}

.spacer {
  flex: 1;
}

.hidden {
  display: none !important;
}
