:root {
  --bg: #0b0f14;
  --bg-soft: #111822;
  --panel: #141c27;
  --panel-2: #192331;
  --line: #243041;
  --line-soft: #1b2534;
  --text: #e3ebf5;
  --muted: #8b9bb0;
  --dim: #64748b;
  --accent: #d97757;
  --accent-soft: rgba(217, 119, 87, .16);
  --green: #46b17b;
  --red: #e05d5d;
  --yellow: #d9a441;
  --blue: #6aa8e8;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body { overflow: hidden; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--red); font-size: 14px; margin: 10px 2px 0; line-height: 1.45; }
.hint { color: var(--dim); font-size: 12px; line-height: 1.5; margin: 14px 2px 0; }
.code { font-family: var(--mono); font-size: 12px; color: var(--muted); word-break: break-all; }

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }

input, textarea, select {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  padding: 13px 14px;
  width: 100%;
  outline: none;
  font-size: 16px; /* prevents iOS zoom-on-focus */
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }

/* ───────────── screens ───────────── */
.screen { position: fixed; inset: 0; }
.screen.center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(217,119,87,.13), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(106,168,232,.10), transparent 60%),
    var(--bg);
  overflow-y: auto;
}

.card {
  background: rgba(20, 28, 39, .86);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 30px 24px 26px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
  backdrop-filter: blur(14px);
}

.login-card { text-align: center; }
.login-card h1 { font-size: 25px; margin: 14px 0 6px; letter-spacing: .3px; }
.login-card p.muted { margin: 0 0 22px; font-size: 14px; line-height: 1.6; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.logo { color: var(--accent); display: flex; justify-content: center; }

button.primary {
  background: var(--accent);
  border: none;
  color: #1a0d08;
  font-weight: 700;
  border-radius: 12px;
  padding: 13px 18px;
  font-size: 16px;
}
button.primary:active { transform: scale(.985); filter: brightness(.94); }
button.primary.small { padding: 9px 13px; font-size: 14px; border-radius: 10px; }

button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 18px;
}
button.ghost.danger { color: var(--red); border-color: rgba(224,93,93,.4); width: 100%; margin-top: 22px; }

.icon-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  flex: 0 0 auto;
}
.icon-btn:active { background: var(--panel-2); color: var(--text); }

/* ───────────── app layout ───────────── */
.app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

#topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: calc(6px + env(safe-area-inset-top)) 8px 6px;
  background: rgba(11, 15, 20, .88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
  z-index: 20;
}
.title-wrap { flex: 1 1 auto; min-width: 0; text-align: center; }
.title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conn {
  font-size: 11px;
  color: var(--dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 2px;
  height: 14px;
}
.conn .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  display: inline-block;
}
.conn.bad .dot { background: var(--red); }
.conn.warn .dot { background: var(--yellow); }

#messages {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 14px 24px;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

#composer {
  flex: 0 0 auto;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, rgba(11,15,20,.92));
  border-top: 1px solid var(--line-soft);
}
.compose-row { display: flex; gap: 8px; align-items: flex-end; }
#input {
  resize: none;
  max-height: 38dvh;
  line-height: 1.45;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--panel);
}
.send {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  border: none;
  background: var(--accent);
  color: #1a0d08;
  display: flex;
  align-items: center;
  justify-content: center;
}
.send:active { transform: scale(.96); }
.send:disabled { opacity: .35; }
.compose-meta { display: flex; gap: 10px; padding: 6px 4px 0; min-height: 12px; }
.badge { font-size: 11px; color: var(--dim); }
.badge + .badge { border-left: 1px solid var(--line); padding-left: 10px; }

