*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  color: #0f2744;
  background:
    radial-gradient(1200px 700px at 10% -10%, rgba(33, 150, 243, 0.28), transparent 55%),
    radial-gradient(900px 500px at 100% 100%, rgba(21, 101, 192, 0.22), transparent 50%),
    #e8f3fc;
}

.page {
  display: flex;
  min-height: 100dvh;
  padding: 0;
}

.brand {
  display: none;
  flex-direction: column;
  justify-content: center;
  padding: 48px 40px;
  color: #0f2744;
  max-width: 360px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 14px;
  color: #1565c0;
  margin-bottom: 20px;
}

.brand-mark img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: brightness(0) saturate(100%) invert(32%) sepia(86%) saturate(1843%) hue-rotate(194deg);
}

.brand h1 {
  margin: 0 0 12px;
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.brand p {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  color: #3d5570;
  max-width: 28ch;
}

.chat-stage {
  position: relative;
  flex: 1;
  min-height: 100dvh;
  min-height: 100svh;
  background: #fff;
}

/* Widget occupies the dedicated stage instead of a corner bubble */
#chat-stage #channel-chat-container,
#chat-stage #channel-chat-container.show {
  display: flex;
  position: absolute;
  inset: 0;
  right: 0;
  bottom: 0;
  left: 0;
  top: 0;
  width: auto;
  height: auto;
  max-height: none;
  max-width: none;
  border-radius: 0;
  box-shadow: none;
  z-index: 1;
}

#chat-stage #channel-chat-header {
  border-radius: 0;
  padding-top: calc(12px + env(safe-area-inset-top));
}

#chat-stage #channel-chat-input-area {
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

#chat-stage #channel-chat-widget,
#chat-stage #channel-chat-widget.chat-open {
  display: none;
}

#chat-stage #channel-chat-close {
  display: none;
}

#chat-stage #channel-chat-input {
  font-size: 16px;
}

/* Tablet */
@media (min-width: 720px) {
  .page {
    align-items: stretch;
    justify-content: center;
    gap: 32px;
    padding: 32px;
    padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  }

  .brand {
    display: flex;
    max-width: 280px;
    padding: 16px 8px;
  }

  .chat-stage {
    flex: 0 1 480px;
    min-height: 0;
    height: min(760px, calc(100dvh - 64px));
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(21, 101, 192, 0.16);
  }

  #chat-stage #channel-chat-container,
  #chat-stage #channel-chat-container.show {
    border-radius: 20px;
  }

  #chat-stage #channel-chat-header {
    border-radius: 20px 20px 0 0;
    padding-top: 12px;
  }

  #chat-stage #channel-chat-input-area {
    padding-bottom: 12px;
  }

  #chat-stage #channel-chat-input {
    font-size: 14px;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .page {
    gap: 56px;
    padding: 40px 64px;
  }

  .brand {
    max-width: 360px;
    padding: 24px 8px;
  }

  .chat-stage {
    flex-basis: 520px;
    height: min(800px, calc(100dvh - 80px));
  }
}

/* Phone landscape: keep the chat usable without a side column */
@media (max-height: 500px) and (orientation: landscape) {
  .brand {
    display: none;
  }

  .page {
    padding: 0;
  }

  .chat-stage {
    flex: 1;
    height: 100dvh;
    min-height: 100svh;
    border-radius: 0;
    box-shadow: none;
  }

  #chat-stage #channel-chat-container,
  #chat-stage #channel-chat-container.show {
    border-radius: 0;
  }

  #chat-stage #channel-chat-header {
    border-radius: 0;
    padding-top: calc(8px + env(safe-area-inset-top));
  }
}
