/* FlowLingo standalone styles, preserved from the original app. */
:root {
  --font-geist: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-noto: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

:root {
  --ink: #172026;
  --muted: #6f7b83;
  --line: #dfe6e2;
  --green: #0f785f;
  --green-dark: #095e4b;
  --mint: #e7f6ef;
  --paper: #fbfcfa;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-noto), var(--font-geist), system-ui, sans-serif;
}
button, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.topbar {
  height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 clamp(22px, 4vw, 68px);
  border-bottom: 1px solid rgba(23, 32, 38, .08);
  background: rgba(251, 252, 250, .9);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 20px; width: fit-content; }
.brandMark {
  width: 35px; height: 35px; border-radius: 10px; display: grid; place-items: center;
  background: transparent;
  box-shadow: none;
  padding: 0;
  overflow: hidden;
}
.brandMark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brandEn { color: #84908b; font-size: 11px; font-weight: 500; margin-left: -4px; margin-top: 5px; letter-spacing: .02em; }
nav { display: flex; gap: 32px; align-items: center; font-size: 14px; color: #56625f; height: 100%; }
nav a { height: 100%; display: flex; gap: 6px; align-items: center; position: relative; white-space: nowrap; }
nav a.active { color: var(--green); font-weight: 600; }
nav a.active::after { content: ""; height: 2px; background: var(--green); position: absolute; bottom: 0; left: 0; right: 0; }
.soon { font-size: 9px; padding: 2px 5px; border-radius: 8px; background: #e6f2ed; color: var(--green); }
.headerActions { justify-self: end; display: flex; align-items: center; gap: 9px; }
.iconButton, .secondaryButton, .primaryButton {
  border: 0; border-radius: 9px; background: transparent; min-height: 38px; padding: 0 16px; font-size: 13px;
}
.iconButton { padding: 0; width: 38px; font-size: 20px; color: #61706a; position: relative; }
.historyCount { position: absolute; top: 0; right: 0; font-size: 9px; background: var(--green); color: white; border-radius: 10px; min-width: 15px; padding: 1px 4px; }
.secondaryButton { border: 1px solid #d8dedb; background: white; }
.primaryButton { background: var(--green); color: white; box-shadow: 0 5px 14px rgba(15, 120, 95, .18); }
.primaryButton:hover { background: var(--green-dark); }
.headerLink { display: inline-flex; align-items: center; }

.hero { text-align: center; padding: 66px 20px 37px; }
.eyebrow { color: var(--green); font-size: 12px; font-weight: 600; letter-spacing: .12em; display: flex; align-items: center; justify-content: center; gap: 8px; }
.eyebrow span { width: 18px; height: 1px; background: var(--green); }
.hero h1 { font-family: Georgia, "Noto Serif SC", serif; font-size: clamp(42px, 5vw, 62px); letter-spacing: -.055em; margin: 17px 0 13px; font-weight: 500; }
.hero h1 em { color: var(--green); font-style: normal; position: relative; }
.hero h1 em::after { content: ""; position: absolute; height: 7px; border-bottom: 2px solid #75ad9c; border-radius: 50%; left: 8%; right: 3%; bottom: -4px; transform: rotate(-1.5deg); }
.hero p { margin: 0; color: var(--muted); font-size: 15px; }

.translatorShell {
  width: min(1040px, calc(100% - 40px)); margin: 0 auto; background: white; border: 1px solid #dce4df;
  border-radius: 15px; box-shadow: 0 22px 55px rgba(28, 55, 45, .08), 0 3px 9px rgba(28, 55, 45, .04); overflow: hidden;
}
.professionalBar { min-height: 49px; display: flex; align-items: center; gap: 22px; padding: 8px 20px; border-bottom: 1px solid var(--line); background: #f4faf7; color: #718079; font-size: 11px; }
.professionalBar label { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.professionalBar select { border: 1px solid #cfddd7; background: white; border-radius: 7px; padding: 5px 25px 5px 9px; color: #34453e; outline: 0; }
.aiBadge { color: var(--green); font-weight: 700; white-space: nowrap; }
.privacyNote { margin-left: auto; color: #87948e; white-space: nowrap; }
.languageBar { height: 60px; display: grid; grid-template-columns: 1fr 70px 1fr; align-items: center; border-bottom: 1px solid var(--line); }
.languageTabs { padding: 0 22px; display: flex; align-items: center; gap: 14px; min-width: 0; }
.languageTabs select { appearance: none; border: 0; outline: 0; color: var(--green); font-weight: 600; background: transparent; padding-right: 20px; background-image: linear-gradient(45deg, transparent 50%, #71807a 50%), linear-gradient(135deg, #71807a 50%, transparent 50%); background-position: calc(100% - 8px) 50%, calc(100% - 4px) 50%; background-size: 4px 4px, 4px 4px; background-repeat: no-repeat; }
.detected { font-size: 11px; color: #87928e; border-left: 1px solid #dfe5e2; padding-left: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.targetTabs { justify-content: flex-start; }
.swap { width: 34px; height: 34px; border: 1px solid #d8e1dd; background: white; color: var(--green); border-radius: 50%; font-size: 19px; justify-self: center; z-index: 2; transition: .2s ease; }
.swap:hover:not(:disabled) { transform: rotate(180deg); background: var(--mint); }
.swap:disabled { opacity: .4; cursor: default; }
.editorGrid { display: grid; grid-template-columns: 1fr 1fr; min-height: 275px; }
.editorPane { position: relative; display: flex; flex-direction: column; min-width: 0; }
.sourcePane { border-right: 1px solid var(--line); }
.editorPane textarea, .translation { border: 0; outline: 0; resize: none; flex: 1; width: 100%; padding: 27px 29px; font-size: 20px; line-height: 1.75; color: #25322e; background: transparent; min-height: 218px; }
.editorPane textarea::placeholder, .placeholder { color: #aab3af; }
.resultPane { background: #fbfcfb; }
.translation { white-space: pre-wrap; }
.clear { position: absolute; right: 17px; top: 18px; border: 0; background: #eef2f0; color: #77827e; width: 25px; height: 25px; border-radius: 50%; font-size: 18px; line-height: 20px; }
.paneFooter { height: 57px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #eef1ef; color: #9aa39f; font-size: 11px; }
.toolButton { width: 34px; height: 34px; border: 0; background: transparent; border-radius: 8px; color: #73807a; font-size: 16px; margin-right: 3px; }
.toolButton:hover, .toolButton.selected { background: var(--mint); color: var(--green); }
.copyButton { border: 1px solid #d7dfdb; border-radius: 8px; background: white; color: #41504a; padding: 8px 14px; font-size: 12px; min-width: 78px; }
.copyButton:disabled { opacity: .45; cursor: default; }
.resultActions { display: flex; align-items: center; gap: 9px; }
.engineLabel { color: var(--green); font-size: 10px; white-space: nowrap; }
.loadingLines { display: flex; flex-direction: column; gap: 13px; margin-top: 6px; }
.loadingLines i { display: block; width: 78%; height: 14px; border-radius: 6px; background: linear-gradient(90deg, #e8eeeb, #f5f7f6, #e8eeeb); background-size: 200%; animation: shimmer 1.2s infinite; }
.loadingLines i:nth-child(2) { width: 62%; }
.loadingLines i:nth-child(3) { width: 38%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.quickSection { width: min(1040px, calc(100% - 40px)); margin: 30px auto 0; }
.sectionLabel { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: #8a9590; text-align: center; margin: 0 0 14px; }
.promptGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.promptGrid > button { background: rgba(255,255,255,.76); border: 1px solid #e0e5e2; border-radius: 12px; padding: 14px 15px; display: grid; grid-template-columns: 38px 1fr 16px; align-items: center; text-align: left; gap: 10px; color: #78847f; transition: .2s; }
.promptGrid > button:hover { transform: translateY(-2px); border-color: #b7d1c7; box-shadow: 0 8px 20px rgba(23, 60, 47, .07); }
.promptIcon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; background: #e9f4ef; color: var(--green); }
.icon2 { background: #edf0f7; color: #50688e; }
.icon3 { background: #f6efe9; color: #9b6743; font-family: Georgia, serif; }
.promptGrid strong, .promptGrid small { display: block; }
.promptGrid strong { color: #34413c; font-size: 12px; margin-bottom: 3px; }
.promptGrid small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 210px; color: #8b9591; font-size: 10px; }
.promptGrid b { font-weight: 400; }
.trustRow { width: min(880px, calc(100% - 40px)); margin: 53px auto 57px; display: grid; grid-template-columns: repeat(4, 1fr); color: #89938f; text-align: center; font-size: 11px; }
.trustRow span + span { border-left: 1px solid #dde3e0; }
.trustRow b { color: #3d4c46; font-size: 14px; margin-right: 4px; }

.historyPanel { position: fixed; z-index: 40; right: 18px; top: 18px; bottom: 18px; width: min(390px, calc(100% - 36px)); background: white; border-radius: 16px; box-shadow: 0 22px 80px rgba(13, 30, 24, .24); padding: 18px; overflow-y: auto; animation: slideIn .25s ease; }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }
.historyHeader { display: flex; justify-content: space-between; align-items: center; padding: 3px 2px 17px; border-bottom: 1px solid var(--line); }
.historyHeader span, .historyHeader small { display: block; }
.historyHeader span { font-weight: 700; }
.historyHeader small { color: #98a19d; font-size: 10px; margin-top: 2px; }
.historyHeader button { border: 0; background: #edf1ef; width: 30px; height: 30px; border-radius: 50%; font-size: 20px; color: #6e7975; }
.historyItem { width: 100%; text-align: left; border: 0; border-bottom: 1px solid #edf0ee; background: white; padding: 15px 5px; }
.historyItem:hover { background: #f7faf8; }
.historyItem small, .historyItem span, .historyItem em { display: block; }
.historyItem small { color: var(--green); font-size: 10px; margin-bottom: 6px; }
.historyItem span { font-size: 13px; color: #34413c; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.historyItem em { font-size: 12px; color: #87918d; font-style: normal; margin-top: 5px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.emptyHistory { text-align: center; color: #9aa39f; font-size: 13px; padding: 90px 20px; line-height: 2; }
.backdrop { position: fixed; z-index: 30; inset: 0; border: 0; background: rgba(14, 26, 21, .18); backdrop-filter: blur(2px); }

footer { min-height: 82px; border-top: 1px solid #e1e6e3; padding: 0 clamp(22px, 4vw, 68px); display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: center; color: #929b97; font-size: 10px; background: #f6f8f5; }
.footerBrand .brandMark { width: 27px; height: 27px; padding: 0; border-radius: 8px; }
.footerBrand { font-size: 15px; }
footer > span { text-align: center; }
footer > div { justify-self: end; display: flex; gap: 23px; }

.documentPage { min-height: 100vh; background: radial-gradient(circle at 50% 20%, #f0f8f4, var(--paper) 42%); }
.documentHero { text-align: center; padding: 58px 20px 30px; }
.documentHero h1 { font-family: Georgia, "Noto Serif SC", serif; font-size: clamp(38px, 4.5vw, 54px); letter-spacing: -.045em; margin: 14px 0 10px; font-weight: 500; }
.documentHero h1 em { color: var(--green); font-style: normal; }
.documentHero p { color: var(--muted); font-size: 14px; margin: 0; }
.documentWorkspace { width: min(860px, calc(100% - 40px)); margin: 0 auto 60px; }
.documentSettings { background: white; border: 1px solid var(--line); border-radius: 13px 13px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); padding: 15px 20px; gap: 22px; }
.documentSettings label { color: #79857f; font-size: 11px; display: flex; align-items: center; gap: 10px; }
.documentSettings select { margin-left: auto; min-width: 120px; border: 1px solid #d8e1dd; background: #fbfcfb; color: #35443e; border-radius: 7px; padding: 7px 9px; outline: 0; }
.hiddenFileInput { display: none; }
.dropZone { min-height: 310px; background: white; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 13px 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; box-shadow: 0 18px 50px rgba(25, 58, 45, .07); transition: .2s; }
.dropZone:hover { background: #fcfefd; }
.dropZone.hasFile { min-height: 250px; }
.fileGlyph { width: 58px; height: 58px; border-radius: 17px; background: var(--mint); color: var(--green); display: grid; place-items: center; font-size: 25px; margin-bottom: 17px; }
.dropZone strong { font-size: 17px; color: #30403a; max-width: 80%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropZone span { color: #87918d; font-size: 12px; margin-top: 7px; }
.dropZone small { color: #a0aaa5; font-size: 10px; margin-top: 19px; }
.selectFile, .changeFile { border: 0; border-radius: 9px; background: var(--green); color: white; padding: 10px 20px; margin-top: 18px; font-size: 12px; }
.changeFile { background: white; color: var(--green); border: 1px solid #cddbd5; padding: 8px 16px; }
.translateDocumentButton { width: 100%; min-height: 50px; margin-top: 14px; border: 0; border-radius: 11px; background: var(--green); color: white; font-weight: 600; box-shadow: 0 8px 22px rgba(15, 120, 95, .2); }
.translateDocumentButton:disabled { opacity: .75; cursor: wait; }
.translateDocumentButton i { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: white; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 7px; }
@keyframes spin { to { transform: rotate(360deg); } }
.documentError { margin-top: 14px; border-radius: 9px; background: #fff1ef; color: #a74336; padding: 13px 17px; font-size: 12px; }
.documentResult { margin-top: 18px; background: white; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; box-shadow: 0 15px 40px rgba(25, 58, 45, .06); }
.documentResultHeader { display: flex; align-items: center; justify-content: space-between; padding: 16px 19px; border-bottom: 1px solid var(--line); }
.documentResultHeader strong, .documentResultHeader span { display: block; }
.documentResultHeader strong { color: var(--green); font-size: 14px; }
.documentResultHeader span { color: #909a95; font-size: 10px; margin-top: 3px; }
.documentResultHeader button { border: 0; border-radius: 8px; background: var(--green); color: white; padding: 9px 14px; font-size: 11px; }
.documentResult pre { max-height: 440px; overflow: auto; white-space: pre-wrap; word-break: break-word; font: 13px/1.8 var(--font-noto), sans-serif; color: #34413c; padding: 22px; margin: 0; }
.documentPrivacy { text-align: center; color: #8f9994; font-size: 10px; margin-top: 17px; }

@media (max-width: 760px) {
  .topbar { grid-template-columns: 1fr auto; height: 64px; padding: 0 17px; }
  nav { display: none; }
  .brandEn, .secondaryButton, .historyButton { display: none; }
  .primaryButton { padding: 0 13px; }
  .hero { padding: 46px 18px 30px; }
  .hero h1 { font-size: 40px; }
  .hero p { font-size: 13px; }
  .translatorShell { width: calc(100% - 24px); }
  .professionalBar { gap: 9px; overflow-x: auto; padding: 8px 12px; }
  .professionalBar label { font-size: 0; gap: 0; }
  .professionalBar label select { font-size: 11px; }
  .privacyNote { display: none; }
  .languageBar { grid-template-columns: 1fr 48px 1fr; }
  .languageTabs { padding: 0 13px; }
  .detected { display: none; }
  .editorGrid { grid-template-columns: 1fr; }
  .sourcePane { border-right: 0; border-bottom: 1px solid var(--line); }
  .editorPane textarea, .translation { min-height: 165px; padding: 22px 20px; font-size: 17px; }
  .quickSection { width: calc(100% - 24px); }
  .promptGrid { grid-template-columns: 1fr; }
  .promptGrid small { max-width: 70vw; }
  .trustRow { grid-template-columns: 1fr 1fr; gap: 22px 0; }
  .trustRow span:nth-child(3) { border-left: 0; }
  footer { grid-template-columns: 1fr; gap: 12px; padding: 22px; text-align: center; }
  .footerBrand, footer > div { justify-self: center; }
  .documentHero { padding-top: 42px; }
  .documentWorkspace { width: calc(100% - 24px); }
  .documentSettings { grid-template-columns: 1fr; gap: 10px; }
  .documentSettings label { justify-content: space-between; }
  .dropZone { min-height: 280px; padding: 22px 15px; }
  .documentPage .headerActions { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
