:root {
  color-scheme: light;
  --ink: #111;
  --muted: #707070;
  --line: #dedede;
  --paper: #fff;
  --panel: rgba(255, 255, 255, 0.94);
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.13);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

.app-shell {
  position: fixed;
  inset: 0;
  background: var(--paper);
}

#world {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  background: var(--paper);
  cursor: crosshair;
  touch-action: none;
}

#town3d {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  opacity: 0;
  pointer-events: none;
  background: #fff;
  image-rendering: pixelated;
  touch-action: none;
}

body[data-view="3d"] #world {
  opacity: 0;
  pointer-events: none;
}

body[data-view="3d"] #town3d {
  opacity: 1;
  pointer-events: auto;
}

.chat {
  position: absolute;
  left: 28px;
  bottom: 28px;
  width: min(560px, calc(100vw - 56px));
  max-height: min(42vh, 340px);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(14px);
}

.chat-log {
  min-height: 92px;
  max-height: 250px;
  overflow: auto;
  padding: 12px 14px 8px;
  scrollbar-width: thin;
}

.message {
  display: grid;
  gap: 3px;
  margin: 0 0 10px;
}

.message:last-child {
  margin-bottom: 0;
}

.message strong {
  font-size: 11px;
  font-weight: 650;
  line-height: 1.15;
  color: var(--muted);
  text-transform: uppercase;
}

.message span {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.35;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.composer input {
  min-width: 0;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  outline: none;
  background: #fff;
  color: var(--ink);
}

.composer input:focus {
  border-color: #111;
  box-shadow: 0 0 0 2px rgba(17, 17, 17, 0.1);
}

.composer button {
  height: 42px;
  min-width: 74px;
  border: 1px solid #111;
  border-radius: 7px;
  background: #111;
  color: #fff;
  cursor: pointer;
}

.composer button.secondary {
  border-color: var(--line);
  background: #fff;
  color: #111;
}

.composer button:disabled {
  cursor: not-allowed;
  color: #999;
  background: #f7f7f7;
}

body.is-thinking .composer button[type="submit"] {
  color: #111;
  background: #fff;
}

.utility-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.composer button:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}
