:root {
  --paper: #f6f7f2;
  --paper-deep: #ecefe6;
  --card: #fcfdf9;
  --ink: #20251d;
  --ink-soft: #363d31;
  --muted: #62695c;
  --line: #dfe3d7;
  --line-strong: #c5ccba;
  --accent: #d8ff63;
  --accent-soft: #eff9d5;
  --danger: #a43b32;
  --white: #ffffff;
  --shadow-sm: 0 2px 3px rgba(32, 37, 29, .02), 0 8px 24px rgba(32, 37, 29, .045);
  --shadow-lg: 0 20px 60px rgba(32, 37, 29, .09);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #e7eae1;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  background: #e7eae1;
}

button,
input,
video {
  font: inherit;
}

button,
label,
summary {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:not(:disabled),
label,
summary {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

button,
a,
input,
summary,
[role="button"] {
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid #66851c;
  outline-offset: 3px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1[tabindex="-1"]:focus,
h2[tabindex="-1"]:focus {
  outline: none;
}

svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

[hidden] {
  display: none !important;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 8px;
  left: 50%;
  transform: translate(-50%, -160%);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--white);
  text-decoration: none;
}

.skip-link:focus {
  transform: translate(-50%, 0);
}

.app-shell {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 0 0 1px rgba(32, 37, 29, .035), var(--shadow-lg);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 22px 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(32, 37, 29, .12);
  border-radius: 14px;
  background: var(--accent);
  box-shadow: 0 4px 12px rgba(114, 143, 36, .12);
}

.brand-mark svg {
  width: 27px;
  height: 27px;
  stroke-width: 1.65;
}

.brand-type {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-type strong {
  font-size: 21px;
  font-weight: 750;
  letter-spacing: .08em;
  line-height: 1.15;
}

.brand-type small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
}

.service-status {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, .45);
  font-size: 10px;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6b8b22;
  box-shadow: 0 0 0 3px rgba(107, 139, 34, .12);
}

main {
  padding: 0 20px calc(112px + var(--safe-bottom));
}

.view {
  animation: view-in .35s ease both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero {
  padding: 32px 2px 0;
}

.eyebrow,
.section-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .17em;
}

.eyebrow i {
  width: 22px;
  height: 1px;
  background: var(--line-strong);
}

.hero h1 {
  margin: 16px 0 15px;
  font-size: clamp(35px, 9.5vw, 44px);
  font-weight: 760;
  letter-spacing: -.045em;
  line-height: 1.24;
}

.highlight {
  display: inline-block;
  margin-left: .08em;
  padding: 0 .1em .03em;
  border-radius: 7px;
  background: var(--accent);
  line-height: 1.15;
  transform: rotate(-1deg);
}

.hero > p {
  max-width: 335px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.steps li:not(:last-child)::after {
  content: "";
  width: 12px;
  height: 1px;
  margin-left: auto;
  margin-right: 8px;
  background: var(--line-strong);
}

.steps b {
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#analyzeForm {
  margin-top: 28px;
}

.upload-card {
  display: flex;
  min-height: 218px;
  padding: 26px 20px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 1.5px dashed #aeb8a1;
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: inset 0 0 0 5px rgba(246, 247, 242, .65);
  text-align: center;
  transition: border-color .2s ease, background-color .2s ease, transform .2s ease;
}

.upload-card:hover,
.upload-card.is-dragging {
  border-color: #728650;
  background: #f8fbeF;
}

.upload-card.is-dragging {
  transform: scale(.99);
}

.upload-orbit {
  display: grid;
  width: 64px;
  height: 64px;
  margin-bottom: 17px;
  place-items: center;
  border: 1px solid #d4e7a5;
  border-radius: 22px;
  background: var(--accent);
  box-shadow: 0 7px 18px rgba(122, 151, 47, .13);
  transform: rotate(-3deg);
}

.upload-orbit svg {
  width: 28px;
  height: 28px;
  transform: rotate(3deg);
}

.upload-card > strong {
  margin-bottom: 7px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.upload-card > span {
  margin-bottom: 15px;
  color: var(--muted);
  font-size: 13px;
}

.upload-card > small {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--paper-deep);
  font-size: 10px;
}

.demo-link {
  display: flex;
  min-height: 44px;
  margin: 7px auto 0;
  padding: 0 12px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 4px;
}

.demo-link svg {
  width: 15px;
  height: 15px;
}

.file-preview {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.video-frame {
  overflow: hidden;
  background: #171a16;
}

.video-frame video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 360px;
  background: #171a16;
  object-fit: contain;
}

.file-meta {
  display: flex;
  min-height: 76px;
  padding: 13px 12px 13px 15px;
  align-items: center;
  gap: 11px;
}

.file-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
}

.file-icon svg {
  width: 20px;
  height: 20px;
}

.file-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 4px;
}

