:root {
  color-scheme: light;
  --ink: #312115;
  --muted: #7a604b;
  --cream: #fff7e8;
  --cream-deep: #f6dfbd;
  --paper: #fffdf7;
  --panel: rgba(255, 253, 247, 0.9);
  --line: rgba(210, 132, 53, 0.24);
  --orange: #f47b20;
  --orange-dark: #b94f09;
  --orange-soft: #ffe1bd;
  --purple: #7c3aed;
  --purple-dark: #4c1d95;
  --purple-soft: #eee4ff;
  --plum: #2b164f;
  --shadow: 0 24px 70px rgba(126, 67, 17, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 45%, rgba(124, 58, 237, 0.28), transparent 19rem),
    radial-gradient(circle at 12% 12%, rgba(244, 123, 32, 0.2), transparent 19rem),
    radial-gradient(circle at 88% 14%, rgba(255, 176, 46, 0.26), transparent 20rem),
    linear-gradient(135deg, #fff4df 0%, #fffaf0 46%, #fff7e8 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  min-height: 100vh;
}

.login-screen,
.app-screen {
  width: min(90rem, calc(100% - 2rem));
  margin: 0 auto;
}

.login-screen {
  display: grid;
  grid-template-columns: minmax(20rem, 1fr) minmax(20rem, 31rem);
  gap: clamp(1.5rem, 5vw, 5rem);
  align-items: center;
  min-height: 100vh;
  padding: 2rem 0;
}

.login-screen.is-hidden,
.app-screen.is-hidden,
.modal-backdrop.is-hidden {
  display: none;
}

.login-card,
.hero-panel,
.topbar,
.identity-panel,
.chat-panel,
.memory-panel,
.profile-modal {
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-card {
  display: grid;
  gap: 1rem;
  padding: clamp(1.25rem, 4vw, 2.2rem);
  animation: riseIn 560ms ease both;
}

.eyebrow {
  margin: 0;
  color: var(--orange-dark);
  font-size: 0.72rem;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 4.65rem);
  font-weight: 580;
  letter-spacing: -0.04em;
}

h2 {
  font-size: 1.1rem;
}

h3 {
  font-size: 1rem;
}

.intro,
.fine-print,
.mixer-card p,
.dataset-card,
.chat-hero p,
.personalization-card p,
.message p,
.profile-modal p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.fine-print {
  font-size: 0.82rem;
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-weight: 760;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  color: var(--ink);
  background: #fffaf2;
  outline: none;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(124, 58, 237, 0.54);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
}

input,
select {
  min-height: 3rem;
  padding: 0 0.9rem;
}

textarea {
  min-height: 9.5rem;
  padding: 0.9rem;
  line-height: 1.55;
  resize: vertical;
}

.primary-action,
.secondary-action,
.ghost-action,
.icon-action,
.close-action {
  min-height: 2.9rem;
  border-radius: 0.85rem;
  font-weight: 830;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.primary-action {
  padding: 0 1.1rem;
  border: 1px solid var(--orange-dark);
  color: #fff;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  box-shadow: 0 12px 24px rgba(244, 123, 32, 0.22);
}

.secondary-action,
.ghost-action {
  padding: 0 0.95rem;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fffaf2;
}

.secondary-action {
  color: var(--purple-dark);
  border-color: rgba(124, 58, 237, 0.26);
  background: var(--purple-soft);
}

.primary-action:hover,
.secondary-action:hover,
.ghost-action:hover,
.icon-action:hover,
.close-action:hover {
  transform: translateY(-1px);
}

.hero-panel {
  position: relative;
  min-height: 39rem;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 48%, rgba(124, 58, 237, 0.76), transparent 9rem),
    radial-gradient(circle at 20% 20%, rgba(244, 123, 32, 0.22), transparent 14rem),
    linear-gradient(145deg, rgba(255, 253, 247, 0.92), rgba(255, 226, 193, 0.55));
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(76, 29, 149, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(76, 29, 149, 0.06) 1px, transparent 1px);
  background-size: 1.25rem 1.25rem;
  mask-image: radial-gradient(circle at center, black, transparent 74%);
}

.poem-window {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(28rem, 78%);
  min-height: 24rem;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 1.4rem;
  background: rgba(255, 250, 242, 0.86);
  box-shadow: 0 30px 72px rgba(76, 29, 149, 0.26);
  transform: translate(-50%, -50%);
  animation: floatWindow 6000ms ease-in-out infinite;
}

.window-bar {
  display: flex;
  gap: 0.4rem;
}

.window-bar span {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--orange);
}

.window-bar span:nth-child(2) {
  background: var(--cream-deep);
}

.window-bar span:nth-child(3) {
  background: var(--purple);
}

.purple-core {
  position: relative;
  display: grid;
  place-items: center;
  width: 10.5rem;
  height: 10.5rem;
  margin: 2.1rem auto 1.6rem;
  border-radius: 50%;
  color: #fff;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.34), transparent 2.4rem),
    linear-gradient(135deg, var(--purple), var(--plum));
  box-shadow:
    0 0 0 1rem rgba(124, 58, 237, 0.08),
    0 0 58px rgba(124, 58, 237, 0.46);
}

