﻿:root {
  --ink: #183336;
  --ink-soft: #315457;
  --muted: #6b8180;
  --paper: #f4f2eb;
  --panel: rgba(255, 253, 248, 0.94);
  --panel-solid: #fffdf8;
  --line: #dbe3de;
  --line-strong: #bccbc5;
  --teal: #0f766e;
  --teal-dark: #0a5c57;
  --teal-soft: #e3f3ef;
  --amber: #d7931f;
  --amber-soft: #fff3d7;
  --red: #c2413b;
  --red-soft: #fdecea;
  --shadow: 0 18px 60px rgba(37, 60, 53, 0.10);
  --shadow-soft: 0 8px 28px rgba(37, 60, 53, 0.08);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  overflow-x: hidden;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  background:
    radial-gradient(circle at 8% 4%, rgba(15, 118, 110, 0.11), transparent 28rem),
    radial-gradient(circle at 92% 13%, rgba(215, 147, 31, 0.10), transparent 23rem),
    linear-gradient(145deg, #f7f5ef 0%, #edf2ee 100%);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

button,
select {
  cursor: pointer;
}

svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hidden {
  display: none !important;
}

.paper-noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(32, 67, 65, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(32, 67, 65, 0.022) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, #000, transparent 88%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  width: min(1560px, 100%);
  margin: 0 auto;
  padding: 1.1rem clamp(1rem, 3vw, 2.5rem);
  background: rgba(247, 245, 239, 0.80);
  border-bottom: 1px solid rgba(188, 203, 197, 0.55);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 0.9rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  flex: 0 0 auto;
  color: white;
  border-radius: 16px;
  background: linear-gradient(145deg, #12978c, #0b625c);
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.24);
}

.brand-mark svg {
  width: 2rem;
  height: 2rem;
  stroke-width: 2.2;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.1rem, 2vw, 1.38rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.brand h1 span {
  color: var(--teal);
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand p {
  margin: 0.28rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  margin-left: 0.25rem;
  padding: 0.45rem 0.8rem;
  color: var(--teal-dark);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid #badbd4;
  border-radius: 999px;
  background: rgba(227, 243, 239, 0.78);
}

.status-pill.working {
  color: #9a6509;
  border-color: #efd494;
  background: var(--amber-soft);
}

.status-pill.error {
  color: var(--red);
  border-color: #efbbb7;
  background: var(--red-soft);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.68rem 1rem;
  font-weight: 750;
  border: 1px solid transparent;
  border-radius: 13px;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.button.primary {
  color: white;
  background: linear-gradient(145deg, #13877e, #0d6863);
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.20);
}

.button.primary:hover:not(:disabled) {
  box-shadow: 0 11px 26px rgba(15, 118, 110, 0.27);
}

.button.secondary {
  color: var(--ink-soft);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.68);
}

.button.secondary:hover:not(:disabled) {
  color: var(--teal-dark);
  border-color: #9abdb5;
  background: white;
}

.button.ghost {
  color: var(--ink-soft);
  border-color: transparent;
  background: transparent;
}

.button.ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.76);
}

.button.danger {
  color: var(--red);
}

.button.wide {
  width: 100%;
  min-height: 3.25rem;
  font-size: 1rem;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 2.65rem;
  height: 2.65rem;
  flex: 0 0 auto;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.icon-button:hover {
  color: var(--teal);
  border-color: #acd1c9;
  background: white;
  transform: translateY(-1px);
}

.icon-button.small {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
}

.icon-button.small svg {
  width: 1.05rem;
  height: 1.05rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(330px, 0.84fr) minmax(0, 1.46fr);
  gap: clamp(1rem, 2.3vw, 2rem);
  width: min(1560px, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 2.5vw, 2rem) clamp(1rem, 3vw, 2.5rem) 3rem;
  align-items: start;
}

.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(191, 205, 199, 0.78);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.input-panel {
  padding: clamp(1rem, 2.4vw, 1.5rem);
}

.result-panel {
  min-height: 660px;
  padding: clamp(1rem, 2.4vw, 1.75rem);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-heading h2 {
  margin: 0.1rem 0 0;
  font-size: 1.44rem;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.eyebrow {
  margin: 0;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.drop-zone {
  position: relative;
  min-height: 350px;
  overflow: hidden;
  border: 1.5px dashed #b6c8c2;
  border-radius: 21px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(238, 246, 242, 0.72));
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.drop-zone.dragging {
  border-color: var(--teal);
  background: var(--teal-soft);
  transform: scale(0.995);
}

.drop-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 350px;
  padding: 1.5rem;
  text-align: center;
}

.camera-illustration {
  width: 144px;
  max-width: 52%;
  margin-bottom: 0.6rem;
  color: var(--teal);
}

.camera-illustration svg {
  width: 100%;
  height: auto;
  overflow: visible;
  stroke-width: 2.4;
}

.cam-body,
.cam-lens,
.cam-line {
  fill: rgba(255, 255, 255, 0.65);
}

.cam-glow {
  fill: rgba(215, 147, 31, 0.25);
  stroke: none;
}

.drop-empty h3 {
  margin: 0.4rem 0 0.35rem;
  font-size: 1.08rem;
}

.drop-empty p {
  max-width: 24rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

.capture-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1.15rem;
}

.editor {
  position: relative;
  padding: 0.65rem;
}

.crop-toolbar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 2.7rem;
  margin-bottom: 0.55rem;
}

.toolbar-group {
  display: flex;
  gap: 0.35rem;
}

.crop-hint {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.crop-stage {
  display: grid;
  place-items: center;
  min-height: 310px;
  max-height: 470px;
  padding: 0.35rem;
  overflow: hidden;
  border-radius: 16px;
  background:
    linear-gradient(45deg, #e9efeb 25%, transparent 25%),
    linear-gradient(-45deg, #e9efeb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e9efeb 75%),
    linear-gradient(-45deg, transparent 75%, #e9efeb 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.crop-wrap {
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
  max-width: 100%;
  border-radius: 9px;
  box-shadow: 0 6px 22px rgba(22, 48, 50, 0.19);
  touch-action: none;
  user-select: none;
}

.crop-wrap > img {
  display: block;
  max-width: none;
  pointer-events: none;
}

.crop-box {
  position: absolute;
  min-width: 5%;
  min-height: 5%;
  border: 2px solid #fff;
  border-radius: 6px;
  outline: 9999px solid rgba(18, 43, 43, 0.50);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(0, 0, 0, 0.20);
  cursor: move;
}

.crop-box:focus-visible {
  outline-color: rgba(18, 43, 43, 0.50);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.92), 0 0 0 5px var(--teal);
}

.crop-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to right, transparent 33.2%, rgba(255,255,255,0.76) 33.2%, rgba(255,255,255,0.76) 33.7%, transparent 33.7%, transparent 66.3%, rgba(255,255,255,0.76) 66.3%, rgba(255,255,255,0.76) 66.8%, transparent 66.8%),
    linear-gradient(to bottom, transparent 33.2%, rgba(255,255,255,0.76) 33.2%, rgba(255,255,255,0.76) 33.7%, transparent 33.7%, transparent 66.3%, rgba(255,255,255,0.76) 66.3%, rgba(255,255,255,0.76) 66.8%, transparent 66.8%);
}

.crop-handle {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 2px solid white;
  border-radius: 4px;
  background: var(--teal);
  box-shadow: 0 1px 5px rgba(0,0,0,0.35);
}

.crop-handle.nw { top: -12px; left: -12px; cursor: nwse-resize; }
.crop-handle.ne { top: -12px; right: -12px; cursor: nesw-resize; }
.crop-handle.sw { bottom: -12px; left: -12px; cursor: nesw-resize; }
.crop-handle.se { bottom: -12px; right: -12px; cursor: nwse-resize; }

.input-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

.input-options label,
.question-field,
.field {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

.input-options label > span,
.question-field > span,
.field > span {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 760;
}

.question-field em {
  color: var(--muted);
  font-size: 0.74rem;
  font-style: normal;
  font-weight: 500;
}

select,
input[type="text"],
input[type="url"],
input[type="password"],
textarea {
  width: 100%;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  outline: none;
  background: rgba(255, 255, 255, 0.86);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

select,
input[type="text"],
input[type="url"],
input[type="password"] {
  min-height: 2.7rem;
  padding: 0.55rem 0.75rem;
}

textarea {
  resize: vertical;
  padding: 0.72rem 0.78rem;
  line-height: 1.55;
}

select:focus,
input:focus,
textarea:focus {
  border-color: #78aaa0;
  background: white;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.11);
}

.question-field {
  margin-top: 1rem;
}

.solve-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.7rem;
  margin-top: 1rem;
}

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.55;
}

.privacy-note svg {
  width: 0.95rem;
  height: 0.95rem;
  flex: 0 0 auto;
  margin-top: 0.08rem;
  color: var(--teal);
}

.result-heading {
  margin-bottom: 1.2rem;
}

.result-actions {
  display: flex;
  gap: 0.4rem;
}

.empty-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 540px;
  padding: 2rem;
  text-align: center;
}

.math-orbit {
  position: relative;
  display: grid;
  place-items: center;
  width: 180px;
  height: 180px;
  margin-bottom: 1.3rem;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 50%;
}

.math-orbit::before,
.math-orbit::after {
  content: "";
  position: absolute;
  border: 1px dashed rgba(15, 118, 110, 0.26);
  border-radius: 50%;
}

.math-orbit::before { inset: 22px; }
.math-orbit::after { inset: 46px; }

.orbit-center {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  color: white;
  font: 800 2rem/1 var(--serif);
  border-radius: 18px;
  background: linear-gradient(145deg, #13958a, #0a615c);
  box-shadow: 0 14px 30px rgba(15,118,110,0.23);
}

.math-orbit > span {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--teal-dark);
  font: 700 1rem/1 var(--serif);
  border: 1px solid #c8ddd8;
  border-radius: 50%;
  background: #f7fffc;
  box-shadow: var(--shadow-soft);
}

.math-orbit > span:nth-child(1) { top: -7px; left: 72px; }
.math-orbit > span:nth-child(2) { top: 72px; right: -7px; }
.math-orbit > span:nth-child(3) { bottom: -7px; left: 72px; }
.math-orbit > span:nth-child(4) { top: 72px; left: -7px; }

.empty-result h3 {
  margin: 0;
  font-size: 1.2rem;
}

.empty-result p {
  max-width: 28rem;
  margin: 0.5rem 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.example-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 1.15rem;
}

.example-chips span {
  padding: 0.38rem 0.66rem;
  color: var(--ink-soft);
  font-size: 0.72rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.7);
}

.result-content {
  animation: resultIn 280ms ease both;
}

@keyframes resultIn {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.result-meta span {
  padding: 0.32rem 0.58rem;
  border-radius: 999px;
  background: #edf3ef;
}

.markdown-body {
  overflow-x: hidden;
  min-height: 390px;
  padding: clamp(1rem, 2.5vw, 1.65rem);
  color: #243f40;
  font-size: 0.98rem;
  line-height: 1.86;
  border: 1px solid #dde6e1;
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.72);
}

.markdown-body > :first-child {
  margin-top: 0;
}

.markdown-body > :last-child {
  margin-bottom: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  color: var(--ink);
  line-height: 1.35;
  letter-spacing: -0.015em;
}

.markdown-body h1 {
  margin: 0 0 1rem;
  padding-bottom: 0.65rem;
  font-size: 1.5rem;
  border-bottom: 2px solid var(--teal-soft);
}

.markdown-body h2 {
  margin: 1.65rem 0 0.72rem;
  padding-left: 0.75rem;
  font-size: 1.2rem;
  border-left: 4px solid var(--teal);
}

.markdown-body h3 {
  margin: 1.2rem 0 0.55rem;
  font-size: 1.04rem;
  color: var(--teal-dark);
}

.markdown-body p {
  margin: 0.6rem 0;
}

.markdown-body strong {
  color: #0a5d57;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0.65rem 0;
  padding-left: 1.45rem;
}

.markdown-body li {
  margin: 0.35rem 0;
}

.markdown-body blockquote {
  margin: 1rem 0;
  padding: 0.7rem 1rem;
  color: #34585a;
  border-left: 4px solid var(--amber);
  border-radius: 0 10px 10px 0;
  background: var(--amber-soft);
}

.markdown-body code {
  padding: 0.12rem 0.35rem;
  color: #9b4d14;
  font-size: 0.9em;
  border-radius: 5px;
  background: #f7eee1;
}

.markdown-body pre {
  overflow-x: auto;
  padding: 1rem;
  color: #ecf7f3;
  border-radius: 12px;
  background: #173c3d;
}

.markdown-body pre code {
  padding: 0;
  color: inherit;
  background: transparent;
}

.markdown-body table {
  width: 100%;
  margin: 1rem 0;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 10px;
}

.markdown-body th,
.markdown-body td {
  padding: 0.62rem 0.7rem;
  text-align: left;
  border: 1px solid #d8e2dd;
}

.markdown-body th {
  color: var(--teal-dark);
  background: #eaf4f0;
}

.markdown-body hr {
  height: 1px;
  margin: 1.4rem 0;
  border: 0;
  background: var(--line);
}

.markdown-body .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.3rem 0;
}

.follow-up {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f7faf7;
}

.follow-up > label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 760;
}

