
/* PERUZA AI V20 — COZY INTERFACE */

body[data-page="ai"] {
  --ai-cream: #eff5dc;
  --ai-lime: #d9ee9e;
  --ai-mint: #9fd6ad;
  --ai-warm: #f0cf8d;
  --ai-ink: #07110c;
  --ai-panel: rgba(10, 28, 19, 0.82);
  --ai-panel-soft: rgba(16, 39, 27, 0.72);
}

body[data-page="ai"] .ai-page,
body[data-page="ai"] .ai-page * {
  box-sizing: border-box;
}

body[data-page="ai"] .ai-page {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  overflow: hidden;
  padding: 132px 5vw 120px;
  isolation: isolate;
}

body[data-page="ai"] .ai-page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -5;
  background:
    radial-gradient(circle at 18% 8%, rgba(180, 224, 176, 0.10), transparent 30%),
    radial-gradient(circle at 88% 22%, rgba(240, 207, 141, 0.07), transparent 27%),
    linear-gradient(180deg, rgba(8, 20, 14, 0.15), rgba(4, 13, 8, 0.56));
  pointer-events: none;
}

.ai-ambient {
  position: absolute;
  inset: 0;
  z-index: -4;
  overflow: hidden;
  pointer-events: none;
}

.ai-ambient__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(85px);
  opacity: 0.16;
}

.ai-ambient__glow--one {
  width: 420px;
  height: 420px;
  top: 110px;
  left: -170px;
  background: #a8dcae;
}

.ai-ambient__glow--two {
  width: 360px;
  height: 360px;
  right: -130px;
  bottom: 80px;
  background: #d6bc7c;
}

