:root {
  color-scheme: light;
  --ink: #1c1915;
  --muted: #6f675e;
  --paper: #f4f1ea;
  --card: #fffdf8;
  --chrome: #241f1b;
  --chrome-2: #3a332d;
  --line: rgba(255, 248, 236, 0.14);
  --accent: #c24b24;
  --danger: #9d2c2c;
  --shadow: 0 18px 50px rgba(36, 31, 27, 0.18);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  min-width: 720px;
}
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
button:focus-visible, .tab:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chrome {
  display: flex;
  align-items: stretch;
  gap: 8px;
  height: 46px;
  padding: 0 8px;
  background: var(--chrome);
  color: #f6f1e8;
  user-select: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 6px;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
}
.brand img { width: 22px; height: 22px; border-radius: 5px; }
.tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}
.tabs::-webkit-scrollbar { height: 0; }
.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 240px;
  height: 34px;
  margin-top: 8px;
  padding: 0 8px 0 10px;
  border: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: #e7e0d6;
}
.tab.active { background: var(--paper); color: var(--ink); }
.mark {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  flex: none;
}
.mark.pdf { background: #c24b24; }
.mark.word { background: #2a5f9e; }
.mark.sheet { background: #2f6f4e; }
.mark.slide { background: #b86a12; }
.tab-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dirty { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.tab.active .dirty { background: var(--danger); }
.close-tab, .lang, .add {
  border: 0;
  border-radius: 8px;
  background: var(--chrome-2);
  color: #f6f1e8;
}
.close-tab {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  line-height: 1;
}
.tab.active .close-tab:hover, .close-tab:hover { background: rgba(0, 0, 0, 0.08); }
.lang, .add { align-self: center; height: 30px; }
.lang { padding: 0 10px; font-size: 13px; }
.add { width: 30px; font-size: 20px; line-height: 1; }
.menu {
  position: fixed;
  z-index: 5;
  top: 44px;
  right: 8px;
  width: 200px;
  padding: 6px;
  background: var(--card);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.menu button, .home-actions button, .ask-actions button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--ink);
}
.menu button:hover, .home-actions button:hover { background: #f3ece3; }
.workspace { flex: 1; min-height: 0; position: relative; }
.home {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(900px 280px at 50% -40px, rgba(194, 75, 36, 0.08), transparent 60%),
    var(--paper);
}
.home-card { width: min(680px, 100%); }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
h1 { margin: 0; font-size: 34px; font-weight: 650; letter-spacing: -0.03em; }
.lede { margin: 12px 0 0; color: var(--muted); font-size: 16px; line-height: 1.5; max-width: 46em; }
.home-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.home-actions button { width: auto; background: white; border: 1px solid #e4dcd0; }
.home-actions .primary, .ask-actions .primary { background: var(--ink); color: #f6f1e8; border-color: var(--ink); }
.stage { position: absolute; inset: 0; background: white; }
.stage iframe, .placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  visibility: hidden;
  pointer-events: none;
  background: white;
}
.stage iframe.on, .placeholder.on { visibility: visible; pointer-events: auto; z-index: 1; }
.placeholder { display: grid; place-items: center; padding: 24px; color: var(--muted); text-align: center; }
.ask {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  background: rgba(28, 25, 21, 0.35);
}
.ask-card {
  width: min(420px, calc(100% - 32px));
  background: var(--card);
  border-radius: 14px;
  padding: 18px 18px 14px;
  box-shadow: var(--shadow);
}
.ask-card h2 { margin: 0 0 8px; font-size: 18px; }
.ask-card p { margin: 0; line-height: 1.5; white-space: pre-wrap; }
.ask-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.ask-actions button { width: auto; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  max-width: min(560px, calc(100% - 24px));
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: #f6f1e8;
  opacity: 0;
  pointer-events: none;
}
.toast.show { opacity: 1; }
