html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

.chat-page {
  --chat-bg: #06070b;
  --chat-surface: rgba(10, 12, 18, 0.88);
  --chat-line: rgba(228, 206, 164, 0.16);
  --chat-line-strong: rgba(233, 212, 170, 0.28);
  --chat-text: #f5efe3;
  --chat-muted: rgba(245, 239, 227, 0.62);
  --chat-accent: #d6b278;
  min-height: 100vh;
  height: 100vh;
  min-height: 100svh;
  height: 100svh;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background:
    radial-gradient(circle at top, rgba(124, 98, 48, 0.14), transparent 28%),
    radial-gradient(circle at 50% 58%, rgba(56, 83, 61, 0.16), transparent 24%),
    linear-gradient(180deg, #07080c 0%, #050609 100%);
  overflow: clip;
}

.chat-page .topbar {
  position: relative;
  z-index: 5;
  margin-bottom: 0;
  width: 100%;
  padding: 8px clamp(16px, 2.4vw, 28px);
  border: none;
  border-radius: 0;
  background: rgba(5, 6, 9, 0.92);
  box-shadow: none;
  backdrop-filter: blur(18px);
}

.chat-page .brand {
  gap: 10px;
  flex: 0 0 auto;
  margin-left: 18px;
  font-size: 21px;
  letter-spacing: -0.03em;
}

.chat-page .brand--wordmark {
  display: inline-flex;
  align-items: center;
  font-family: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  color: var(--chat-text);
  font-weight: 600;
  line-height: 1;
  text-transform: none;
  white-space: nowrap;
}

.chat-page .brand-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  object-fit: contain;
}

.chat-page .brand--wordmark span {
  display: block;
  max-width: none;
  white-space: nowrap;
}

.chat-page .nav {
  gap: clamp(18px, 2.2vw, 34px);
  padding: 0;
  border: none;
  background: transparent;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.chat-page .nav::-webkit-scrollbar {
  display: none;
}

.chat-page .nav--minimal a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: auto;
  padding: 3px 0 7px;
  border: none;
  border-radius: 0;
  color: var(--chat-text);
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  box-shadow: none;
  transition: color 0.22s ease;
}

.chat-page .nav--minimal a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  height: 1px;
  transform: scaleX(0);
  transform-origin: center;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 212, 118, 0) 0%, rgba(255, 232, 181, 0.98) 50%, rgba(255, 212, 118, 0) 100%);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.chat-page .nav--minimal a.is-active {
  color: #f1cf86;
}

.chat-page .nav--minimal .nav-account {
  color: var(--chat-text);
}

.chat-page .nav--minimal a:hover {
  color: #fff7eb;
}

.chat-page .nav--minimal a:hover::after,
.chat-page .nav--minimal a.is-active::after {
  transform: scaleX(1);
  opacity: 1;
}

.chat-stage {
  position: relative;
  min-height: 0;
  height: 100%;
  padding: clamp(16px, 2.4vw, 24px) clamp(14px, 3vw, 24px) clamp(14px, 2.4vw, 20px);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 14px;
  overflow: hidden;
}

.chat-stage-glow {
  position: absolute;
  width: 26rem;
  height: 26rem;
  border-radius: 50%;
  filter: blur(24px);
  pointer-events: none;
  opacity: 0.44;
}

.chat-stage-glow--left {
  top: 16%;
  left: -10rem;
  background: radial-gradient(circle, rgba(197, 167, 103, 0.18), rgba(197, 167, 103, 0));
}

.chat-stage-glow--right {
  right: -8rem;
  bottom: 18%;
  background: radial-gradient(circle, rgba(57, 102, 77, 0.24), rgba(57, 102, 77, 0));
}

.chat-table-scene {
  position: relative;
  z-index: 1;
  align-self: center;
  justify-self: center;
  width: min(100%, 980px);
  display: grid;
  gap: 12px;
  justify-items: center;
  min-height: 0;
}

.chat-stage-kicker {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--chat-muted);
}

.chat-table {
  position: relative;
  width: min(100%, 860px);
  min-height: clamp(240px, 34vw, 390px);
  max-height: 100%;
  border: 1px solid var(--chat-line);
  border-radius: 30px;
  background:
    radial-gradient(circle at 50% 48%, rgba(32, 74, 55, 0.52), rgba(14, 29, 24, 0.94) 52%, rgba(8, 14, 16, 0.98) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 0 0 1px rgba(255, 240, 214, 0.02),
    0 26px 80px rgba(0, 0, 0, 0.34);
  overflow: hidden;
  touch-action: none;
}

.chat-table::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(234, 217, 184, 0.08);
  border-radius: 22px;
  pointer-events: none;
}