.file-copy strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-copy span {
  color: var(--muted);
  font-size: 11px;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.icon-button:hover {
  background: var(--paper-deep);
}

.icon-button svg {
  width: 19px;
  height: 19px;
}

.analysis-options {
  margin-top: 25px;
}

.option-group {
  min-width: 0;
  margin: 0 0 22px;
  padding: 0;
  border: 0;
}

.option-group legend {
  width: 100%;
  margin-bottom: 11px;
  padding: 0;
  font-size: 13px;
  font-weight: 700;
}

.option-group legend span {
  margin-left: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
}

.model-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.choice-pill,
.segmented-control label {
  position: relative;
}

.choice-pill input,
.segmented-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.choice-pill > span {
  display: grid;
  min-height: 44px;
  padding: 0 6px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card);
  font-size: 12px;
  transition: background-color .18s ease, border-color .18s ease;
}

.choice-pill input:checked + span {
  border-color: #b8d672;
  background: var(--accent);
  font-weight: 700;
}

.choice-pill input:focus-visible + span,
.segmented-control input:focus-visible + span {
  outline: 3px solid #66851c;
  outline-offset: 3px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 15px;
  background: var(--paper-deep);
}

.segmented-control span {
  display: grid;
  min-height: 44px;
  place-items: center;
  border-radius: 11px;
  color: var(--muted);
  font-size: 12px;
}

.segmented-control input:checked + span {
  background: var(--white);
  box-shadow: 0 2px 8px rgba(32, 37, 29, .08);
  color: var(--ink);
  font-weight: 700;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 52px;
  padding: 0 18px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 700;
  transition: transform .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.primary-button {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--ink);
  background: var(--ink);
  box-shadow: 0 8px 18px rgba(32, 37, 29, .12);
  color: var(--white);
}

.primary-button > svg:first-child {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.primary-button .button-arrow {
  width: 19px;
  height: 19px;
  margin-left: auto;
  color: var(--white);
}

.primary-button > span {
  margin-right: auto;
}

.primary-button:not(:disabled):hover {
  background: #30382a;
  box-shadow: 0 10px 24px rgba(32, 37, 29, .16);
}

.primary-button:not(:disabled):active,
.secondary-button:not(:disabled):active {
  transform: translateY(1px);
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
}

.secondary-button:hover {
  background: var(--paper-deep);
}

.secondary-button svg {
  width: 19px;
  height: 19px;
}

.privacy-note {
  display: flex;
  margin: 12px 0 0;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

.privacy-note svg {
  width: 13px;
  height: 13px;
}

.page-footer {
  margin-top: 36px;
  color: #777e70;
  font-size: 10px;
  letter-spacing: .12em;
  text-align: center;
}

/* Analyzing */
.analyzing-view {
  padding: 42px 2px 24px;
}

.analyzing-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
}

.live-dot {
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0;
  font-weight: 500;
}

.live-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #698b1c;
  animation: breathe 1.8s ease-in-out infinite;
}

@keyframes breathe {
  50% { opacity: .35; }
}

.analyzing-visual {
  display: grid;
  min-height: 210px;
  place-items: center;
}

.scan-frame {
  position: relative;
  display: grid;
  width: 132px;
  height: 132px;
  overflow: hidden;
  place-items: center;
  border-radius: 38px;
  background: var(--ink);
  box-shadow: 0 16px 36px rgba(32, 37, 29, .16);
  transform: rotate(-3deg);
}

.scan-frame::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid #4c5544;
  border-radius: 29px;
}

.scan-frame svg {
  width: 58px;
  height: 58px;
  color: var(--accent);
  stroke-width: 1.2;
}

.scan-frame i {
  position: absolute;
  top: 20px;
  left: 18px;
  right: 18px;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(216, 255, 99, .5);
  animation: scan 2.8s ease-in-out infinite;
}

@keyframes scan {
  0%, 100% { transform: translateY(0); opacity: .4; }
  50% { transform: translateY(88px); opacity: 1; }
}

.analyzing-view h2 {
  margin: 0 0 10px;
  font-size: 25px;
  letter-spacing: -.03em;
  text-align: center;
}

