.ai, .ai * { margin: 0; padding: 0; box-sizing: border-box; }

.ai, .ai * { scrollbar-width: thin; scrollbar-color: rgba(129, 140, 248, 0.35) transparent; }
.ai *::-webkit-scrollbar { width: 10px; height: 10px; }
.ai *::-webkit-scrollbar-track { background: transparent; }
.ai *::-webkit-scrollbar-thumb {
  background: rgba(129, 140, 248, 0.28);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.ai *::-webkit-scrollbar-thumb:hover { background: rgba(129, 140, 248, 0.5); background-clip: padding-box; }
.ai *::-webkit-scrollbar-corner { background: transparent; }

:root {
  --bg: #0b0d17;
  --fg: #e2e4f0;
  --muted: #8b8fa8;
  --accent: #818cf8;
  --accent-soft: rgba(129, 140, 248, 0.12);
  --border: rgba(129, 140, 248, 0.14);
  --hover: rgba(129, 140, 248, 0.1);
  --composer-bg: rgba(129, 140, 248, 0.05);
  --composer-ring: rgba(129, 140, 248, 0.12);
  --composer-focus-ring: rgba(129, 140, 248, 0.4);
  --user-bg: rgba(129, 140, 248, 0.14);
  --tooltip-bg: #111322;
  --rail-bg: rgba(129, 140, 248, 0.04);
  --glow: 0 0 24px rgba(129, 140, 248, 0.08);
  --bg-image: url("/images/themes/ghostly.png");
  --bg-blur: 2px;
  --bg-opacity: 0.85;
  --bg-overlay: rgba(5, 6, 15, 0.45);
}

html, body { height: 100%; }

.ai {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
  contain: paint;
}
.ai, .ai * { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; }
.ai::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  filter: blur(var(--bg-blur));
  opacity: var(--bg-opacity);
  pointer-events: none;
}
.ai::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--bg-overlay);
  pointer-events: none;
}
.shell { display: flex; height: 100%; width: 100%; overflow: hidden; position: relative; z-index: 1; }

.side {
  display: none;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--rail-bg);
  overflow: hidden;
}
@media (min-width: 768px) { .side { display: flex; } }
.side.collapsed { width: 48px; }
.side.expanded { width: 260px; }

.sidehead {
  display: flex;
  align-items: center;
  height: 48px;
  flex-shrink: 0;
  padding: 0 8px;
  gap: 4px;
}
.side.collapsed .sidehead { justify-content: flex-start; padding: 0 8px; }
.sidetoggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: var(--fg);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}
.sidetoggle:hover { background: var(--hover); }
.sidetitle {
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--fg);
  margin-left: 8px;
  overflow: hidden;
  opacity: 1;
}
.side.collapsed .sidetitle { opacity: 0; }

.railplus {
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  height: 0;
  padding: 0;
  opacity: 0;
  overflow: hidden;
}
.side.collapsed .railplus { height: 40px; padding: 0 0 8px; opacity: 1; }
.colnew {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: var(--fg);
  border-radius: 8px;
  cursor: pointer;
}
.colnew:hover { background: var(--hover); }

.railbody {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 1;
  white-space: nowrap;
}
.side.collapsed .railbody { opacity: 0; pointer-events: none; padding: 12px 8px; }
.sidesep {
  flex-shrink: 0;
  margin: 0 0 16px;
  height: 1px;
  background: var(--border);
}

.newbtn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--fg);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  flex-shrink: 0;
}
.newbtn:hover { background: var(--hover); }

.threadsearch {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--rail-bg);
  flex-shrink: 0;
}
.threadsearch input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  font-size: 14px;
  color: var(--fg);
}
.threadsearch input::placeholder { color: var(--muted); }

