/* ==========================================================================
   Capra Translator · 主样式表
   配色：暖纸底 + 墨色字 + 玉青点缀
   ========================================================================== */

:root {
  --paper: #f6f4ee;
  --paper-2: #efece3;
  --card: #fffdf8;
  --card-2: #faf8f1;
  --line: #e5e0d4;
  --line-strong: #d6d0c1;
  --ink: #201e1b;
  --muted: #6a6358;
  --faint: #9a9285;
  --jade: #1e6f5c;
  --jade-2: #2b8a72;
  --jade-soft: #e8f1ed;
  --jade-line: #cfe3db;
  --gold: #a9762b;
  --gold-soft: #f8efdf;
  --danger: #b0483c;
  --danger-soft: #fbecea;

  --sans: "Inter", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei",
    system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia,
    "Songti SC", "Noto Serif SC", "Times New Roman", serif;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(32, 30, 27, 0.05);
  --shadow-md: 0 2px 4px rgba(32, 30, 27, 0.04), 0 12px 28px -18px rgba(32, 30, 27, 0.28);
  --shadow-lg: 0 24px 60px -28px rgba(32, 30, 27, 0.35);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(900px 420px at 88% -12%, #fdf7ea 0%, rgba(253, 247, 234, 0) 62%),
    radial-gradient(720px 380px at 6% 104%, #eef4f0 0%, rgba(238, 244, 240, 0) 58%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.6;
}

::selection { background: #cfe8de; color: #123f36; }

button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

/* ------------------------------- 滚动条 -------------------------------- */
.scroll::-webkit-scrollbar,
textarea::-webkit-scrollbar,
.drawer__body::-webkit-scrollbar { width: 10px; height: 10px; }

.scroll::-webkit-scrollbar-thumb,
textarea::-webkit-scrollbar-thumb,
.drawer__body::-webkit-scrollbar-thumb {
  background: #d9d3c5;
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 99px;
}

.scroll::-webkit-scrollbar-thumb:hover,
textarea::-webkit-scrollbar-thumb:hover { background: #c3bbaa; background-clip: content-box; }

.scroll::-webkit-scrollbar-track,
textarea::-webkit-scrollbar-track { background: transparent; }

/* ============================== 顶栏 =================================== */
.topbar {
  height: 62px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.82);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 40;
}

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

.brand__mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(150deg, #2b8a72, #1b5f50);
  color: #f4fbf8;
  box-shadow: 0 4px 12px -6px rgba(27, 95, 80, 0.8);
  flex: none;
}
.brand__mark svg { width: 20px; height: 20px; }

.brand__name {
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: -0.01em;
  font-weight: 600;
  white-space: nowrap;
}
.brand__name em {
  font-style: normal;
  color: var(--faint);
  font-weight: 400;
  margin-left: 7px;
  font-size: 13px;
  letter-spacing: 0.06em;
  font-family: var(--sans);
  text-transform: uppercase;
}

.topbar__right { display: flex; align-items: center; gap: 10px; }

.quota {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border-radius: 99px;
  background: var(--jade-soft);
  border: 1px solid var(--jade-line);
  color: #1a5548;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}
.quota__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--jade-2);
  box-shadow: 0 0 0 3px rgba(43, 138, 114, 0.16);
  flex: none;
}
.quota.is-low { background: var(--gold-soft); border-color: #ecd9b6; color: #7d5518; }
.quota.is-low .quota__dot { background: var(--gold); box-shadow: 0 0 0 3px rgba(169, 118, 43, 0.16); }
.quota.is-empty { background: var(--danger-soft); border-color: #f0cfca; color: #8c3529; }
.quota.is-empty .quota__dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(176, 72, 60, 0.16); }

.usermenu {
  display: flex; align-items: center; gap: 8px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: #efe9db;
  color: #6b5a35;
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  flex: none;
}

.usermenu__name {
  font-size: 13px;
  color: var(--muted);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================== 按钮 =================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 99px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.16s, border-color 0.16s, transform 0.12s, box-shadow 0.16s, color 0.16s;
  white-space: nowrap;
  user-select: none;
}
.btn:hover { background: var(--card-2); border-color: #c8c1b0; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 2px solid var(--jade-2); outline-offset: 2px; }

.btn--sm { height: 30px; padding: 0 12px; font-size: 12.5px; }

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.btn--ghost:hover { background: #efece3; color: var(--ink); border-color: transparent; }

.btn--primary {
  background: linear-gradient(160deg, #2b8a72, #1b6152);
  border-color: #17564a;
  color: #f6fffb;
  padding: 0 18px;
  box-shadow: 0 6px 16px -10px rgba(23, 86, 74, 0.9);
}
.btn--primary:hover { background: linear-gradient(160deg, #30997e, #1d6a59); border-color: #17564a; }

.btn--icon {
  width: 32px; height: 32px;
  padding: 0;
  border-radius: 9px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
}
.btn--icon:hover { background: var(--paper-2); color: var(--ink); border-color: var(--line); }
.btn--icon svg { width: 16px; height: 16px; }
.btn--icon.is-done { color: var(--jade); background: var(--jade-soft); border-color: var(--jade-line); }

.btn kbd {
  font-family: var(--sans);
  font-size: 10.5px;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.18);
  letter-spacing: 0.02em;
  margin-left: 2px;
}

/* ============================== 主区域 ================================= */
.workspace {
  max-width: 1480px;
  margin: 0 auto;
  padding: 20px 24px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  height: calc(100vh - 62px);
  height: calc(100dvh - 62px);
  min-height: 520px;
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  position: relative;
}

.panel--in:focus-within {
  border-color: var(--jade-line);
  box-shadow: 0 0 0 3px rgba(43, 138, 114, 0.08), var(--shadow-md);
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px 11px;
  border-bottom: 1px solid var(--line);
  flex: none;
  min-height: 50px;
}

.panel__title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel__title::before {
  content: "";
  width: 3px; height: 12px;
  border-radius: 2px;
  background: var(--jade-2);
  opacity: 0.55;
}
.panel--out .panel__title::before { background: var(--gold); }

.panel__meta { font-size: 12px; color: var(--faint); }
.panel__actions { display: flex; align-items: center; gap: 8px; }

.panel__body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.panel__foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--card-2);
  flex-wrap: wrap;
}

.foot__right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.foot__note { font-size: 11.5px; color: var(--faint); }
.panel__foot--out { justify-content: flex-start; padding: 9px 18px; }

/* --------------------------- 输入区 --------------------------- */
.editor {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  padding: 20px 22px 40px;
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink);
  font-family: var(--sans);
  letter-spacing: 0.005em;
}
.editor::placeholder { color: #b6ae9f; }

.charcount {
  position: absolute;
  right: 16px;
  bottom: 10px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--faint);
  background: linear-gradient(90deg, rgba(255, 253, 248, 0) 0%, var(--card) 26%);
  padding: 2px 0 2px 14px;
  pointer-events: none;
  transition: color 0.16s;
}
.charcount.is-warn { color: var(--gold); }
.charcount.is-over { color: var(--danger); font-weight: 600; }

/* --------------------------- 风格切换 --------------------------- */
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: #efece3;
  border-radius: 99px;
  border: 1px solid var(--line);
}
.segmented button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 13px;
  border-radius: 99px;
  transition: background 0.16s, color 0.16s, box-shadow 0.16s;
}
.segmented button:hover { color: var(--ink); }
.segmented button.is-active {
  background: var(--card);
  color: #1a5548;
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* --------------------------- 开关 --------------------------- */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  padding: 4px 2px;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  width: 34px; height: 19px;
  border-radius: 99px;
  background: #ded8c9;
  position: relative;
  transition: background 0.2s;
  flex: none;
}
.switch__knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s cubic-bezier(0.4, 0.2, 0.2, 1);
}
.switch input:checked + .switch__track { background: var(--jade-2); }
.switch input:checked + .switch__track .switch__knob { transform: translateX(15px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--jade-2); outline-offset: 2px; }
.switch__label { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.switch input:checked ~ .switch__label { color: var(--jade); font-weight: 500; }

/* ============================ 输出区 ================================== */
.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 500;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.badge--word { background: var(--jade-soft); border-color: var(--jade-line); color: #1a5548; }
.badge--sentence { background: var(--gold-soft); border-color: #ecd9b6; color: #7d5518; }

.panel__body--out {
  display: block;
  overflow-y: auto;
  padding: 24px 26px 32px;
}

.empty {
  height: 100%;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--faint);
  text-align: center;
  animation: fade 0.4s ease both;
}
.empty svg { width: 74px; height: 74px; opacity: 0.3; margin-bottom: 10px; color: var(--jade); }
.empty p { margin: 0; font-size: 14.5px; color: var(--muted); }
.empty .empty__hint { font-size: 12.5px; color: var(--faint); }

/* --------------------------- 词典卡片 --------------------------- */
.dict { animation: rise 0.34s cubic-bezier(0.22, 1, 0.36, 1) both; }

.dict__head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.dict__word {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(30px, 3.2vw, 40px);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #1c2b26;
  word-break: break-word;
}
.dict__tag {
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 2px 9px;
  background: var(--card-2);
}

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

.dict__item {
  padding: 18px 0 18px 16px;
  border-bottom: 1px dashed var(--line);
  position: relative;
}
.dict__item:last-child { border-bottom: 0; }
.dict__item::before {
  content: "";
  position: absolute;
  left: 0; top: 22px;
  width: 3px; height: calc(100% - 34px);
  border-radius: 2px;
  background: linear-gradient(180deg, var(--jade-line), rgba(207, 227, 219, 0));
}

.dict__row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }

.pos {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13.5px;
  color: #8a6a2a;
  background: var(--gold-soft);
  border: 1px solid #f0e0c2;
  border-radius: 5px;
  padding: 1px 7px;
  flex: none;
  line-height: 1.5;
}

.dict__tr {
  font-size: 17.5px;
  font-weight: 600;
  color: #1d2a26;
  letter-spacing: 0.01em;
}

.dict__ex {
  margin: 10px 0 0 0;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.65;
  color: #46403a;
  padding-left: 12px;
  border-left: 2px solid #eee8db;
  font-style: italic;
}
.dict__ex-tr {
  margin: 4px 0 0 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--faint);
  padding-left: 12px;
  border-left: 2px solid transparent;
}

/* --------------------------- 句子译文 --------------------------- */
.trans { animation: rise 0.34s cubic-bezier(0.22, 1, 0.36, 1) both; }

.trans__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 14px;
}
.trans__label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.trans__text {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(19px, 1.6vw, 22px);
  line-height: 1.85;
  color: #1d2a26;
  white-space: pre-wrap;
  word-break: break-word;
  letter-spacing: 0.004em;
}

