@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=Space+Grotesk:wght@500;600&display=swap");
@import url("./shell.css");
@import url("./site-overrides.css");

:root {
  --ink: #f4f4f5;
  --muted: #c8c8d0;
  --line: rgba(255, 255, 255, 0.14);
  --bg: #08080a;
  --surface: rgba(255, 255, 255, 0.025);
  --surface-alt: rgba(255, 255, 255, 0.05);
  --paper: #08080a;
  --paper-ink: #f0f0f3;
  --paper-muted: #9a9aa4;
  --nav: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: inherit; }
button, textarea, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid rgba(244, 244, 245, 0.92); outline-offset: 3px; }

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--nav);
  padding: 0 28px;
  background: rgba(8, 8, 10, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.nav.is-paper { background: rgba(8, 8, 10, 0.94); color: var(--paper-ink); border-bottom-color: var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: "Space Grotesk", system-ui, sans-serif; font-weight: 600; letter-spacing: -0.04em; font-size: 18px; }
.brand img { width: 22px; height: 22px; }
.nav ul { display: flex; gap: 2px; list-style: none; margin: 0 0 0 24px; padding: 0; flex: 1; }
.nav .brand { margin-right: 4px; }
.nav li a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; text-decoration: none; color: inherit; opacity: 0.78; }
.nav li a:hover, .nav li a[aria-current="page"] { opacity: 1; }
.dash {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}
.dash:hover { border-color: rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.08); }
.menu { display: none; min-width: 44px; min-height: 44px; border: 0; background: transparent; color: inherit; cursor: pointer; }

.word {
  color: #fafafa;
  letter-spacing: -0.04em;
}

.page { padding: var(--section-y-md) 0 var(--section-y-sm); }
.page.shell { width: var(--shell); margin-left: auto; margin-right: auto; }
.page h1 {
  margin: 0;
  max-width: 16ch;
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: clamp(44px, 6vw, 76px);
  line-height: 0.94;
  letter-spacing: -0.05em;
  font-weight: 560;
  color: #fafafa;
}
.lede { max-width: 40rem; margin: 18px 0 0; color: var(--muted); font-size: 18px; }