.ai-ambient__grain {
  position: absolute;
  inset: 0;
  opacity: 0.025;
  background-image:
    radial-gradient(circle at 20% 30%, #fff 0 0.7px, transparent 0.8px),
    radial-gradient(circle at 70% 65%, #fff 0 0.7px, transparent 0.8px);
  background-size: 31px 31px, 37px 37px;
}

.ai-welcome,
.ai-room {
  width: min(1280px, 100%);
  margin-inline: auto;
}

.ai-welcome {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 36px;
  align-items: end;
  margin-bottom: 34px;
}

.ai-welcome__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: rgba(232, 242, 225, 0.62);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.ai-welcome__spark {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ai-lime);
  box-shadow:
    0 0 0 5px rgba(217, 238, 158, 0.06),
    0 0 18px rgba(217, 238, 158, 0.55);
}

.ai-welcome h1 {
  max-width: 850px;
  margin: 18px 0 16px;
  color: #f4f6f0;
  font-size: clamp(44px, 6vw, 82px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.ai-welcome h1 span {
  color: var(--ai-lime);
}

.ai-welcome__copy > p {
  max-width: 720px;
  margin: 0;
  color: rgba(221, 231, 223, 0.68);
  font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.7;
}

.ai-welcome__note {
  min-width: 255px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px 18px;
  border: 1px solid rgba(217, 238, 158, 0.12);
  border-radius: 18px;
  background: rgba(11, 28, 19, 0.56);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(18px);
}

.ai-welcome__note-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #9adf9d;
  box-shadow: 0 0 18px rgba(154, 223, 157, 0.55);
}

.ai-welcome__note div {
  display: grid;
  gap: 3px;
}

.ai-welcome__note b {
  color: #eef4e8;
  font-size: 12px;
}

.ai-welcome__note small {
  color: rgba(217, 227, 219, 0.50);
  font-size: 9px;
  line-height: 1.45;
}

.ai-room {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(560px, 1.55fr);
  gap: 22px;
  align-items: stretch;
}

.ai-corner,
.ai-chat--cozy {
  border: 1px solid rgba(217, 238, 158, 0.12);
  border-radius: 30px;
  background:
    linear-gradient(145deg, rgba(18, 43, 29, 0.84), rgba(7, 20, 13, 0.88));
  box-shadow:
    0 32px 100px rgba(0, 0, 0, 0.28),
    inset 0 1px rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(24px);
}

.ai-corner {
  min-height: 660px;
  display: flex;
  flex-direction: column;
  padding: 30px;
}

.ai-corner__label {
  display: block;
  margin-bottom: 12px;
  color: rgba(217, 238, 158, 0.58);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.ai-corner h2 {
  max-width: 330px;
  margin: 0;
  color: #eef3ec;
  font-size: clamp(25px, 2.4vw, 34px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.ai-topic-grid {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.ai-topic-card {
  width: 100%;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 13px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.026);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.22s ease,
    border-color 0.22s ease,
    background 0.22s ease;
}

.ai-topic-card:hover {
  transform: translateY(-2px);
  border-color: rgba(217, 238, 158, 0.20);
  background: rgba(217, 238, 158, 0.055);
}

.ai-topic-card__icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(217, 238, 158, 0.14);
  border-radius: 13px;
  background:
    linear-gradient(145deg, rgba(217, 238, 158, 0.14), rgba(217, 238, 158, 0.035));
  color: var(--ai-lime);
  font-size: 14px;
  font-weight: 900;
}

.ai-topic-card > span:last-child {
  display: grid;
  gap: 4px;
}

.ai-topic-card b {
  color: #e9efe7;
  font-size: 12px;
}

.ai-topic-card small {
  color: rgba(215, 225, 216, 0.50);
  font-size: 9px;
  line-height: 1.45;
}

.ai-corner__tip {
  margin-top: 24px;
  padding: 16px;
  border-left: 2px solid rgba(240, 207, 141, 0.46);
  border-radius: 0 14px 14px 0;
  background: rgba(240, 207, 141, 0.035);
}

.ai-corner__tip span {
  color: rgba(240, 207, 141, 0.72);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ai-corner__tip p {
  margin: 7px 0 0;
  color: rgba(224, 232, 224, 0.56);
  font-size: 10px;
  line-height: 1.55;
}

.ai-clear--cozy {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding: 0 16px;
  border: 1px solid rgba(217, 238, 158, 0.10);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.025);
  color: rgba(224, 233, 224, 0.68);
  font: inherit;
  font-size: 10px;
  cursor: pointer;
  transition: 0.2s ease;
}

.ai-clear--cozy:hover {
  border-color: rgba(217, 238, 158, 0.24);
  color: #edf3e9;
  background: rgba(217, 238, 158, 0.045);
}

.ai-clear--cozy i {
  font-style: normal;
  font-size: 15px;
}

.ai-chat--cozy {
  min-height: 660px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ai-chat__head--cozy {
  min-height: 78px;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(217, 238, 158, 0.09);
  background: rgba(6, 18, 11, 0.18);
}

.ai-avatar--cozy {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(217, 238, 158, 0.20);
  border-radius: 15px;
  background:
    radial-gradient(circle at 35% 30%, rgba(217, 238, 158, 0.25), transparent 38%),
    linear-gradient(145deg, #294c34, #10241a);
  color: #efffc9;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.ai-chat__identity {
  display: grid;
  gap: 5px;
}

.ai-chat__identity > b {
  color: #edf3e9;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.ai-chat__identity small {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(217, 227, 219, 0.50);
  font-size: 9px;
}

.ai-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #78847b;
}

.ai-chat[data-ready="1"] .ai-status-dot {
  background: #9ee09c;
  box-shadow: 0 0 14px rgba(158, 224, 156, 0.65);
}

.ai-chat[data-ready="error"] .ai-status-dot {
  background: #f18a80;
}

.ai-limit {
  padding: 8px 11px;
  border: 1px solid rgba(217, 238, 158, 0.10);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.018);
  color: rgba(217, 227, 219, 0.46);
  font-size: 8px;
  white-space: nowrap;
}

.ai-messages--cozy {
  flex: 1;
  min-height: 390px;
  max-height: 545px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 24px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(217, 238, 158, 0.16) transparent;
}

.ai-message {
  width: min(82%, 700px);
  display: grid;
  gap: 6px;
}

.ai-message--user {
  align-self: flex-end;
}

.ai-message__label {
  color: rgba(217, 227, 219, 0.38);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.ai-message--user .ai-message__label {
  text-align: right;
}

.ai-message p {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 18px 18px 18px 6px;
  background: rgba(255, 255, 255, 0.032);
  color: rgba(235, 241, 234, 0.90);
  font-size: 13px;
  line-height: 1.67;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.10);
}

.ai-message--assistant p {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.038), rgba(255, 255, 255, 0.020));
}

.ai-message--user p {
  border-radius: 18px 18px 6px 18px;
  border-color: rgba(217, 238, 158, 0.16);
  background:
    linear-gradient(145deg, rgba(217, 238, 158, 0.13), rgba(217, 238, 158, 0.075));
  color: #f1f6ed;
}

.ai-message--welcome {
  width: min(88%, 620px);
}

.ai-message--welcome p {
  color: rgba(235, 241, 234, 0.78);
}

.ai-message--typing p {
  color: rgba(217, 227, 219, 0.48);
  animation: ai-soft-pulse 1.35s ease-in-out infinite;
}

@keyframes ai-soft-pulse {
  50% {
    opacity: 0.45;
  }
}

.ai-suggestions--cozy {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 20px 13px;
  scrollbar-width: none;
}

.ai-suggestions--cozy button {
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 1px solid rgba(217, 238, 158, 0.10);
  border-radius: 999px;
  background: rgba(217, 238, 158, 0.030);
  color: rgba(220, 230, 221, 0.58);
  font: inherit;
  font-size: 9px;
  cursor: pointer;
  transition: 0.2s ease;
}

.ai-suggestions--cozy button:hover {
  border-color: rgba(217, 238, 158, 0.24);
  color: #edf3e8;
  background: rgba(217, 238, 158, 0.060);
}

.ai-composer--cozy {
  padding: 15px 18px 17px;
  border-top: 1px solid rgba(217, 238, 158, 0.09);
  background:
    linear-gradient(180deg, rgba(5, 15, 9, 0.18), rgba(4, 13, 8, 0.42));
}

.ai-composer__box--cozy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 7px;
  border: 1px solid rgba(217, 238, 158, 0.14);
  border-radius: 18px;
  background: rgba(13, 33, 22, 0.82);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.020),
    0 14px 36px rgba(0, 0, 0, 0.14);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.ai-composer__box--cozy:focus-within {
  border-color: rgba(217, 238, 158, 0.38);
  box-shadow:
    0 0 0 3px rgba(217, 238, 158, 0.050),
    0 14px 36px rgba(0, 0, 0, 0.16);
}

.ai-composer--cozy textarea {
  width: 100%;
  min-height: 48px;
  max-height: 160px;
  resize: none;
  padding: 13px 12px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #edf3e9;
  font: inherit;
  font-size: 13px;
  line-height: 1.55;
}

.ai-composer--cozy textarea::placeholder {
  color: rgba(217, 227, 219, 0.34);
}

.ai-send--cozy {
  min-width: 116px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  background:
    linear-gradient(135deg, #e3f5aa, #cfe88c);
  color: #0b170f;
  font: inherit;
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
  box-shadow:
    0 12px 28px rgba(157, 190, 96, 0.18),
    inset 0 1px rgba(255, 255, 255, 0.45);
  transition:
    transform 0.2s ease,
    filter 0.2s ease;
}

.ai-send--cozy:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.ai-send--cozy:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.ai-send--cozy i {
  font-style: normal;
  font-size: 15px;
}

.ai-composer__meta--cozy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 3px 0;
  color: rgba(217, 227, 219, 0.34);
  font-size: 8px;
}

.ai-error {
  min-height: 14px;
  margin: 8px 3px 0;
  color: #f09a91;
  font-size: 10px;
}

.ai-garland {
  position: absolute;
  left: 50%;
  bottom: 18px;
  width: min(1180px, 90vw);
  height: 62px;
  transform: translateX(-50%);
  z-index: -1;
  opacity: 0.42;
  pointer-events: none;
}

.ai-garland__wire {
  position: absolute;
  left: 0;
  right: 0;
  top: 17px;
  height: 26px;
  border-top: 1px solid rgba(221, 231, 219, 0.13);
  border-radius: 50%;
  transform: rotate(-0.4deg);
}

.ai-garland i {
  position: absolute;
  left: var(--x);
  top: 24px;
  width: 6px;
  height: 8px;
  border-radius: 50% 50% 45% 45%;
  background: rgba(240, 207, 141, 0.60);
  box-shadow:
    0 0 8px rgba(240, 207, 141, 0.30),
    0 0 18px rgba(240, 207, 141, 0.16);
  animation: ai-garland-breathe 4.8s ease-in-out infinite;
  animation-delay: var(--delay);
}

.ai-garland i:nth-of-type(3n) {
  background: rgba(201, 232, 161, 0.62);
  box-shadow:
    0 0 8px rgba(201, 232, 161, 0.28),
    0 0 18px rgba(201, 232, 161, 0.14);
}

.ai-garland i::before {
  content: "";
  position: absolute;
  left: 2px;
  top: -7px;
  width: 1px;
  height: 7px;
  background: rgba(221, 231, 219, 0.17);
}

@keyframes ai-garland-breathe {
  0%,
  100% {
    opacity: 0.34;
    transform: translateY(0) scale(0.92);
  }
  50% {
    opacity: 0.78;
    transform: translateY(1px) scale(1.06);
  }
}

@media (max-width: 980px) {
  body[data-page="ai"] .ai-page {
    padding-top: 116px;
  }

  .ai-welcome {
    grid-template-columns: 1fr;
  }

  .ai-welcome__note {
    display: none;
  }

  .ai-room {
    grid-template-columns: 1fr;
  }

  .ai-chat--cozy {
    order: 1;
  }

  .ai-corner {
    order: 2;
    min-height: auto;
  }

  .ai-clear--cozy {
    margin-top: 24px;
  }
}

@media (max-width: 640px) {
  body[data-page="ai"] .ai-page {
    padding:
      104px
      14px
      94px;
  }

  .ai-welcome {
    margin-bottom: 24px;
  }

  .ai-welcome h1 {
    font-size: 42px;
  }

  .ai-welcome__copy > p {
    font-size: 14px;
    line-height: 1.65;
  }

  .ai-corner,
  .ai-chat--cozy {
    border-radius: 22px;
  }

  .ai-chat--cozy {
    min-height: 620px;
  }

  .ai-chat__head--cozy {
    grid-template-columns: 42px 1fr;
    padding: 13px;
  }

  .ai-limit {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .ai-messages--cozy {
    min-height: 340px;
    max-height: 480px;
    padding: 15px;
  }

  .ai-message {
    width: 92%;
  }

  .ai-message p {
    padding: 13px 14px;
    font-size: 12px;
  }

  .ai-suggestions--cozy {
    padding:
      0
      13px
      11px;
  }

  .ai-composer--cozy {
    padding: 12px;
  }

  .ai-composer__box--cozy {
    grid-template-columns: 1fr 48px;
  }

  .ai-send--cozy {
    min-width: 48px;
    width: 48px;
    padding: 0;
  }

  .ai-send--cozy span {
    display: none;
  }

  .ai-composer__meta--cozy span:last-child {
    display: none;
  }

  .ai-corner {
    padding: 21px;
  }

  .ai-topic-card {
    grid-template-columns: 39px 1fr;
  }

  .ai-topic-card__icon {
    width: 39px;
    height: 39px;
  }

  .ai-garland {
    bottom: 10px;
    opacity: 0.30;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-garland i,
  .ai-message--typing p {
    animation: none !important;
  }

  .ai-topic-card,
  .ai-send--cozy {
    transition: none !important;
  }
}