.follow-up-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.65rem;
}

.loading-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 1rem;
  border-radius: inherit;
  background: rgba(248, 250, 246, 0.82);
  backdrop-filter: blur(10px);
}

.loading-card {
  width: min(360px, 100%);
  padding: 1.5rem;
  text-align: center;
  border: 1px solid rgba(188, 203, 197, 0.82);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.loading-card h3 {
  margin: 0.9rem 0 0.3rem;
  font-size: 1.08rem;
}

.loading-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.thinking-glyph {
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  gap: 7px;
  height: 38px;
}

.thinking-glyph span {
  display: block;
  width: 10px;
  border-radius: 999px;
  background: var(--teal);
  animation: think 900ms ease-in-out infinite alternate;
}

.thinking-glyph span:nth-child(1) { height: 18px; }
.thinking-glyph span:nth-child(2) { height: 34px; animation-delay: 150ms; background: var(--amber); }
.thinking-glyph span:nth-child(3) { height: 24px; animation-delay: 300ms; }

@keyframes think {
  from { transform: scaleY(0.58); opacity: 0.55; }
  to { transform: scaleY(1); opacity: 1; }
}

.progress-track {
  height: 5px;
  margin-top: 1rem;
  overflow: hidden;
  border-radius: 999px;
  background: #e6eeea;
}

.progress-track i {
  display: block;
  width: 45%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #62b9a9, var(--amber));
  animation: progressMove 1.4s ease-in-out infinite;
}

@keyframes progressMove {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(260%); }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  z-index: 80;
  max-width: min(90vw, 480px);
  padding: 0.78rem 1.05rem;
  color: white;
  font-size: 0.84rem;
  font-weight: 650;
  text-align: center;
  border-radius: 12px;
  background: rgba(24, 51, 54, 0.94);
  box-shadow: 0 14px 34px rgba(20, 42, 42, 0.24);
  transform: translateX(-50%);
  animation: toastIn 180ms ease both;
}

