:root {
  font-family: Inter, 'Segoe UI', 'Microsoft YaHei', system-ui, sans-serif;
  color: #20221d;
  background: #f5f1e8;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 18%, rgba(211, 226, 187, 0.55), transparent 27rem),
    radial-gradient(circle at 84% 48%, rgba(235, 209, 168, 0.38), transparent 25rem),
    #f5f1e8;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }

:where(button, a, input):focus-visible {
  outline: 3px solid #d49353;
  outline-offset: 3px;
}

.page-shell {
  width: min(1160px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.site-header {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-actions { display: flex; align-items: center; gap: 9px; }

.install-button {
  padding: 8px 12px;
  color: #fff;
  border: 0;
  border-radius: 999px;
  background: #2e4a37;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.install-button:hover { background: #223e2c; }

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: #20221d;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.5px;
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: #f7f5ee;
  background: #2e4a37;
  border-radius: 9px 9px 9px 2px;
  font-family: Georgia, serif;
  font-style: italic;
}

.privacy-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  color: #536257;
  border: 1px solid rgba(46, 74, 55, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  font-size: 13px;
  font-weight: 600;
}

.privacy-pill svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

main { flex: 1; }

.hero {
  max-width: 760px;
  margin: 65px auto 42px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 18px;
  color: #697968;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

h1 {
  margin: 0;
  color: #22241f;
  font-family: Georgia, 'Songti SC', 'SimSun', serif;
  font-size: clamp(42px, 6vw, 68px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.05em;
}

h1 span { color: #52705a; }

.hero-copy {
  max-width: 620px;
  margin: 24px auto 0;
  color: #676a61;
  font-size: 16px;
  line-height: 1.8;
}

.tool-card {
  max-width: 920px;
  min-height: 348px;
  margin: 0 auto;
  padding: 12px;
  background: rgba(255, 253, 248, 0.82);
  border: 1px solid rgba(48, 57, 43, 0.11);
  border-radius: 26px;
  box-shadow: 0 22px 60px rgba(66, 57, 38, 0.1);
  backdrop-filter: blur(12px);
}

.drop-zone {
  min-height: 322px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 35px;
  border: 1.5px dashed #b8c3b5;
  border-radius: 18px;
  text-align: center;
  transition: 160ms ease;
}

.drop-zone.is-dragging {
  border-color: #496952;
  background: #f1f5ed;
  transform: scale(0.995);
}

.upload-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  color: #426049;
  background: #e4ebdf;
  border-radius: 16px;
}

.upload-icon svg {
  width: 27px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.drop-zone h2 {
  margin: 18px 0 6px;
  font-family: Georgia, 'Songti SC', 'SimSun', serif;
  font-size: 23px;
  font-weight: 400;
}

.drop-zone p {
  margin: 0 0 19px;
  color: #75786f;
  font-size: 14px;
}

.primary-button, .convert-button, .download-button {
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: #2f503a;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease;
}

.primary-button { padding: 11px 22px; }
.primary-button:hover, .convert-button:hover, .download-button:hover { background: #223e2c; transform: translateY(-1px); }

.file-note {
  margin-top: 16px;
  color: #989b92;
  font-size: 11px;
}

.workspace {
  min-height: 322px;
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(300px, 0.96fr);
  overflow: hidden;
  border-radius: 18px;
}

.preview-panel {
  padding: 26px;
  background: #e9e7df;
}

.preview-frame {
  position: relative;
  height: 220px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background-color: #d8d7d0;
  background-image:
    linear-gradient(45deg, #c7c7c0 25%, transparent 25%),
    linear-gradient(-45deg, #c7c7c0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #c7c7c0 75%),
    linear-gradient(-45deg, transparent 75%, #c7c7c0 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 180ms ease;
}

.selection-count {
  position: absolute;
  z-index: 1;
  top: 10px;
  right: 10px;
  padding: 5px 8px;
  color: #fff;
  border-radius: 999px;
  background: rgba(34, 62, 44, 0.82);
  font-size: 10px;
  font-weight: 700;
  backdrop-filter: blur(6px);
}

.file-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding-top: 15px;
}

.file-details div { min-width: 0; display: flex; flex-direction: column; }
.file-details strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.file-details span { margin-top: 3px; color: #777a71; font-size: 11px; }

.text-button {
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  color: #476550;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.privacy-note {
  margin: 18px 0 0;
  padding: 11px 12px;
  color: #646b62;
  border: 1px solid rgba(64, 84, 68, 0.12);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.45);
  font-size: 10px;
  line-height: 1.6;
}

.settings-panel { padding: 29px; background: #fffdfa; }
.section-label, .quality-header label { margin: 0 0 11px; color: #33362f; font-size: 12px; font-weight: 700; }

.format-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.format-option {
  min-width: 0;
  padding: 11px 7px;
  border: 1px solid #dedfd9;
  border-radius: 10px;
  color: #3f423b;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.format-option strong, .format-option span { display: block; }
.format-option strong { font-size: 13px; }
.format-option span { overflow: hidden; margin-top: 3px; color: #92958c; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.format-option.is-selected { border-color: #43614c; background: #f0f5ee; box-shadow: inset 0 0 0 1px #43614c; }

.quality-setting { margin-top: 26px; }
.quality-setting.is-disabled { opacity: 0.58; }
.quality-header { display: flex; justify-content: space-between; }
.quality-header label { margin: 0; }
.quality-header output { color: #496651; font-size: 12px; font-weight: 700; }

input[type='range'] {
  width: 100%;
  height: 4px;
  margin: 15px 0 6px;
  appearance: none;
  border-radius: 99px;
  background: linear-gradient(to right, #44654d var(--range-progress), #dcded8 var(--range-progress));
}

input[type='range']::-webkit-slider-thumb {
  width: 15px;
  height: 15px;
  appearance: none;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #3f6249;
  box-shadow: 0 0 0 1px #3f6249;
  cursor: pointer;
}

.range-labels { display: flex; justify-content: space-between; color: #a0a29b; font-size: 9px; }

.rotation-setting {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #e7e6e0;
}

.rotation-header { display: flex; align-items: center; justify-content: space-between; }
.rotation-header .section-label { margin-bottom: 9px; }
.rotation-header output { color: #496651; font-size: 11px; font-weight: 700; }
.rotation-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }

.rotation-option {
  min-width: 0;
  padding: 8px 4px;
  color: #656a62;
  border: 1px solid #dedfd9;
  border-radius: 8px;
  background: #fff;
  font-size: 9px;
  cursor: pointer;
}

.rotation-option:hover { border-color: #8a9d8e; }
.rotation-option.is-selected { color: #294a34; border-color: #43614c; background: #f0f5ee; box-shadow: inset 0 0 0 1px #43614c; }

.resize-setting {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #e7e6e0;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  cursor: pointer;
}

.toggle-row span { display: flex; flex-direction: column; }
.toggle-row strong { color: #33362f; font-size: 12px; }
.toggle-row small { margin-top: 3px; color: #92958c; font-size: 9px; }
.toggle-row input { width: 17px; height: 17px; accent-color: #3f6249; }

.resize-fields {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 8px;
  margin-top: 13px;
}

.resize-fields label { color: #777b72; font-size: 9px; }
.resize-fields > span { padding-bottom: 9px; color: #9a9c95; font-size: 11px; }

.resize-fields input {
  width: 100%;
  margin-top: 5px;
  padding: 8px 9px;
  border: 1px solid #d8dbd4;
  border-radius: 8px;
  color: #343830;
  background: #fff;
  font-size: 11px;
  outline: none;
}

.resize-fields input:focus { border-color: #52705a; box-shadow: 0 0 0 2px rgba(82, 112, 90, 0.12); }

.convert-button { width: 100%; margin-top: 27px; padding: 13px; }
.convert-button:disabled { opacity: 0.6; cursor: wait; }

.result-box {
  margin-top: 23px;
  padding: 11px;
  border: 1px solid #cbd9c7;
  border-radius: 11px;
  background: #f1f6ee;
}

.result-header { display: flex; align-items: center; justify-content: space-between; padding: 1px 2px 9px; }
.result-header > div { display: flex; flex-direction: column; }
.result-header span { color: #52705a; font-size: 9px; }
.result-header strong { margin-top: 2px; font-size: 12px; }

.download-all-button {
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: #2f503a;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.result-list { max-height: 154px; overflow-y: auto; display: grid; gap: 5px; }

.result-item {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 9px;
  color: #343830;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.72);
  text-decoration: none;
}

.result-item span { min-width: 0; display: flex; flex-direction: column; }
.result-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.result-item small { margin-top: 2px; color: #858980; font-size: 8px; }
.result-item b { flex: 0 0 auto; color: #3f6249; font-size: 10px; }
.result-item:hover { background: #fff; }

.error-message {
  margin: 10px 5px 0;
  padding: 9px 12px;
  border-radius: 9px;
  color: #8a322d;
  background: #fbe9e5;
  font-size: 12px;
}

.trust-row {
  max-width: 820px;
  margin: 30px auto 65px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.trust-row > div { display: flex; align-items: center; justify-content: center; gap: 10px; }
.trust-row > div + div { border-left: 1px solid rgba(49, 58, 44, 0.14); }
.trust-row span { color: #8b9989; font-family: Georgia, serif; font-size: 13px; font-style: italic; }
.trust-row p { display: flex; flex-direction: column; margin: 0; color: #8a8c84; font-size: 10px; }
.trust-row strong { margin-bottom: 2px; color: #4b4f47; font-size: 12px; }

footer {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(48, 57, 43, 0.12);
  color: #898c83;
  font-size: 11px;
}

footer a { color: #59685b; font-weight: 600; text-decoration: none; }
.footer-links { display: flex; align-items: center; gap: 15px; }
.footer-button { padding: 0; color: #59685b; border: 0; background: transparent; font-size: inherit; font-weight: 600; cursor: pointer; }
.footer-button:hover, footer a:hover { color: #2f503a; }
.network-status { display: inline-flex; align-items: center; gap: 5px; }
.network-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #6e8a71; }
.network-status.is-offline { color: #52705a; font-weight: 600; }
.network-status.is-offline::before { background: #d49353; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 720px) {
  .page-shell { width: min(100% - 24px, 1160px); }
  .site-header { height: 70px; }
  .hero { margin: 42px auto 30px; }
  h1 { font-size: clamp(38px, 12vw, 54px); }
  .hero-copy br { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .preview-panel, .settings-panel { padding: 20px; }
  .preview-frame { height: 200px; }
  .trust-row { grid-template-columns: 1fr; gap: 14px; margin-bottom: 38px; }
  .trust-row > div + div { border-left: 0; }
  .trust-row > div { justify-content: flex-start; padding-left: 28%; }
}

@media (max-width: 430px) {
  .install-button { padding: 8px 10px; font-size: 10px; }
  .privacy-pill span { display: none; }
  .privacy-pill { padding: 8px; }
  .tool-card { padding: 7px; border-radius: 20px; }
  .drop-zone { min-height: 300px; padding: 22px; }
  .format-option span { display: none; }
  footer span { max-width: 190px; }
  .network-status { display: none; }
  .footer-links { gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
