:root {
  color-scheme: light;
  --bg: #f5f5f5;
  --panel: #ffffff;
  --ink: #252525;
  --muted: #8a8a8a;
  --line: #e7e7e7;
  --brand: #f26a2a;
  --brand-dark: #d9551c;
  --soft: #fff5e8;
  --good: #45b47a;
  --question: #d84b42;
  --shadow: 0 10px 26px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei",
    sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell,
.login-shell {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 22px 16px 108px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding-bottom: 22px;
}

.login-card {
  width: min(440px, 100%);
}

.top-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.hero-link {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 850;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 112px;
  margin: 0 0 18px;
  padding: 22px 24px;
  border-radius: 18px;
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow);
}

.hero-card h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 8vw, 40px);
  line-height: 1.05;
  letter-spacing: 0;
}

.hero-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 17px;
}

.hero-card span {
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
}

.panel,
.record-card {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-title,
.building-head {
  font-size: 20px;
  font-weight: 850;
}

.building-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.field {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.field span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.field input,
.field textarea {
  width: 100%;
  min-height: 48px;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--brand);
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.chip {
  min-width: 74px;
  min-height: 48px;
  border: 2px solid #dedede;
  border-radius: 12px;
  background: #fff;
  color: #333;
  font-size: 18px;
  font-weight: 800;
}

.chip.active {
  border-color: var(--brand);
  background: var(--soft);
  color: var(--brand-dark);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 14px 0 18px;
  border-top: 1px solid var(--line);
}

.stats-row div {
  display: grid;
  place-items: center;
  gap: 4px;
}

.stats-row strong {
  color: var(--brand);
  font-size: 26px;
  line-height: 1;
}

.stats-row div:nth-child(3) strong {
  color: var(--good);
}

.stats-row div:nth-child(4) strong {
  color: var(--question);
}

.stats-row span {
  color: var(--muted);
  font-size: 14px;
}

.action-row,
.actions {
  display: grid;
  gap: 12px;
}

.action-row,
.actions.two {
  grid-template-columns: 1fr 1fr;
}

.action-row.single-upload {
  grid-template-columns: 1fr;
}

.big-action {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 64px;
  border-radius: 16px;
  background: var(--brand);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  box-shadow: 0 8px 22px rgba(242, 106, 42, 0.22);
}

.big-action.secondary {
  border: 2px solid var(--line);
  background: #fff;
  color: #333;
  box-shadow: none;
}

.big-action.disabled {
  opacity: 0.48;
  filter: grayscale(0.2);
}

.big-action input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.photo-grid,
.record-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(94px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.photo-tile {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f0f0f0;
}

.photo-tile img,
.record-photos img,
.image-button img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  background: #eee;
}

.image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
}

.question-photo-item {
  display: grid;
  gap: 6px;
}

.photo-inline-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.photo-inline-actions button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #555;
  font-size: 12px;
  font-weight: 850;
}

.photo-inline-actions button:last-child {
  color: var(--question);
}

.photo-wrap {
  position: relative;
  overflow: hidden;
}

.photo-meta {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  padding: 4px 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.88);
}

.image-modal img {
  align-self: center;
  justify-self: center;
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 10px;
  -webkit-touch-callout: default;
}

.image-modal p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  text-align: center;
}

.modal-photo-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: min(620px, 100%);
  justify-self: center;
}

.voice-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
}

.voice-panel p {
  margin: 0;
  color: #333;
  font-size: 14px;
  font-weight: 800;
  text-align: left;
}

.voice-transcript {
  overflow: hidden;
  border: 2px solid #ffe0ce;
  border-radius: 12px;
  background: #fff6ef;
  color: var(--brand-dark);
  min-height: 42px;
  display: flex;
  align-items: center;
}

.voice-transcript span {
  display: inline-block;
  max-width: 100%;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 900;
  white-space: nowrap;
}

.voice-transcript.scrolling span {
  max-width: none;
  min-width: 100%;
  animation: transcript-scroll 9s linear infinite;
}

.voice-meter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
}

.voice-meter span {
  width: 6px;
  height: 12px;
  border-radius: 999px;
  background: var(--brand);
  animation: voice-wave 0.86s ease-in-out infinite;
}

.voice-meter span:nth-child(2) {
  animation-delay: 0.1s;
}

.voice-meter span:nth-child(3) {
  animation-delay: 0.2s;
}

.voice-meter span:nth-child(4) {
  animation-delay: 0.3s;
}

.voice-meter span:nth-child(5) {
  animation-delay: 0.4s;
}