.toast.error {
  background: rgba(156, 48, 43, 0.96);
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.modal {
  width: min(620px, calc(100vw - 2rem));
  max-height: min(860px, calc(100vh - 2rem));
  padding: 0;
  color: var(--ink);
  border: 0;
  border-radius: 24px;
  background: transparent;
}

.modal::backdrop {
  background: rgba(17, 37, 39, 0.48);
  backdrop-filter: blur(5px);
}

.modal-card {
  max-height: min(860px, calc(100vh - 2rem));
  overflow: auto;
  padding: clamp(1.1rem, 3vw, 1.6rem);
  border: 1px solid rgba(255,255,255,0.75);
  border-radius: 24px;
  background: var(--panel-solid);
  box-shadow: 0 30px 90px rgba(14, 37, 37, 0.28);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.modal-head h2 {
  margin: 0.15rem 0 0;
  font-size: 1.4rem;
}

.modal-intro,
.modal-note {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.65;
}

.modal-intro {
  margin: 0 0 1rem;
}

.modal-note {
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: #f0f5f2;
}

.settings-modal .field {
  margin-top: 0.85rem;
}

.field-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 0.75rem;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 4rem;
}

.text-button {
  position: absolute;
  top: 50%;
  right: 0.7rem;
  padding: 0.25rem;
  color: var(--teal);
  font-size: 0.75rem;
  font-weight: 750;
  border: 0;
  background: transparent;
  transform: translateY(-50%);
}

.advanced {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8faf8;
}

.advanced summary {
  padding: 0.76rem 0.85rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 750;
  cursor: pointer;
}

.advanced .field,
.advanced .check-field {
  margin: 0 0.85rem 0.85rem;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.check-field input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--teal);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.15rem;
}

