:root {
  --bg: #f4f2ec;
  --surface: #fffdf8;
  --surface-2: #e8e6df;
  --ink: #141817;
  --muted: #777a73;
  --line: #dddcd5;
  --dark: #121816;
  --mint: #77dec0;
  --mint-dark: #3f9b80;
  --danger: #c25445;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", Arial, sans-serif;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .6; }
.hidden { display: none !important; }

.brand {
  color: var(--ink);
  text-decoration: none;
  font: 600 16px "Space Grotesk", sans-serif;
  letter-spacing: .08em;
}
.brand-light { color: white; }
.brand strong { font-weight: 700; }
.eyebrow {
  display: inline-block;
  font-size: 10px;
  letter-spacing: .16em;
  color: #8b8d86;
}
.accent { color: var(--mint) !important; }

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  background: var(--dark);
}
.auth-visual {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: clamp(35px, 8vw, 110px);
  background: radial-gradient(circle at 52% 35%, #2b5146 0, #121816 58%);
  color: white;
}
.visual-grid {
  position: absolute;
  inset: 0;
  opacity: .16;
  background-image: linear-gradient(#b8eee022 1px, transparent 1px), linear-gradient(90deg, #b8eee022 1px, transparent 1px);
  background-size: 55px 55px;
  transform: perspective(600px) rotateX(58deg) scale(1.7);
  transform-origin: bottom;
}
.visual-orbit {
  position: absolute;
  border: 1px solid #a5e8d355;
  border-radius: 50%;
}
.orbit-a { width: 54vw; height: 18vw; left: 20%; top: 24%; transform: rotate(-18deg); }
.orbit-b { width: 68vw; height: 25vw; left: 10%; top: 19%; transform: rotate(12deg); opacity: .55; }
.visual-core {
  position: absolute;
  top: 27%;
  left: 48%;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--mint-dark);
  background: #d9fff2;
  box-shadow: 0 0 90px #77dec066;
  font-size: 25px;
}
.visual-copy {
  position: relative;
  z-index: 2;
  max-width: 620px;
}
.visual-copy h1 {
  margin: 28px 0 20px;
  font: 600 clamp(50px, 6.5vw, 92px)/.9 "Space Grotesk", sans-serif;
  letter-spacing: -.055em;
}
.visual-copy h1 em {
  color: var(--mint);
  font-style: normal;
}
.visual-copy p {
  max-width: 440px;
  color: #b8c0bb;
  line-height: 1.6;
}

.auth-side {
  display: grid;
  place-items: center;
  padding: 35px;
  background: var(--bg);
}
.auth-card {
  width: min(420px, 100%);
  padding: 42px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 30px 100px #00000018;
}
.auth-tabs {
  display: flex;
  gap: 26px;
  margin: 46px 0 25px;
  border-bottom: 1px solid var(--line);
}
.auth-tab {
  padding: 0 0 13px;
  border: 0;
  background: transparent;
  color: #92938d;
}
.auth-tab.active {
  color: var(--ink);
  border-bottom: 2px solid var(--ink);
}
.field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}
.field span {
  font-size: 11px;
  color: #7b7d76;
}
.field input {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  background: #faf9f5;
}
.field input:focus { border-color: #6b6d67; }
.primary-button,
.send-button {
  border: 0;
  border-radius: 11px;
  padding: 14px 17px;
  background: var(--dark);
  color: white;
  font-weight: 700;
}
.primary-button {
  width: 100%;
  margin-top: 4px;
}
.google-button {
  width: 100%;
  margin-top: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
  color: var(--ink);
}
.google-mark {
  margin-right: 8px;
  font-weight: 700;
}
.text-button {
  border: 0;
  background: transparent;
  color: #777a73;
  padding: 12px 0;
}
.auth-note {
  margin: 20px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: #999a94;
}

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 100;
  max-width: min(90vw, 520px);
  padding: 12px 16px;
  border-radius: 12px;
  background: #171c1a;
  color: white;
  box-shadow: 0 15px 50px #0004;
  transform: translate(-50%, -150%);
  transition: transform .25s ease;
  font-size: 13px;
}
.toast.show { transform: translate(-50%, 0); }

.app { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 72px;
  padding: 0 4vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: #f4f2ecec;
  backdrop-filter: blur(15px);
}
.workspace-status {
  font-size: 12px;
  color: #777a73;
}
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: #48bd98;
}
.top-actions { display: flex; gap: 8px; }
.round-button,
.avatar-button,
.close-button {
  border: 0;
  border-radius: 50%;
  background: #e6e4dd;
}
.round-button,
.avatar-button {
  width: 36px;
  height: 36px;
}
.avatar-button { font-weight: 700; }

.workspace {
  width: min(1160px, 92%);
  margin: 0 auto;
  padding: 65px 0 100px;
}
.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.hero h2 {
  margin: 18px 0;
  font: 600 clamp(48px, 6vw, 80px)/.94 "Space Grotesk", sans-serif;
  letter-spacing: -.06em;
}
.hero h2 em {
  color: #579985;
  font-style: normal;
}
.hero p {
  max-width: 490px;
  color: var(--muted);
  line-height: 1.6;
}
.signal {
  position: relative;
  width: 190px;
  height: 190px;
  display: grid;
  place-items: center;
}
.signal-center {
  position: relative;
  z-index: 3;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d7faee;
  color: var(--mint-dark);
  box-shadow: 0 0 55px #77dec066;
}
.signal-ring {
  position: absolute;
  border: 1px solid #94cdbc;
  border-radius: 50%;
}
.ring-one { width: 100%; height: 48%; transform: rotate(25deg); }
.ring-two { width: 100%; height: 48%; transform: rotate(-25deg); }
.ring-three { width: 48%; height: 100%; transform: rotate(25deg); opacity: .65; }

