:root {
  --bg: #f7f8fa;
  --surface: #fff;
  --ink: #263142;
  --muted: #788594;
  --subtle: #98a3b2;
  --line: #e4e9ef;
  --brand: #ef7858;
  --tint: #fff1e9;
  --success: #63957d;
  --success-bg: #f2f8f4;
  --warning: #ac8a50;
  --warning-bg: #fff7e9;
  color-scheme: light;
  font-family:
    "Noto Sans SC",
    "PingFang SC",
    system-ui,
    -apple-system,
    sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.55;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 10px 18px;
  font-weight: 500;
  transition: background 0.15s;
}
button:hover {
  background: #faf5f1;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}
button.primary:hover:not(:disabled) {
  background: #e96b49;
}
a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
:focus-visible {
  outline: 3px solid #f5af99;
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 36px;
  line-height: 1.55;
  letter-spacing: -0.7px;
}
h2 {
  font-size: 18px;
  line-height: 1.55;
}
h2.large,
h3 {
  font-size: 20px;
}
p {
  color: var(--muted);
  font-size: 13px;
}
small,
.small {
  font-size: 11px;
  color: var(--muted);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px max(24px, calc((100% - 1268px) / 2));
  background: white;
  min-height: 90px;
}
.logo {
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -0.6px;
}
.nav nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 13px;
  color: var(--muted);
}
.nav .active,
.accent {
  color: var(--brand);
}
.text-button {
  min-height: 32px;
  background: none;
  border: 0;
  padding: 4px 0;
  font-weight: 400;
  color: inherit;
  text-align: left;
}
.text-button.accent {
  color: var(--brand);
}
.text-button:hover {
  background: none;
  text-decoration: underline;
}
.wrap {
  max-width: 1228px;
  padding: 44px 24px 36px;
  margin: auto;
}
.hero {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
}
.benefits {
  font-size: 12px;
  color: var(--success);
}
.steps {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 16px;
  background: white;
  border-radius: 12px;
  margin: 0 0 24px;
  list-style: none;
  color: var(--muted);
  font-size: 13px;
}
.steps .active {
  color: var(--brand);
}
.workspace {
  display: grid;
  grid-template-columns: 365px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.workspace > * {
  min-width: 0;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  min-width: 0;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.card-head > div {
  display: grid;
  gap: 10px;
}
.card-head > button {
  flex-shrink: 0;
}
label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  min-width: 0;
}
input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 11px 12px;
  font-size: 14px;
}
select {
  padding-right: 26px;
}
textarea {
  resize: vertical;
  min-height: 100px;
}
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  accent-color: var(--brand);
  flex-shrink: 0;
}
input[type="range"] {
  padding: 0;
  min-height: 28px;
  accent-color: var(--brand);
}
.checkbox {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 9px;
  font-size: 12px;
}
.pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.badge {
  background: var(--tint);
  color: var(--brand);
  font-size: 11px;
  padding: 8px 10px;
  border-radius: 20px;
}
.specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 12px;
  background: var(--bg);
  border-radius: 8px;
  padding: 16px;
  margin: 0;
}
.specs dt {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 3px;
}
.specs dd {
  margin: 0;
  font-weight: 500;
  font-size: 14px;
}
.source {
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--success);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.notice {
  font-size: 12px;
  background: var(--warning-bg);
  color: var(--warning);
  padding: 12px;
  border-radius: 8px;
  overflow-wrap: anywhere;
}
.notice.success {
  background: var(--success-bg);
  color: var(--success);
}
.notice.error {
  color: #a23731;
  background: #fff0ed;
  margin-bottom: 20px;
}
.guide-tiles > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border-radius: 8px;
  padding: 16px 8px;
  font-size: 11px;
  color: var(--muted);
}
.guide-tiles img {
  display: block;
  flex-shrink: 0;
}
.guide-list {
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  display: grid;
  gap: 16px;
}
.dropzone {
  border: 1px dashed var(--brand);
  border-radius: 12px;
  background: var(--tint);
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.dropzone.dragging {
  outline: 3px solid var(--brand);
  background: #ffe5d8;
}
.upload-icon {
  color: var(--brand);
  font-size: 38px;
  line-height: 1.55;
  font-weight: 700;
}
.dropzone .primary {
  min-width: 190px;
}
.upload-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 11px;
  color: var(--muted);
}
.features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.features strong {
  font-size: 12px;
  font-weight: 500;
}
.features p {
  font-size: 11px;
  margin-top: 6px;
}
.positive {
  color: var(--success);
}
.warning {
  color: var(--warning);
}
.explain strong {
  font-size: 13px;
  font-weight: 500;
}
.explain p {
  font-size: 12px;
}
.disclaimer {
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 11px !important;
}
.tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}
.tools .card {
  padding: 16px;
  text-align: left;
  font-size: 12px;
}
.tools p {
  font-size: 11px;
}
.tools strong {
  font-weight: 500;
}
.tool-button {
  font-weight: 400;
}
.tool-button:hover {
  border-color: #e5b3a3;
}
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
  color: var(--subtle);
  font-size: 10px;
}
footer > div {
  display: flex;
  gap: 12px;
}
footer .text-button {
  font-size: 10px;
}
.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
}
.photo-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg);
  border-radius: 10px;
  padding: 20px;
  min-width: 0;
}
.photo-stage {
  width: 100%;
  position: relative;
  background: #e8ecee;
  overflow: hidden;
  line-height: 0;
  margin: auto;
  max-width: 320px;
}
.photo-stage canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: grab;
}
.crop-guide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.photo-stage canvas.crop-guide { cursor: default; }
.processing-panel { padding: 16px; background: var(--tint); border-radius: 10px; display: grid; gap: 12px; }
.processing-title { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.processing-title strong { flex: 1; }
.processing-title button { font-size: 11px; padding: 6px 10px; }
.processing-panel progress { width: 100%; height: 7px; accent-color: var(--brand); }
.spinner { width: 16px; height: 16px; border: 2px solid #edd6cd; border-top-color: var(--brand); border-radius: 50%; animation: spin 1s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.photo-warnings { margin: 0; padding-left: 28px; line-height: 1.7; }
.photo-warnings li + li { margin-top: 6px; }
.diagnostic-text { white-space: pre-wrap; word-break: break-word; font-size: 11px; }
.comparison-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.comparison-grid figure { margin: 0; min-width: 0; }
.comparison-grid canvas { width: 100%; height: auto; margin-top: 10px; }
.comparison-grid figcaption { font-size: 12px; color: var(--muted); }
.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.button-row button {
  flex: 1;
  padding: 8px;
  font-size: 12px;
}
.check-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.check-panel h3 {
  font-size: 15px;
}
.checks {
  margin: 0;
  font-size: 12px;
}
.checks > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
}
.checks dt {
  color: var(--muted);
}
.checks dd {
  margin: 0;
  text-align: right;
}
.task-status {
  font-size: 12px;
  overflow-wrap: anywhere;
  color: var(--success);
}
.download-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.download-row > div { flex: 1 1 100%; }
.download-row h3 {
  font-size: 16px;
}
.download-row p {
  margin-top: 4px;
}
.download-row button {
  flex-shrink: 0;
}
.comparing .crop-guide {
  display: none;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  width: calc(100% - 32px);
  max-width: 640px;
  max-height: 85vh;
  padding: 28px;
  color: var(--ink);
  background: white;
}
dialog::backdrop {
  background: #26314280;
}
dialog .card-head {
  margin-bottom: 20px;
}
dialog .card-head button {
  padding: 4px 12px;
  min-height: 36px;
  font-size: 22px;
}
dialog p {
  margin: 12px 0;
  white-space: pre-line;
}
dialog li {
  color: var(--muted);
  margin-bottom: 12px;
  font-size: 13px;
}
dialog form {
  display: grid;
  gap: 16px;
}
.admin-shell {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  min-height: calc(100vh - 90px);
}
.sidebar {
  background: white;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sidebar small {
  padding: 12px 0;
}
.sidebar button {
  border: 0;
  text-align: left;
  font-size: 13px;
}
.sidebar button.active {
  background: var(--tint);
  color: var(--brand);
}
.console {
  padding: 32px;
  max-width: 1600px;
}
.console h1 {
  font-size: 28px;
}
.console .hero {
  margin-bottom: 24px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stats .card {
  padding: 20px;
}
.stats b {
  font-size: 28px;
}
.stats p {
  font-size: 12px;
}
.admin-grid {
  display: grid;
  align-items: start;
  grid-template-columns: minmax(300px, 1fr) minmax(360px, 1fr);
  gap: 24px;
}
.rule-list {
  display: grid;
}
.rule-row {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  padding: 18px 0;
  font-size: 12px;
}
.rule-row.active {
  color: var(--brand);
  background: var(--tint);
  padding: 18px 10px;
}
.rule-row small {
  white-space: normal;
  min-width: 90px;
  text-align: right;
}
.diff-table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 16px 0; }
.diff-table th, .diff-table td { border: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; overflow-wrap: anywhere; white-space: pre-wrap; }
.diff-table th { background: var(--tint); }
.research-source { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow-y: auto; font-size: 12px; padding: 12px; background: var(--surface); }
#adminDialog { max-width: 900px; }
#modalBody { display: grid; gap: 14px; }
#filters { flex-wrap: wrap; }
.login-card {
  max-width: 440px;
  margin: 70px auto;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.form-section {
  border: 0;
  border-top: 1px solid var(--line);
  padding: 20px 0 0;
  margin: 4px 0 0;
  display: grid;
  gap: 16px;
  min-width: 0;
}
.form-section legend {
  font-size: 14px;
  font-weight: 600;
  padding: 0 12px 0 0;
}
.tabs {
  display: flex;
  gap: 16px;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.tabs button {
  padding: 2px 0;
  border: 0;
  min-height: 30px;
  background: none;
  color: var(--muted);
}
.tabs .active {
  color: var(--brand);
}
.history-row {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.history-row button {
  font-size: 12px;
}
.feedback-message {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.empty {
  font-size: 13px;
  color: var(--muted);
  padding: 20px 0;
}
.admin-message {
  margin-bottom: 20px;
}
.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.form-actions button {
  flex: 1;
}
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.original-preview {
  display: block;
  max-width: 100%;
  height: auto;
}
.translation-group {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}
@media (min-width: 1600px) {
  .nav {
    padding-left: calc((100% - 1268px) / 2);
    padding-right: calc((100% - 1268px) / 2);
  }
}
@media (max-width: 1050px) {
  .workspace {
    grid-template-columns: 310px minmax(0, 1fr);
  }
  .nav nav {
    gap: 18px;
  }
  .result-grid {
    grid-template-columns: 1fr;
  }
  .photo-panel {
    max-width: 100%;
  }
  .console {
    padding: 24px;
  }
  .admin-grid {
    grid-template-columns: 1fr;
  }
  .admin-shell {
    grid-template-columns: 180px minmax(0, 1fr);
  }
  .stats {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 700px) {
  .nav {
    min-height: 90px;
    padding: 22px 20px;
  }
  .nav nav {
    gap: 14px;
  }
  .desktop-link {
    display: none !important;
  }
  .logo {
    font-size: 30px;
  }
  .nav .active {
    display: none;
  }
  .wrap {
    padding: 30px 18px;
  }
  .hero h1 {
    font-size: 28px;
  }
  .benefits {
    font-size: 10px;
  }
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
  .steps {
    gap: 8px;
    padding: 18px 12px;
    font-size: 10px;
  }
  .steps li {
    max-width: 24%;
  }
  .card {
    padding: 24px;
  }
  .card-head {
    flex-wrap: wrap;
  }
  .dropzone {
    padding: 24px 18px;
  }
  .upload-links {
    gap: 8px;
  }
  .tools {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .result-grid {
    grid-template-columns: 1fr;
  }
  .download-row {
    align-items: stretch;
    flex-direction: column;
  }
  .photo-stage {
    max-width: 300px;
  }
  footer {
    align-items: flex-start;
  }
  .admin-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 12px 18px;
    gap: 4px;
  }
  .sidebar small {
    display: none;
  }
  .sidebar button {
    font-size: 12px;
    padding: 8px;
  }
  .console {
    padding: 24px 18px;
  }
  .console h1 {
    font-size: 24px;
  }
  .admin-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .login-card {
    margin: 40px 18px;
  }
  .stats {
    gap: 12px;
  }
  .stats .card {
    padding: 16px;
  }
  .form-actions {
    flex-direction: column;
  }
  dialog {
    padding: 22px;
  }
  .features {
    gap: 12px;
  }
}

.production-status { margin: 16px 0 20px; }
.production-status strong { font-size: 16px; }
.production-status ul { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 0; margin: 10px 0 0; list-style: none; font-size: 12px; }
.production-status li::before { content: "✓ "; }
.production-status ul[hidden] { display: none; }

.background-mode-label { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; font-size: 13px; font-weight: 600; }
#backgroundModeHint { line-height: 1.7; margin: 8px 0 0; }
/* Country/channel discovery and workflows that preserve the original file. */
.scenario-results { max-height: 280px; overflow-y: auto; border: 1px solid #d8e3df; border-radius: 10px; margin-bottom: 16px; padding: 6px; }
.scenario-results button { display: block; width: 100%; border: 0; text-align: left; padding: 10px; }
.scenario-results button:hover { background: #edf5f1; }
.guidance-card p, #originalResult, #serviceNote { white-space: pre-line; }
.guidance-card .guide-list { margin: 24px 0; }
.official-action { display: inline-block; padding: 12px 18px; border-radius: 10px; text-decoration: none; background: var(--brand); color: white; }
.original-check { border-top: 1px solid #d8e3df; margin-top: 28px; padding-top: 16px; }

.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.usage-table th, .usage-table td {
  padding: .7rem .25rem;
  border-bottom: 1px solid #dce3df;
  text-align: end;
}
.usage-table th:first-child { text-align: start; }