.camera-modal {
  width: min(900px, calc(100vw - 1.25rem));
}

.camera-card {
  padding: 1rem;
}

.camera-view {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  background: #0b1718;
}

.camera-view video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-guide {
  position: absolute;
  inset: 8%;
  border: 2px solid rgba(255,255,255,0.72);
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(6, 18, 19, 0.17);
}

.camera-guide::before,
.camera-guide::after {
  content: "";
  position: absolute;
  background: rgba(255,255,255,0.55);
}

.camera-guide::before { top: 33.33%; left: 0; width: 100%; height: 1px; box-shadow: 0 33.33vh 0 rgba(255,255,255,0.0); }
.camera-guide::after { left: 33.33%; top: 0; width: 1px; height: 100%; }

.camera-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1rem;
}

.camera-controls .button.ghost {
  justify-self: end;
}

.shutter-button {
  width: 66px;
  height: 66px;
  border: 5px solid var(--panel-solid);
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 2px var(--teal), 0 9px 24px rgba(15,118,110,0.28);
  transition: transform 130ms ease;
}

.shutter-button:hover {
  transform: scale(1.04);
}

.shutter-button:active {
  transform: scale(0.94);
}

.history-modal {
  width: min(720px, calc(100vw - 1.5rem));
}

.history-list {
  display: grid;
  gap: 0.7rem;
  max-height: min(560px, 62vh);
  overflow: auto;
  padding-right: 0.25rem;
}