.trans__note {
  margin-top: 18px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--card-2);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--faint);
}

/* --------------------------- 流式原始输出 --------------------------- */
.stream {
  margin: 0;
  font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  color: #6f685c;
  white-space: pre-wrap;
  word-break: break-word;
}

.streaming-hint {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--jade);
  margin-bottom: 12px;
}
.streaming-hint .pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--jade-2);
  animation: pulse 1.2s ease-in-out infinite;
}

/* --------------------------- 思考面板 --------------------------- */
.thinking {
  flex: none;
  border-bottom: 1px solid var(--line);
  background: #fbf9f3;
}
.thinking[hidden] { display: none; }

.thinking__head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 18px;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 12.5px;
  text-align: left;
}
.thinking__head:hover { background: #f6f2e8; }

.thinking__title { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.thinking__title .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(169, 118, 43, 0.14);
}
.thinking__title .dot.is-live { animation: pulse 1.1s ease-in-out infinite; }

.thinking__count {
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
}

.thinking__chev {
  width: 14px; height: 14px;
  transition: transform 0.22s ease;
  color: var(--faint);
}
.thinking.is-open .thinking__chev { transform: rotate(180deg); }

.thinking__body {
  display: none;
  max-height: 220px;
  overflow-y: auto;
  padding: 0 18px 14px 32px;
  font-size: 13px;
  line-height: 1.8;
  color: #6b6355;
  white-space: pre-wrap;
  word-break: break-word;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
}
.thinking.is-open .thinking__body { display: block; animation: fade 0.2s ease both; }

.thinking__body:empty::after {
  content: "等待模型思考…";
  color: var(--faint);
  font-size: 12.5px;
}

/* --------------------------- 错误态 --------------------------- */
.errorbox {
  display: flex;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--r-md);
  background: var(--danger-soft);
  border: 1px solid #f0d3ce;
  color: #8c3529;
  font-size: 13.5px;
  line-height: 1.65;
  animation: rise 0.28s ease both;
}
.errorbox svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }

