:root {
  color-scheme: light;
  --bg: #f2efe6;
  --ink: #1f2428;
  --muted: #6f7478;
  --line: #d9d3c2;
  --chat-bg: #b8c8d8;
  --incoming: #ffffff;
  --outgoing: #fee94e;
  --header: #3d454c;
  --accent: #ffd84d;
  --accent-dark: #574513;
  --shadow: 0 22px 70px rgba(34, 39, 44, 0.22);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  background:
    radial-gradient(circle at 15% 12%, rgba(255, 216, 77, 0.36), transparent 26%),
    linear-gradient(135deg, #f7f1dd 0%, #d7e1e8 52%, #f4eadc 100%);
  color: var(--ink);
  display: flex;
  flex-direction: column;
}

.app-shell {
  width: 100%;
  min-height: calc(100vh - 42px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.phone {
  width: min(440px, 100%);
  height: min(760px, calc(100vh - 92px));
  min-height: 560px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  overflow: hidden;
  border: 1px solid rgba(31, 36, 40, 0.12);
  border-radius: 28px;
  background: var(--chat-bg);
  box-shadow: var(--shadow);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 15px;
  color: #fff;
  background: var(--header);
}

.room-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--accent);
  color: var(--accent-dark);
  font-weight: 900;
  font-size: 20px;
}

.room-meta {
  min-width: 0;
  flex: 1;
}

.room-meta h1,
.room-meta p {
  margin: 0;
}

.room-meta h1 {
  font-size: 18px;
  line-height: 1.25;
}

.room-meta p {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #6df29a;
  box-shadow: 0 0 0 5px rgba(109, 242, 154, 0.13);
}

.notice {
  margin: 12px 14px 0;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
  color: rgba(20, 35, 45, 0.78);
  font-size: 12px;
  text-align: center;
}

.messages {
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px 18px;
  scroll-behavior: smooth;
}

.message {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.system-message {
  justify-content: center;
}

.system-message span {
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(41, 55, 66, 0.18);
  color: rgba(24, 34, 43, 0.72);
  font-size: 12px;
}

.incoming {
  align-items: flex-start;
}

.outgoing {
  justify-content: flex-end;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #1e252b;
  font-weight: 800;
  font-size: 15px;
}

.avatar.amber {
  background: #ffc94a;
}

.avatar.teal {
  background: #62d8c8;
}

.avatar.rose {
  background: #f6a6b2;
}

.avatar.blue {
  background: #91bfff;
}

.bubble-wrap {
  max-width: min(72%, 300px);
}

.sender {
  margin: 0 0 4px 2px;
  color: rgba(18, 31, 42, 0.74);
  font-size: 12px;
  font-weight: 700;
}

.bubble {
  width: fit-content;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  line-height: 1.45;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 15px;
  box-shadow: 0 1px 1px rgba(31, 36, 40, 0.08);
}

.incoming .bubble {
  background: var(--incoming);
  border-top-left-radius: 4px;
}

.outgoing .bubble {
  background: var(--outgoing);
  border-top-right-radius: 4px;
}

.composer {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border-top: 1px solid rgba(31, 36, 40, 0.12);
  background: rgba(255, 255, 255, 0.88);
}

.composer input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  outline: none;
}

.composer input:focus {
  border-color: #9b8b25;
  box-shadow: 0 0 0 3px rgba(255, 216, 77, 0.28);
}

.icon-button,
.send-button {
  height: 42px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.icon-button {
  width: 40px;
  background: #eef1f3;
  color: #4d555c;
  font-size: 18px;
}

.send-button {
  padding: 0 15px;
  background: #2d343a;
  color: #fff;
}

.icon-button:hover,
.send-button:hover {
  filter: brightness(0.96);
}

footer {
  min-height: 42px;
  display: grid;
  place-items: center;
  padding: 9px 16px 14px;
  color: rgba(31, 36, 40, 0.62);
  font-size: 12px;
}

@media (max-width: 520px) {
  .app-shell {
    padding: 0;
    min-height: calc(100vh - 38px);
  }

  .phone {
    width: 100%;
    height: calc(100vh - 38px);
    min-height: 520px;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .bubble-wrap {
    max-width: 78%;
  }
}
