:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #eef2f8;
  color: #172033;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, #eef2f8 0%, #f8fafc 52%, #eef2f8 100%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.mini-shell {
  width: min(430px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 14px 28px;
  background: #f5f7fb;
}

.status-spacer {
  height: max(16px, env(safe-area-inset-top));
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0 18px;
}

.app-header h1 {
  margin: 0;
  color: #172033;
  font-size: 27px;
  line-height: 1.16;
  letter-spacing: 0;
}

.app-header p {
  margin: 7px 0 0;
  color: #697386;
  font-size: 14px;
}

.status-pill {
  flex: 0 0 auto;
  min-width: 58px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #fff7e2;
  color: #956400;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.status-pill.logged-in {
  background: #e8f3ee;
  color: #227153;
}

.auth-panel,
.account-panel,
.capture-panel,
.summary-card,
.question-card {
  border: 1px solid #e1e7f0;
  border-radius: 8px;
  background: #fff;
}

.auth-panel,
.capture-panel {
  padding: 12px;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.panel-title-row h2 {
  margin: 0;
  color: #172033;
  font-size: 17px;
  line-height: 1.3;
}

.panel-title-row p {
  margin: 5px 0 0;
  color: #697386;
  font-size: 13px;
  line-height: 1.45;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 14px;
  padding: 4px;
  border-radius: 8px;
  background: #eef3fb;
}

.auth-tab {
  min-height: 38px;
  border-radius: 7px;
  background: transparent;
  color: #526172;
  font-weight: 700;
}

.auth-tab.active {
  background: #fff;
  color: #172033;
  box-shadow: 0 2px 7px rgba(31, 42, 68, 0.08);
}

.auth-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: #4a5870;
  font-size: 13px;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid #d7dfeb;
  border-radius: 8px;
  outline: 0;
  background: #f9fbff;
  color: #172033;
}

.auth-form input:focus {
  border-color: #2f6feb;
  box-shadow: 0 0 0 3px rgba(47, 111, 235, 0.12);
}

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

.eyebrow {
  display: block;
  color: #697386;
  font-size: 12px;
}

.account-panel strong {
  display: block;
  margin-top: 4px;
  color: #172033;
  font-size: 17px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.icon-text-button {
  min-width: 64px;
  min-height: 38px;
  border-radius: 8px;
  background: #eef3fb;
  color: #244366;
  font-size: 14px;
  font-weight: 700;
}

.capture-panel {
  margin-top: 12px;
}

.capture-panel.locked {
  background: #fbfcff;
}

.empty-state {
  display: flex;
  min-height: 276px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 1px dashed #c9d4e4;
  border-radius: 8px;
  background: #f9fbff;
  color: #35445a;
  text-align: center;
}

.empty-state strong {
  margin-top: 16px;
  font-size: 18px;
  line-height: 1.25;
}

.empty-state p {
  margin: 8px 0 0;
  color: #697386;
  font-size: 13px;
  line-height: 1.4;
}

.camera-icon {
  position: relative;
  width: 58px;
  height: 43px;
  border: 4px solid #3f6fba;
  border-radius: 8px;
}

.camera-icon::before {
  position: absolute;
  top: -12px;
  left: 12px;
  width: 24px;
  height: 11px;
  border-radius: 7px 7px 0 0;
  background: #3f6fba;
  content: "";
}

.camera-icon span {
  position: absolute;
  top: 8px;
  left: 17px;
  width: 18px;
  height: 18px;
  border: 4px solid #3f6fba;
  border-radius: 50%;
}

.preview-wrap {
  display: flex;
  height: min(54vh, 420px);
  min-height: 276px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 8px;
  background: #0f1725;
}

.preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  border-radius: 8px;
  font-weight: 750;
}

.primary-button {
  width: 100%;
  margin-top: 10px;
  background: #2f6feb;
  color: #fff;
}

.primary-button:disabled {
  background: #aebbd1;
}

.secondary-button {
  background: #eef3fb;
  color: #244366;
}

.secondary-button:disabled {
  color: #7b8798;
  background: #edf1f7;
}

.file-input {
  display: none;
}

.message {
  margin-top: 14px;
  padding: 13px 14px;
  border-radius: 8px;
  background: #eaf2ff;
  color: #295483;
  font-size: 14px;
  line-height: 1.45;
}

.message.error {
  background: #fff0ee;
  color: #b23b2d;
}

.result-area {
  margin-top: 16px;
}

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

.summary-grid > div {
  min-width: 0;
  padding: 14px;
  border-radius: 8px;
  background: #172033;
}

.summary-grid span,
.field-label {
  display: block;
  color: #aab7cc;
  font-size: 13px;
}

.summary-grid strong {
  display: block;
  margin-top: 6px;
  color: #fff;
  font-size: 20px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.summary-card {
  margin-top: 10px;
  padding: 14px;
  color: #26344b;
  font-size: 15px;
  line-height: 1.6;
}

.question-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.question-card {
  padding: 14px;
}

.question-head,
.answer-grid {
  display: grid;
  gap: 10px;
}

.question-head {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.question-index {
  font-size: 16px;
  font-weight: 750;
}

.status-tag {
  min-width: 54px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

.status-correct .status-tag {
  background: #e6f7ee;
  color: #177348;
}

.status-wrong .status-tag {
  background: #fff0ee;
  color: #b23b2d;
}

.status-uncertain .status-tag {
  background: #fff7e2;
  color: #956400;
}

.stem {
  margin: 13px 0 0;
  color: #1d293d;
  font-size: 18px;
  font-weight: 750;
  line-height: 1.45;
}

.answer-grid {
  grid-template-columns: 1fr 1fr;
  margin-top: 12px;
}

.answer-box {
  min-width: 0;
  min-height: 72px;
  padding: 12px;
  border-radius: 8px;
  background: #f5f7fb;
}

.answer-box .field-label {
  color: #6a7689;
}

.field-value {
  display: block;
  margin-top: 7px;
  color: #172033;
  font-size: 18px;
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.explanation {
  margin: 12px 0 0;
  color: #4a5870;
  font-size: 15px;
  line-height: 1.55;
}

.footnote {
  margin: 18px 0 0;
  color: #8793a6;
  font-size: 13px;
  text-align: center;
}

.hidden {
  display: none !important;
}

@media (max-width: 380px) {
  .answer-grid {
    grid-template-columns: 1fr;
  }

  .app-header h1 {
    font-size: 25px;
  }

  .mini-shell {
    padding-right: 12px;
    padding-left: 12px;
  }
}

@media (min-width: 700px) {
  body {
    padding: 24px 0;
  }

  .mini-shell {
    min-height: calc(100vh - 48px);
    border: 1px solid #dfe6f2;
    border-radius: 8px;
    box-shadow: 0 18px 42px rgba(31, 42, 68, 0.12);
  }
}