.running {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 6px 10px;
  font-size: 13px;
  color: var(--muted);
}
.running .stop {
  margin-left: auto;
  background: rgba(224,93,93,.12);
  color: var(--red);
  border: 1px solid rgba(224,93,93,.35);
  border-radius: 9px;
  padding: 6px 12px;
  font-size: 13px;
}
.spinner {
  width: 13px; height: 13px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  flex: 0 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────────── messages ───────────── */
.msg { margin: 0 0 18px; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .bubble {
  background: var(--accent-soft);
  border: 1px solid rgba(217,119,87,.28);
  color: var(--text);
  border-radius: 16px 16px 4px 16px;
  padding: 11px 14px;
  max-width: 86%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
}
.msg.assistant .bubble {
  background: transparent;
  border-left: 2px solid rgba(217,119,87,.55);
  padding: 2px 0 2px 14px;
  line-height: 1.62;
  overflow-wrap: anywhere;
}
.msg.assistant .bubble.streaming::after {
  content: "";
  display: inline-block;
  width: 7px; height: 16px;
  background: var(--accent);
  margin-left: 3px;
  vertical-align: -2px;
  animation: blink 1s steps(2) infinite;
  border-radius: 1px;
}
@keyframes blink { 50% { opacity: 0; } }
.msg.error .bubble {
  background: rgba(224,93,93,.08);
  border: 1px solid rgba(224,93,93,.3);
  color: #f0a3a3;
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.md p { margin: 0 0 10px; }
.md p:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { margin: 18px 0 8px; line-height: 1.3; }
.md h1 { font-size: 20px; } .md h2 { font-size: 18px; } .md h3 { font-size: 16px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 4px 0; }
.md blockquote {
  margin: 10px 0; padding: 4px 12px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}
.md code.inline {
  font-family: var(--mono);
  font-size: .88em;
  background: rgba(110,130,160,.16);
  padding: 1.5px 5px;
  border-radius: 5px;
  white-space: break-spaces;
}
.md a { color: var(--blue); text-decoration: none; }
.md hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.md table { border-collapse: collapse; font-size: 14px; margin: 10px 0; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.md th { background: var(--panel); }

.codeblock {
  position: relative;
  margin: 12px 0;
  background: #0a0e13;
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
}
.codeblock .cb-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: rgba(255,255,255,.025);
  border-bottom: 1px solid var(--line-soft);
  font-size: 11px;
  color: var(--dim);
  font-family: var(--mono);
}
.codeblock pre {
  margin: 0;
  padding: 12px 13px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  color: #cfdae8;
  -webkit-overflow-scrolling: touch;
}
.copy-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 6px;
  font-size: 11px;
  padding: 2px 8px;
}

/* ───────────── tool cards ───────────── */
.tool-card {
  margin: 0 0 12px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: rgba(20,28,39,.6);
  overflow: hidden;
  font-size: 13px;
}
.tool-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  cursor: pointer;
  user-select: none;
}
.tool-head .tname {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--blue);
  background: rgba(106,168,232,.10);
  border-radius: 5px;
  padding: 2px 6px;
  flex: 0 0 auto;
}
.tool-head .tsum {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
}
.tool-head .tstate { color: var(--dim); flex: 0 0 auto; font-size: 11px; }
.tool-card.err .tool-head .tstate { color: var(--red); }
.tool-body { display: none; border-top: 1px solid var(--line-soft); }
.tool-card.open .tool-body { display: block; }
.tool-body pre {
  margin: 0;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 46dvh;
  overflow: auto;
  color: #b9c6d6;
}
.tool-body .label {
  font-size: 10px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 8px 12px 0;
}
.tool-live { opacity: .65; }

.result-line {
  margin: 4px 0 16px;
  font-size: 11px;
  color: var(--dim);
  font-family: var(--mono);
  padding-left: 16px;
}

.jump {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(108px + env(safe-area-inset-bottom));
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  padding: 7px 13px;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
  z-index: 15;
}

/* ───────────── drawers ───────────── */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
  z-index: 40;
  opacity: 1;
  transition: opacity .2s;
}
.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  width: min(86vw, 380px);
  background: var(--bg-soft);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transition: transform .24s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 0 60px rgba(0,0,0,.5);
}
.drawer.left { left: 0; transform: translateX(-102%); border-right: 1px solid var(--line); }
.drawer.right { right: 0; transform: translateX(102%); border-left: 1px solid var(--line); }
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(16px + env(safe-area-inset-top)) 16px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.drawer-head h2 { font-size: 17px; margin: 0; }
.drawer-body { padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; }
.drawer-foot { padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-soft); }

.session-list { flex: 1 1 auto; overflow-y: auto; padding: 8px; }
.session-item {
  display: block;
  position: relative;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 11px 42px 11px 12px;
  color: var(--text);
  margin-bottom: 2px;
  cursor: pointer;
  user-select: none;
}
.session-del {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--dim);
  font-size: 13px;
}
.session-del:active { background: rgba(224,93,93,.16); color: var(--red); }
.session-item:active { background: var(--panel); }
.session-item.active { background: var(--panel); border-color: var(--line); }
.session-item .s-title {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.session-item .s-meta { font-size: 11px; color: var(--dim); display: flex; gap: 8px; }
.session-item .s-meta .running-dot { color: var(--green); }
.empty { color: var(--dim); text-align: center; font-size: 13px; padding: 40px 10px; line-height: 1.7; }

/* ───────────── settings ───────────── */
.field { display: block; margin-bottom: 22px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.inline-form { display: flex; gap: 8px; margin-top: 10px; }
.inline-form input { flex: 1 1 auto; min-width: 0; font-size: 14px; padding: 10px 12px; }
.inline-form button { flex: 0 0 auto; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 0 14px; }
.stack-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.stack-form input, .stack-form select { font-size: 14px; padding: 10px 12px; }
.stack-form button { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 11px 14px; }
.adv-box { text-align: left; margin: 2px 0 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.adv-box summary { cursor: pointer; padding: 12px 14px; font-size: 14px; color: var(--muted); }
.adv-box[open] summary { border-bottom: 1px solid var(--line); }
.adv-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; }
.adv-body input, .adv-body select { font-size: 14px; padding: 10px 12px; }
.login-card input, .login-card select { text-align: left; }
.small-hint { margin: 4px 0 0; }

.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 13px;
}
.switch-row > span { flex: 1 1 auto; }
.switch-row strong { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.switch-row small { display: block; color: var(--dim); font-size: 12px; line-height: 1.45; }
.switch {
  appearance: none;
  width: 48px; height: 28px;
  border-radius: 999px;
  background: var(--line);
  position: relative;
  flex: 0 0 auto;
  margin: 1px 0 0;
  padding: 0;
  transition: background .18s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #cfd8e4;
  transition: transform .18s;
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); background: #fff; }

/* ───────────── permission sheet ───────────── */
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 60px rgba(0,0,0,.55);
  animation: sheet-up .22s cubic-bezier(.2,.8,.2,1);
  max-height: 82dvh;
  display: flex;
  flex-direction: column;
}
@keyframes sheet-up { from { transform: translateY(30px); opacity: .4; } }
.sheet-grab { width: 38px; height: 4px; border-radius: 999px; background: var(--line); margin: 0 auto 14px; }
.sheet h3 { font-size: 16px; margin: 0 0 12px; }
.perm-tool {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--blue);
  margin-bottom: 8px;
  word-break: break-all;
}
.perm-body {
  background: #0a0e13;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  max-height: 36dvh;
  margin: 0 0 14px;
  color: #c7d3e2;
}
.perm-actions { display: flex; gap: 10px; }
.perm-actions button { flex: 1 1 0; }
.link-btn {
  background: none;
  border: none;
  color: var(--dim);
  font-size: 13px;
  padding: 13px 0 2px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ───────────── toast ───────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(100px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: #243041;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 80;
  box-shadow: 0 8px 30px rgba(0,0,0,.45);
  max-width: 86vw;
  text-align: center;
  animation: toast-in .16s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 6px); } }

