:root {
  color-scheme: dark;
  --ink: #f7f8f3;
  --muted: #a9b0a5;
  --panel: rgba(18, 24, 26, 0.86);
  --line: rgba(255, 255, 255, 0.14);
  --amber: #f7c948;
  --teal: #39d0bd;
  --red: #ff6b6b;
  --ground: #101514;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(247, 201, 72, 0.16), transparent 32%),
    radial-gradient(circle at 78% 18%, rgba(57, 208, 189, 0.2), transparent 28%),
    var(--ground);
}

.login-screen,
.home-screen {
  display: grid;
}

.login-shell {
  width: min(960px, calc(100% - 32px));
  margin: auto;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  border: 1px solid var(--line);
  background: rgba(8, 12, 13, 0.72);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

.brand-panel,
.login-panel {
  padding: clamp(28px, 5vw, 58px);
}

.brand-panel {
  display: flex;
  min-height: 520px;
  flex-direction: column;
  justify-content: flex-end;
  background:
    linear-gradient(160deg, rgba(247, 201, 72, 0.92), rgba(57, 208, 189, 0.7)),
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(0, 0, 0, 0.18) 18px 19px);
  color: #101514;
}

.brand-mark {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  margin-bottom: auto;
  border: 2px solid rgba(16, 21, 20, 0.82);
  font-weight: 800;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: clamp(40px, 7vw, 84px);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  font-size: 24px;
}

.brand-panel p,
.hero p {
  max-width: 620px;
  font-size: 18px;
  line-height: 1.6;
}

.login-panel {
  align-self: center;
}

.muted {
  color: var(--muted);
}

.error {
  padding: 12px 14px;
  border-left: 4px solid var(--red);
  background: rgba(255, 107, 107, 0.12);
  color: #ffd6d6;
}

form {
  display: grid;
  gap: 12px;
}

label {
  color: var(--muted);
  font-size: 14px;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  font-size: 16px;
}

input:focus {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: var(--amber);
  color: #15120b;
  cursor: pointer;
  font-weight: 800;
}

button:hover {
  filter: brightness(1.06);
}

.topbar {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wordmark {
  color: var(--ink);
  text-decoration: none;
  font-size: 20px;
  font-weight: 800;
}

.ghost-button {
  min-height: 40px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.chat-popup {
  position: fixed;
  right: 24px;
  top: 84px;
  z-index: 10;
  width: min(380px, calc(100vw - 32px));
  display: none;
}

.codex-popup {
  position: fixed;
  right: 24px;
  top: 84px;
  z-index: 11;
  width: min(520px, calc(100vw - 32px));
  display: none;
}

.codex-popup.is-open {
  display: block;
}

.chat-popup.is-open {
  display: block;
}

.chat-window,
.codex-window {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 17, 18, 0.98);
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.48);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 201, 72, 0.1);
}

.chat-header h2 {
  margin-bottom: 2px;
  font-size: 18px;
}

.chat-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.icon-button {
  width: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 20px;
}

.chat-messages {
  height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}

.chat-message {
  width: fit-content;
  max-width: 82%;
  margin-bottom: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.45;
}

.chat-message.assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

.chat-message.user {
  align-self: flex-end;
  border-color: rgba(247, 201, 72, 0.42);
  background: var(--amber);
  color: #15120b;
}

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

.chat-form input {
  min-height: 44px;
}

.chat-form button {
  min-height: 44px;
}

.codex-form {
  padding: 16px;
}

textarea {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  font: inherit;
  line-height: 1.45;
}

textarea:focus {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.codex-output {
  min-height: 150px;
  max-height: 280px;
  overflow: auto;
  margin: 0;
  padding: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: rgba(0, 0, 0, 0.24);
  white-space: pre-wrap;
  font-family: "Courier New", monospace;
  font-size: 13px;
  line-height: 1.45;
}

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

.noscript-chat {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  color: var(--muted);
}

.hero {
  width: min(1180px, calc(100% - 32px));
  min-height: 58vh;
  margin: 32px auto 0;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  align-items: center;
  gap: 40px;
}

.eyebrow {
  margin-bottom: 16px;
  color: var(--amber);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-media {
  margin: 0;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.hero-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.services {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 64px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.services article {
  min-height: 190px;
  padding: 24px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.services span {
  color: var(--teal);
  font-weight: 800;
}

.services h2 {
  margin-top: 34px;
}

.services p {
  color: var(--muted);
  line-height: 1.55;
}

@media (max-width: 760px) {
  .login-shell,
  .hero,
  .services {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    min-height: 320px;
  }

  .hero {
    margin-top: 14px;
  }

  .hero-media {
    width: min(100%, 520px);
    justify-self: center;
  }

  .topbar {
    align-items: flex-start;
    gap: 16px;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .chat-popup {
    inset: auto 16px 16px 16px;
    top: auto;
    width: auto;
  }

  .codex-popup {
    inset: auto 16px 16px 16px;
    top: auto;
    width: auto;
  }

  .chat-messages {
    height: min(46vh, 320px);
  }
}
