:root {
  color-scheme: dark;
  --ink: #f3f0e4;
  --muted: #aebdb2;
  --faint: #789084;
  --forest-950: #07140f;
  --forest-900: #0a1c14;
  --forest-850: #10271d;
  --forest-800: #143426;
  --forest-700: #20513a;
  --leaf: #6fd28f;
  --leaf-soft: #a9e7b9;
  --sun: #e9bd69;
  --danger: #f5a27f;
  --line: rgba(196, 226, 204, 0.13);
  --panel: rgba(13, 36, 26, 0.86);
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.36);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 77% 3%, rgba(58, 121, 77, 0.18), transparent 30rem),
    linear-gradient(145deg, var(--forest-950), #0a1812 48%, #09110e);
  color: var(--ink);
  overflow-x: hidden;
}

button,
textarea,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(111, 210, 143, 0.4);
  outline-offset: 2px;
}

.atmosphere {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(2px);
  opacity: 0.5;
  pointer-events: none;
}

.atmosphere-one {
  width: 28rem;
  height: 28rem;
  top: -15rem;
  right: -6rem;
  border: 1px solid rgba(111, 210, 143, 0.18);
  box-shadow: 0 0 0 5rem rgba(111, 210, 143, 0.025), 0 0 0 10rem rgba(111, 210, 143, 0.02);
}

