:root {
  font-family: "Manrope", system-ui, sans-serif;
  color: #f6f8f5;
  font-synthesis: none;
  --ink: #111513;
  --glass: rgba(17, 21, 19, 0.93);
  --line: rgba(255, 255, 255, 0.13);
  --muted: #aeb8b2;
  --acid: #d8ff71;
  --coral: #ff896e;
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }

body { background: #ecebe5; }

button, textarea { font: inherit; }
button { cursor: pointer; }

#site-frame {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ecebe5;
}

.control-layer {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
}

.brand,
.queue-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 2.35rem;
  padding: 0 .85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #f6f8f5;
  background: rgba(17, 21, 19, .86);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .16);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: -.01em;
}

.queue-pill { appearance: none; }
.queue-pill:hover { background: rgba(27, 33, 30, .94); }

.brand-dot,
.status-dot {
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 0 3px rgba(216, 255, 113, .12);
}

.status-dot[data-state="building"] {
  background: var(--coral);
  box-shadow: 0 0 0 3px rgba(255, 137, 110, .13);
  animation: pulse 1.4s ease-in-out infinite;
}

.status-dot[data-state="offline"] {
  background: #a6aba8;
  box-shadow: none;
}

.pill-divider { width: 1px; height: 1rem; background: var(--line); }

.composer {
  pointer-events: auto;
  position: absolute;
  left: 50%;
  bottom: 1.1rem;
  translate: -50% 0;
  width: min(52rem, calc(100% - 2rem));
  padding: .9rem;
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background: var(--glass);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .3), inset 0 1px rgba(255, 255, 255, .05);
  backdrop-filter: blur(24px) saturate(1.25);
  -webkit-backdrop-filter: blur(24px) saturate(1.25);
}

.composer-context,
.composer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 .25rem;
}

.composer-context { margin-bottom: .7rem; }
.composer-meta { margin-top: .65rem; min-height: 1rem; color: var(--muted); font-size: .69rem; }

.context-label {
  color: var(--acid);
  font: 500 .67rem/1 "DM Mono", monospace;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.context-status {
  min-width: 0;
  overflow: hidden;
  color: #c6cec9;
  font-size: .7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: .7rem;
}

textarea {
  flex: 1;
  min-width: 0;
  min-height: 3.25rem;
  max-height: 10rem;
  resize: none;
  overflow-y: auto;
  padding: .9rem 1rem;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: .9rem;
  outline: none;
  color: #fff;
  background: rgba(255, 255, 255, .065);
  line-height: 1.5;
  transition: border-color 160ms ease, background 160ms ease;
}

textarea::placeholder { color: #818b85; }
textarea:focus { border-color: rgba(216, 255, 113, .6); background: rgba(255, 255, 255, .085); }

.submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  min-height: 3.25rem;
  padding: 0 1.2rem;
  border: 0;
  border-radius: .9rem;
  color: #151b17;
  background: var(--acid);
  font-size: .82rem;
  font-weight: 700;
  transition: transform 140ms ease, filter 140ms ease;
}

.submit-button:hover { transform: translateY(-1px); filter: brightness(1.05); }
.submit-button:active { transform: translateY(0); }
.submit-button:disabled { cursor: wait; opacity: .55; transform: none; }
.submit-arrow { font-size: 1.05rem; }

.shortcut { display: inline-flex; gap: .2rem; }
kbd { min-width: 1.15rem; padding: .1rem .25rem; border: 1px solid rgba(255, 255, 255, .12); border-radius: .28rem; color: #aeb8b2; font: 500 .62rem/1.2 "DM Mono", monospace; text-align: center; }

.history-panel {
  pointer-events: auto;
  position: absolute;
  top: .7rem;
  right: .7rem;
  bottom: .7rem;
  width: min(25rem, calc(100% - 1.4rem));
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  background: rgba(15, 18, 17, .96);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .36);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  translate: calc(100% + 2rem) 0;
  visibility: hidden;
  transition: translate 220ms cubic-bezier(.2, .8, .2, 1), visibility 220ms;
}

.history-panel.is-open { translate: 0 0; visibility: visible; }
.history-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: .3rem .2rem 1rem; border-bottom: 1px solid var(--line); }
.panel-kicker { margin: 0 0 .4rem; color: var(--acid); font: 500 .65rem/1 "DM Mono", monospace; text-transform: uppercase; letter-spacing: .12em; }
.history-header h2 { margin: 0; font-size: 1.35rem; letter-spacing: -.04em; }
.close-button { width: 2rem; height: 2rem; border: 1px solid var(--line); border-radius: 50%; color: #fff; background: transparent; font-size: 1.25rem; line-height: 1; }
.close-button:hover { background: rgba(255, 255, 255, .08); }

.history-list { max-height: calc(100% - 5rem); overflow-y: auto; padding: .45rem 0 6rem; scrollbar-width: thin; scrollbar-color: #4f5853 transparent; }
.history-item { display: grid; grid-template-columns: .7rem 1fr; gap: .7rem; padding: 1rem .2rem; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.history-marker { width: .55rem; height: .55rem; margin-top: .35rem; border-radius: 50%; background: #6f7873; }
.history-marker[data-status="published"] { background: var(--acid); }
.history-marker[data-status="running"] { background: var(--coral); animation: pulse 1.4s ease-in-out infinite; }
.history-marker[data-status="published_error"] { background: #ff6e69; }
.history-prompt { margin: 0; color: #eff3f0; font-size: .84rem; line-height: 1.45; overflow-wrap: anywhere; }
.history-meta { display: flex; justify-content: space-between; gap: .7rem; margin-top: .5rem; color: #87918b; font: 400 .63rem/1.3 "DM Mono", monospace; text-transform: uppercase; }
.history-empty { color: #818b85; font-size: .8rem; line-height: 1.5; }

.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; }

:focus-visible { outline: 2px solid var(--acid); outline-offset: 3px; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

@media (max-width: 700px) {
  .topbar { padding: .65rem; }
  .brand { padding-inline: .7rem; }
  .brand span:last-child { display: none; }
  .composer { width: calc(100% - 1rem); bottom: .5rem; padding: .7rem; border-radius: 1.05rem; }
  .composer-context { margin-bottom: .55rem; }
  .context-status { max-width: 58%; }
  .composer-row { gap: .5rem; }
  textarea { min-height: 3rem; padding: .78rem .85rem; font-size: .88rem; }
  .submit-button { min-height: 3rem; padding-inline: .9rem; }
  .submit-button span:first-child { display: none; }
  .composer-meta { margin-top: .5rem; }
  .shortcut { display: none; }
  .history-panel { top: .4rem; right: .4rem; bottom: .4rem; width: calc(100% - .8rem); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