/* ============================= 抽屉 =================================== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(32, 30, 27, 0.22);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s;
  z-index: 50;
}
.overlay.is-open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  height: 100dvh;
  width: min(400px, 92vw);
  background: var(--card);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  transform: translateX(102%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 60;
  display: flex;
  flex-direction: column;
}
.drawer.is-open { transform: translateX(0); }

.drawer__head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.drawer__head h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
}
.drawer__sub { font-size: 11.5px; color: var(--faint); margin-left: 8px; font-family: var(--sans); }

.drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.drawer__foot {
  flex: none;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
}

.hist {
  position: relative;
  padding: 11px 40px 11px 12px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  animation: fade 0.3s ease both;
}
.hist:hover { background: var(--card-2); border-color: var(--line); }
.hist + .hist { margin-top: 2px; }

.hist__text {
  font-size: 13.5px;
  line-height: 1.55;
  color: #33302a;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.hist__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--faint);
}
.hist__type {
  padding: 1px 6px;
  border-radius: 4px;
  background: #f0ede3;
  color: #7a7364;
  font-size: 10.5px;
}

.hist__del {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px; height: 26px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--faint);
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  display: grid;
  place-items: center;
}
.hist:hover .hist__del { opacity: 1; }
.hist__del:hover { background: var(--danger-soft); color: var(--danger); }
.hist__del svg { width: 14px; height: 14px; }

.skeleton {
  height: 62px;
  border-radius: var(--r-md);
  background: linear-gradient(90deg, #f4f1e9 25%, #faf8f2 37%, #f4f1e9 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  margin: 8px 4px;
}

.drawer-empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
}
.drawer-empty strong { display: block; color: var(--muted); margin-bottom: 4px; font-weight: 500; }

/* ============================= Toast ================================== */
.toastwrap {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 90;
  pointer-events: none;
  align-items: center;
}
.toast {
  padding: 9px 16px;
  border-radius: 99px;
  background: #262420;
  color: #f7f4ec;
  font-size: 13px;
  box-shadow: 0 12px 30px -14px rgba(0, 0, 0, 0.6);
  animation: toastIn 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
  max-width: 80vw;
}
.toast.is-error { background: #8c3529; }
.toast.is-ok { background: #1d6a59; }
.toast.is-out { animation: toastOut 0.22s ease forwards; }

/* ============================= 动画 =================================== */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.82); }
}
@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(6px) scale(0.98); }
}
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

/* ============================= 响应式 ================================= */
@media (max-width: 1080px) {
  .workspace { grid-template-columns: 1fr; height: auto; padding: 16px; gap: 14px; }
  .panel { min-height: 380px; }
  .panel--in { height: 46dvh; }
  .panel--out { height: auto; min-height: 420px; }
  .panel__body--out { max-height: 62dvh; }
}

@media (max-width: 620px) {
  .topbar { padding: 0 14px; gap: 8px; }
  .brand__name em { display: none; }
  .usermenu__name { display: none; }
  .quota { font-size: 11.5px; padding: 0 9px; }
  .workspace { padding: 10px; }
  .panel__foot { padding: 9px 12px; gap: 8px; }
  .segmented button { padding: 5px 10px; font-size: 12px; }
  .panel__body--out { padding: 18px 18px 24px; }
  .editor { padding: 16px 16px 38px; font-size: 16px; }
  .btn kbd { display: none; }
  .foot__note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
