/* Design tokens lifted from the Claude desktop UI. */
:root {
  /* Mono, the default theme. js/themes.js overrides these per theme. */
  --bg-deep: hsl(0 0% 6.5%);
  --bg-sidebar: hsl(0 0% 11.5%);
  --bg-main: hsl(0 0% 14.5%);
  --bg-raised: hsl(0 0% 18.5%);
  --bg-hover-solid: hsl(0 0% 21%);
  --bg-hover-strong: hsl(0 0% 24%);
  --border-soft: hsl(0 0% 17.5%);
  --border: hsl(0 0% 22.5%);
  --border-focus: hsl(0 0% 29%);
  --text: hsl(0 0% 95%);
  --text-muted: hsl(0 0% 66%);
  --text-faint: hsl(0 0% 50%);
  --accent: hsl(0 0% 86%);
  --accent-soft: hsl(0 0% 86% / 0.16);
  --on-accent: hsl(0 22% 11%);
  /* Favourite marker. Deliberately constant across themes. */
  --star: hsl(45 92% 58%);
  --backdrop: hsl(0 0% 4% / 0.82);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --sidebar-width: 300px;
  --content-width: 720px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --font-serif: "Georgia", "Iowan Old Style", serif;
  --font-mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

/* Selection and focus were falling back to the browser's blue. */
::selection {
  background: var(--accent-soft);
  color: var(--text);
}

input,
textarea,
button {
  font-family: inherit;
}

:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 1px;
}

/* Fields that draw their own focus state do not need a ring as well. */
input:focus,
textarea:focus { outline: none; }

/* Every icon is the same stroked vector at the same optical size. */
.icon,
[data-icon] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  color: inherit;
}

.icon svg,
[data-icon] svg { display: block; }

/* An author `display` must never beat the hidden attribute. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg-main);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  height: 100vh;
  overflow: hidden;
}

.main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* Without min-height:0 a tall composer pushes the whole grid past the viewport. */
  min-height: 0;
  overflow: hidden;
  background: var(--bg-main);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  transition: background 120ms ease, color 120ms ease;
}

.icon-btn:hover {
  background: var(--bg-hover-solid);
  color: var(--text);
}

.ghost-btn {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  transition: background 120ms ease, color 120ms ease;
}

.ghost-btn:hover {
  background: var(--bg-hover-solid);
  color: var(--text);
}

/* Welcome screen ------------------------------------------------------- */
.welcome {
  position: relative;
  z-index: 1;
  flex: 1;
  /* The header is gone, so the greeting owns the whole upper area. */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 24px;
  min-height: 0;
}

.stage-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.welcome__title {
  position: relative;
  margin: 0;
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.welcome__subtitle {
  position: relative;
  margin: 0;
  color: var(--text-faint);
  font-size: 14px;
}

/* Engine connect screen (hosted UI, engine not reachable) ---------------- */

.connect {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg-deep);
}

.connect__panel {
  max-width: 520px;
  padding: 32px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-main);
}

.connect__title {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 500;
}

.connect__lead { margin: 0 0 16px; color: var(--text-muted); line-height: 1.55; }

.connect__steps {
  margin: 0 0 18px;
  padding-left: 20px;
  color: var(--text-muted);
  line-height: 1.7;
}

.connect__link { color: var(--accent); text-decoration: none; }
.connect__link:hover { text-decoration: underline; }

.connect__row { display: flex; gap: 8px; }

.connect__address {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
}

.connect__retry {
  flex: none;
  padding: 9px 20px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14px;
}

.connect__retry:disabled { opacity: 0.6; }

.connect__hint { margin: 14px 0 0; color: var(--text-faint); font-size: 12px; line-height: 1.5; }