.mode-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 55px;
}
.mode-card {
  position: relative;
  min-height: 165px;
  padding: 20px;
  text-align: left;
  border: 0;
  border-radius: 17px;
  background: var(--surface-2);
  color: var(--ink);
  transition: transform .2s, background .2s, color .2s;
}
.mode-card:hover,
.mode-card.active {
  background: var(--dark);
  color: white;
  transform: translateY(-3px);
}
.mode-number {
  font-size: 10px;
  color: #8d9089;
}
.mode-card strong {
  display: block;
  margin: 28px 0 8px;
  font: 600 24px "Space Grotesk", sans-serif;
}
.mode-card > span:last-of-type {
  display: block;
  max-width: 190px;
  color: #858880;
  font-size: 12px;
  line-height: 1.45;
}
.mode-card.active > span:last-of-type { color: #adb7b2; }
.mode-card i {
  position: absolute;
  top: 18px;
  right: 18px;
  font-style: normal;
}

.composer {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 23px;
  background: var(--surface);
  box-shadow: 0 20px 65px #20241e0d;
}
.composer-meta,
.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.composer-meta {
  color: #92948d;
  font-size: 10px;
  letter-spacing: .14em;
}
.composer textarea {
  display: block;
  width: 100%;
  min-height: 140px;
  padding: 24px 2px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.55;
}
.composer textarea::placeholder { color: #aaa9a2; }
.composer-hint {
  color: #a0a19b;
  font-size: 11px;
}
.send-button { min-width: 82px; }
.send-button span { margin-left: 5px; }

.recent-section { margin-top: 72px; }
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
}
.section-heading h3 {
  margin: 9px 0 20px;
  font: 600 30px "Space Grotesk", sans-serif;
}
.history-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.history-card,
.history-empty {
  min-height: 125px;
  padding: 19px;
  border: 0;
  border-radius: 16px;
  background: var(--surface-2);
  text-align: left;
}
.history-card {
  color: var(--ink);
  transition: transform .2s;
}
.history-card:hover { transform: translateY(-2px); }
.history-card small {
  color: #898b84;
  font-size: 9px;
  letter-spacing: .12em;
}
.history-card p {
  margin: 17px 0 0;
  font-size: 14px;
  line-height: 1.5;
}
.history-empty {
  display: grid;
  align-content: center;
  gap: 7px;
}
.history-empty span,
.history-loading {
  color: #83857e;
  font-size: 12px;
}
.history-loading {
  grid-column: 1 / -1;
  padding: 20px;
}

.result-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  width: min(620px, calc(100% - 40px));
  max-height: 76vh;
  overflow: auto;
  padding: 25px;
  border-radius: 24px;
  background: #151b19;
  color: white;
  box-shadow: 0 30px 100px #0006;
  transform: translateY(140%);
  transition: transform .3s ease;
}
.result-panel.open { transform: translateY(0); }
.result-header {
  display: flex;
  justify-content: space-between;
}
.result-header h3 {
  margin: 8px 0 22px;
  font: 600 26px "Space Grotesk", sans-serif;
}
.close-button {
  width: 30px;
  height: 30px;
  color: var(--ink);
}
.result-panel .close-button {
  background: #ffffff12;
  color: white;
}
.result-body {
  white-space: pre-wrap;
  color: #d9e0dc;
  font-size: 14px;
  line-height: 1.75;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #0007;
}
.account-card {
  position: relative;
  width: min(370px, 100%);
  padding: 32px;
  border-radius: 22px;
  background: var(--surface);
  text-align: center;
}
.account-card > .close-button {
  position: absolute;
  top: 13px;
  right: 13px;
}
.avatar-large {
  width: 62px;
  height: 62px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--dark);
  color: white;
  font-weight: 700;
}
.account-card p {
  color: var(--muted);
  font-size: 13px;
}
.danger-button {
  width: 100%;
  margin-top: 18px;
  padding: 13px;
  border: 0;
  border-radius: 11px;
  background: #fff0ed;
  color: var(--danger);
}

@media (max-width: 850px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-side { padding: 22px; }
  .auth-card { padding: 32px 25px; }
  .signal { display: none; }
  .hero { align-items: flex-start; }
  .mode-grid { grid-template-columns: 1fr 1fr; }
  .history-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .topbar { padding: 0 16px; }
  .workspace-status { display: none; }
  .workspace { width: 94%; padding-top: 40px; }
  .hero h2 { font-size: 49px; }
  .mode-card { min-height: 145px; padding: 15px; }
  .mode-card strong { margin-top: 20px; }
  .mode-card > span:last-of-type { font-size: 11px; }
  .composer { padding: 14px; }
  .composer textarea { min-height: 130px; font-size: 16px; }
  .composer-hint { display: none; }
  .result-panel { right: 10px; bottom: 10px; width: calc(100% - 20px); }
}