.analyzing-lead {
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

.analysis-stages {
  display: flex;
  margin: 0;
  padding: 8px 18px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  list-style: none;
}

.analysis-stages li {
  position: relative;
  display: flex;
  min-height: 78px;
  align-items: center;
  gap: 14px;
  color: #747b6d;
}

.analysis-stages li:not(:last-child)::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 40px;
  right: 0;
  height: 1px;
  background: var(--line);
}

.stage-marker {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper);
}

.analysis-stages li > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.analysis-stages strong {
  font-size: 13px;
  font-weight: 600;
}

.analysis-stages small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.analysis-stages li.is-active {
  color: var(--ink);
}

.analysis-stages li.is-active .stage-marker {
  border: 5px solid var(--accent);
  background: var(--ink);
  animation: stage-pulse 1.6s ease-in-out infinite;
}

.analysis-stages li.is-done .stage-marker {
  border-color: var(--accent);
  background: var(--accent);
}

.analysis-stages li.is-done .stage-marker::after {
  content: "";
  width: 7px;
  height: 4px;
  border-bottom: 1.5px solid var(--ink);
  border-left: 1.5px solid var(--ink);
  transform: translateY(-1px) rotate(-45deg);
}

@keyframes stage-pulse {
  50% { box-shadow: 0 0 0 5px rgba(216, 255, 99, .25); }
}

.waiting-note {
  margin: 17px 6px 20px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
  text-align: center;
}

.analyzing-view > .secondary-button {
  width: 100%;
  background: transparent;
}

/* Result */
.result-view {
  padding-top: 27px;
}

.result-status {
  display: flex;
  align-items: center;
  gap: 11px;
}

.success-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid #c6dd92;
  border-radius: 15px;
  background: var(--accent);
}

.success-mark svg {
  width: 23px;
  height: 23px;
  stroke-width: 2;
}

.result-badges {
  display: flex;
  align-items: center;
  gap: 7px;
}

.status-label {
  font-size: 13px;
  font-weight: 700;
}

.result-status p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.demo-badge {
  padding: 3px 7px;
  border: 1px solid #9eaa8c;
  border-radius: 6px;
  background: var(--paper-deep);
  font-size: 10px;
  font-weight: 700;
}

.demo-notice {
  display: flex;
  margin-top: 18px;
  padding: 11px 13px;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid #d1deaf;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.55;
}