.chat-table::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 28%),
    radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.22) 82%);
  pointer-events: none;
}

.chat-table-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(170px, 22vw, 240px);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(232, 214, 178, 0.16);
  box-shadow:
    0 0 0 18px rgba(232, 214, 178, 0.04),
    0 0 40px rgba(236, 213, 164, 0.06);
}

.chat-cards {
  position: absolute;
  inset: 0;
  padding: 24px;
  pointer-events: none;
  isolation: isolate;
}

.chat-card-back {
  position: absolute;
  left: 0;
  top: 0;
  width: clamp(76px, 7vw, 94px);
  aspect-ratio: 0.64;
  border-radius: 12px;
  border: 1px solid rgba(239, 219, 180, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)),
    url("/assets/tarot/new design/taror card.png");
  background-size: cover;
  background-position: center;
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.22),
    0 0 0 1px rgba(255, 250, 235, 0.03);
  transform: translate3d(0, 0, 0);
  transform-origin: center center;
  will-change: transform;
  z-index: var(--card-layer);
}

.chat-card-back::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 28%, rgba(0, 0, 0, 0.08));
  mix-blend-mode: screen;
  opacity: 0.26;
}

.chat-card-back::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 244, 216, 0.12);
}

.chat-card-back + .chat-card-back {
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.2),
    -1px 0 0 rgba(255, 241, 214, 0.08),
    0 0 0 1px rgba(255, 250, 235, 0.03);
}

.chat-compose {
  position: relative;
  z-index: 2;
  width: min(100%, 980px);
  justify-self: center;
}

.chat-compose-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--chat-line-strong);
  border-radius: 22px;
  background: var(--chat-surface);
  box-shadow:
    0 18px 60px rgba(0, 0, 0, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
}

.chat-compose textarea {
  width: 100%;
  min-height: 52px;
  max-height: 120px;
  padding: 14px 16px;
  border: none;
  resize: none;
  outline: none;
  background: transparent;
  color: var(--chat-text);
  font: inherit;
  font-size: 0.96rem;
  line-height: 1.45;
}

.chat-compose textarea::placeholder {
  color: var(--chat-muted);
}

.chat-submit {
  min-width: 118px;
  height: 52px;
  padding: 0 18px;
  border: 1px solid rgba(232, 208, 161, 0.24);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(228, 204, 158, 0.14), rgba(228, 204, 158, 0.06));
  color: var(--chat-text);
  font: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.chat-submit:hover {
  transform: translateY(-1px);
  border-color: rgba(232, 208, 161, 0.38);
  background: linear-gradient(180deg, rgba(228, 204, 158, 0.2), rgba(228, 204, 158, 0.08));
}

.chat-submit:active {
  transform: translateY(0);
}

.chat-table.is-awaiting .chat-table-ring {
  box-shadow:
    0 0 0 18px rgba(232, 214, 178, 0.05),
    0 0 56px rgba(236, 213, 164, 0.12);
}

@media (prefers-reduced-motion: reduce) {
  .chat-card-back {
    will-change: auto;
  }
}

@media (max-width: 900px) {
  .chat-page .topbar {
    padding: 8px 12px;
  }

  .chat-page .brand {
    margin-left: 0;
    font-size: 18px;
  }

  .chat-page .nav {
    gap: 12px;
  }

  .chat-stage {
    padding: 12px;
    gap: 12px;
  }

  .chat-table {
    min-height: min(42vh, 320px);
    border-radius: 24px;
  }

  .chat-cards {
    padding: 18px;
  }

  .chat-compose-shell {
    grid-template-columns: 1fr;
  }

  .chat-submit {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .chat-stage {
    gap: 10px;
    padding: 10px 10px max(10px, env(safe-area-inset-bottom));
  }

  .chat-stage-kicker {
    font-size: 0.62rem;
    letter-spacing: 0.22em;
    text-align: center;
  }

  .chat-table {
    min-height: min(38vh, 240px);
  }

  .chat-cards {
    padding: 16px;
  }

  .chat-card-back {
    width: min(17vw, 68px);
    border-radius: 10px;
  }

  .chat-compose textarea {
    min-height: 48px;
    max-height: 96px;
    padding: 12px 14px;
  }

  .chat-submit {
    height: 48px;
    border-radius: 14px;
  }
}
