    :root {
      --bg: #f3f6fb;
      --panel: #ffffff;
      --line: #dde6f2;
      --text: #22304a;
      --muted: #72829b;
      --pri: #6f8db8;
      --pri2: #5f7ea9;
      --ok: #166534;
      --err: #991b1b;
      --ring: rgba(96, 165, 250, .26);
      --panel-shadow: 0 14px 36px rgba(30, 52, 85, .1);
    }
body.theme-dark {
  --bg: #171717;
  --panel: #202020;
  --line: #383838;
  --text: #dddddd;
  --muted: #a7a7a7;
  --pri: #4a4a4a;
  --pri2: #3d3d3d;
  --ok: #4ade80;
  --err: #f87171;
}
    * { box-sizing: border-box; }
    html, body { width: 100%; height: 100%; }
    body {
      margin: 0;
      font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
      color: var(--text);
      background: radial-gradient(circle at 16% -8%, #fbfdff, #eef3fb 44%, #e8eef8 100%);
      overflow: hidden;
    }
    body.theme-dark {
      background: radial-gradient(circle at 20% 0%, #1a1a1a, #101010 40%, #090909);
    }
    .app {
      position: fixed;
      inset: 0;
      width: 100vw;
      min-height: 100vh;
      height: 100vh;
      height: 100svh;
      height: 100dvh;
      display: flex;
      flex-direction: column;
      gap: 0;
      padding: 0;
      margin: 0;
      overflow: hidden;
    }
    .topbar {
      background: rgba(255,255,255,.9);
      border: 1px solid var(--line);
      border-radius: 0;
      padding: 8px 16px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      min-height: 52px;
      box-shadow: var(--panel-shadow);
      backdrop-filter: blur(8px);
      transition: border-color .18s ease, box-shadow .18s ease;
      flex: 0 0 auto;
      position: relative;
      z-index: 1200;
      overflow: visible;
    }
    body.theme-dark .topbar {
      background: rgba(20,20,20,.92);
      border-color: #2a2a2a;
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
    }
    .brand-line {
      display: flex;
      align-items: baseline;
      gap: 10px;
      min-width: 0;
      flex-wrap: nowrap;
    }
    .title { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: .1px; flex: 0 0 auto; }
    .subtitle {
      margin: 0;
      font-size: 13px;
      color: var(--muted);
      line-height: 1.35;
      font-weight: 500;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .tip { display: none; }
    .top-links { display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.top-links a {
  color: #334155;
  text-decoration: none;
  border: 1px solid #cdd8e8;
      border-radius: 999px;
      padding: 2px 9px;
      font-size: 12px;
  line-height: 1.2;
  background: rgba(255,255,255,.72);
}
.top-link-btn {
  color: #9b7b35;
  border: 1px solid #e4d3a8;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  line-height: 1.2;
  background: linear-gradient(180deg, rgba(255,251,240,.98) 0%, rgba(244,234,202,.92) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65);
  cursor: pointer;
}
.top-links a:hover { color: #0f172a; background: #f3f7ff; border-color: #b7c7e0; }
.top-link-btn:hover {
  color: #886924;
  background: linear-gradient(180deg, rgba(255,249,232,.98) 0%, rgba(241,229,188,.96) 100%);
  border-color: #d7bf83;
}
body.theme-dark .top-links a { color: #d4d4d4; border-color: #3a3a3a; background: #252525; }
body.theme-dark .top-links a:hover { color: #ffffff; border-color: #585858; background: #2d2d2d; }
body.theme-dark .top-link-btn {
  color: #f4d98d;
  border-color: #7a6532;
  background: linear-gradient(180deg, #3b3218 0%, #2d2614 100%);
}
body.theme-dark .top-link-btn:hover {
  color: #ffe7a8;
  border-color: #9a7f43;
  background: linear-gradient(180deg, #4a3e1d 0%, #362d16 100%);
}
    .top-actions { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1300; }
.top-menu-panel { display: flex; align-items: center; gap: 12px; z-index: 1400; }
.menu-toggle {
  display: none;
  width: 38px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  font-size: 18px;
  line-height: 1;
}
.controls { display: inline-flex; align-items: center; gap: 6px; }
.controls .auth-state {
  font-size: 12px;
  color: var(--muted);
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Homepage SEO block: keep in DOM for crawlers, hide from users */
.seo-only-index {
  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;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
  pointer-events: none !important;
}
    .controls select {
      border: 1px solid var(--line);
      border-radius: 10px;
      background: #fff;
      color: var(--text);
      padding: 6px 10px;
      font-size: 12px;
    }
    body.theme-dark .controls select { background: #1a1a1a; border-color: #2f2f2f; color: #ececec; }
@media (max-width: 980px) {
  .topbar { align-items: flex-start; }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .top-actions { margin-left: auto; }
  .top-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    min-width: 220px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: var(--panel-shadow);
    z-index: 9999;
  }
  .top-menu-panel.open { display: flex; }
  .top-links { display: grid; gap: 8px; width: 100%; }
  .top-links a,
  .top-link-btn { display: block; text-align: right; border-radius: 8px; font-size: 12px; width: 100%; }
  .controls { width: 100%; justify-content: flex-end; }
  .controls select { flex: 1; min-width: 120px; }
}
    .grid {
      width: 100%;
      flex: 1 1 auto;
      min-height: 0;
      display: grid;
      grid-template-columns: 50% 50%;
      gap: 0;
    }
    .grid > .panel:nth-child(3) { display: none; }
    @media (max-width: 1100px) {
      body { overflow: auto; }
      .app { height: auto; min-height: 100%; }
      .grid { grid-template-columns: 1fr; }
    }
    .panel {
      min-width: 0;
      min-height: 0;
      height: 100%;
      background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(253, 255, 255, .93));
      border: 1px solid var(--line);
      border-radius: 0;
      display: flex;
      flex-direction: column;
      box-shadow: var(--panel-shadow);
      overflow: hidden;
      transition: box-shadow .18s ease, border-color .18s ease;
    }
    .panel:hover { box-shadow: 0 16px 40px rgba(30, 52, 85, .12); border-color: #c9d9ec; }
    body.theme-dark .panel {
      background: rgba(18,18,18,.96);
      border-color: #2a2a2a;
      box-shadow: 0 10px 26px rgba(2,6,23,.45);
    }
    .panel h2, .panel h3 {
      margin: 0;
      font-size: 13px;
      padding: 10px 12px 0;
    }
    .panel .desc { display: none; }
    .panel .desc .warn-red {
      color: #dc2626;
      font-weight: 700;
    }
    body.theme-dark .panel .desc .warn-red {
      color: #f87171;
    }
    .panel-head {
      padding: 10px 14px 2px;
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 10px;
      min-height: 0;
    }
.panel-head h2, .panel-head h3 {
      margin: 0;
      padding: 0;
      font-size: 16px;
      line-height: 1.25;
      padding-top: 2px;
    }
    #clearHistoryBtn {
      padding: 4px 8px;
      font-size: 11px;
      border-radius: 6px;
      line-height: 1.1;
    }
    .toolbar {
      padding: 10px 14px 12px;
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      align-items: center;
      border-top: 1px solid #edf2f7;
      background: rgba(248,251,255,.72);
    }
    body.theme-dark .toolbar {
      border-top-color: #2a2a2a;
      background: rgba(10,10,10,.62);
    }
    button {
      border: 1px solid transparent;
      border-radius: 10px;
      padding: 8px 12px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: transform .12s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease, color .16s ease;
    }
    button:focus-visible, .controls select:focus-visible {
      outline: none;
      box-shadow: 0 0 0 3px var(--ring);
    }
    button:active:not(:disabled) {
      transform: translateY(1px) scale(.985);
      filter: saturate(1.06);
    }
    button:disabled { cursor: not-allowed; opacity: .65; }
    button.btn-tap:not(:disabled) {
      transform: scale(.985);
      box-shadow: inset 0 0 0 999px rgba(255,255,255,.10);
    }
    button.btn-success:not(:disabled) {
      box-shadow: 0 0 0 2px rgba(22,163,74,.18);
    }
    .btn-p {
      background: linear-gradient(180deg, #5879af 0%, #476594 100%);
      color: #fff;
      border-color: #486894;
      box-shadow: 0 5px 14px rgba(71, 101, 148, .24);
    }
    .btn-p:hover:not(:disabled) {
      background: linear-gradient(180deg, #4c6ea6 0%, #3f5f8f 100%);
      border-color: #3f5f8f;
    }
    .btn-s { background: #ebf3ff; border-color: #c8daf7; color: #355173; }
    .btn-s:hover:not(:disabled) { background: #deebff; border-color: #b8cff4; }
    #downloadBtn {
      transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, color .16s ease;
    }
    #downloadBtn:active:not(:disabled),
    #downloadBtn.btn-tap:not(:disabled) {
      transform: none;
      filter: none;
    }
    body.theme-dark .btn-s {
      background: #1e1e1e;
      border-color: #333333;
      color: #e0e0e0;
    }
    body.theme-dark .btn-s:hover:not(:disabled) { background: #262626; }
    .grow { flex: 1; }
    .tiny { display: none; }

    .drop-wrap {
      flex: 1 1 auto;
      min-height: 0;
      padding: 0 12px 10px;
      display: grid;
      grid-template-rows: 1fr auto;
      gap: 8px;
    }
    .dropzone {
      min-height: 0;
      border: 2px dashed #a5b6cc;
      border-radius: 12px;
      background: linear-gradient(180deg, #fbfdff, #f3f8ff);
      position: relative;
      overflow: hidden;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      user-select: none;
    }
    body.theme-dark .dropzone {
      border-color: #3a3a3a;
      background: linear-gradient(180deg, #1a1a1a, #131313);
    }
    .dropzone.dragover {
      border-color: var(--pri);
      background: #e4efff;
    }
    body.theme-dark .dropzone.dragover {
      border-color: #5b5b5b;
      background: #1d1d1d;
    }
    .dropzone-corner-group {
      position: absolute !important;
      top: 8px !important;
      right: 8px !important;
      left: auto !important;
      bottom: auto !important;
      z-index: 4;
      display: flex;
      align-items: center;
      flex-direction: row;
      gap: 8px;
    }
    .dropzone-corner-btn {
      white-space: nowrap;
    }
    .dropzone-mode-select {
      height: 38px;
      min-width: 130px;
      border: 1px solid #96afcf;
      border-radius: 10px;
      padding: 0 10px;
      font-size: 13px;
      color: #1f3656;
      background: linear-gradient(180deg, #f8fbff 0%, #edf4ff 100%);
      box-shadow: 0 8px 20px rgba(40, 70, 120, .12);
      outline: none;
    }
    .dropzone-mode-select.is-premium-mode {
      color: #9a6a00;
      font-weight: 700;
      border-color: #d8b14e;
      background: linear-gradient(180deg, #fff5d8 0%, #ffe6a8 100%);
      box-shadow: 0 8px 22px rgba(173, 124, 17, .18);
    }
    body.theme-dark .dropzone-mode-select {
      color: #e2e8f0;
      border-color: #3a4b66;
      background: linear-gradient(180deg, #1b2430 0%, #131a24 100%);
      box-shadow: none;
    }
    body.theme-dark .dropzone-mode-select.is-premium-mode {
      color: #ffd76a;
      border-color: #b98d25;
      background: linear-gradient(180deg, #3a2a08 0%, #271b06 100%);
      box-shadow: 0 8px 22px rgba(0, 0, 0, .22);
    }
    .is-hidden-mode-select {
      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;
      opacity: 0 !important;
      pointer-events: none !important;
      min-width: 0 !important;
    }
    .mode-strip {
      margin: 0;
      position: relative;
      z-index: 30;
      overflow: visible;
    }
    .mode-strip-inner {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 10px;
      overflow: visible;
    }
    .mode-strip-inner-four {
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 8px;
    }
    .mode-tab {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      min-height: 34px;
      padding: 5px 10px;
      border-radius: 12px;
      border: 1px solid #d5e0ef;
      background: linear-gradient(180deg, #ffffff 0%, #f4f8fd 100%);
      color: #35537c;
      box-shadow: 0 12px 28px rgba(70, 102, 154, .10);
      font-size: 13px;
      font-weight: 700;
      line-height: 1.15;
      cursor: pointer;
      transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
      overflow: visible;
    }
    .mode-tab:hover {
      transform: translateY(-1px);
      box-shadow: 0 14px 30px rgba(70, 102, 154, .15);
    }
    .mode-tab.is-disabled,
    .mode-tab:disabled {
      cursor: not-allowed;
      color: #94a3b8;
      border-color: #d8e1ec;
      background: linear-gradient(180deg, #f5f7fb 0%, #edf2f7 100%);
      box-shadow: none;
      opacity: 1;
      transform: none;
    }
    .mode-tab.is-disabled:hover,
    .mode-tab:disabled:hover {
      transform: none;
      box-shadow: none;
    }
    .mode-tab.is-active {
      border-color: #7da4ea;
      background: linear-gradient(180deg, #fbfdff 0%, #eaf2ff 100%);
      color: #2a4e84;
      box-shadow: 0 14px 30px rgba(60, 102, 188, .18);
    }
    .mode-tab-premium {
      border-color: #d5e0ef;
      background: linear-gradient(180deg, #ffffff 0%, #f4f8fd 100%);
      color: #35537c;
    }
    .mode-tab-premium.is-active {
      border-color: #7da4ea;
      background: linear-gradient(180deg, #fbfdff 0%, #eaf2ff 100%);
      color: #2a4e84;
      box-shadow: 0 14px 30px rgba(60, 102, 188, .18);
    }
    .mode-tab-label {
      line-height: 1.2;
    }
    .mode-tab-member {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      height: 22px;
      padding: 0 8px;
      border-radius: 999px;
      background: linear-gradient(180deg, #fff9ec 0%, #f3e4bb 100%);
      color: #9a7932;
      font-size: 11px;
      font-weight: 800;
      letter-spacing: .02em;
      border: 1px solid rgba(198, 170, 103, .34);
      box-shadow: inset 0 1px 0 rgba(255,255,255,.72);
    }
    .mode-tab-help {
      position: relative;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 17px;
      height: 17px;
      border-radius: 999px;
      border: 1px solid currentColor;
      font-size: 11px;
      font-weight: 800;
      line-height: 1;
      opacity: .85;
      cursor: help;
      flex: 0 0 auto;
    }
    .mode-tab-tooltip {
      position: absolute;
      left: 50%;
      top: calc(100% + 10px);
      transform: translateX(-50%);
      min-width: 200px;
      max-width: 260px;
      padding: 9px 11px;
      border-radius: 10px;
      background: rgba(16, 24, 40, .94);
      color: #fff;
      font-size: 12px;
      font-weight: 600;
      line-height: 1.45;
      box-shadow: 0 14px 32px rgba(0, 0, 0, .22);
      opacity: 0;
      pointer-events: none;
      transition: opacity .16s ease, transform .16s ease;
      z-index: 9999;
    }
    .mode-tab-help:hover .mode-tab-tooltip,
    .mode-tab-help:focus-visible .mode-tab-tooltip {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }
    body.theme-dark .mode-tab {
      border-color: #3a3a3a;
      background: linear-gradient(180deg, #252525 0%, #202020 100%);
      color: #d8d8d8;
      box-shadow: none;
    }
    body.theme-dark .mode-tab.is-disabled,
    body.theme-dark .mode-tab:disabled {
      border-color: #2f2f2f;
      background: linear-gradient(180deg, #1b1b1b 0%, #161616 100%);
      color: #6b7280;
      box-shadow: none;
    }
    body.theme-dark .mode-tab.is-active {
      border-color: #585858;
      background: linear-gradient(180deg, #2d2d2d 0%, #262626 100%);
      color: #f0f0f0;
    }
    body.theme-dark .mode-tab-premium {
      border-color: #3a3a3a;
      background: linear-gradient(180deg, #252525 0%, #202020 100%);
      color: #d8d8d8;
    }
    body.theme-dark .mode-tab-premium.is-active {
      border-color: #585858;
      background: linear-gradient(180deg, #2d2d2d 0%, #262626 100%);
      color: #f0f0f0;
    }
    body.theme-dark .mode-tab-member {
      background: linear-gradient(180deg, #51421f 0%, #3b3117 100%);
      color: #f2d894;
      border-color: rgba(205, 176, 99, .26);
    }
@media (max-width: 980px) {
  .brand-line {
    flex-wrap: wrap;
    gap: 2px 8px;
    align-items: flex-start;
  }
  .subtitle {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
  .mode-strip-inner {
        grid-template-columns: repeat(4, minmax(0, 1fr));
      }
    }
    @media (max-width: 640px) {
      .mode-strip-inner {
        grid-template-columns: repeat(4, minmax(0, 1fr));
      }
      .mode-tab {
        justify-content: center;
        padding: 5px 6px;
        font-size: 11px;
      }
      .preview-stage.is-expanded-preview {
        width: min(96vw, 1180px);
        height: min(88vh, 820px);
        padding: 14px;
      }
    }
    .mode-choose-tip {
      color: #dc2626;
      font-size: 13px;
      font-weight: 700;
      white-space: nowrap;
      line-height: 1;
      text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
    }
    .mode-choose-hints {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 4px;
      margin-top: 2px;
    }
    .mode-choose-subtip {
      position: absolute;
      top: 52px;
      right: 8px;
      z-index: 4;
      color: #dc2626;
      font-size: 12px;
      font-weight: 600;
      line-height: 1.1;
      text-align: right;
      white-space: nowrap;
      text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
    }
    body.theme-dark .mode-choose-tip {
      color: #ff5a5a;
      text-shadow: none;
    }
    body.theme-dark .mode-choose-subtip {
      color: #ff7b7b;
      text-shadow: none;
    }
    .drop-hint {
      color: var(--muted);
      font-size: 13px;
      line-height: 1.5;
      padding: 16px;
      text-align: center;
      max-width: 90%;
    }
    .image-stage {
      width: 100%;
      height: 100%;
      display: none;
      align-items: center;
      justify-content: center;
      position: relative;
      background: #f6f8fc;
    }
    body.theme-dark .image-stage { background: #121212; }
    .image-stage.active { display: flex; }
    #imagePreview {
      max-width: 100%;
      max-height: 100%;
      object-fit: contain;
      display: block;
      pointer-events: none;
    }
    #stageCanvas {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
    }
    .selected-shots {
      width: 100%;
      height: 100%;
      display: none;
      overflow: auto;
      padding: 10px;
      gap: 12px;
      align-content: flex-start;
      grid-template-columns: 1fr;
      background: #f6f8fc;
    }
    body.theme-dark .selected-shots { background: #121212; }
    .selected-shots.active { display: grid; }
    .shot-item {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #fff;
      overflow: visible;
    }
    body.theme-dark .shot-item { background: #161616; border-color: #2a2a2a; }
    .shot-item img {
      width: 100%;
      height: auto;
      object-fit: unset;
      display: block;
      background: #fff;
    }
    body.theme-dark .shot-item img { background: #0f0f0f; }
    .shot-item .shot-cap {
      padding: 6px 8px;
      font-size: 12px;
      color: var(--muted);
    }
    .status {
      border: 1px solid #dce6f2;
      border-radius: 10px;
      background: #f4f8ff;
      padding: 8px 10px;
      font-size: 13px;
      white-space: pre-wrap;
      color: #334155;
    }
    body.theme-dark .status {
      background: #181818;
      border-color: #303030;
      color: #e0e0e0;
    }
    .status.ok { color: var(--ok); background: #f0fdf4; border-color: #bbf7d0; }
    .status.err { color: var(--err); background: #fef2f2; border-color: #fecaca; }
    body.theme-dark .status.ok { background: #0f2a1b; border-color: #1f6a3e; color: #78e2a4; }
    body.theme-dark .status.err { background: #321519; border-color: #7a2831; color: #ff9aa4; }
    .status .status-accent { color: #d92d20; font-weight: 700; }
    body.theme-dark .status .status-accent { color: #ff7b7b; }
.chain-trace {
      border: 1px solid #dce6f2;
      border-radius: 8px;
      background: #f8fbff;
      padding: 7px 9px;
      font-size: 12px;
      color: #475569;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    body.theme-dark .chain-trace {
      background: #161616;
      border-color: #303030;
      color: #b8c4d9;
    }
    .progress-wrap {
      border: 1px solid #dce6f2;
      border-radius: 8px;
      background: #fff;
      padding: 7px 9px;
      display: grid;
      gap: 5px;
      min-height: 46px;
      opacity: 1;
      visibility: visible;
      transition: opacity .18s ease, visibility .18s ease;
    }
    body.theme-dark .progress-wrap {
      background: #151515;
      border-color: #303030;
    }
    .progress-wrap.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
    .progress-track {
      width: 100%;
      height: 8px;
      border-radius: 999px;
      background: #e7eef8;
      overflow: hidden;
      position: relative;
    }
    body.theme-dark .progress-track { background: #2a2a2a; }
    body.theme-dark .progress-fill { background: linear-gradient(90deg, #5a5a5a, #7a7a7a); }
    .progress-fill {
      height: 100%;
      width: 0%;
      border-radius: inherit;
      background: linear-gradient(90deg, #6b7280, #9ca3af);
      transition: width .18s ease;
    }
    .progress-wrap.indeterminate .progress-fill {
      width: 45% !important;
      position: relative;
      animation: pslide 1s linear infinite;
    }
    .progress-text {
      font-size: 11px;
      color: var(--muted);
      line-height: 1.25;
    }
    @keyframes pslide {
      from { left: -45%; }
      to { left: 100%; }
    }

    .result-wrap {
      flex: 1 1 auto;
      min-height: 0;
      padding: 0 12px 10px;
      display: grid;
      grid-template-rows: minmax(170px, 1.05fr) auto minmax(130px, .95fr);
      gap: 8px;
      position: relative;
    }
    .panel-result .panel-head {
      align-items: center;
      padding: 10px 14px 2px;
    }
    .panel-result .panel-head h2 {
      padding-top: 0;
      line-height: 1.2;
      display: block;
      visibility: visible;
      opacity: 1;
      color: var(--text);
    }
    .result-head-actions {
      display: inline-flex;
      align-items: center;
      justify-content: flex-end;
      flex: 0 0 auto;
      gap: 6px;
    }
    .preview-stage {
      min-height: 0;
      position: relative;
      display: grid;
      align-content: start;
      transform-origin: top right;
      transition:
        width .34s cubic-bezier(.22, 1, .36, 1),
        height .34s cubic-bezier(.22, 1, .36, 1),
        transform .34s cubic-bezier(.22, 1, .36, 1),
        opacity .22s ease,
        box-shadow .34s ease,
        border-color .24s ease,
        background .24s ease,
        padding .34s cubic-bezier(.22, 1, .36, 1);
      will-change: width, height, transform;
    }
    .preview-stage .preview-list {
      height: 100%;
      align-self: start;
    }
    .word-preview-stage {
      position: absolute;
      inset: 0;
      display: none;
      border-radius: 18px;
      overflow: hidden;
      background: linear-gradient(180deg, rgba(244, 248, 255, 0.96), rgba(233, 240, 251, 0.98));
      border: 1px solid rgba(165, 186, 220, 0.85);
      box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
    }
    .word-preview-stage.is-open {
      display: grid;
    }
    .word-preview-loading {
      position: absolute;
      inset: 0;
      display: grid;
      place-items: center;
      padding: 18px;
      color: #4b648e;
      font-size: 14px;
      font-weight: 700;
      background: linear-gradient(180deg, rgba(244, 248, 255, 0.92), rgba(233, 240, 251, 0.96));
      z-index: 2;
    }
    .word-preview-frame {
      width: 100%;
      height: 100%;
      border: 0;
      background: #f6f8fc;
    }
    .preview-expand-btn {
      width: 22px;
      height: 22px;
      min-height: 22px;
      border-radius: 999px;
      border: 1px solid rgba(166, 184, 212, 0.92);
      background: rgba(255, 255, 255, 0.96);
      color: #36527f;
      box-shadow: none;
      font-size: 10px;
      font-weight: 800;
      line-height: 1;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex: 0 0 auto;
      transition: transform .22s ease, box-shadow .22s ease, background .22s ease, border-color .22s ease;
    }
    .preview-expand-btn:hover,
    .preview-expand-btn:focus-visible {
      transform: translateY(-1px);
      background: #ffffff;
      box-shadow: none;
    }
    .preview-word-btn {
      font-size: 10px;
      letter-spacing: .02em;
    }
    .preview-word-btn.is-active {
      background: linear-gradient(135deg, #4d84df, #2f66c2);
      border-color: rgba(53, 97, 176, 0.96);
      color: #fff;
      box-shadow: 0 14px 28px rgba(47, 102, 194, 0.28);
    }
    .preview-expand-btn.is-expanded-preview-toggle {
      position: fixed;
      top: calc(var(--preview-expanded-top, 40px) + 10px);
      right: calc(max(14px, 100vw - (var(--preview-expanded-left, 40px) + var(--preview-expanded-width, 1180px))) + 18px);
      z-index: 1705;
    }
    .preview-word-btn.is-expanded-preview-topbtn {
      position: fixed;
      top: calc(var(--preview-expanded-top, 40px) + 10px);
      right: calc(max(14px, 100vw - (var(--preview-expanded-left, 40px) + var(--preview-expanded-width, 1180px))) + 60px);
      z-index: 1705;
    }
    #resultPanelTitle.is-expanded-preview-title {
      position: fixed;
      left: calc(var(--preview-expanded-left, 40px) + 18px);
      top: calc(var(--preview-expanded-top, 40px) + 8px);
      z-index: 1705;
      margin: 0;
      display: block;
      pointer-events: none;
      visibility: visible;
      opacity: 1;
      color: var(--text);
    }
    .table-copy-notice {
      grid-column: 1 / -1;
      margin-top: 2px;
      padding: 6px 10px;
      border-radius: 10px;
      border: 1px solid rgba(221, 177, 88, 0.38);
      background: linear-gradient(180deg, rgba(255, 247, 225, 0.92), rgba(255, 240, 204, 0.96));
      color: #8a5a05;
      font-size: 12px;
      font-weight: 700;
      line-height: 1.3;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    body.preview-expanded {
      overflow: hidden;
    }
    .preview-stage.is-expanded-preview {
      position: fixed;
      left: var(--preview-expanded-left, 50%);
      top: var(--preview-expanded-top, 50%);
      width: var(--preview-expanded-width, min(1180px, 92vw));
      height: var(--preview-expanded-height, min(820px, 84vh));
      padding: 50px 14px 72px;
      border: 1px solid var(--line);
      border-radius: 12px;
      background: var(--panel);
      box-shadow: none;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
      z-index: 1600;
      transform: none;
      animation: none;
      overflow: hidden;
    }
    .preview-stage.is-expanded-preview .preview-list {
      margin-top: 0;
      align-self: start;
    }
    .preview-stage.is-expanded-preview .preview-list,
    .preview-stage.is-expanded-preview .word-preview-stage {
      border-radius: 10px;
      min-height: 0;
    }
    .result-toolbar.is-expanded-preview-toolbar {
      position: fixed;
      left: calc(var(--preview-expanded-left, 40px) + 14px);
      right: calc(max(14px, 100vw - (var(--preview-expanded-left, 40px) + var(--preview-expanded-width, 1180px))) + 14px);
      bottom: calc(max(8px, 100vh - (var(--preview-expanded-top, 40px) + var(--preview-expanded-height, 820px))) + 8px);
      z-index: 1704;
      display: grid;
      grid-template-columns: repeat(6, minmax(0, 1fr));
      gap: 6px;
      padding: 0;
      border: 0;
      border-radius: 0;
      box-shadow: none;
      background: transparent;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }
    .result-toolbar.is-expanded-preview-toolbar > button {
      min-height: 36px;
      height: 36px;
      padding: 4px 8px;
    }
    body.theme-dark .preview-expand-btn {
      border-color: rgba(94, 118, 160, 0.72);
      background: rgba(24, 30, 42, 0.94);
      color: #d9e6ff;
      box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
    }
    body.theme-dark .table-copy-notice {
      border-color: rgba(167, 128, 41, 0.46);
      background: linear-gradient(180deg, rgba(62, 48, 18, 0.92), rgba(48, 37, 14, 0.96));
      color: #f3cd75;
    }
    body.theme-dark .preview-expand-btn:hover,
    body.theme-dark .preview-expand-btn:focus-visible {
      background: rgba(31, 40, 56, 0.98);
    }
    body.theme-dark .preview-stage.is-expanded-preview {
      background: rgba(16, 18, 24, 0.98);
      border-color: #353535;
      box-shadow: 0 28px 64px rgba(0, 0, 0, 0.46);
    }
    body.theme-dark .preview-stage.is-expanded-preview {
      background: var(--panel);
      border-color: #353535;
      box-shadow: none;
    }
    body.theme-dark .preview-expand-btn.is-expanded-preview-toggle,
    body.theme-dark .preview-word-btn.is-expanded-preview-topbtn {
      box-shadow: none;
    }
    body.theme-dark .result-toolbar.is-expanded-preview-toolbar {
      background: transparent;
      box-shadow: none;
    }
    #latexOutput {
      width: 100%;
      height: 100%;
      min-height: 0;
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 8px;
      resize: none;
      font-size: 12px;
      line-height: 1.45;
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      background: #fff;
      white-space: pre-wrap;
      overflow: auto;
      overflow-wrap: anywhere;
      word-break: break-word;
    }
    body.theme-dark #latexOutput {
      background: #111111;
      color: #ececec;
      border-color: #303030;
    }
    .preview-list {
      min-height: 0;
      overflow: auto;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: linear-gradient(180deg, #f8fbff, #f5f9ff);
      padding: 6px;
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      align-items: stretch;
      gap: 6px;
    }
    body.theme-dark .preview-list {
      background: #141414;
      border-color: #303030;
    }
.result-toolbar {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fcff;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  align-items: stretch;
}
    body.theme-dark .result-toolbar {
      background: #141414;
      border-color: #303030;
    }
    .result-toolbar > button {
      width: 100%;
      min-width: 0;
      min-height: 36px;
      height: 36px;
      padding: 4px 10px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      white-space: nowrap;
    }
    .preview-item {
      border: 1px solid #e7edf6;
      border-radius: 10px;
      padding: 8px;
      background: #fff;
    }
    body.theme-dark .preview-item {
      background: #1a1a1a;
      border-color: #333333;
    }
    .preview-item .meta {
      font-size: 11px;
      color: var(--muted);
      margin-bottom: 6px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }
    .mini-copy {
      padding: 3px 8px;
      font-size: 11px;
      border-radius: 6px;
      line-height: 1.1;
    }
    .preview-math {
      overflow: auto;
      min-height: 36px;
    }
    .preview-math .katex-display {
      margin: 0;
      text-align: left;
    }
    .preview-math .katex-display > .katex {
      text-align: left;
      white-space: nowrap;
    }
    .preview-math.has-eq-suffix {
      overflow: visible;
    }
    .preview-math .eq-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: center;
      column-gap: 12px;
      min-height: 36px;
    }
    .preview-math .eq-main {
      min-width: 0;
      display: flex;
      justify-content: flex-start;
      overflow-x: auto;
      overflow-y: hidden;
    }
    .preview-math .eq-main .katex-display {
      text-align: left;
    }
    .preview-math .eq-main .katex-display > .katex {
      text-align: left;
    }
    .preview-math .eq-suffix {
      justify-self: end;
      white-space: nowrap;
      font-size: 30px;
      line-height: 1.1;
      color: #0f172a;
    }
    body.theme-dark .preview-math .eq-suffix {
      color: #e5e7eb;
    }
    .preview-text {
      min-height: 36px;
      white-space: pre-wrap;
      word-break: break-word;
      color: var(--text);
      line-height: 1.55;
      font-size: 18px;
    }
    .preview-text .md-render-table {
      width: 100%;
      border-collapse: collapse;
      table-layout: auto;
      margin: 8px 0;
      white-space: normal;
      background: rgba(255, 255, 255, 0.72);
      border: 1px solid var(--line);
      border-radius: 10px;
      overflow: hidden;
      display: table;
    }
    .preview-text .md-render-table tr {
      border-bottom: 1px solid var(--line);
    }
    .preview-text .md-render-table tr:last-child {
      border-bottom: none;
    }
    .preview-text .md-render-table td,
    .preview-text .md-render-table th {
      padding: 8px 10px;
      vertical-align: top;
      white-space: normal;
      word-break: break-word;
      border-right: 1px solid var(--line);
    }
    .preview-text .md-render-table td:last-child,
    .preview-text .md-render-table th:last-child {
      border-right: none;
    }
    .preview-text .md-render-table-wrap {
      overflow-x: auto;
      margin: 8px 0;
    }
    body.theme-dark .preview-text .md-render-table {
      background: rgba(15, 23, 42, 0.55);
    }

    .side-stack {
      min-height: 0;
      padding: 0 12px 12px;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .history-wrap {
      flex: 1.6 1 0;
      min-height: 0;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: linear-gradient(180deg, #fcfdff, #f8fbff);
      padding: 8px;
      display: grid;
      grid-template-rows: 1fr;
    }
    body.theme-dark .history-wrap {
      background: #141414;
      border-color: #303030;
    }
    .history {
      min-height: 0;
      overflow: auto;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: linear-gradient(180deg, #fcfdff, #f8fbff);
    }
    body.theme-dark .history {
      background: #141414;
      border-color: #303030;
    }
    .history-item {
      display: grid;
      grid-template-columns: 84px 1fr;
      gap: 8px;
      padding: 10px;
      border-bottom: 1px dashed #e3eaf4;
      cursor: pointer;
    }
    .history-item:last-child { border-bottom: 0; }
    .history-item:hover { background: #ebf3ff; }
    body.theme-dark .history-item:hover { background: #1f1f1f; }
    .thumb {
      width: 84px;
      height: 60px;
      object-fit: contain;
      background: #eef2f7;
      border: 1px solid #dfe7f2;
      border-radius: 8px;
    }
    body.theme-dark .thumb {
      background: #1d1d1d;
      border-color: #333333;
    }
    .h-time { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.h-preview { min-height: 40px; overflow: auto; font-size: 12px; }
.h-preview {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.history-preview-seg {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
}
.history-preview-seg.is-text {
  font-size: 12px;
  line-height: 1.45;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.history-preview-seg.is-math {
  font-size: 12px;
}
.history-preview-seg.is-math .katex-display {
  margin: 0;
  text-align: left;
}
.history-preview-seg.is-math .katex-display > .katex {
  text-align: left;
  white-space: nowrap;
}
.history-preview-seg.is-math .katex {
  font-size: 0.92em;
}
    .friend-wrap {
      flex: 0.9 1 0;
      min-height: 0;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: linear-gradient(180deg, #fcfdff, #f7fbff);
      padding: 10px;
      display: grid;
      gap: 10px;
      grid-template-rows: auto 1fr;
      overflow: auto;
    }
    body.theme-dark .friend-wrap {
      background: #161616;
      border-color: #303030;
    }
    .friend-head {
      font-size: 13px;
      font-weight: 700;
      color: var(--text);
    }
    .friend-links {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }
    .friend-links a {
      display: inline-block;
      color: #2563eb;
      text-decoration: none;
      font-size: 15px;
      font-weight: 700;
      line-height: 1.4;
    }
    .friend-links a:hover {
      color: #1d4ed8;
      text-decoration: underline;
    }
    body.theme-dark .friend-links a {
      color: #93c5fd;
    }
    .ad-reserve {
      min-height: 0;
      height: 100%;
    }
    .ad-reserve-title {
      font-size: 12px;
      color: var(--muted);
      font-weight: 600;
    }
    .ad-reserve-box {
      border: 1px dashed #a5b6cc;
      border-radius: 10px;
      min-height: 100%;
      display: flex;
      align-items: flex-start;
      justify-content: center;
      padding: 16px;
      font-size: 12px;
      color: #607189;
      background: linear-gradient(180deg, #f8fbff, #eef5ff);
      position: relative;
    }
    .ad-link-card {
      width: min(440px, 72%);
      border: 1px solid #cfdcf0;
      border-radius: 12px;
      background: #ffffff;
      box-shadow: 0 8px 22px rgba(33, 54, 86, .10);
      padding: 14px 16px;
      display: grid;
      gap: 12px;
      text-align: center;
      margin-top: 6px;
    }
    .ad-reserve-box a {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      border: 1px solid #c7d6ee;
      background: #f3f8ff;
      color: #2f4a6c;
      border-radius: 10px;
      padding: 10px 14px;
      text-decoration: none;
      font-size: 13px;
      font-weight: 700;
    }
    .ad-reserve-box a:hover {
      background: #e8f1ff;
      border-color: #b2c8ea;
    }
    body.theme-dark .ad-reserve-box {
      border-color: #3d4757;
      color: #9fb0c8;
      background: linear-gradient(180deg, #1b2431, #171e2a);
    }
    body.theme-dark .ad-link-card {
      border-color: #3a4556;
      background: #1f2632;
      box-shadow: 0 8px 22px rgba(0, 0, 0, .35);
    }
    body.theme-dark .ad-reserve-box a {
      background: #253043;
      border-color: #3d4c65;
      color: #d7e0ee;
    }

    .modal {
      position: fixed;
      inset: 0;
      display: none;
      align-items: center;
      justify-content: center;
      background: rgba(15,23,42,.55);
      z-index: 5000;
      padding: 14px;
      overscroll-behavior: contain;
    }
    .modal.active { display: flex; }
    body.modal-open {
      overflow: hidden !important;
      touch-action: none;
    }
    .modal-card {
      width: min(1200px, 100%);
      height: min(88vh, 900px);
      background: #fff;
      border-radius: 14px;
      border: 1px solid var(--line);
      box-shadow: 0 20px 60px rgba(0,0,0,.18);
      display: grid;
      grid-template-rows: auto auto 1fr auto;
      overflow: hidden;
    }
    body.theme-dark .modal-card {
      background: #222222;
      border-color: #383838;
      box-shadow: 0 20px 60px rgba(0,0,0,.5);
    }
    .modal-head {
      padding: 12px 14px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      border-bottom: 1px solid var(--line);
    }
    body.theme-dark .modal-head { border-bottom-color: #383838; }
    .modal-tools {
      padding: 10px 14px;
      display: flex;
      gap: 8px;
      align-items: center;
      border-bottom: 1px solid var(--line);
      flex-wrap: wrap;
    }
    body.theme-dark .modal-tools { border-bottom-color: #383838; background: #222222; }
    .modal-stage {
      min-height: 0;
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #f5f7fb;
      overflow: hidden;
    }
    body.theme-dark .modal-stage { background: #202020; }
    #cropImg {
      max-width: 100%;
      max-height: 100%;
      object-fit: contain;
      display: block;
      user-select: none;
      pointer-events: none;
    }
    #cropCanvas {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      cursor: crosshair;
    }
    .modal-foot {
      border-top: 1px solid var(--line);
      padding: 10px 14px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }
    body.theme-dark .modal-foot { border-top-color: #383838; background: #222222; }
    .regions-note { font-size: 12px; color: var(--muted); }
    .kbd {
      border: 1px solid var(--line);
      border-bottom-width: 2px;
      border-radius: 6px;
      padding: 1px 6px;
      background: #fff;
      font-size: 11px;
      color: #334155;
    }
    .sr-only {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }

/* 2026-03-05: 3-column top + scroll-down history */
body { overflow: auto; }
:root { --topbar-h: 62px; --teaser-h: 52px; }
.app {
  position: relative;
  inset: auto;
  width: 100%;
  min-height: 100dvh;
  height: auto;
  overflow: visible;
}
.history-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.build-version {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border: 1px solid #c7d7ea;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  color: #4b5f78;
  background: #f4f8ff;
}
body.theme-dark .build-version {
  border-color: #334155;
  color: #cbd5e1;
  background: #0f172a;
}
    .model-info {
      border: 1px solid #dce6f2;
      border-radius: 8px;
      background: #f8fbff;
      padding: 7px 9px;
      font-size: 12px;
      color: #3d4f69;
      white-space: normal;
      overflow: visible;
      text-overflow: clip;
      word-break: break-word;
    }
    body.theme-dark .model-info {
      background: #161616;
      border-color: #303030;
      color: #c4d0e0;
    }
    .complexity-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 8px;
      align-items: center;
    }
    .complexity-row #formulaComplexity {
      margin: 0;
      line-height: 1.35;
    }
    .backend-inline {
      border: 1px solid #dce6f2;
      border-radius: 8px;
      background: #f8fbff;
      color: #3d4f69;
      padding: 7px 9px;
      font-size: 12px;
      max-width: 340px;
      min-width: 220px;
    }
    body.theme-dark .backend-inline {
      background: #161616;
      border-color: #303030;
      color: #c4d0e0;
    }
    @media (max-width: 980px) {
      .complexity-row {
        grid-template-columns: 1fr;
        gap: 6px;
      }
      .backend-inline {
        max-width: 100%;
        min-width: 0;
      }
    }
.page-main {
  display: grid;
  gap: 10px;
}
.top-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  min-height: calc(100dvh - var(--topbar-h) - var(--teaser-h));
}
.top-grid > .panel {
  height: calc(100dvh - var(--topbar-h) - var(--teaser-h));
  min-height: 560px;
}
.panel { height: auto; min-height: 320px; }
.drop-wrap, .result-wrap { min-height: 0; height: 100%; }
.panel-community .side-stack {
  height: 100%;
  min-height: 0;
}
.say-wrap {
  flex: 1 1 auto;
  min-height: 280px;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #fcfdff, #f7fbff);
  padding: 10px;
  display: grid;
  gap: 10px;
  grid-template-rows: auto auto auto 1fr;
  overflow: auto;
}
body.theme-dark .say-wrap { background: #161616; border-color: #303030; }
.say-head { font-size: 13px; font-weight: 700; color: var(--text); }
.post-row textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  font-size: 12px;
}
body.theme-dark .post-row textarea { background: #111; border-color: #303030; color: #ececec; }
.auth-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.post-row { display: grid; gap: 8px; }
.post-row textarea { min-height: 76px; resize: vertical; }
.post-tools { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
.post-list {
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.7);
  overflow: auto;
  padding: 8px;
  display: grid;
  gap: 8px;
}
body.theme-dark .post-list { border-color: #303030; background: #111; }
.post-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: #fff; }
body.theme-dark .post-item { border-color: #2b2b2b; background: #161616; }
.post-item-pinned {
  border-color: #e7c75c;
  box-shadow: 0 0 0 1px rgba(231, 199, 92, 0.28) inset;
}
body.theme-dark .post-item-pinned {
  border-color: #8a6b16;
  box-shadow: 0 0 0 1px rgba(231, 199, 92, 0.18) inset;
}
.post-meta {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.post-pin-badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(231, 199, 92, 0.18);
  color: #8a6500;
  border: 1px solid rgba(231, 199, 92, 0.55);
  font-weight: 700;
}
body.theme-dark .post-pin-badge {
  color: #f6d76d;
  background: rgba(231, 199, 92, 0.12);
  border-color: rgba(231, 199, 92, 0.35);
}
.member-name {
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  color: inherit;
}
.member-name.compact {
  font-size: inherit;
}
.member-name.is-member {
  color: #9b6a00;
  text-shadow: 0 1px 0 rgba(255,255,255,.5);
}
.member-name-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid rgba(215, 167, 39, 0.55);
  background: linear-gradient(180deg, #fff4ca 0%, #f8dc87 100%);
  color: #7b5400;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  box-shadow: 0 1px 2px rgba(176, 125, 0, 0.12);
}
.member-balance-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  min-height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(29, 78, 216, 0.16);
  background: rgba(219, 234, 254, 0.82);
  color: #1e3a8a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
}
body.theme-dark .member-name.is-member {
  color: #f3cf68;
  text-shadow: none;
}
body.theme-dark .member-name-badge {
  border-color: rgba(243, 207, 104, 0.34);
  background: linear-gradient(180deg, rgba(148, 108, 18, 0.42) 0%, rgba(92, 66, 9, 0.42) 100%);
  color: #f7dd8a;
  box-shadow: none;
}
body.theme-dark .member-balance-badge {
  border-color: rgba(147, 197, 253, 0.2);
  background: rgba(30, 58, 138, 0.35);
  color: #dbeafe;
}
.post-content { font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.post-replies {
  margin-top: 8px;
  border-top: 1px solid #c6d7ee;
  padding-top: 8px;
  display: grid;
  gap: 6px;
}
body.theme-dark .post-replies {
  border-top-color: #3a4d67;
}
.post-reply {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: rgba(104, 144, 216, 0.08);
}
body.theme-dark .post-reply {
  border-color: #334155;
  background: rgba(100, 149, 237, 0.12);
}
.post-reply-meta { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.post-reply-content { font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.post-image-list {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.post-image-list img,
.home-feed-images img {
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
}
.post-image-list img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #edf3fb;
}
body.theme-dark .post-image-list img {
  background: #0f172a;
}
.post-votes {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}
.active-vote {
  border-color: #6aa0ff !important;
  background: #dfeeff !important;
}
body.theme-dark .active-vote {
  background: #243247 !important;
  border-color: #4f6ea8 !important;
}

.auth-modal-card {
  width: min(460px, 96vw);
  height: auto;
  grid-template-rows: auto 1fr;
}
.auth-modal-body {
  padding: 14px;
  display: grid;
  gap: 10px;
}
.auth-modal-tip {
  border: 1px solid rgba(15, 98, 254, 0.18);
  border-radius: 12px;
  background: rgba(15, 98, 254, 0.08);
  color: #2c4870;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
}
.auth-modal-body input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  font-size: 12px;
}
body.theme-dark .auth-modal-body input {
  background: #111;
  border-color: #303030;
  color: #ececec;
}
body.theme-dark .auth-modal-tip {
  background: rgba(79, 110, 168, 0.16);
  border-color: rgba(124, 155, 214, 0.28);
  color: #d8e4ff;
}
.donate-modal-card {
  width: min(860px, 96vw);
  height: auto;
  grid-template-rows: auto 1fr;
}
.donate-head-main {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  flex: 1 1 auto;
}
.donate-head-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.donate-head-switch .btn-s {
  min-width: 108px;
}
.donate-modal-body {
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.donate-modal-left,
.donate-modal-right {
  min-width: 0;
}
.donate-modal-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.donate-modal-right {
  display: grid;
  gap: 12px;
}
.donate-prompt-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: #51627e;
  text-align: left;
}
.donate-summary-card,
.donate-order-card {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(246,250,255,.94));
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
}
.donate-order-card {
  display: grid;
  gap: 10px;
}
.donate-order-title {
  font-size: 13px;
  line-height: 1.6;
  color: #c79a2b;
  font-weight: 700;
}
.donate-order-warn {
  font-size: 12px;
  line-height: 1.5;
  color: #c2410c;
  font-weight: 700;
}
.donate-order-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 10px;
}
.donate-order-row input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.92);
  color: var(--text);
  padding: 0 12px;
  font-size: 13px;
}
.donate-order-status {
  min-height: 20px;
  font-size: 12px;
  line-height: 1.5;
  color: #51627e;
}
.donate-checkout-fallback {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}
.donate-checkout-fallback-btn {
  min-width: min(100%, 260px);
  justify-content: center;
  padding: 12px 24px;
  border-radius: 999px;
  border: 1px solid #b8cdef;
  background: linear-gradient(180deg, #f7fbff 0%, #eaf3ff 100%);
  color: #3e6fb3;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(62, 111, 179, 0.12);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.donate-checkout-fallback-btn:hover,
.donate-checkout-fallback-btn:focus-visible {
  color: #315f9d;
  border-color: #8fb1e1;
  background: linear-gradient(180deg, #ffffff 0%, #e1edff 100%);
  box-shadow: 0 12px 24px rgba(62, 111, 179, 0.18);
  transform: translateY(-1px);
}
body.theme-dark .donate-prompt-text {
  color: #d6e3fb;
}
body.theme-dark .donate-summary-card,
body.theme-dark .donate-order-card {
  background: #171717;
  border-color: #303030;
  color: #ececec;
}
body.theme-dark .donate-order-title,
body.theme-dark .donate-order-status {
  color: #d6e3fb;
}
body.theme-dark .donate-checkout-fallback-btn {
  border-color: rgba(143, 177, 225, 0.42);
  background: linear-gradient(180deg, rgba(38, 72, 118, 0.92) 0%, rgba(28, 56, 92, 0.96) 100%);
  color: #d8e6ff;
  box-shadow: 0 10px 24px rgba(4, 10, 22, 0.32);
}
body.theme-dark .donate-checkout-fallback-btn:hover,
body.theme-dark .donate-checkout-fallback-btn:focus-visible {
  color: #eef5ff;
  border-color: rgba(173, 199, 238, 0.55);
  background: linear-gradient(180deg, rgba(48, 88, 140, 0.96) 0%, rgba(34, 68, 110, 0.98) 100%);
  box-shadow: 0 14px 28px rgba(4, 10, 22, 0.42);
}
body.theme-dark .donate-order-title {
  color: #e7c75c;
}
body.theme-dark .donate-order-warn {
  color: #fdba74;
}
body.theme-dark .donate-order-row input {
  background: #111;
  border-color: #303030;
  color: #ececec;
}
.donate-modal-body img {
  display: block;
  width: min(360px, 100%);
  height: auto;
  border-radius: 20px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, .18);
}
.donate-qr-frame {
  display: none;
  width: min(360px, 100%);
  height: 560px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(15, 23, 42, .12);
}
body.theme-dark .donate-qr-frame {
  background: #111;
  border-color: #303030;
}
.donate-loading-state {
  width: min(360px, 100%);
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(246,250,255,.94));
  box-shadow: 0 14px 32px rgba(15, 23, 42, .12);
  display: grid;
  place-items: center;
  gap: 14px;
  padding: 24px;
}
.donate-loading-spinner {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  border: 4px solid rgba(80, 110, 160, 0.18);
  border-top-color: #4f74b8;
  animation: donate-spin 0.9s linear infinite;
}
.donate-loading-text {
  font-size: 15px;
  line-height: 1.6;
  color: #425673;
  font-weight: 700;
}
body.theme-dark .donate-loading-state {
  background: #171717;
  border-color: #303030;
}
body.theme-dark .donate-loading-spinner {
  border-color: rgba(191, 210, 255, 0.16);
  border-top-color: #86a8e6;
}
body.theme-dark .donate-loading-text {
  color: #d6e3fb;
}
@keyframes donate-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.donate-head-switch .btn-s.is-active {
  background: var(--btn-primary-bg);
  border-color: var(--btn-primary-border);
  color: var(--btn-primary-fg);
  box-shadow: var(--btn-primary-shadow);
}
body.theme-dark .donate-head-switch .btn-s.is-active {
  background: #29497b;
  border-color: #3f68a8;
  color: #eef4ff;
}
@media (max-width: 900px) {
  .donate-modal-card {
    width: min(440px, 96vw);
  }
  .donate-modal-body {
    grid-template-columns: 1fr;
  }
  .donate-head-main {
    flex-direction: column;
    align-items: flex-start;
  }
  .donate-modal-left {
    order: 2;
  }
  .donate-modal-right {
    order: 1;
  }
}

.membership-modal-card {
  width: min(880px, 96vw);
  height: auto;
  max-height: min(88vh, 920px);
  grid-template-rows: auto 1fr;
}
.membership-modal-body {
  padding: 16px;
  display: grid;
  gap: 14px;
  overflow: auto;
}
.membership-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(246,250,255,.94));
  padding: 14px;
  display: grid;
  gap: 12px;
}
body.theme-dark .membership-block {
  background: #171717;
  border-color: #303030;
}
.membership-block-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.membership-block-head h3 {
  margin: 0;
  font-size: 16px;
}
.membership-provider-line {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}
.membership-provider-line select {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 6px 10px;
}
body.theme-dark .membership-provider-line select {
  background: #111;
  border-color: #303030;
  color: #ececec;
}
.membership-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #cfdcf2;
  background: #eff6ff;
  color: #36517b;
  font-size: 12px;
  font-weight: 700;
}
.membership-badge.is-active {
  border-color: #86c9a8;
  background: #e8fff1;
  color: #166534;
}
.membership-badge.is-inactive {
  border-color: #e9d2a5;
  background: #fff8e9;
  color: #8a6200;
}
body.theme-dark .membership-badge {
  border-color: #374151;
  background: #111827;
  color: #dbeafe;
}
body.theme-dark .membership-badge.is-active {
  border-color: #2f7d54;
  background: rgba(22,101,52,.18);
  color: #8de0b1;
}
body.theme-dark .membership-badge.is-inactive {
  border-color: #7c5d18;
  background: rgba(138,98,0,.16);
  color: #f4d27e;
}
.membership-summary {
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}
.membership-plans-list,
.membership-orders-list {
  display: grid;
  gap: 10px;
}
.membership-plan-card,
.membership-order-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.88);
  padding: 12px;
  display: grid;
  gap: 8px;
}
body.theme-dark .membership-plan-card,
body.theme-dark .membership-order-card {
  background: #111;
  border-color: #2f2f2f;
}
.membership-plan-top,
.membership-order-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.membership-price {
  font-size: 24px;
  font-weight: 800;
  color: #1d4ed8;
}
body.theme-dark .membership-price {
  color: #93c5fd;
}
.membership-features {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.membership-order-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}
.membership-order-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.membership-order-qr {
  display: flex;
  justify-content: flex-start;
}
.membership-order-qr img {
  width: 180px;
  height: 180px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px;
}
body.theme-dark .membership-order-qr img {
  border-color: #303030;
}
.membership-empty {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 14px;
  color: var(--muted);
  text-align: center;
}
body.theme-dark .membership-empty {
  border-color: #303030;
}

.history-panel {
  min-height: calc(100dvh - var(--topbar-h));
}
.history-panel .panel-head {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.history-desc-inline {
  display: block !important;
  padding: 0 14px 8px;
  color: var(--muted);
  font-size: 12px;
}
.history-wrap-full {
  margin: 0 12px 12px;
  min-height: 0;
  flex: 1 1 auto;
  height: auto;
}
.bottom-dual {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}
.home-feed-panel {
  min-height: 420px;
  height: 420px;
}
.home-feed-panel .panel-head {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.home-feed-wrap {
  margin: 0 12px 12px;
  min-height: 0;
  flex: 1 1 auto;
  height: auto;
  overflow: auto;
}
.history-panel {
  min-height: 420px;
  height: 420px;
}
.home-feed-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.home-feed-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 10px 30px rgba(90, 116, 158, 0.12);
  padding: 14px;
}
.home-feed-item-title {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.35;
  color: #183153;
}
.home-feed-meta {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}
.home-feed-item-text {
  color: #334155;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.home-feed-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.home-feed-images img {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #edf3fb;
}
.home-feed-empty {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 16px 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.52);
}
body.theme-dark .home-feed-item {
  background: rgba(18, 28, 44, 0.82);
  box-shadow: 0 14px 36px rgba(2, 8, 23, 0.32);
}
body.theme-dark .home-feed-item-title {
  color: #eff6ff;
}
body.theme-dark .home-feed-item-text {
  color: #d8e4ff;
}
body.theme-dark .home-feed-images img {
  background: #0f172a;
}
body.theme-dark .home-feed-empty {
  background: rgba(15, 23, 42, 0.68);
}
.image-lightbox-card {
  width: min(92vw, 1080px);
  height: min(90vh, 820px);
  grid-template-rows: auto 1fr;
}
.image-lightbox-stage {
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(235, 241, 249, 0.96));
}
body.theme-dark .image-lightbox-stage {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.96));
}
#postImageModalImg {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
  background: rgba(255, 255, 255, 0.88);
}
body.theme-dark #postImageModalImg {
  background: rgba(15, 23, 42, 0.88);
  box-shadow: 0 22px 54px rgba(2, 6, 23, 0.55);
}
.seo-panel {
  margin: 8px 0 14px;
  min-height: auto;
}
.seo-panel-body {
  padding: 6px 14px 14px;
  font-size: 13px;
  color: #334155;
  line-height: 1.6;
}
body.theme-dark .seo-panel-body {
  color: #cbd5e1;
}
.seo-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.seo-links-grid a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  text-decoration: none;
  color: #31507e;
  background: #f8fbff;
  font-size: 12px;
  font-weight: 600;
}
body.theme-dark .seo-links-grid a {
  color: #dbeafe;
  background: #121827;
  border-color: #334155;
}
.history {
  min-height: 0;
  overflow: auto;
}
.history-item {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px dashed #e3eaf4;
  cursor: pointer;
}
.h-preview {
  min-height: 40px;
  overflow: auto;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@media (max-width: 980px) {
  .top-grid {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .top-grid > .panel {
    height: auto;
    min-height: 500px;
  }
  .bottom-dual {
    grid-template-columns: 1fr;
  }
  .home-feed-panel,
  .history-panel {
    min-height: 0;
    height: auto;
  }
  .home-feed-wrap,
  .history-wrap-full {
    height: 56vh;
    flex: 0 0 auto;
  }
}

.subtitle .warn-red { color: #dc2626; font-weight: 700; }
body.theme-dark .subtitle .warn-red { color: #f87171; }

/* 2026-03-10 global UI polish (opt38) */
.app {
  max-width: 1880px;
  margin: 0 auto;
}
.topbar {
  margin: 6px 6px 0;
  border-radius: 12px;
  padding: 8px 14px;
}
.page-main {
  padding: 6px;
  gap: 6px;
}
.top-grid {
  gap: 6px;
}
.top-grid > .panel {
  border-radius: 12px;
  border-width: 1px;
}
.panel-head {
  padding: 12px 14px 6px;
}
.panel-head h2, .panel-head h3 {
  font-size: 15px;
}
.drop-wrap, .result-wrap, .side-stack {
  padding-left: 10px;
  padding-right: 10px;
}
button,
.controls select,
.dropzone-mode-select {
  height: 38px;
  min-height: 38px;
}
button {
  border-radius: 11px;
  letter-spacing: .1px;
}
.toolbar, .result-toolbar {
  border-radius: 12px;
  gap: 8px;
  padding: 9px 10px;
}
#latexOutput,
.preview-list,
.history,
.post-list,
.say-wrap,
.status,
.progress-wrap,
.model-info,
.chain-trace {
  border-radius: 10px;
}
.dropzone {
  border-radius: 14px;
}
.dropzone-corner-group {
  top: 10px !important;
  right: 10px !important;
  gap: 7px;
}
.mode-choose-subtip {
  top: 55px;
  right: 10px;
  font-size: 11px;
}
.preview-item {
  padding: 10px;
}
.preview-text {
  line-height: 1.6;
  font-size: 17px;
}
.post-row textarea,
.auth-modal-body input {
  font-size: 13px;
  line-height: 1.45;
}
/* Desktop/tablet scrollbar polish */
* {
  scrollbar-width: thin;
  scrollbar-color: #9fb0c8 #e9f0fa;
}
body.theme-dark * {
  scrollbar-color: #566074 #1a1f27;
}
@media (max-width: 980px) {
  .topbar {
    margin: 4px 4px 0;
    border-radius: 10px;
  }
  .page-main {
    padding: 4px;
    gap: 4px;
  }
  .top-grid {
    gap: 4px;
  }
  .top-grid > .panel {
    min-height: 480px;
    border-radius: 10px;
  }
  .toolbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .toolbar button {
    width: 100%;
    padding-left: 8px;
    padding-right: 8px;
  }
  .dropzone-corner-group {
    gap: 6px;
  }
  .mode-choose-hints {
    display: none;
  }
  .mode-choose-subtip {
    position: static;
    display: block;
    margin: 6px 8px 0;
    white-space: normal;
    text-align: left;
    font-size: 11px;
    line-height: 1.25;
  }
}

/* 2026-04-06 minimal redesign experiment (new server only) */
:root {
  --ios-bg-1: #f4f7fb;
  --ios-bg-2: #eef3f9;
  --ios-bg-3: #e8eef6;
  --ios-glass: rgba(255, 255, 255, .96);
  --ios-glass-strong: #ffffff;
  --ios-stroke: #d7e2ef;
  --ios-shadow: 0 6px 18px rgba(31, 53, 86, .08);
  --ios-shadow-soft: 0 3px 10px rgba(31, 53, 86, .06);
}
body.theme-dark {
  --ios-bg-1: #1b1b1b;
  --ios-bg-2: #202020;
  --ios-bg-3: #252525;
  --ios-glass: #222222;
  --ios-glass-strong: #282828;
  --ios-stroke: #383838;
  --ios-shadow: 0 6px 16px rgba(0, 0, 0, .18);
  --ios-shadow-soft: 0 3px 8px rgba(0, 0, 0, .14);
}
body {
  font-family: "SF Pro Text", "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, var(--ios-bg-1) 0%, var(--ios-bg-2) 52%, var(--ios-bg-3) 100%);
}
body.theme-dark {
  background: linear-gradient(180deg, var(--ios-bg-1) 0%, var(--ios-bg-2) 52%, var(--ios-bg-3) 100%);
}
.topbar,
.panel,
.history-wrap,
.history,
.say-wrap,
.post-list,
.preview-list,
.result-toolbar,
.toolbar,
.status,
.progress-wrap,
.model-info,
.chain-trace,
.modal-card,
.history-wrap-full,
.friend-wrap {
  background: var(--ios-glass) !important;
  border: 1px solid var(--ios-stroke) !important;
  box-shadow: var(--ios-shadow) !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.top-menu-panel {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.panel:hover {
  box-shadow: 0 8px 22px rgba(31, 53, 86, .10) !important;
}
body.theme-dark .panel:hover {
  box-shadow: 0 10px 24px rgba(2, 6, 23, .30) !important;
}
.preview-item,
.post-item,
.shot-item,
.history-item,
.auth-modal-body input,
#latexOutput,
.post-row textarea,
.controls select,
.dropzone-mode-select {
  background: var(--ios-glass-strong) !important;
  border: 1px solid var(--ios-stroke) !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: var(--ios-shadow-soft);
}
.dropzone {
  border: 1.5px dashed #b8c7da;
  background: #f8fbff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
}
body.theme-dark .dropzone {
  border-color: #2d2d2d;
  background: #101010;
}
.btn-p {
  background: #6f8db8 !important;
  border-color: #6584b0 !important;
  box-shadow: none !important;
}
.btn-p:hover:not(:disabled) {
  background: #6483ae !important;
}
.btn-s {
  background: #f7f9fd !important;
  border-color: #d9e3f0 !important;
  color: #476182 !important;
  box-shadow: none !important;
}
body.theme-dark .btn-s {
  background: #1d1d1d !important;
  border-color: #353535 !important;
  color: #d7d7d7 !important;
}
.top-links a {
  background: #ffffff !important;
  border-color: #dde6f2 !important;
  box-shadow: none;
}
.top-link-btn {
  box-shadow: none;
}
body.theme-dark .top-links a {
  background: #1a1a1a !important;
  border-color: #363636 !important;
  box-shadow: none;
}
body.theme-dark .top-link-btn {
  box-shadow: none;
}
.top-menu-panel {
  padding: 0 !important;
  gap: 10px !important;
}
.preview-list,
.say-wrap,
.post-list,
.history-wrap-full,
.history-wrap,
.history,
.friend-wrap {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
.preview-list,
.post-list,
.history {
  padding: 0 !important;
}
.history-wrap-full,
.history-wrap,
.say-wrap,
.friend-wrap {
  padding: 0 !important;
}
.result-toolbar {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
.post-row,
.auth-actions {
  border: 0 !important;
  box-shadow: none !important;
}
.preview-math .katex-display,
.preview-math .katex-display > .katex {
  text-align: left !important;
}
.preview-copyable-math {
  position: relative;
}
.preview-math-copy-btn {
  appearance: none;
  border: 1px solid #c7d5ea;
  background: rgba(255, 255, 255, 0.94);
  color: #415a84;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  padding: 6px 10px;
  cursor: pointer;
  transition: opacity .16s ease, transform .16s ease, background .16s ease;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}
.preview-math-copy-btn:hover,
.preview-math-copy-btn:focus-visible {
  background: #fff;
  transform: translateY(-1px);
}
body.theme-dark .preview-math-copy-btn {
  border-color: rgba(108, 134, 184, 0.42);
  background: rgba(23, 29, 40, 0.92);
  color: #d9e6ff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.26);
}
body.theme-dark .preview-math-copy-btn:hover,
body.theme-dark .preview-math-copy-btn:focus-visible {
  background: rgba(31, 40, 56, 0.98);
  border-color: rgba(140, 168, 220, 0.58);
  color: #f2f7ff;
  transform: translateY(-1px);
}
.preview-math-copy-btn.is-display {
  position: absolute;
  top: 6px;
  right: 6px;
  opacity: 0;
  z-index: 2;
}
.preview-copyable-math:hover > .preview-math-copy-btn.is-display,
.preview-copyable-math:focus-within > .preview-math-copy-btn.is-display,
.preview-math-copy-btn.is-display:focus-visible {
  opacity: 1;
}
.preview-math-copy-btn.is-inline {
  margin-left: 8px;
  vertical-align: middle;
  white-space: nowrap;
}
.text-convert-panel {
  display: grid;
  gap: 10px;
  padding: 0 2px 4px;
  height: 100%;
  min-height: 0;
}
.text-convert-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: #4b6588;
}
.text-convert-head select {
  min-width: 120px;
}
.text-convert-input {
  width: 100%;
  min-height: 360px;
  resize: vertical;
  border: 1px solid #c8daf7;
  border-radius: 12px;
  padding: 14px 16px;
  font: 500 14px/1.65 "SFMono-Regular", "JetBrains Mono", "Menlo", monospace;
  background: linear-gradient(180deg, #fcfdff 0%, #f4f8ff 100%);
  color: #27405f;
  outline: none;
}
.panel-input.is-convert-only .drop-wrap {
  display: none;
}
.text-convert-panel[hidden] {
  display: none !important;
}
.panel-input:not(.is-convert-only) .text-convert-panel {
  display: none !important;
}
.panel-input.is-convert-only .toolbar {
  margin-top: 10px;
  margin-top: auto;
}
.panel-input.is-convert-only .text-convert-panel {
  padding: 0 14px 10px;
}
.panel-input.is-convert-only {
  display: flex;
  flex-direction: column;
}
.panel-input.is-convert-only .panel-head {
  flex: 0 0 auto;
}
.panel-input.is-convert-only .text-convert-panel {
  flex: 1 1 auto;
}
.panel-input.is-convert-only .toolbar {
  flex: 0 0 auto;
}
.panel-result.is-convert-only .result-wrap {
  grid-template-rows: minmax(170px, 1fr) auto;
}
.panel-result.is-convert-only #latexOutput {
  display: none;
}
.panel-result:not(.is-convert-only) #latexOutput {
  display: block;
}
.panel-result:not(.is-convert-only) [data-convert-only="1"] {
  display: none !important;
}
.text-convert-input:focus {
  border-color: #87a8dc;
  box-shadow: 0 0 0 4px rgba(88, 121, 175, 0.12);
}
.text-convert-hint {
  display: block;
  color: #6f84a3;
  line-height: 1.5;
  min-height: 24px;
}
.text-convert-hint.is-ok {
  color: #166534;
  font-weight: 700;
}
.text-convert-hint.is-error {
  color: #991b1b;
  font-weight: 700;
}
body.theme-dark .text-convert-head {
  color: #a7b7d6;
}
body.theme-dark .text-convert-input {
  background: linear-gradient(180deg, #171c24 0%, #11161e 100%);
  border-color: #2e3a4d;
  color: #eef4ff;
}
body.theme-dark .text-convert-input:focus {
  border-color: #5f7fb6;
  box-shadow: 0 0 0 4px rgba(95, 127, 182, 0.18);
}
body.theme-dark .text-convert-hint {
  color: #90a3c4;
}
body.theme-dark .text-convert-hint.is-ok {
  color: #4ade80;
}
body.theme-dark .text-convert-hint.is-error {
  color: #f87171;
}
.modal {
  background: rgba(15, 23, 42, .45);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
@media (max-width: 980px) {
  .top-menu-panel {
    background: var(--ios-glass) !important;
    border: 1px solid var(--ios-stroke) !important;
    box-shadow: var(--ios-shadow) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .topbar,
  .panel,
  .history-wrap-full,
  .history-wrap,
  .toolbar,
  .result-toolbar {
    border-radius: 12px !important;
  }
  .top-menu-panel {
    border-radius: 14px !important;
    box-shadow: var(--ios-shadow) !important;
  }
  .preview-math-copy-btn.is-display {
    opacity: 1;
  }
}
