:root {
  --ink: #12160f;
  --paper: #f2ebe0;
  --moss: #3d5a3a;
  --moss-deep: #243522;
  --amber: #c4783a;
  --amber-hot: #e09a52;
  --line: rgba(242, 235, 224, 0.14);
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.4);
  --radius: 20px;
  --font-display: "Instrument Serif", Georgia, serif;
  --font-body: "Schibsted Grotesk", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--paper);
  font-family: var(--font-body);
  background: var(--ink);
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 55% at 12% -8%, rgba(196, 120, 58, 0.3), transparent 55%),
    radial-gradient(ellipse 55% 45% at 92% 8%, rgba(61, 90, 58, 0.38), transparent 50%),
    radial-gradient(ellipse 70% 40% at 50% 115%, rgba(36, 53, 34, 0.95), transparent 55%),
    linear-gradient(165deg, #0d110b 0%, #171c13 45%, #10140e 100%);
  animation: drift 18s ease-in-out infinite alternate;
}

@keyframes drift {
  from { filter: hue-rotate(0deg) saturate(1); }
  to { filter: hue-rotate(8deg) saturate(1.08); }
}

.hero {
  padding: clamp(1.6rem, 4vw, 3rem) clamp(1.2rem, 4vw, 3rem) 0.4rem;
  animation: rise 0.7s ease both;
}

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

.brand-mark {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--amber-hot), var(--amber) 55%, var(--moss));
  box-shadow: 0 0 0 7px rgba(196, 120, 58, 0.12);
  animation: pulse 3.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.85; }
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3rem, 9vw, 5.2rem);
  font-weight: 400;
  letter-spacing: 0.05em;
  line-height: 0.9;
}

.lead {
  margin: 0.85rem 0 0;
  max-width: 28ch;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.8vw, 1.65rem);
  font-style: italic;
  color: rgba(242, 235, 224, 0.62);
  line-height: 1.35;
}

.qa {
  width: min(44rem, 100%);
  margin: 0 auto;
  padding: 1.4rem clamp(1.2rem, 4vw, 3rem) 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.ask {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1rem;
  background: rgba(18, 22, 15, 0.72);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  animation: rise 0.8s 0.08s ease both;
}

.ask label {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(242, 235, 224, 0.5);
}

.ask textarea {
  width: 100%;
  resize: vertical;
  min-height: 5.5rem;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--paper);
  font: inherit;
  font-size: 1.15rem;
  line-height: 1.5;
  padding: 0.35rem 0.15rem;
}

.ask textarea::placeholder {
  color: rgba(242, 235, 224, 0.32);
}