.history-empty {
  padding: 2.5rem 1rem;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 15px;
}

.history-item {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.65rem;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: white;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.history-item:hover {
  border-color: #9dc5bd;
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.history-thumb {
  width: 68px;
  height: 52px;
  object-fit: cover;
  border-radius: 10px;
  background: #eaf0ed;
}

.history-main {
  min-width: 0;
}

.history-title {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-sub {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.7rem;
}

.history-delete {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  color: var(--muted);
  border: 0;
  border-radius: 9px;
  background: transparent;
}

.history-delete:hover {
  color: var(--red);
  background: var(--red-soft);
}

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

  .result-panel {
    min-height: 560px;
  }

  .empty-result {
    min-height: 400px;
  }

  .markdown-body {
  overflow-x: hidden;
    min-height: 300px;
  }
}

@media (max-width: 680px) {
  #installBtn {
    display: none !important;
  }

  .camera-modal {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }

  .camera-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-height: none;
    padding: max(0.7rem, env(safe-area-inset-top)) 0.7rem max(0.7rem, env(safe-area-inset-bottom));
    overflow: hidden;
    border-radius: 0;
  }

  .camera-card .modal-head,
  .camera-controls {
    flex: 0 0 auto;
  }

  .camera-view {
    flex: 1 1 auto;
    min-height: 0;
    aspect-ratio: auto;
    border-radius: 14px;
  }

  .camera-guide {
    inset: 4%;
  }

  .camera-controls {
    margin-top: 0.75rem;
  }
  .topbar {
    align-items: flex-start;
    padding: 0.8rem 0.8rem;
  }

  .brand-mark {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 13px;
  }

  .brand-mark svg {
    width: 1.65rem;
    height: 1.65rem;
  }

  .brand p,
  .status-pill {
    display: none;
  }

  .top-actions {
    flex: 0 0 auto;
    gap: 0.25rem;
  }

  .top-actions .button {
    min-width: 2.55rem;
    min-height: 2.55rem;
    padding: 0.52rem;
    font-size: 0;
  }

  .top-actions .button svg {
    width: 1.12rem;
    height: 1.12rem;
  }

  .workspace {
    padding: 0.8rem 0.8rem 2rem;
    gap: 0.8rem;
  }

  .input-panel,
  .result-panel {
    border-radius: 20px;
  }

  .drop-zone,
  .drop-empty {
    min-height: 310px;
  }

  .crop-stage {
    min-height: 240px;
    max-height: 360px;
  }

  .crop-hint {
    display: none;
  }

  .input-options,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .solve-actions {
    grid-template-columns: 1fr;
  }

  .follow-up-row {
    grid-template-columns: 1fr;
  }

  .camera-controls {
    grid-template-columns: 1fr auto 1fr;
  }

  .camera-controls .button {
    padding: 0.55rem;
    font-size: 0.74rem;
  }

  .shutter-button {
    width: 58px;
    height: 58px;
  }

  .history-item {
    grid-template-columns: 56px minmax(0, 1fr) auto;
  }

  .history-thumb {
    width: 56px;
    height: 46px;
  }
}

@media print {
  @page { margin: 12mm; }

  body {
  overflow-x: hidden;
    color: #000;
    background: white;
  }

  .paper-noise,
  .topbar,
  .input-panel,
  .result-actions,
  .follow-up,
  .toast,
  .loading-layer {
    display: none !important;
  }

  .workspace {
    display: block;
    width: 100%;
    padding: 0;
  }

  .result-panel {
    min-height: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: white;
  }

  .result-panel .panel-heading {
    display: none;
  }

  .result-content,
  .markdown-body {
  overflow-x: hidden;
    display: block !important;
    min-height: 0;
    padding: 0;
    border: 0;
    background: white;
  }

  .result-meta {
    display: none;
  }

  .markdown-body {
  overflow-x: hidden;
    font-size: 11.5pt;
    line-height: 1.65;
  }

  .markdown-body h2 {
    break-after: avoid;
  }

  .markdown-body p,
  .markdown-body li,
  .markdown-body table {
    break-inside: avoid;
  }
}