.demo-notice svg {
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

.demo-media {
  margin-top: 18px;
  border-radius: var(--radius-lg);
}

.demo-media p {
  margin: 0;
  padding: 14px;
  background: var(--paper-deep);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.result-intro {
  padding: 27px 1px 24px;
}

.result-intro h2 {
  margin: 10px 0 11px;
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -.035em;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.result-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.result-section {
  margin-top: 25px;
}

.section-heading,
.section-heading > div {
  display: flex;
  align-items: center;
}

.section-heading {
  min-height: 32px;
  margin-bottom: 12px;
  justify-content: space-between;
  gap: 10px;
}

.section-heading > div {
  gap: 8px;
}

.section-heading h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.section-index {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.section-note {
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .12em;
}

.language-tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 11px;
  background: var(--paper-deep);
}

.language-tabs button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.language-tabs button[aria-selected="true"] {
  background: var(--ink);
  color: var(--white);
  font-weight: 700;
}

.prompt-card {
  overflow: hidden;
  padding: 19px;
  border: 1px solid #343c2e;
  border-radius: var(--radius-xl);
  background: var(--ink);
  box-shadow: 0 12px 28px rgba(32, 37, 29, .13);
  color: #f6f7f2;
}

.prompt-card-top {
  display: flex;
  margin-bottom: 16px;
  align-items: center;
  justify-content: space-between;
  color: #c5ccbb;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
}

.prompt-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.prompt-text {
  min-height: 90px;
  margin: 0;
  color: #f3f5ed;
  font-size: 14px;
  line-height: 1.9;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.english-prompt {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.85;
}

.copy-button {
  display: flex;
  width: 100%;
  min-height: 46px;
  margin-top: 20px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 13px;
  background: var(--accent);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.copy-button:hover {
  background: #e2ff8d;
}

.copy-button svg {
  width: 17px;
  height: 17px;
}

.shot-timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.shot-item {
  position: relative;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  padding-bottom: 14px;
}

.shot-item:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 33px;
  bottom: -1px;
  left: 23px;
  width: 1px;
  background: var(--line-strong);
}

.shot-time {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  align-self: start;
  border: 1px solid #cbdc9f;
  border-radius: 9px;
  background: var(--accent-soft);
  font-size: 9px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.shot-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card);
}

.shot-visual {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.shot-detail {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 5px 7px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  line-height: 1.6;
}

.shot-detail dt {
  color: var(--muted);
}

.shot-detail dd {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty-section-note {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.audio-card {
  display: flex;
  padding: 17px;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid #d8e5b8;
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
}

.audio-card > span {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  background: var(--accent);
}

.audio-card svg {
  width: 19px;
  height: 19px;
}

.audio-card p {
  margin: 0;
  font-size: 12px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.parameter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.parameter-chip {
  display: inline-flex;
  min-height: 38px;
  padding: 8px 12px;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  font-size: 11px;
}

.parameter-chip span {
  color: var(--muted);
}

.parameter-chip strong {
  max-width: 260px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.negative-card {
  margin-top: 25px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
}

.negative-card summary {
  display: grid;
  min-height: 66px;
  grid-template-columns: 1fr auto;
  align-content: center;
  align-items: center;
  gap: 3px 8px;
  list-style: none;
}

.negative-card summary::-webkit-details-marker {
  display: none;
}

.negative-card summary > span {
  font-size: 13px;
  font-weight: 700;
}

.negative-card summary small {
  grid-column: 1;
  color: var(--muted);
  font-size: 10px;
}

.negative-card summary svg {
  grid-column: 2;
  grid-row: 1 / span 2;
  width: 17px;
  height: 17px;
  transform: rotate(90deg);
  transition: transform .2s ease;
}

.negative-card[open] summary svg {
  transform: rotate(-90deg);
}

.negative-card > p {
  margin: 0;
  padding: 15px 0 0;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.text-copy-button {
  display: flex;
  min-height: 44px;
  margin: 8px 0 8px auto;
  padding: 0 4px 0 12px;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.text-copy-button svg {
  width: 15px;
  height: 15px;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 26px;
}

.again-button {
  margin-top: 10px;
}

.again-button > span {
  margin: 0;
}

/* History */
.history-view {
  padding-top: 35px;
}

.history-header {
  display: flex;
  margin-bottom: 26px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.history-header h1 {
  margin: 9px 0 8px;
  font-size: 30px;
  letter-spacing: -.04em;
}

.history-header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.text-button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  font-size: 12px;
}

.danger-text {
  color: var(--danger);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.history-item {
  display: flex;
  overflow: hidden;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.history-open {
  display: flex;
  min-width: 0;
  min-height: 116px;
  padding: 17px 5px 17px 16px;
  flex: 1;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  text-align: left;
}

.history-open:hover {
  background: rgba(236, 239, 230, .45);
}

.history-thumb {
  display: grid;
  width: 44px;
  height: 52px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--ink);
}

.history-thumb svg {
  width: 22px;
  height: 22px;
}

.history-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 7px;
}

.history-copy strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.history-copy small {
  color: var(--muted);
  font-size: 10px;
}

.history-open > svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.history-delete {
  align-self: stretch;
  width: 44px;
  min-height: 44px;
  margin-right: 3px;
  color: var(--muted);
}

.history-delete:hover {
  color: var(--danger);
}

.empty-history {
  padding: 60px 20px 30px;
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 74px;
  height: 74px;
  margin: 0 auto 22px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 25px;
  background: var(--paper-deep);
  color: var(--muted);
}

.empty-icon svg {
  width: 32px;
  height: 32px;
}

.empty-history h2 {
  margin-bottom: 10px;
  font-size: 19px;
}

.empty-history p {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

/* Fixed navigation and feedback */
.bottom-nav {
  position: fixed;
  z-index: 50;
  bottom: 0;
  left: 50%;
  display: grid;
  width: min(100%, 480px);
  min-height: calc(72px + var(--safe-bottom));
  padding: 7px max(24px, env(safe-area-inset-right, 0px)) var(--safe-bottom) max(24px, env(safe-area-inset-left, 0px));
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid rgba(197, 204, 186, .75);
  background: rgba(246, 247, 242, .96);
  box-shadow: 0 -8px 24px rgba(32, 37, 29, .035);
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.bottom-nav button {
  position: relative;
  display: flex;
  min-height: 58px;
  padding: 5px 16px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
}

.bottom-nav button > svg {
  width: 23px;
  height: 23px;
}

.bottom-nav button[aria-current="page"] {
  color: var(--ink);
  font-weight: 700;
}

.bottom-nav button[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 4px;
  width: 34px;
  height: 28px;
  border-radius: 10px;
  background: var(--accent);
  z-index: -1;
}

.bottom-nav button[aria-current="page"] > svg {
  transform: translateY(-2px);
}

.bottom-nav button[aria-current="page"] > span:not(.history-count) {
  transform: translateY(-2px);
}

.history-count {
  position: absolute;
  top: 5px;
  left: calc(50% + 9px);
  display: grid;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  place-items: center;
  border: 2px solid var(--paper);
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  font-size: 8px;
  font-weight: 700;
}

.install-tip {
  position: fixed;
  z-index: 80;
  bottom: calc(84px + var(--safe-bottom));
  left: 50%;
  display: grid;
  width: min(calc(100% - 28px), 440px);
  min-height: 84px;
  padding: 12px 8px 12px 13px;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 16px 45px rgba(32, 37, 29, .16);
  transform: translateX(-50%);
  animation: tip-in .3s ease both;
}

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

.install-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: var(--accent);
}

.install-icon svg {
  width: 19px;
  height: 19px;
}

.install-tip strong {
  font-size: 12px;
}

.install-tip p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.install-action {
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
}

.install-tip .icon-button {
  width: 44px;
}

.native-app .service-status {
  display: none;
}

.server-settings {
  min-width: 64px;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.server-dialog {
  width: min(calc(100% - 32px), 420px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(32, 37, 29, .25);
}

.server-dialog::backdrop {
  background: rgba(20, 25, 18, .52);
  backdrop-filter: blur(4px);
}

.server-dialog form {
  padding: 26px;
}

.server-dialog h2 {
  margin: 12px 0 8px;
  font-size: 25px;
}

.server-dialog p,
.server-dialog small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.server-dialog label {
  display: block;
  margin: 22px 0 8px;
  font-size: 12px;
  font-weight: 700;
}

.server-dialog input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
}

.server-dialog small {
  display: block;
  margin-top: 9px;
}

.server-dialog .server-test-status {
  min-height: 20px;
  margin: 12px 0 0;
}

.server-dialog-actions {
  display: grid;
  margin-top: 18px;
  grid-template-columns: 1fr 1fr 1.15fr;
  gap: 8px;
}

.server-dialog-actions button {
  min-height: 46px;
  padding: 0 10px;
}

.server-dialog .primary-button {
  margin: 0;
}

.toast {
  position: fixed;
  z-index: 100;
  bottom: calc(92px + var(--safe-bottom));
  left: 50%;
  display: flex;
  width: max-content;
  max-width: min(calc(100% - 36px), 420px);
  min-height: 50px;
  padding: 12px 17px;
  align-items: center;
  gap: 9px;
  border: 1px solid #3f4838;
  border-radius: 15px;
  background: var(--ink);
  box-shadow: 0 12px 32px rgba(32, 37, 29, .2);
  color: var(--white);
  font-size: 12px;
  line-height: 1.55;
  transform: translateX(-50%);
  animation: toast-in .22s ease both;
}

.toast.is-error .toast-icon {
  color: #ffc1b8;
}

.toast-icon {
  display: inline-flex;
  color: var(--accent);
}

.toast-icon svg {
  width: 18px;
  height: 18px;
}

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

@media (max-width: 360px) {
  .app-header { padding-left: 17px; padding-right: 17px; }
  main { padding-left: 16px; padding-right: 16px; }
  .service-status { padding: 0 8px; font-size: 9px; }
  .hero h1 { font-size: 34px; }
  .steps li { gap: 4px; font-size: 10px; }
  .steps li:not(:last-child)::after { width: 7px; margin-right: 5px; }
  .model-options { gap: 5px; }
  .choice-pill > span { font-size: 11px; }
  .option-group legend span { display: block; margin: 4px 0 0; }
  .install-tip { grid-template-columns: auto 1fr auto; }
  .install-tip .install-icon { display: none; }
}

@media (min-width: 700px) {
  body { padding: 22px 0; }
  .app-shell { min-height: calc(100dvh - 44px); border-radius: 30px; }
  .bottom-nav { bottom: 22px; border-radius: 0 0 30px 30px; }
  .install-tip, .toast { bottom: 108px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .scan-frame i { display: none; }
}

@media (forced-colors: active) {
  .status-dot, .live-dot::before, .prompt-dot { border: 1px solid CanvasText; }
  .upload-card { border-style: dashed; }
  .bottom-nav { background: Canvas; }
}