.ask-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.ask button[type="submit"] {
  border: 0;
  cursor: pointer;
  background: linear-gradient(160deg, var(--amber-hot), var(--amber));
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.9rem 1.35rem;
  border-radius: 14px;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.ask button[type="submit"]:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.ask button[type="submit"]:disabled {
  opacity: 0.45;
  cursor: wait;
}

.ghost {
  border: 0;
  background: transparent;
  color: rgba(242, 235, 224, 0.6);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.25em;
  padding: 0.4rem 0;
}

.ghost:hover {
  color: var(--paper);
}

.stop {
  border: 1px solid rgba(180, 70, 50, 0.45);
  background: rgba(180, 70, 50, 0.12);
  color: #8a2f22;
  border-radius: 999px;
  padding: 0.7rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.stop:hover {
  background: rgba(180, 70, 50, 0.2);
}

body.is-answering .stop {
  animation: pulse-stop 1.4s ease-in-out infinite;
}

@keyframes pulse-stop {
  0%, 100% { box-shadow: 0 0 0 0 rgba(180, 70, 50, 0.25); }
  50% { box-shadow: 0 0 0 6px rgba(180, 70, 50, 0); }
}



.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  animation: rise 0.85s 0.14s ease both;
}

.suggestions button {
  border: 1px solid var(--line);
  background: rgba(242, 235, 224, 0.05);
  color: rgba(242, 235, 224, 0.78);
  font: inherit;
  font-size: 0.88rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.suggestions button:hover {
  background: rgba(242, 235, 224, 0.12);
  color: var(--paper);
}

.result {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: rise 0.45s ease both;
}

.block h2 {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(242, 235, 224, 0.45);
  font-weight: 500;
}

.block p {
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.question-block p {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-style: italic;
  color: rgba(242, 235, 224, 0.9);
}

.answer-block {
  padding: 1.15rem 1.25rem;
  background: rgba(242, 235, 224, 0.07);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.answer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.answer-head h2 {
  margin: 0;
}

.speak {
  flex-shrink: 0;
  border: 1px solid rgba(232, 168, 74, 0.45);
  background: rgba(232, 168, 74, 0.12);
  color: var(--amber);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.speak:hover {
  background: rgba(232, 168, 74, 0.22);
  border-color: var(--amber);
}

.speak.is-speaking {
  background: rgba(196, 92, 62, 0.25);
  border-color: rgba(196, 92, 62, 0.7);
  color: #f5d5c8;
}

.answer {
  font-size: 1.05rem;
  color: var(--paper);
  min-height: 1.5em;
}

.answer.streaming::after {
  content: "▍";
  display: inline-block;
  margin-left: 0.12em;
  color: var(--amber-hot);
  animation: blink 0.9s steps(1) infinite;
}

.answer.error {
  color: #f5d5c8;
}

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

.status {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: rgba(242, 235, 224, 0.4);
}

.foot {
  padding: 0.4rem clamp(1.2rem, 4vw, 3rem) 1.2rem;
  color: rgba(242, 235, 224, 0.35);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

body.is-answering .suggestions {
  opacity: 0.35;
  pointer-events: none;
}

@media (max-width: 640px) {
  .ask-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .ask button[type="submit"] {
    width: 100%;
  }
}

/* —— SSH connector —— */
.ssh-panel {
  margin: 0 0 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(20, 40, 50, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
}
.ssh-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.ssh-eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: #5b6b7c;
}
.ssh-head h2 {
  margin: 0.15rem 0 0;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 1.45rem;
  font-weight: 400;
}
.ssh-head-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.ssh-state {
  font-size: 0.82rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: #e8eef3;
  color: #405060;
}
.ssh-state.online { background: #d9f0e2; color: #1f6b3a; }
.ssh-state.ready { background: #e5eef8; color: #1d4f8c; }
.ssh-state.locked { background: #f3e7e4; color: #8a2f22; }
.ssh-body { margin-top: 0.9rem; }
.ssh-lock, .ssh-form { display: grid; gap: 0.75rem; }
.ssh-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.6fr 1fr 1.2fr;
  gap: 0.6rem;
}
.ssh-panel label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: #405060;
}
.ssh-panel input[type="text"],
.ssh-panel input[type="password"],
.ssh-panel input[type="number"] {
  width: 100%;
  border: 1px solid rgba(20, 40, 50, 0.16);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  background: #fff;
}
.ssh-out {
  margin: 0;
  min-height: 4.5rem;
  max-height: 220px;
  overflow: auto;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: #142028;
  color: #d7ece4;
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.ssh-check {
  display: inline-flex !important;
  align-items: center;
  gap: 0.4rem;
  grid-auto-flow: column;
  font-size: 0.85rem;
}
.ssh-cmd-label { margin-top: 0.25rem; }
@media (max-width: 900px) {
  .ssh-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .ssh-grid { grid-template-columns: 1fr; }
  .ssh-head { flex-direction: column; align-items: flex-start; }
}

.settings-panel {
  margin: 0 0 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(20, 40, 50, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 0.75rem;
}
.settings-panel label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: #405060;
}
.settings-panel select,
.settings-panel input[type="number"],
.settings-panel textarea {
  width: 100%;
  border: 1px solid rgba(20, 40, 50, 0.16);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  background: #fff;
}
.settings-panel input[type="range"] {
  width: 100%;
}
.settings-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: #5b6b7c;
}
@media (max-width: 900px) {
  .settings-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .settings-grid { grid-template-columns: 1fr; }
}