.secondary-btn.recording {
  border-color: #ffc7a8;
  background: #fff0e8;
  color: var(--brand-dark);
  animation: recording-pulse 1.1s ease-in-out infinite;
}

.voice-panel textarea {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  color: #222;
  font: inherit;
  font-weight: 700;
}

.voice-text-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@keyframes voice-wave {
  0%,
  100% {
    height: 10px;
    opacity: 0.55;
  }
  50% {
    height: 28px;
    opacity: 1;
  }
}

@keyframes recording-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(242, 106, 42, 0);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(242, 106, 42, 0.14);
  }
}

@keyframes transcript-scroll {
  0%,
  14% {
    transform: translateX(0);
  }
  86%,
  100% {
    transform: translateX(-55%);
  }
}

.modal-photo-actions .secondary-btn,
.modal-photo-actions .danger-btn {
  min-height: 44px;
  border-radius: 12px;
}

.modal-close {
  justify-self: end;
  min-width: 76px;
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #222;
  font-weight: 900;
}

.photo-tile span {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.64);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.photo-tile button {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  font-size: 20px;
  line-height: 1;
}

.photo-tile.failed {
  border-color: var(--question);
}

.primary-btn,
.secondary-btn,
.danger-btn {
  width: 100%;
  min-height: 50px;
  border-radius: 13px;
  padding: 10px 14px;
  font-weight: 900;
}

.primary-btn {
  border: 0;
  background: var(--brand);
  color: #fff;
}

.submit-recognition-btn {
  background: #58c987;
  color: #073d22;
  box-shadow: 0 8px 20px rgba(52, 168, 105, 0.18);
}

.primary-btn:disabled {
  opacity: 0.62;
  cursor: wait;
}

.secondary-btn {
  border: 2px solid var(--line);
  background: #fff;
  color: #333;
}

.danger-btn {
  border: 2px solid #f0c6c2;
  background: #fff7f6;
  color: var(--question);
}

.text-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.compact {
  width: auto;
  min-width: 118px;
}

.bottom-tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.user-row h3,
.user-row p {
  margin: 0;
}

.user-actions {
  display: flex;
  gap: 8px;
}

.bottom-tab {
  min-height: 52px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #8c8c8c;
  font-size: 18px;
  font-weight: 850;
}

.bottom-tab.active {
  background: var(--soft);
  color: var(--brand-dark);
}

.result-head,
.record-meta,
.report-building {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.result-head h2,
.record-card h3 {
  margin: 0;
  font-size: 20px;
}

.muted {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.status-passed {
  background: #e8f6ef;
  color: #23764e;
}

.status-question {
  background: #fff0e8;
  color: var(--brand-dark);
}

.summary-strip,
.reason-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.summary-strip span,
.reason-list span {
  padding: 6px 10px;
  border-radius: 999px;
  background: #f6f6f6;
  color: #555;
  font-weight: 800;
}

.reason-list span {
  background: #fff0e8;
  color: var(--brand-dark);
}

.kv {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.kv dt {
  color: var(--muted);
  font-weight: 850;
}

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.search-row .field {
  margin: 0;
}

.records {
  display: grid;
  gap: 14px;
}

.learning-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.learning-stat {
  display: grid;
  gap: 6px;
  min-height: 86px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}

.learning-stat strong {
  color: var(--brand);
  font-size: 32px;
  line-height: 1;
}

.feedback-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.feedback-item {
  display: grid;
  gap: 10px;
}

.feedback-item h3 {
  margin: 0;
  font-size: 18px;
}

.feedback-item .muted {
  overflow-wrap: anywhere;
}

.report-total {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 160px;
}

.report-total strong {
  color: var(--brand);
  font-size: 64px;
  line-height: 1;
}

.report-total span,
.report-building span {
  color: var(--muted);
}

.report-building {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.report-building strong {
  color: var(--brand-dark);
  font-size: 22px;
}

.report-line {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  padding: 12px 0 0;
  color: #666;
  overflow-wrap: anywhere;
}

.warning-item {
  border-left: 4px solid var(--brand);
  border-radius: 12px;
  background: #fff8f3;
  padding: 12px;
}

.hidden {
  display: none;
}

@media (max-width: 620px) {
  .app-shell {
    padding-inline: 14px;
  }

  .hero-card {
    border-radius: 16px;
    padding: 20px;
  }

  .search-row,
  .action-row,
  .actions.two {
    grid-template-columns: 1fr;
  }

  .compact {
    width: 100%;
  }

  .report-line {
    grid-template-columns: 1fr;
  }

  .learning-grid,
  .modal-photo-actions,
  .photo-inline-actions {
    grid-template-columns: 1fr;
  }
}