.threadlist { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.threaditem {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 6px 0 0;
  border-radius: 8px;
  color: var(--fg);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
}
.threaditem:hover { background: var(--hover); }
.threaditem:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--hover);
}
.threaditem.active { background: var(--accent-soft); color: var(--accent); }
.threaditem .tlabel {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 4px 0 10px;
  border: none;
  background: none;
  outline: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.threaditem .tactions {
  display: none;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.threaditem:hover .tactions,
.threaditem:focus-within .tactions {
  display: flex;
}
@media (hover: none) {
  .threaditem .tactions { display: flex; }
}
.threaditem .tdel,
.threaditem .tedit {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.threaditem .tedit:hover { background: var(--hover); color: var(--accent); }
.threaditem .tdel:hover { background: var(--hover); color: #f87171; }
.threadempty { padding: 10px; font-size: 13px; color: var(--muted); text-align: center; }

.signbtn {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin: 0 8px 14px;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--fg);
  font-size: 14px;
  cursor: pointer;
  overflow: hidden;
}
.signbtn svg, .signbtn > span:first-child { flex-shrink: 0; }
.signbtn > span:last-child {
  max-width: 120px;
  overflow: hidden;
  white-space: nowrap;
  opacity: 1;
}
.side.collapsed .signbtn { margin: 0 0 14px; padding: 8px 16px; }
.side.collapsed .signbtn > span:last-child { max-width: 0; opacity: 0; }
.signbtn:hover { background: var(--hover); color: var(--accent); }
.sidefoot {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 8px 8px;
  max-height: 48px;
  overflow: hidden;
  opacity: 1;
}
.side.collapsed .sidefoot { opacity: 0; max-height: 0; margin: 0; pointer-events: none; }
.sideusage {
  flex: 1;
  min-width: 0;
  padding: 0 10px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sharetoggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: none;
  background: none;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
}
.sharetoggle:hover { background: var(--hover); color: var(--fg); }
.sharetoggle.on { color: var(--accent); background: var(--accent-soft); }
.sharetoggle[hidden] { display: none; }
.railshare {
  display: none;
  justify-content: center;
  flex-shrink: 0;
  padding: 0 0 8px;
}
.side.collapsed .railshare { display: flex; }
.railshare .sharetoggle { width: 40px; height: 40px; }

.mobilebtn {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--tooltip-bg);
  color: var(--fg);
  cursor: pointer;
}
@media (min-width: 768px) { .mobilebtn { display: none; } }
@media (max-width: 767px) {
  .threadroot { padding: 0 8px; }
}
.mobilesheet {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  flex-direction: column;
  background: var(--bg);
  padding: 0;
}
.mobilesheet.open { display: flex; }
.sheethead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 8px 0 16px;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sheetclose {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--fg);
  cursor: pointer;
}
.sheetclose:hover { background: var(--hover); }
.sheetbody { flex: 1; overflow-y: auto; padding: 12px; }
.sheetfoot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sheetusage {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheetfoot .signbtn { margin: 0; flex-shrink: 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.threadroot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 100%;
  padding: 0 16px;
}

.emptystate {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  max-width: 768px;
  margin: 0 auto;
}
.mizumark { align-self: center; }
.emptystate #emptycomp { align-self: stretch; }
.mizumark {
  margin-bottom: 24px;
  font-size: 42px;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 32px rgba(129, 140, 248, 0.35);
  user-select: none;
}

.tviewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-top: 64px;
}

.threadmsgs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  contain: layout style;
}

.cgroup {
  margin: 0 auto 12px;
  width: 100%;
  max-width: 768px;
}
.cbox {
  overflow: visible;
  border-radius: 20px;
  background: var(--composer-bg);
  box-shadow: inset 0 0 0 1px var(--composer-ring);
}
.cbox:focus-within { box-shadow: inset 0 0 0 1px var(--composer-focus-ring); }

.cbox.locked .crow { display: none; }
.signinbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 10px 16px;
}
.cbox.locked .signinbar { display: flex; }
.signinbar span { font-size: 14px; color: var(--muted); }
.signinbar button {
  flex-shrink: 0;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.signinbar button:hover { background: #6f7bf0; }

.cattach {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 0;
}
.cattach:empty { display: none; }
.attachchip .attachname {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
  padding: 0 6px;
}

.crow {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 8px;
}

.addattach {
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  border-radius: 50%;
  color: var(--fg);
  cursor: pointer;
  flex-shrink: 0;
}
.addattach:hover { background: var(--hover); }

.cinput {
  flex: 1;
  min-width: 0;
  margin: 8px 0;
  padding: 0 4px;
  max-height: 200px;
  border: none;
  background: none;
  outline: none;
  resize: none;
  overflow-y: auto;
  font-size: 16px;
  line-height: 24px;
  color: var(--fg);
  font-family: inherit;
}
.cinput::placeholder { color: var(--muted); }

.sendstack {
  position: relative;
  margin-bottom: 2px;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--glow);
}
.sendstack:hover { background: #6f7bf0; }
.sendstack button {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
}
.sendstack.hidden { width: 0; margin-left: 0; margin-right: 0; opacity: 0; pointer-events: none; }
.sendstack .hidden { opacity: 0; pointer-events: none; }

.modelbtn {
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border: none;
  background: none;
  border-radius: 999px;
  color: var(--fg);
  cursor: pointer;
  flex-shrink: 0;
}
.modelbtn:hover { background: var(--hover); }
.modelbtn > .arcticons--deepseek,
.modelbtn > .hugeicons--chat-gpt { width: 24px; height: 24px; }
.modellabel {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  max-width: 160px;
}
.modelname { font-size: 14px; font-weight: 600; white-space: nowrap; }
.modelbtn.empty .modellabel { max-width: 160px; opacity: 1; }
.modelbtn.filled .modellabel { max-width: 0; opacity: 0; }

.modeldrop {
  position: absolute;
  z-index: 50;
  right: 0;
  bottom: calc(100% + 4px);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--tooltip-bg);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  padding: 6px;
  display: none;
}
.modeldrop.open { display: block; }
.emptystate .modeldrop { bottom: auto; top: calc(100% + 4px); }
.modelitem {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 8px;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  color: var(--fg);
}
.modelitem:hover { background: var(--hover); }
.micon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  color: var(--fg);
  flex-shrink: 0;
}
.micon .arcticons--deepseek,
.micon .hugeicons--chat-gpt { width: 20px; height: 20px; }
.mtext { display: flex; flex-direction: column; flex: 1; }
.mname { font-size: 14px; color: var(--fg); }
.mdesc { font-size: 12px; color: var(--muted); }
.modelsep { height: 1px; background: var(--border); margin: 6px 4px; }
.modelsub {
  width: 100%;
  padding: 8px;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  color: var(--muted);
  font-size: 14px;
}
.modelsub:hover { background: var(--hover); }
.modelwrap { position: relative; flex-shrink: 0; margin-left: auto; }