.purple-core strong {
  position: relative;
  z-index: 1;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.4rem;
}

.signature-ring {
  position: absolute;
  inset: 1rem;
  border: 1px dashed rgba(255, 255, 255, 0.62);
  border-radius: 50%;
  animation: rotateRing 14000ms linear infinite;
}

.verse-lines {
  display: grid;
  gap: 0.7rem;
}

.verse-lines span {
  height: 0.7rem;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(244, 123, 32, 0.42), rgba(124, 58, 237, 0.24));
}

.verse-lines span:nth-child(1) {
  width: 84%;
}

.verse-lines span:nth-child(2) {
  width: 64%;
}

.verse-lines span:nth-child(3) {
  width: 92%;
}

.verse-lines span:nth-child(4) {
  width: 50%;
}

.orbit-card,
.api-badge {
  position: absolute;
  z-index: 1;
  max-width: 13rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(124, 58, 237, 0.18);
  border-radius: 1rem;
  color: #5d3925;
  background: rgba(255, 253, 247, 0.9);
  box-shadow: 0 16px 34px rgba(126, 67, 17, 0.12);
  line-height: 1.35;
}

.orbit-card span,
.api-badge span {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--purple-dark);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card-one {
  top: 4.5rem;
  left: 7%;
}

.card-two {
  right: 8%;
  bottom: 7rem;
}

.api-badge {
  left: 9%;
  bottom: 5rem;
}

.app-screen {
  min-height: 100vh;
  padding: 1rem 0 2rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem;
  margin-bottom: 1rem;
}

.brand,
.topbar-actions,
.api-status,
.composer-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 0.95rem;
  color: #fff;
  background: linear-gradient(135deg, var(--orange), var(--purple));
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.3rem;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 0.86rem;
}

.api-status {
  min-height: 2.8rem;
  padding: 0 0.8rem;
  border: 1px solid rgba(47, 138, 85, 0.22);
  border-radius: 999px;
  color: #286348;
  background: rgba(239, 248, 242, 0.88);
  font-size: 0.84rem;
  font-weight: 800;
}

.api-status span {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: #2f8a55;
  box-shadow: 0 0 0 0 rgba(47, 138, 85, 0.36);
  animation: ping 1600ms ease infinite;
}

.icon-action,
.close-action {
  display: grid;
  place-items: center;
  width: 2.9rem;
  border: 1px solid rgba(124, 58, 237, 0.28);
  color: var(--purple-dark);
  background: #fff;
}

.fingerprint-icon {
  width: 1.5rem;
  height: 1.8rem;
  border: 0.14rem solid currentColor;
  border-top-color: transparent;
  border-radius: 50% 50% 45% 45%;
  box-shadow:
    inset 0 0 0 0.22rem #fff,
    inset 0 0 0 0.34rem currentColor;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(16rem, 19rem) minmax(0, 1fr) minmax(17rem, 21rem);
  gap: 1rem;
  align-items: start;
}

.identity-panel,
.chat-panel,
.memory-panel {
  padding: 1rem;
}

.identity-panel,
.memory-panel {
  display: grid;
  gap: 1rem;
}

.panel-heading {
  display: grid;
  gap: 0.35rem;
}

.poet-list,
.thread-list,
.mix-options,
.identity-grid {
  display: grid;
  gap: 0.7rem;
}

.poet-card,
.thread-card,
.identity-stat {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 250, 242, 0.84);
}

.poet-card,
.thread-card {
  width: 100%;
  padding: 0.78rem;
  color: inherit;
  text-align: left;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.poet-card:hover,
.poet-card.active,
.thread-card:hover,
.thread-card.active {
  transform: translateY(-1px);
  border-color: rgba(124, 58, 237, 0.38);
  background: #fff;
}

.poet-card strong,
.thread-card strong {
  display: block;
  margin-bottom: 0.28rem;
}

.poet-card span,
.thread-card span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.thread-card small {
  display: inline-flex;
  margin-top: 0.55rem;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  color: var(--purple-dark);
  background: var(--purple-soft);
  font-weight: 800;
}

.mixer-card,
.dataset-card,
.personalization-card,
.signal-card {
  display: grid;
  gap: 0.7rem;
  padding: 0.9rem;
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 1rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(124, 58, 237, 0.11), transparent 8rem),
    rgba(255, 255, 255, 0.7);
}

.mix-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: #fffaf2;
  color: var(--ink);
  font-size: 0.86rem;
}

.mix-check input {
  width: auto;
  min-height: auto;
}