.sheet { background: transparent; color: var(--ink); }
.sheet h1, .sheet h2, .sheet h3 { color: #fafafa; }
.sheet .lede, .sheet .unit { color: #d4d4d8; }
.sheet .plans { border-top-color: rgba(255, 255, 255, 0.12); }
.sheet .plans article + article { border-left-color: rgba(255, 255, 255, 0.12); }
.sheet .plans li { border-top-color: rgba(255, 255, 255, 0.1); color: #f4f4f5; }
.sheet .switch button, .sheet a.use { border-color: rgba(255, 255, 255, 0.2); color: #f4f4f5; }
.sheet .switch button[aria-pressed="true"], .sheet .plans a.use { background: #f4f4f5; color: #141418; }
.sheet table.compare th, .sheet table.compare td { border-top-color: rgba(255, 255, 255, 0.1); color: #f4f4f5; }

.switch { display: flex; gap: 8px; padding: 0 0 12px; width: var(--shell); margin: 0 auto; }
.switch button, .use {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.switch button[aria-pressed="true"] { background: #141418; color: #fafafa; }

.plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: var(--shell);
  margin: 0 auto;
  padding-bottom: var(--section-y-md);
  border-top: 1px solid var(--line);
}
.plans article { padding: 28px 8px 36px 0; }
.plans article + article { padding-left: 28px; border-left: 1px solid rgba(0, 0, 0, 0.1); }
.plans h2 { margin: 0 0 8px; font-family: "Space Grotesk", system-ui, sans-serif; font-size: 22px; letter-spacing: -0.03em; }
.plans .amt { font-family: "Space Grotesk", system-ui, sans-serif; font-size: 56px; letter-spacing: -0.06em; line-height: 1; font-weight: 560; }
.plans .unit { color: var(--paper-muted); margin-top: 6px; }
.plans ul { margin: 18px 0 0; padding: 0; list-style: none; }
.plans li { padding: 8px 0; border-top: 1px solid rgba(0, 0, 0, 0.08); font-size: 15px; color: #141418; }
.plans a.use { margin-top: 18px; background: #141418; color: #fafafa; border: 0; }

table.compare { width: var(--shell); margin: 48px auto var(--section-y-md); border-collapse: collapse; }
table.compare th, table.compare td { text-align: left; padding: 14px 12px 14px 0; border-top: 1px solid rgba(0, 0, 0, 0.08); vertical-align: top; }
table.compare th { font-weight: 600; }
table.compare td:first-child, table.compare th:first-child { width: 34%; }

.tpl { border-top: 1px solid var(--line); }
.tpl.shell { width: var(--shell); margin: 0 auto; padding-bottom: var(--section-y-md); }
.tpl-row {
  display: grid;
  grid-template-columns: 220px 1fr auto;
  gap: var(--gap-lg, 2rem);
  align-items: start;
  padding: 32px 0;
  border-bottom: 1px solid var(--line);
}
.tpl-row h2 { margin: 0 0 8px; font-family: "Space Grotesk", system-ui, sans-serif; font-size: 28px; letter-spacing: -0.04em; }
.tpl-row p { margin: 0; color: var(--muted); max-width: 46rem; }
.tree { margin: 14px 0 0; font-family: "IBM Plex Sans", monospace; font-size: 14px; color: #f4f4f5; }
.tree div { padding: 3px 0; }
.tpl-row .use { border-color: rgba(255, 255, 255, 0.2); }

.app { height: 100vh; display: grid; grid-template-rows: var(--nav) 1fr; }
.app.studio-page {
  height: auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app.studio-page .workspace {
  flex: 1;
  min-height: min(72vh, 720px);
}
.app.studio-app {
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.app.studio-app .site-header.ed-nav {
  flex-shrink: 0;
}
.app.studio-app .workspace {
  flex: 1;
  min-height: 0;
}
.layout-gallery {
  margin-top: 28px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.layout-gallery-title {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.layout-card {
  width: 100%;
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 14px 4px;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: #f4f4f5;
  cursor: pointer;
  font: inherit;
  transition: background 160ms ease;
}
.layout-card:hover { background: rgba(255, 255, 255, 0.04); }
.layout-card b { font-weight: 600; font-size: 15px; }
.layout-card span { color: #9a9aa4; font-size: 13px; line-height: 1.45; }
.workspace.in-chat .rail-tpl-open { display: none; }
.app .nav { position: relative; }
.workspace {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 0;
  width: 100%;
}
.workspace.in-chat { grid-template-columns: 248px minmax(0, 1fr) 280px; }
.rail-tpl-open {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  text-align: left;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
.rail-tpl-open:hover { border-color: rgba(255, 255, 255, 0.22); background: var(--surface-alt); }
#sessions { flex: 1; min-height: 0; max-height: none; }
.tpl-dialog { width: min(560px, 100%); max-height: min(88vh, 720px); display: flex; flex-direction: column; }
.tpl-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tpl-dialog-head h2 { margin: 0; flex: 1; }
.tpl-close {
  min-width: 44px;
  min-height: 44px;
  margin: -8px -8px 0 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.tpl-close:hover { background: rgba(255, 255, 255, 0.06); }
.tpl-dialog-lede { margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.tpl-grid { overflow-y: auto; display: grid; gap: 10px; }
.tpl-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}
.tpl-card h3 { margin: 0; font-size: 16px; font-weight: 600; }
.tpl-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.tpl-import {
  justify-self: start;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.tpl-import:hover { border-color: rgba(255, 255, 255, 0.22); }
.board { display: none; }
.workspace.in-chat .board { display: block; }
.rail, .board { border-right: 1px solid var(--line); min-height: 0; }
.rail {
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  gap: 6px;
  background: transparent;
  overflow: visible;
}
.workspace > .rail { overflow: visible; z-index: 2; }
.rail-server-select .iridex-select.is-open { position: relative; z-index: 80; }
.rail-head {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 8px 8px;
}
.rail button.primary, #send, #signIn {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-alt);
  color: var(--ink);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
}
.rail button.primary:hover { border-color: rgba(255, 255, 255, 0.22); }
.rail-sub {
  margin: 10px 8px 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.rail-server-select {
  width: 100%;
  margin: 4px 0 0;
}
.rail-server-select .iridex-select-trigger {
  width: 100%;
  min-height: 44px;
  font-size: 13px;
  border-radius: 10px;
}
.rail-server-empty {
  margin-top: 8px;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}
.rail-server-empty p { margin: 0 0 8px; }
.rail-server-empty a { color: var(--ink); font-weight: 500; text-decoration: none; }
.rail-server-empty a:hover { text-decoration: underline; }
.rail-server-browse {
  width: 100%;
  min-height: 40px;
  margin-top: 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  padding: 0 8px;
  cursor: pointer;
}
.rail-server-browse:hover { color: var(--ink); }
.picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.picker-head h2 { margin: 0; }
.picker-close {
  min-width: 44px;
  min-height: 44px;
  margin: -8px -8px 0 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.picker-close:hover { background: rgba(255, 255, 255, 0.06); }
.picker-grid {
  display: grid;
  gap: 8px;
  max-height: min(52vh, 420px);
  overflow: auto;
  margin-top: 12px;
}
.picker-grid .guild {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}
.picker-grid .guild:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
}
.picker-grid .guild img,
.picker-grid .guild i {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex: none;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
  font-style: normal;
  font-weight: 600;
}
.picker-grid .guild span {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picker-empty { color: var(--muted); font-size: 14px; line-height: 1.5; }
.picker-empty a { color: var(--ink); }
.rail-server-pick,
.rail-server-label {
  width: 100%;
  min-height: 40px;
  margin: 6px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.rail-server-pick:hover,
.rail-server-label:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
}
.rail-server-label.is-empty {
  color: var(--muted);
  font-style: normal;
}
#serverLabel:empty { display: none; }
#sessions { overflow: auto; display: flex; flex-direction: column; gap: 2px; }
#sessions button { min-height: 40px; text-align: left; background: transparent; border: 0; color: inherit; cursor: pointer; border-radius: 8px; padding: 0 8px; }
#sessions button[aria-current="true"] { background: rgba(255, 255, 255, 0.06); }
.board { background: transparent; border-right: 0; border-left: 1px solid var(--line); }
.stage {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
  padding: clamp(32px, 6vh, 72px) 0 clamp(28px, 5vh, 56px);
}
.stage.has-chat { justify-content: flex-start; padding: 0; }
#thread { flex: 1; overflow: auto; padding: 36px 10vw 12px; display: none; flex-direction: column; gap: 18px; }
.stage.has-chat #thread { display: flex; }
.stage.has-chat #below { display: none; }
.dock { width: min(720px, calc(100% - 40px)); margin: auto; }
.stage.has-chat .dock { margin: 0 auto 22px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ask {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 14px 8px;
  box-shadow: none;
}
.ask textarea { width: 100%; min-height: 52px; max-height: 180px; resize: none; background: transparent; border: 0; padding: 2px 4px 8px; color: #f5f5f5; line-height: 1.5; }
.ask textarea::placeholder { color: #c8c8c8; }
.ask textarea:focus { outline: none; }
.ask:focus-within { border-color: rgba(255, 255, 255, 0.28); }
.ask-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.plus-pop { position: relative; }
.plus { width: 32px; height: 32px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.18); background: transparent; color: #f4f4f5; cursor: pointer; font-size: 20px; line-height: 1; }
.plus-menu { position: absolute; left: 0; bottom: calc(100% + 8px); min-width: 220px; margin: 0; padding: 6px; background: #2a2a2a; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.45); }
.plus-menu button { width: 100%; min-height: 40px; text-align: left; border: 0; background: transparent; color: #f4f4f5; border-radius: 8px; cursor: pointer; padding: 0 10px; }
.plus-menu button:hover { background: rgba(255,255,255,.08); }
#trial { margin: 8px 4px 0; color: #e4e4e7; font-size: 13px; }
#trial a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.ask-right { display: flex; align-items: center; gap: 8px; }
.mode-pop { position: relative; }
.mode-btn { min-height: 36px; padding: 0 8px; border: 0; background: transparent; color: #e8e8e8; cursor: pointer; font-size: 14px; }
.mode-btn::after { content: ""; display: inline-block; width: 0; height: 0; margin-left: 8px; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid #e8e8e8; vertical-align: middle; }
.mode-menu { position: absolute; right: 0; bottom: calc(100% + 8px); margin: 0; padding: 6px; list-style: none; min-width: 180px; background: #2a2a2a; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4); }
.mode-menu button { width: 100%; min-height: 40px; text-align: left; border: 0; background: transparent; color: #f4f4f5; border-radius: 8px; cursor: pointer; padding: 0 10px; }
.mode-menu button[aria-pressed="true"], .mode-menu button:hover { background: rgba(255, 255, 255, 0.08); }
#send { width: 32px; min-width: 32px; height: 32px; min-height: 32px; padding: 0; border: 0; border-radius: 999px; background: #f4f4f5; color: #141418; font-weight: 700; cursor: pointer; transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1), opacity 160ms ease; }
#send:hover:not(:disabled) { transform: scale(1.03); }
#send:active:not(:disabled) { transform: scale(0.98); }
#send:disabled { opacity: 0.45; cursor: not-allowed; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chips button, .starters button { font: inherit; cursor: pointer; }
.chips button { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.14); background: transparent; color: #f0f0f0; }
#below { margin-top: 20px; }
.starters { margin-top: 4px; display: flex; flex-direction: column; gap: 0; }
.starters button { width: 100%; display: grid; grid-template-columns: 1fr; gap: 4px; text-align: left; padding: 16px 4px; border: 0; border-top: 1px solid rgba(255, 255, 255, 0.1); background: transparent; color: #f4f4f5; transition: background 160ms ease; }
.starters button:hover { background: rgba(255, 255, 255, 0.04); }
.starters b { font-weight: 600; }
.starters span { color: #d0d0d0; font-weight: 400; }
.msg { max-width: 680px; line-height: 1.55; color: #f4f4f5; }
.msg.user { align-self: flex-end; background: #2a2a2a; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 14px; padding: 12px 14px; }
.msg.assistant { align-self: flex-start; }
.msg h3 { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.msg ul { margin: 8px 0 0; padding-left: 18px; color: #e4e4e7; }
#think { color: #d0d0d0; font-size: 13px; margin-top: 16px; }
#think summary { cursor: pointer; min-height: 32px; }
#railSign {
  margin-top: auto;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  padding: 8px;
  font-size: 13px;
}
#railSign:hover { color: var(--ink); }
.board { padding: 20px 18px; overflow: auto; }
.board h2 { margin: 0 0 12px; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: #e4e4e7; font-weight: 500; }
.board .empty-thread, .board p { color: #d4d4d8; }
.bp-line { padding: 6px 0; border-top: 1px solid var(--line); }
#err { color: #ff8d8d; min-height: 18px; font-size: 14px; }
.veil { position: fixed; inset: 0; background: rgba(18, 18, 21, 0.72); display: flex; align-items: center; justify-content: center; padding: 24px; }
.veil[hidden] { display: none; }
.dialog { width: min(460px, 100%); background: #1a1a1f; border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.dialog h2 { margin: 0 0 8px; font-family: "Space Grotesk", system-ui, sans-serif; letter-spacing: -0.03em; }
.dialog p { margin: 0 0 16px; color: var(--muted); }
.guild { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; text-align: left; background: transparent; border: 0; border-top: 1px solid var(--line); color: inherit; cursor: pointer; }
.guild img, .guild i { width: 28px; height: 28px; border-radius: 8px; background: rgba(255,255,255,0.06); display: grid; place-items: center; font-style: normal; }

@media (max-width: 900px) {
  .nav ul { display: none; position: absolute; top: var(--nav); left: 0; right: 0; flex-direction: column; background: #121215; border-bottom: 1px solid var(--line); padding: 8px; }
  .nav ul.open { display: flex; }
  .menu { display: inline-flex; align-items: center; justify-content: center; }
  .plans, .tpl-row, .workspace { grid-template-columns: 1fr; }
  .plans article + article { border-left: 0; padding-left: 0; border-top: 1px solid rgba(0,0,0,0.1); }
  .app { height: auto; }
  .workspace { min-height: calc(100vh - var(--nav)); }
  table.compare { display: block; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .word { animation: none; }
}
