:root {
  color-scheme: light;
  --chat-paper: #f7f7f5;
  --chat-ink: #101010;
  --chat-muted: #6f6f6b;
  --chat-line: #deded8;
  --chat-soft: #ffffff;
  --chat-press: #ededeb;
  --chat-shadow: 0 18px 44px rgba(18, 18, 18, 0.08);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body.chat-standalone {
  margin: 0;
  overflow: hidden;
  background: var(--chat-paper);
  color: var(--chat-ink);
  font-family:
    Inter, "Pretendard", "Noto Sans KR", "Noto Sans SC", "Microsoft YaHei",
    sans-serif;
  letter-spacing: 0;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

:where(.chat-root, body.chat-standalone) button {
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  background: transparent;
}

[hidden] {
  display: none !important;
}

.chat-root {
  position: fixed;
  inset: 0;
  z-index: 4;
  background: var(--chat-paper);
  color: var(--chat-ink);
  font-family:
    Inter, "Pretendard", "Noto Sans KR", "Noto Sans SC", "Microsoft YaHei",
    sans-serif;
  letter-spacing: 0;
}

.chat-root[hidden] {
  display: none !important;
}

.chat-shell {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(100%, 480px);
  margin: 0 auto;
  padding:
    max(12px, env(safe-area-inset-top))
    calc(env(safe-area-inset-right) + 18px)
    calc(env(safe-area-inset-bottom) + 14px)
    calc(env(safe-area-inset-left) + 18px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(247, 247, 245, 0.96) 38%),
    var(--chat-paper);
  opacity: 0;
  transform: translateY(18px) scale(0.985);
  transition:
    opacity 360ms ease,
    transform 440ms cubic-bezier(0.18, 0.88, 0.2, 1);
}

:where(.chat-root.is-chat-ready, body.chat-standalone.is-chat-ready) .chat-shell {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.chat-topbar,
.chat-tabbar,
.chat-view {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 360ms ease,
    transform 440ms cubic-bezier(0.18, 0.88, 0.2, 1);
}

:where(.chat-root.is-chat-ready, body.chat-standalone.is-chat-ready) .chat-topbar,
:where(.chat-root.is-chat-ready, body.chat-standalone.is-chat-ready) .chat-tabbar,
:where(.chat-root.is-chat-ready, body.chat-standalone.is-chat-ready) .chat-view.is-active {
  opacity: 1;
  transform: translateY(0);
}

:where(.chat-root.is-chat-ready, body.chat-standalone.is-chat-ready) .chat-topbar {
  transition-delay: 40ms;
}

:where(.chat-root.is-chat-ready, body.chat-standalone.is-chat-ready) .chat-view.is-active {
  transition-delay: 90ms;
}

:where(.chat-root.is-chat-ready, body.chat-standalone.is-chat-ready) .chat-tabbar {
  transition-delay: 150ms;
}

.chat-topbar {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 12px;
  min-height: 56px;
}

.chat-icon-button {
  display: grid;
  width: 42px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid var(--chat-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition:
    background 150ms ease,
    transform 150ms ease;
}

.chat-icon-button:disabled {
  cursor: default;
  opacity: 0.34;
}

.chat-icon-button:not(:disabled):active {
  background: var(--chat-press);
  transform: scale(0.96);
}

.chat-icon-button svg,
.chat-tab svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}

.chat-title {
  min-width: 0;
  text-align: center;
}

.chat-title p {
  margin: 0 0 2px;
  color: var(--chat-muted);
  font-size: 0.64rem;
  font-weight: 850;
  line-height: 1;
}

.chat-title h1 {
  margin: 0;
  overflow: hidden;
  font-size: 1.02rem;
  font-weight: 850;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-view {
  position: relative;
  display: grid;
  min-height: 0;
  place-items: center;
  padding: 24px 0;
}

.chat-placeholder {
  display: grid;
  justify-items: center;
  gap: 7px;
  width: min(100%, 300px);
  padding: 0 18px;
  text-align: center;
}

.chat-placeholder-kicker {
  color: var(--chat-muted);
  font-size: 0.67rem;
  font-weight: 850;
  line-height: 1;
}

.chat-placeholder h2 {
  margin: 0;
  font-size: clamp(2.2rem, 14vw, 4.8rem);
  font-weight: 900;
  line-height: 0.96;
}

.chat-placeholder p {
  margin: 0;
  color: var(--chat-muted);
  font-size: 0.92rem;
  font-weight: 750;
}

.chat-hero {
  position: absolute;
  inset: 14% 16% auto;
  height: min(36vw, 150px);
  pointer-events: none;
}

.chat-hero span {
  position: absolute;
  display: block;
  border: 1.5px solid var(--chat-ink);
  background: var(--chat-soft);
  box-shadow: var(--chat-shadow);
}

.chat-hero span:nth-child(1) {
  top: 0;
  left: 0;
  width: 58%;
  height: 40%;
  border-radius: 22px 22px 22px 6px;
}

.chat-hero span:nth-child(2) {
  right: 0;
  bottom: 14%;
  width: 48%;
  height: 36%;
  border-radius: 22px 22px 6px;
}

.chat-hero span:nth-child(3) {
  left: 26%;
  bottom: 0;
  width: 22px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--chat-ink);
  box-shadow: none;
}

.activity-placeholder-stack,
.contact-placeholder-list {
  position: absolute;
  inset: 18% 10% auto;
  display: grid;
  gap: 12px;
  pointer-events: none;
}

.activity-placeholder-stack {
  inset-inline: 13%;
}

.activity-placeholder-stack span {
  display: block;
  height: 48px;
  border: 1.5px solid var(--chat-line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 25px 50%, var(--chat-ink) 0 7px, transparent 8px),
    linear-gradient(90deg, transparent 0 48px, var(--chat-line) 49px 50px, transparent 51px),
    linear-gradient(90deg, transparent 66px, rgba(16, 16, 16, 0.12) 67px 72%, transparent 72%),
    var(--chat-soft);
}

.activity-placeholder-stack span:nth-child(2) {
  margin-left: 18px;
}

.activity-placeholder-stack span:nth-child(3) {
  margin-right: 24px;
}

.contact-placeholder-list span {
  display: block;
  height: 52px;
  border: 1.5px solid var(--chat-line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 26px 50%, var(--chat-ink) 0 8px, transparent 9px),
    linear-gradient(90deg, transparent 0 50px, var(--chat-line) 51px 52px, transparent 53px),
    var(--chat-soft);
}

.home-placeholder-mark {
  position: absolute;
  top: 18%;
  display: grid;
  width: min(56vw, 190px);
  aspect-ratio: 1;
  place-items: center;
  pointer-events: none;
}

.home-placeholder-mark::before,
.home-placeholder-mark::after,
.home-placeholder-mark span {
  position: absolute;
  border: 1.5px solid var(--chat-ink);
  content: "";
}

.home-placeholder-mark::before {
  width: 58%;
  height: 58%;
  transform: rotate(45deg);
  background: var(--chat-soft);
}

.home-placeholder-mark::after {
  bottom: 18%;
  width: 44%;
  height: 28%;
  border-top: 0;
  background: var(--chat-paper);
}

.home-placeholder-mark span {
  bottom: 18%;
  width: 12%;
  height: 18%;
  border-bottom: 0;
  background: var(--chat-soft);
  z-index: 1;
}

.chat-tabbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  min-height: 72px;
  padding: 8px;
  border: 1px solid var(--chat-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--chat-shadow);
}

.chat-tab {
  display: grid;
  min-width: 0;
  min-height: 56px;
  place-items: center;
  gap: 4px;
  border-radius: 8px;
  color: var(--chat-muted);
  cursor: pointer;
  transition:
    background 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

.chat-tab span {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-tab.is-active {
  background: var(--chat-ink);
  color: #fff;
}

.chat-tab:active {
  transform: scale(0.97);
}

@media (max-height: 620px) {
  .chat-placeholder h2 {
    font-size: clamp(2rem, 11vw, 3.4rem);
  }

  .chat-hero,
  .activity-placeholder-stack,
  .contact-placeholder-list,
  .home-placeholder-mark {
    opacity: 0.18;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-shell,
  .chat-topbar,
  .chat-tabbar,
  .chat-view {
    transition-duration: 1ms;
  }
}