.atmosphere-two {
  width: 22rem;
  height: 22rem;
  bottom: -15rem;
  left: -10rem;
  background: rgba(233, 189, 105, 0.055);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.eyebrow,
.side-label {
  margin: 0;
  color: var(--leaf);
  font-size: 0.7rem;
  font-weight: 760;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.access-layer {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.access-layer[hidden] {
  display: none;
}

.access-card {
  width: min(32rem, 100%);
  padding: clamp(1.7rem, 5vw, 3rem);
  border: 1px solid var(--line);
  border-radius: 2rem;
  background: linear-gradient(145deg, rgba(20, 52, 38, 0.96), rgba(8, 24, 17, 0.94));
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.access-mark {
  width: 4.5rem;
  height: 4.5rem;
  margin-bottom: 1.6rem;
}

.access-card h1 {
  margin: 0.55rem 0 0.75rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.3rem, 8vw, 3.8rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.access-copy,
.access-footnote {
  color: var(--muted);
  line-height: 1.65;
}

.access-form {
  margin-top: 1.7rem;
}

.access-form label {
  display: block;
  margin-bottom: 0.55rem;
  color: var(--leaf-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.access-row {
  display: flex;
  gap: 0.65rem;
}

.access-row input {
  min-width: 0;
  flex: 1;
  padding: 0.9rem 1rem;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: rgba(3, 14, 9, 0.52);
}

.access-row button,
.send-button {
  border: 0;
  background: var(--leaf);
  color: #06130c;
  font-weight: 800;
  cursor: pointer;
}

.access-row button {
  padding: 0.9rem 1.2rem;
  border-radius: 0.85rem;
}

.form-error {
  min-height: 1.3rem;
  margin: 0.55rem 0 0;
  color: var(--danger);
  font-size: 0.83rem;
}

.access-footnote {
  margin: 1.5rem 0 0;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
}

.app-shell {
  width: min(100%, 100rem);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 20rem minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.7rem;
  border-right: 1px solid var(--line);
  background: rgba(5, 20, 13, 0.56);
  backdrop-filter: blur(24px);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand-mark {
  width: 2.85rem;
  height: 2.85rem;
}

.brand-name,
.brand-subtitle,
.status-label,
.status-detail,
.sidebar-note p {
  margin: 0;
}

.brand-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.brand-subtitle,
.status-detail {
  margin-top: 0.12rem;
  color: var(--faint);
  font-size: 0.72rem;
}

.status-card {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 1.8rem 0 2.2rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: rgba(27, 62, 44, 0.34);
}

.status-dot {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: 0 0 0 0.25rem rgba(233, 189, 105, 0.12);
}

.status-dot.ready {
  background: var(--leaf);
  box-shadow: 0 0 0 0.25rem rgba(111, 210, 143, 0.12);
}

.status-label {
  font-size: 0.8rem;
  font-weight: 740;
}

.side-section {
  min-height: 0;
}

.prompt-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.prompt-card {
  width: 100%;
  padding: 0.9rem;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.prompt-card:hover {
  transform: translateX(0.18rem);
  border-color: var(--line);
  background: rgba(111, 210, 143, 0.055);
}

.prompt-card span,
.prompt-card strong {
  display: block;
}

.prompt-card span {
  margin-bottom: 0.22rem;
  color: var(--faint);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.prompt-card strong {
  color: #dfe9e1;
  font-size: 0.83rem;
  line-height: 1.35;
}

.sidebar-note {
  display: flex;
  gap: 0.65rem;
  margin-top: auto;
  padding: 1rem 0 1.1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.5;
}

.note-icon {
  flex: 0 0 auto;
  width: 1.3rem;
  height: 1.3rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(245, 162, 127, 0.14);
  color: var(--danger);
  font-size: 0.75rem;
  font-weight: 900;
}

.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--faint);
  font-size: 0.75rem;
  text-align: left;
  cursor: pointer;
}

.text-button:hover {
  color: var(--ink);
}

.chat-panel {
  min-width: 0;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto minmax(20rem, 1fr) auto;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: flex-start;
  padding: 2.4rem clamp(1.2rem, 5vw, 4rem) 1.7rem;
}

.chat-header h1 {
  max-width: 46rem;
  margin: 0.45rem 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.65rem);
  line-height: 1.02;
  font-weight: 500;
  letter-spacing: -0.045em;
}

.new-chat-button {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.72rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(20, 52, 38, 0.48);
  color: var(--muted);
  cursor: pointer;
}

.new-chat-button:hover {
  border-color: rgba(111, 210, 143, 0.28);
  color: var(--ink);
}

.safety-strip {
  display: flex;
  gap: 0.8rem;
  margin: 0 clamp(1.2rem, 5vw, 4rem);
  padding: 0.8rem 1rem;
  border: 1px solid rgba(233, 189, 105, 0.15);
  border-radius: 0.85rem;
  background: rgba(233, 189, 105, 0.055);
  color: #d7d4c5;
  font-size: 0.77rem;
  line-height: 1.5;
}

.safety-strip p {
  margin: 0;
}

.safety-symbol {
  color: var(--sun);
}

.conversation {
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 1.9rem clamp(1.2rem, 5vw, 4rem) 2rem;
}

.message {
  max-width: 52rem;
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr);
  gap: 0.8rem;
  margin-bottom: 1.6rem;
  animation: message-in 220ms ease both;
}

@keyframes message-in {
  from { opacity: 0; transform: translateY(0.4rem); }
  to { opacity: 1; transform: translateY(0); }
}

.user-message {
  margin-left: auto;
  grid-template-columns: minmax(0, 1fr) 2.2rem;
}

.avatar {
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  border-radius: 0.72rem;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.assistant-avatar {
  color: #092015;
  background: linear-gradient(145deg, var(--leaf-soft), var(--leaf));
}

.user-avatar {
  order: 2;
  background: rgba(233, 189, 105, 0.16);
  color: var(--sun);
}

.message-content {
  min-width: 0;
  padding-top: 0.12rem;
  color: #dfe7e1;
  font-size: 0.94rem;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.user-message .message-content {
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem 0.3rem 1rem 1rem;
  background: rgba(31, 76, 53, 0.48);
}

.message-content p {
  margin: 0;
}

.message-role {
  margin-bottom: 0.35rem !important;
  color: var(--faint);
  font-size: 0.68rem;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.inline-safety-notice {
  display: block;
  margin: 0 0 0.75rem;
  padding: 0.7rem 0.8rem;
  border-left: 3px solid var(--danger);
  background: rgba(245, 162, 127, 0.07);
  color: #f2c2ad;
  white-space: normal;
}

.typing-indicator::after {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 1em;
  margin-left: 0.22rem;
  vertical-align: -0.12em;
  background: var(--leaf);
  animation: blink 0.9s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.composer-wrap {
  position: sticky;
  bottom: 0;
  padding: 0.4rem clamp(1.2rem, 5vw, 4rem) 1.1rem;
  background: linear-gradient(0deg, var(--forest-950) 52%, transparent);
}

.generation-status {
  min-height: 1.4rem;
  color: var(--leaf-soft);
  font-size: 0.75rem;
}

.composer {
  padding: 0.7rem;
  border: 1px solid rgba(178, 218, 188, 0.18);
  border-radius: 1.15rem;
  background: rgba(15, 43, 30, 0.94);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.23);
}

.composer textarea {
  width: 100%;
  max-height: 10rem;
  resize: none;
  padding: 0.45rem 0.5rem;
  color: var(--ink);
  border: 0;
  outline: 0;
  background: transparent;
  line-height: 1.5;
}

.composer textarea::placeholder {
  color: #74887c;
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  padding-top: 0.35rem;
}

.character-count {
  margin-right: auto;
  padding-left: 0.5rem;
  color: var(--faint);
  font-size: 0.68rem;
}

.stop-button {
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(245, 162, 127, 0.25);
  border-radius: 999px;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
}

.send-button {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 0.82rem 0.6rem 0.95rem;
  border-radius: 0.75rem;
}

.send-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.send-button svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.disclaimer {
  margin: 0.55rem 0 0;
  color: var(--faint);
  font-size: 0.68rem;
  line-height: 1.4;
  text-align: center;
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.8rem;
    padding: 1rem 1.2rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .status-card {
    margin: 0;
  }

  .side-section,
  .sidebar-note,
  .logout-button {
    display: none;
  }

  .chat-header {
    padding-top: 1.6rem;
  }

  .chat-panel {
    min-height: calc(100vh - 5rem);
  }
}

@media (max-width: 560px) {
  .access-row {
    flex-direction: column;
  }

  .brand-subtitle,
  .status-detail,
  .send-button span {
    display: none;
  }

  .chat-header {
    gap: 0.8rem;
  }

  .chat-header h1 {
    font-size: 2rem;
  }

  .new-chat-button {
    width: 2.65rem;
    height: 2.65rem;
    justify-content: center;
    padding: 0;
    font-size: 0;
  }

  .new-chat-button span {
    font-size: 1.1rem;
  }

  .safety-strip {
    font-size: 0.72rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