@media (max-width: 600px) {
  .cgroup .crow { flex-wrap: wrap; }
  .cgroup .cinput { order: 1; flex-basis: 100%; margin-bottom: 0; }
  .cgroup .addattach { order: 2; }
  .cgroup .modelwrap { order: 3; margin-left: 0; }
  .cgroup .sendstack { order: 4; margin-left: auto; }
  .cgroup .modelbtn { padding: 0 4px; }
  .cgroup .modellabel { max-width: 120px; }
}

.message {
  position: relative;
  margin: 0 auto 8px;
  width: 100%;
  max-width: 768px;
  display: flex;
  flex-direction: column;
  padding-bottom: 2px;
  contain: layout style;
}

.msguser { display: flex; flex-direction: column; align-items: flex-end; }
.userbubble {
  position: relative;
  max-width: 90%;
  border-radius: 16px;
  border-bottom-right-radius: 4px;
  border: 1px solid var(--border);
  background: var(--user-bg);
  padding: 12px 16px;
  color: var(--fg);
}
.userbubble p { margin: 0; font-size: 15px; line-height: 1.5; white-space: pre-wrap; }
.userbubble .ubimgs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.userbubble .ubimgs:last-child { margin-bottom: 0; }
.userbubble .ubimg {
  width: 180px;
  height: 135px;
  max-width: min(240px, 100%);
  max-height: 240px;
  background: var(--composer-bg);
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: pointer;
  object-fit: cover;
  display: block;
}
.ubgone { font-size: 13px; color: var(--muted); }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 14, 0.85);
  backdrop-filter: blur(6px);
  cursor: zoom-out;
}
.lightbox.on { display: flex; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }

.confirm {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 14, 0.7);
  backdrop-filter: blur(6px);
}
.confirm.on { display: flex; }
.confirmbox {
  width: 320px;
  max-width: calc(100vw - 40px);
  background: var(--tooltip-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.confirmtitle { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.confirmtext { font-size: 13px; color: var(--muted); line-height: 1.5; margin-bottom: 16px; word-break: break-word; }
.confirminput {
  display: none;
  width: 100%;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--composer-bg);
  color: var(--fg);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.confirminput:focus { border-color: var(--composer-focus-ring); }
.confirmrow { display: flex; gap: 8px; justify-content: flex-end; }
.confirmbtn {
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.confirmbtn:hover { background: var(--hover); }
.confirmbtn.danger {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
}
.confirmbtn.danger:hover { background: rgba(248, 113, 113, 0.22); }

.msga { display: flex; flex-direction: column; align-items: flex-start; }
.aiprose { width: 100%; max-width: none; }
.aiprose p { margin: 0; font-size: 15px; line-height: 1.6; }
.aiprose p + p { margin-top: 8px; }
.aiprose ul, .aiprose ol { margin: 8px 0; padding-left: 24px; }
.aiprose li { margin: 2px 0; font-size: 15px; line-height: 1.6; }
.aiprose h1, .aiprose h2, .aiprose h3, .aiprose h4, .aiprose h5, .aiprose h6 {
  margin: 14px 0 6px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}
.aiprose h1:first-child, .aiprose h2:first-child, .aiprose h3:first-child { margin-top: 0; }
.aiprose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
}
.aiprose pre {
  margin: 10px 0;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
}
.aiprose pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
}
.aiprose strong { font-weight: 600; }
.aiprose a { color: var(--accent); text-decoration: underline; }
.aiprose .katex { font-size: 1.15em; }
.aiprose .katex-display { margin: 10px 0; padding: 2px 0; overflow-x: auto; overflow-y: hidden; }
.aiprose .tablewrap { margin: 10px 0; overflow-x: auto; }
.aiprose table { border-collapse: collapse; font-size: 14px; }
.aiprose th, .aiprose td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.aiprose th { background: var(--accent-soft); font-weight: 600; }
.aipcontinue {
  margin-top: 8px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.aipcontinue:hover { background: var(--hover); }
.aiprose blockquote {
  margin: 8px 0;
  padding: 2px 0 2px 12px;
  border-left: 2px solid var(--border);
  color: var(--muted);
}
.aiprose blockquote p { margin: 2px 0; }
.aimark { margin: 0 0 0 4px; font-size: 12px; color: var(--muted); }
.aimark:empty { display: none; }
.typing { display: flex; gap: 4px; padding: 4px 0; }
.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

.actionbar {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 0;
  margin-top: 0;
  overflow: hidden;
  opacity: 0;
}
.message:hover .actionbar,
.actionbar:has(.timing.open),
.actionbar:has(.aimark:not(:empty)) { height: 32px; margin-top: 4px; opacity: 1; overflow: visible; }
@media (hover: none) {
  .message .actionbar { height: 32px; margin-top: 4px; opacity: 1; }
}
.actionbar.userbar { justify-content: flex-end; }
.actionbar.aibar { justify-content: flex-start; }
.actionbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
}
.actionbtn:hover { background: var(--hover); color: var(--fg); }
.actionbtn.on { color: var(--fg); }

.timing {
  position: relative;
  margin-left: 4px;
}
.timingbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border: none;
  background: none;
  border-radius: 8px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.timingbtn:hover { background: var(--hover); color: var(--fg); }
.timingtip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 10;
  width: max-content;
  max-width: calc(100vw - 48px);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--tooltip-bg);
  padding: 8px 12px;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
}
.timingtip::before {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 0;
  height: 8px;
  width: 100%;
}
.timing:hover .timingtip,
.timing.open .timingtip { opacity: 1; pointer-events: auto; }
.timinggrid { display: grid; min-width: 140px; gap: 6px; font-size: 12px; }
.timingrow { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.timingrow span:first-child { color: var(--muted); }
.timingrow span:last-child { font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; color: var(--fg); }

.footer {
  margin: 0 auto;
  width: 100%;
  max-width: 768px;
  padding-bottom: 8px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.attachchip {
  position: relative;
  display: flex;
  align-items: center;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--user-bg);
  padding: 2px 28px 2px 2px;
}
.attachchip .attachthumb { height: 42px; width: 42px; border-radius: 9px; object-fit: cover; display: block; }
.thumbfallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  width: 42px;
  border-radius: 9px;
  background: var(--border);
  color: var(--muted);
}
.attachremove {
  position: absolute;
  top: 50%;
  right: 3px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.attachremove:hover { background: var(--hover); color: #f87171; }

.piproot { display: flex; flex-direction: column; height: 100vh; background: var(--bg); color: var(--fg); position: relative; z-index: 1; }
.pipbody { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pipead { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px; }
.pipead .aiprose { margin: 0 0 14px; font-size: 13px; line-height: 1.55; color: var(--fg); }
.pipead .aiprose:last-child { margin-bottom: 0; }
.pipead .aiprose p, .pipead .aiprose li { font-size: 13px; line-height: 1.55; }
.pipask {
  margin: 0 0 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
}
.pipask:empty { display: none; }
.pipbar { border-radius: 14px; margin: 8px 10px 10px; }
.pipbar .crow { align-items: center; padding: 4px 4px 4px 12px; }
.pipbar .cinput { margin: 0; padding: 6px 0; max-height: 92px; font-size: 14px; line-height: 20px; }
.pipsend {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--fg);
  box-shadow: var(--glow);
  cursor: pointer;
}
.pipsend:disabled {
  background: var(--border);
  color: var(--muted);
  box-shadow: none;
  cursor: default;
}
.pipchoose {
  display: block;
  margin: 8px 10px 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: transparent;
  color: var(--fg);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.pipchoose:hover { background: var(--hover); }
.pipnote { padding: 0 12px 10px; font-size: 11px; color: var(--muted); }
.pipnote:empty { display: none; }
#fileinput { display: none; }
#sharevideo { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
#vport, #composermount, #footer { display: none; }
.sheetbody .newbtn { width: 100%; }
.sheetbody .threadsearch, .sheetbody .threadlist { margin-top: 8px; }