.dataset-card span,
.signal-card span {
  color: var(--orange-dark);
  font-size: 0.72rem;
  font-weight: 830;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dataset-card strong {
  color: var(--purple-dark);
  font-size: 2.2rem;
  line-height: 1;
}

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

.chat-hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-radius: 1.05rem;
  background:
    radial-gradient(circle at 50% 50%, rgba(124, 58, 237, 0.18), transparent 12rem),
    linear-gradient(135deg, #fffaf2, #fff1dc);
}

.chat-hero h1 {
  margin: 0.25rem 0;
  font-size: clamp(1.8rem, 4vw, 3.4rem);
}

.model-chip,
.simulated-call {
  width: fit-content;
  height: fit-content;
  padding: 0.46rem 0.7rem;
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 999px;
  color: var(--purple-dark);
  background: #fff;
  font-size: 0.75rem;
  font-weight: 840;
  white-space: nowrap;
}

.chat-log {
  display: grid;
  gap: 0.85rem;
  min-height: 20rem;
  max-height: 44vh;
  overflow: auto;
  margin: 1rem 0;
  padding: 0.25rem;
}

.empty-chat {
  display: grid;
  place-items: center;
  min-height: 18rem;
  border: 1px dashed var(--line);
  border-radius: 1rem;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 250, 242, 0.56);
}

.message {
  display: grid;
  gap: 0.4rem;
  width: min(88%, 42rem);
  padding: 0.85rem 0.95rem;
  border-radius: 1rem;
  line-height: 1.55;
}

.message.user {
  justify-self: end;
  color: #fff;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  box-shadow: 0 12px 28px rgba(244, 123, 32, 0.18);
}

.message.ai {
  justify-self: start;
  border: 1px solid rgba(124, 58, 237, 0.18);
  background: #fff;
}

.message strong {
  font-size: 0.82rem;
}

.message.user p {
  color: rgba(255, 255, 255, 0.88);
}

.composer {
  display: grid;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.composer-actions {
  justify-content: space-between;
}

.personalization-card ul,
.profile-modal ul {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  line-height: 1.45;
}

.personalization-meter {
  overflow: hidden;
  height: 0.72rem;
  border: 1px solid rgba(124, 58, 237, 0.18);
  border-radius: 999px;
  background: #fff;
}

.personalization-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), var(--purple));
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(49, 33, 21, 0.34);
}

.profile-modal {
  position: relative;
  width: min(42rem, 100%);
  padding: clamp(1.2rem, 4vw, 2rem);
  background:
    radial-gradient(circle at 50% 38%, rgba(124, 58, 237, 0.18), transparent 14rem),
    rgba(255, 253, 247, 0.96);
}

.close-action {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  min-height: auto;
  height: 2.35rem;
  width: 2.35rem;
}

.fingerprint-viz {
  position: relative;
  width: 9rem;
  height: 9rem;
  margin: 1rem auto;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(124, 58, 237, 0.95) 0 0.45rem, transparent 0.48rem),
    repeating-radial-gradient(circle, transparent 0 0.72rem, rgba(124, 58, 237, 0.34) 0.78rem 0.9rem);
  box-shadow: 0 0 44px rgba(124, 58, 237, 0.24);
}

.fingerprint-viz span {
  position: absolute;
  inset: 1rem;
  border: 0.12rem solid rgba(244, 123, 32, 0.58);
  border-left-color: transparent;
  border-radius: 48% 52% 45% 55%;
}

.fingerprint-viz span:nth-child(2) {
  inset: 2rem;
  transform: rotate(28deg);
}

.fingerprint-viz span:nth-child(3) {
  inset: 3rem;
  transform: rotate(-18deg);
}

.fingerprint-viz span:nth-child(4) {
  inset: 4rem;
  border-color: rgba(76, 29, 149, 0.7);
  border-right-color: transparent;
}

.identity-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.identity-stat {
  padding: 0.85rem;
}

.identity-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.identity-stat strong {
  display: block;
  margin-top: 0.25rem;
  color: var(--purple-dark);
}

.confidence-bar {
  overflow: hidden;
  height: 0.8rem;
  border-radius: 999px;
  background: #fff;
}

.confidence-bar i {
  display: block;
  width: 37%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), var(--purple));
}

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

@keyframes floatWindow {
  0%,
  100% {
    transform: translate(-50%, -50%) rotate(-1deg);
  }
  50% {
    transform: translate(-50%, calc(-50% - 0.7rem)) rotate(1deg);
  }
}

@keyframes rotateRing {
  to {
    transform: rotate(360deg);
  }
}

@keyframes ping {
  70%,
  100% {
    box-shadow: 0 0 0 0.6rem rgba(47, 138, 85, 0);
  }
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .identity-panel,
  .memory-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-heading,
  .dataset-card,
  .personalization-card {
    grid-column: 1 / -1;
  }

  .chat-log {
    max-height: none;
  }
}

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

  .hero-panel {
    min-height: 28rem;
    order: 2;
  }

  .topbar,
  .chat-hero,
  .composer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .identity-panel,
  .memory-panel {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .api-status,
  .ghost-action,
  .icon-action,
  .primary-action,
  .secondary-action {
    width: 100%;
  }

  .icon-action {
    min-height: 2.9rem;
  }

  .message {
    width: 100%;
  }
}

@media (max-width: 540px) {
  .login-screen,
  .app-screen {
    width: min(100% - 1rem, 90rem);
  }

  .login-card,
  .hero-panel,
  .topbar,
  .identity-panel,
  .chat-panel,
  .memory-panel {
    border-radius: 1rem;
  }

  .identity-grid {
    grid-template-columns: 1fr;
  }

  .orbit-card,
  .api-badge {
    display: none;
  }
}
