:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #fff9fc;
  --surface: #ffffff;
  --surface-soft: #fff1f7;
  --line: #ead4df;
  --line-strong: #d9b7c8;
  --text: #2d2630;
  --muted: #7f7079;
  --pink: #d92d7f;
  --pink-dark: #a5165d;
  --rose: #ff8abf;
  --coral: #e6687e;
  --ink: #251f27;
  --mint: #58a897;
  --shadow: 0 24px 70px rgba(155, 62, 108, 0.16);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(217, 45, 127, 0.07) 0 1px, transparent 1px 38px),
    linear-gradient(45deg, rgba(88, 168, 151, 0.05) 0 1px, transparent 1px 44px),
    linear-gradient(180deg, #fff 0%, var(--bg) 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled {
  cursor: wait;
  opacity: 0.68;
}

.app-shell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 56px 18px;
  overflow: hidden;
}

.writer,
.access-card {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  width: min(900px, 100%);
}

.writer[hidden],
.access-card[hidden] {
  display: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  margin-bottom: 18px;
  color: var(--pink);
  background: linear-gradient(180deg, #fff, #fff5fa);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(217, 45, 127, 0.18);
  animation: floatBrain 4.8s ease-in-out infinite;
}

.brand-mark svg {
  width: 43px;
  height: 43px;
  fill: #ffd0e4;
  stroke: var(--pink);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

h1 {
  margin: 0 0 34px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.55rem, 5.4vw, 4.7rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
}

.composer {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(760px, 100%);
  min-height: 158px;
  padding: 20px;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, rgba(217, 45, 127, 0.48), rgba(88, 168, 151, 0.22), rgba(230, 104, 126, 0.32)) border-box;
  border: 1px solid transparent;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.access-card {
  width: min(520px, 100%);
}

.access-card h1 {
  margin-bottom: 24px;
}

.user-strip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: -18px 0 24px;
  color: var(--pink-dark);
  font-size: 0.92rem;
  font-weight: 800;
}

.access-form {
  display: grid;
  gap: 14px;
  width: 100%;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.access-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 760;
}

.access-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: 0;
}

.access-form input:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(217, 45, 127, 0.12);
}

.access-form .send-button {
  width: 100%;
}

.access-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
  text-align: center;
}

.composer::before {
  content: "";
  position: absolute;
  inset: 10px;
  pointer-events: none;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 0 19%, rgba(217, 45, 127, 0.14) 19% 20%, transparent 20% 100%),
    linear-gradient(0deg, transparent 0 70%, rgba(88, 168, 151, 0.13) 70% 71%, transparent 71% 100%);
  mask-image: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent);
  opacity: 0.55;
}

.composer:focus-within {
  box-shadow: 0 28px 80px rgba(217, 45, 127, 0.22);
}

.composer textarea {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 96px;
  max-height: 280px;
  padding: 8px 6px;
  resize: none;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 1.08rem;
  line-height: 1.58;
}

.composer textarea::placeholder {
  color: #8d8288;
}

.composer-bar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.status-text {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.send-button,
.copy-button,
.logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  font-weight: 780;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.send-button {
  min-width: 142px;
  padding: 0 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--coral));
  box-shadow: 0 14px 28px rgba(217, 45, 127, 0.28);
}

.send-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.send-button:hover,
.copy-button:hover {
  transform: translateY(-1px);
}

.send-button:active,
.copy-button:active {
  transform: translateY(0);
}

.result-panel {
  position: relative;
  width: min(860px, 100%);
  margin-top: 22px;
  padding: 22px 22px 44px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 46px rgba(155, 62, 108, 0.1);
  backdrop-filter: blur(14px);
  animation: riseIn 260ms ease both;
}

.result-panel[hidden] {
  display: none;
}

.result-panel.is-pending .result-text {
  color: var(--muted);
}

.thinking-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 18px;
  padding: 10px 13px;
  color: var(--muted);
  background: #fff7fb;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.95rem;
}

.thinking-box[hidden] {
  display: none;
}

.thinking-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(217, 45, 127, 0.18);
  border-top-color: var(--pink);
  border-radius: 50%;
  animation: spinThinking 900ms linear infinite;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--pink-dark);
  font-size: 0.8rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.copy-button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--pink-dark);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.logout-button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--pink-dark);
  background: #fff;
  border: 1px solid var(--line);
}

.result-meta {
  position: absolute;
  right: 16px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 760;
}

.result-meta span {
  padding: 4px 8px;
  background: #fff7fb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.result-text {
  color: #332b35;
  white-space: normal;
  overflow-wrap: break-word;
  font-size: 1.06rem;
  line-height: 1.82;
}

.result-text h3 {
  margin: 22px 0 12px;
  color: #171219;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.42rem;
  line-height: 1.25;
}

.result-text h3:first-child {
  margin-top: 0;
}

.result-text p {
  margin: 0 0 20px;
}

.result-text p:last-child {
  margin-bottom: 0;
}

.result-text strong {
  color: #171219;
  font-weight: 800;
}

.result-text ul {
  margin: 0 0 20px 22px;
  padding: 0;
}

.result-text li {
  margin: 0 0 10px;
  padding-left: 4px;
  line-height: 1.75;
}

.neural-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.72;
}

.neural-field::before,
.neural-field::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 260px;
  border: 1px solid rgba(217, 45, 127, 0.12);
  border-radius: 8px;
  transform: rotate(-12deg);
}

.neural-field::before {
  top: 8%;
  left: 5%;
  background:
    linear-gradient(115deg, transparent 0 49%, rgba(217, 45, 127, 0.18) 49% 50%, transparent 50% 100%),
    linear-gradient(25deg, transparent 0 58%, rgba(88, 168, 151, 0.14) 58% 59%, transparent 59% 100%);
}

.neural-field::after {
  right: 4%;
  bottom: 8%;
  background:
    linear-gradient(65deg, transparent 0 42%, rgba(217, 45, 127, 0.16) 42% 43%, transparent 43% 100%),
    linear-gradient(135deg, transparent 0 62%, rgba(230, 104, 126, 0.16) 62% 63%, transparent 63% 100%);
}

.node {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid var(--pink);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 6px rgba(217, 45, 127, 0.08);
  animation: pulseNode 3.8s ease-in-out infinite;
}

.node-a {
  top: 17%;
  left: 15%;
}

.node-b {
  top: 30%;
  right: 18%;
  border-color: var(--mint);
  box-shadow: 0 0 0 6px rgba(88, 168, 151, 0.08);
  animation-delay: 0.8s;
}

.node-c {
  bottom: 23%;
  left: 22%;
  animation-delay: 1.3s;
}

.node-d {
  right: 12%;
  bottom: 18%;
  border-color: var(--coral);
  box-shadow: 0 0 0 6px rgba(230, 104, 126, 0.08);
  animation-delay: 2s;
}

@keyframes floatBrain {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

@keyframes pulseNode {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.58;
  }

  50% {
    transform: scale(1.28);
    opacity: 1;
  }
}

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

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .app-shell {
    align-items: start;
    padding-top: 44px;
    overflow: visible;
  }

  .brand-mark {
    width: 56px;
    height: 56px;
  }

  .brand-mark svg {
    width: 36px;
    height: 36px;
  }

  h1 {
    margin-bottom: 24px;
    font-size: clamp(2.7rem, 14vw, 3.7rem);
  }

  .composer {
    padding: 16px;
  }

  .composer-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .send-button {
    width: 100%;
  }

  .neural-field::before,
  .neural-field::after {
    width: 240px;
    height: 160px;
  }
}