@media (min-width: 760px) {
  #messages { padding-left: max(14px, calc(50vw - 420px)); padding-right: max(14px, calc(50vw - 420px)); }
  #composer { padding-left: max(12px, calc(50vw - 420px)); padding-right: max(12px, calc(50vw - 420px)); }
  .title-wrap { text-align: left; }
  .conn { justify-content: flex-start; }
}

/* ───────────── model sheet ───────────── */
.model-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.model-head .link-btn { padding: 0; }
#modelSource { margin: -6px 0 8px; }
.model-list { overflow-y: auto; max-height: 48dvh; margin: 6px 0 10px; -webkit-overflow-scrolling: touch; }
.model-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.model-row.current { border-color: var(--accent); }
.model-row .m-main { flex: 1 1 auto; min-width: 0; }
.model-row .m-name { font-size: 14px; }
.model-row .m-id { color: var(--dim); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.model-row .m-check { color: var(--accent); font-size: 16px; flex: 0 0 auto; }
.model-row .m-tag { color: var(--dim); font-size: 10px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; flex: 0 0 auto; }
#modelBadge, #effortBadge { cursor: pointer; }
#modelBadge::after, #effortBadge::after { content: ' ▾'; color: var(--dim); }

/* ───────────── reasoning effort ───────────── */
.effort-block { margin: 0 0 14px; }
.effort-title { font-size: 12px; color: var(--dim); margin: 0 0 8px; }
.effort-title.model-title { margin-top: 2px; }
.effort-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.effort-chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 10px; text-align: left; color: var(--text); min-width: 0;
}
.effort-chip.current { border-color: var(--accent); background: var(--accent-soft); }
.effort-chip .e-label { font-size: 13px; }
.effort-chip .e-hint {
  font-size: 10px; color: var(--dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.effort-chip.current .e-hint { color: var(--muted); }

/* ───────────── workspace ───────────── */
.workspace-screen { position: fixed; inset: 0; z-index: 55; background: var(--bg); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.ws-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.ws-title-wrap { flex: 1 1 auto; min-width: 0; }
.ws-title { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-sub { color: var(--dim); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.ws-crumb { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 8px 16px 4px; font-size: 12px; color: var(--dim); }
.ws-crumb button { background: none; border: none; color: var(--accent); font-size: 12px; padding: 2px 0; }
.ws-banner { margin: 8px 14px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--dim); font-size: 12px; line-height: 1.5; }
.ws-list { flex: 1 1 auto; overflow-y: auto; padding: 6px 12px calc(24px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
.ws-row { display: flex; align-items: center; gap: 12px; padding: 11px 8px; border-radius: 12px; }
.ws-row:active { background: var(--panel); }
.ws-icon { width: 32px; height: 32px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; font-size: 15px; }
.ws-name { flex: 1 1 auto; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-meta { flex: 0 0 auto; color: var(--dim); font-size: 11px; }
.ws-viewer { position: fixed; inset: 0; z-index: 56; background: var(--bg); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.ws-view-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.ws-view-title { flex: 1 1 auto; min-width: 0; }
.ws-view-title > div { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-view-title small { color: var(--dim); font-size: 11px; }
.ws-file-body { flex: 1 1 auto; overflow: auto; margin: 0; padding: 12px 14px calc(30px + env(safe-area-inset-bottom)); font-family: var(--mono); font-size: 12px; line-height: 1.55; white-space: pre; tab-size: 2; -webkit-overflow-scrolling: touch; }
