:root {
  --yellow: #fee054;
  --yellow-strong: #f6c944;
  --ink: #17191d;
  --muted: #72757d;
  --line: #e7e5df;
  --panel: #fbfaf7;
  --surface: #ffffff;
  --chat-bg: #cfdceb;
  --bubble: #ffffff;
  --me: #fee054;
  --accent: #2f7d6b;
  --danger: #f26b5e;
  --shadow: 0 18px 50px rgba(38, 42, 50, 0.16);
}

:root[data-theme="dark"] {
  --yellow: #f2c94c;
  --yellow-strong: #d9ad30;
  --ink: #f4f0e8;
  --muted: #aaa397;
  --line: #3b3833;
  --panel: #1f1d1a;
  --surface: #26231f;
  --chat-bg: #202a34;
  --bubble: #34312c;
  --me: #d3ad35;
  --accent: #79c6b1;
  --danger: #ff766b;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(254, 224, 84, 0.26), transparent 34rem),
    linear-gradient(135deg, #ece8df 0%, #e8edf0 45%, #f6f1e7 100%);
  color: var(--ink);
  font-family:
    Inter, Pretendard, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at top left, rgba(242, 201, 76, 0.16), transparent 34rem),
    linear-gradient(135deg, #161513 0%, #1f252a 50%, #191714 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
}

.login-gate {
  display: grid;
  min-height: 100%;
  place-items: center;
  padding: 1.5rem;
}

.login-gate[hidden] {
  display: none;
}

.login-card {
  width: min(100%, 25rem);
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0.35rem 0 0.65rem;
  font-size: 1.65rem;
  line-height: 1.28;
}

.login-card__description {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 0.8rem;
}

.login-form label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.app-shell {
  display: grid;
  grid-template-columns: 4.75rem minmax(18rem, 24rem) minmax(0, 1fr) minmax(15rem, 19rem);
  height: min(54rem, calc(100vh - 2rem));
  min-height: 42rem;
  margin: 1rem;
  overflow: hidden;
  border: 1px solid rgba(23, 25, 29, 0.1);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.app-shell[hidden] {
  display: none;
}

#callButton,
#pinButton,
#favoriteButton,
#clearChatButton,
#resetButton,
#replyPreview {
  display: none;
}

.message-sender {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--accent);
  font-size: 0.72rem;
}

.message-row--me .message-sender {
  color: color-mix(in srgb, var(--ink) 72%, transparent);
}

.message-text {
  white-space: pre-wrap;
}

.profile-handle {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
}

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0.7rem;
  background: #332e29;
  color: rgba(255, 255, 255, 0.72);
}

.rail__button,
.icon-button,
.round-action {
  display: grid;
  place-items: center;
  border: 0;
  color: inherit;
}

.rail__button {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 8px;
  background: transparent;
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.rail__button:hover,
.rail__button--active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.rail__button:active,
.icon-button:active,
.round-action:active {
  transform: scale(0.96);
}

.rail__button--bottom {
  margin-top: auto;
}

.rail__initial {
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 8px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 900;
}

.chat-list,
.profile-panel {
  background: var(--panel);
}

.chat-list {
  min-width: 0;
  border-right: 1px solid var(--line);
}

.panel-header,
.conversation__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 5.5rem;
  padding: 1.1rem 1.2rem;
}

.panel-header {
  justify-content: space-between;
}

.eyebrow {
  margin: 0 0 0.2rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.8rem;
  line-height: 1.1;
}

.icon-button {
  flex: 0 0 auto;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 8px;
  background: rgba(23, 25, 29, 0.06);
  color: var(--ink);
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.icon-button:hover {
  background: rgba(23, 25, 29, 0.11);
}

.search {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 1.2rem 0.85rem;
  padding: 0 0.8rem;
  height: 2.75rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 78%, var(--ink) 8%);
  color: var(--muted);
}

.room-search {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  height: 2.8rem;
  margin: 0.7rem 0.95rem 0;
  padding: 0 0.8rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
}

.room-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.search:focus-within {
  border-color: var(--yellow-strong);
  background: var(--surface);
}

.search input,
.composer input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin: 0 1.2rem 1rem;
}

.filter {
  height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
}

.filter--active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.rooms {
  height: calc(100% - 11.75rem);
  overflow-y: auto;
  padding: 0 0.75rem 1rem;
}

.room {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr) auto;
  gap: 0.8rem;
  width: 100%;
  min-height: 4.8rem;
  align-items: center;
  border: 0;
  border-radius: 8px;
  padding: 0.7rem;
  background: transparent;
  text-align: left;
}

.room:hover,
.room--active {
  background: var(--surface);
}

.friend__action {
  border: 0;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 850;
}

.friend__actions {
  display: flex;
  gap: 0.35rem;
}

.friend__action--muted {
  background: var(--surface);
}

.friend__action--danger {
  background: #f4d3d3;
  color: #8b2d2d;
}

.blocked-users {
  margin-top: 1.4rem;
  border-top: 1px solid rgba(23, 25, 29, 0.1);
  padding-top: 1rem;
}

.blocked-users h3 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.avatar {
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--avatar-bg, #d8ece4);
  color: var(--avatar-color, #18473c);
  font-weight: 900;
}

.room .avatar {
  width: 3.25rem;
  height: 3.25rem;
  font-size: 1.05rem;
}

.room__main {
  min-width: 0;
}

.room__top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.room__name {
  overflow: hidden;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pin {
  color: var(--yellow-strong);
  font-size: 0.82rem;
}

.room__preview {
  margin: 0.28rem 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.badge {
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.35rem;
  text-align: center;
}

.conversation {
  display: grid;
  min-width: 0;
  grid-template-rows: auto auto 1fr auto auto;
  background: var(--chat-bg);
}

.conversation__header {
  border-bottom: 1px solid rgba(23, 25, 29, 0.08);
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(18px);
}

.conversation__back {
  display: none;
}

.avatar--large {
  width: 3.1rem;
  height: 3.1rem;
}

.conversation__title {
  min-width: 0;
  margin-right: auto;
}

.conversation__title h2 {
  margin: 0 0 0.2rem;
  overflow: hidden;
  font-size: 1.08rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation__title p {
  margin-bottom: 0;
  color: #5c6874;
  font-size: 0.84rem;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow-y: auto;
  padding: 1.1rem clamp(1rem, 2vw, 1.65rem);
}

.messages--searching .message-row {
  opacity: 0.45;
}

.messages--searching .message-row.is-match {
  opacity: 1;
}

.day-chip {
  align-self: center;
  margin-bottom: 0.3rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  color: #62717d;
  font-size: 0.75rem;
  font-weight: 750;
}

.load-older-button {
  align-self: center;
  border: 1px solid rgba(23, 25, 29, 0.12);
  border-radius: 999px;
  padding: 0.42rem 0.8rem;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.load-older-button:hover:not(:disabled) {
  background: #fff;
  color: var(--ink);
}

.load-older-button:disabled,
.send-button:disabled,
.attach-button:has(input:disabled) {
  cursor: wait;
  opacity: 0.55;
}

.message-row {
  display: flex;
  align-items: end;
  gap: 0.45rem;
  max-width: min(82%, 42rem);
}

.message-row--me {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.bubble {
  display: grid;
  gap: 0.35rem;
  padding: 0.72rem 0.86rem;
  border-radius: 8px;
  background: var(--bubble);
  box-shadow: 0 0.4rem 1.2rem rgba(39, 52, 63, 0.08);
  line-height: 1.45;
  word-break: break-word;
}

.message-row--me .bubble {
  background: var(--me);
}

.message-row--sending .bubble {
  opacity: 0.72;
}

.message-row--failed .bubble {
  outline: 1px solid color-mix(in srgb, var(--danger) 58%, transparent);
}

.message-image {
  display: block;
  width: min(17rem, 62vw);
  max-height: 16rem;
  border-radius: 8px;
  cursor: zoom-in;
  object-fit: cover;
}

.bubble:has(.message-image) {
  padding: 0.35rem;
}

.message-meta {
  display: grid;
  flex: 0 0 auto;
  justify-items: end;
  gap: 0.12rem;
}

.message-unread {
  color: #ad7a00;
  font-size: 0.72rem;
  font-weight: 900;
}

.message-time {
  flex: 0 0 auto;
  color: #5f6c78;
  font-size: 0.72rem;
  white-space: nowrap;
}

.message-state {
  font-size: 0.7rem;
  font-weight: 900;
  white-space: nowrap;
}

.message-state--sending {
  color: var(--muted);
}

.message-state--failed {
  color: var(--danger);
}

.unread-divider {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.25rem 0;
  color: var(--danger);
  font-size: 0.76rem;
  font-weight: 900;
}

.unread-divider::before,
.unread-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: color-mix(in srgb, var(--danger) 68%, transparent);
}

.message-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 140ms ease;
}

.message-row:hover .message-actions,
.message-row:focus-within .message-actions {
  opacity: 1;
}

.message-actions button {
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-weight: 900;
}

.message-row--me .message-actions button {
  background: rgba(255, 255, 255, 0.56);
}

.message-actions--retry {
  opacity: 1;
}

.message-actions--retry button {
  width: auto;
  padding: 0 0.5rem;
  color: var(--danger);
  font-size: 0.72rem;
  white-space: nowrap;
}

.reply-quote {
  display: grid;
  gap: 0.15rem;
  max-width: 18rem;
  border-left: 3px solid rgba(23, 25, 29, 0.2);
  padding-left: 0.55rem;
  color: #4c5660;
  font-size: 0.8rem;
}

.reply-quote strong,
.reply-quote span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edited-mark {
  color: rgba(23, 25, 29, 0.55);
  font-size: 0.7rem;
  font-weight: 800;
}

.search-count {
  align-self: center;
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  background: rgba(23, 25, 29, 0.68);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
}

.emoji-bar {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding: 0 0.95rem 0.2rem;
}

.emoji-bar button {
  flex: 0 0 auto;
  height: 2.15rem;
  border: 1px solid rgba(23, 25, 29, 0.08);
  border-radius: 8px;
  padding: 0 0.75rem;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-weight: 800;
}

.emoji-bar button:hover {
  background: var(--yellow);
}

.reply-preview {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0.95rem 0.5rem;
  padding: 0.65rem 0.75rem;
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.reply-preview div {
  min-width: 0;
  margin-right: auto;
}

.reply-preview strong {
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.82rem;
}

.reply-preview p {
  margin-bottom: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-preview button {
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border: 0;
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 82%, var(--ink) 7%);
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1;
}

.typing-row {
  align-self: flex-start;
}

.typing-indicator {
  align-self: flex-start;
  border-radius: 999px;
  padding: 0.42rem 0.7rem;
  background: rgba(255, 255, 255, 0.65);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.typing-dots {
  display: flex;
  gap: 0.28rem;
  align-items: center;
  width: 4rem;
  height: 2.25rem;
  justify-content: center;
  border-radius: 8px;
  background: var(--bubble);
  box-shadow: 0 0.4rem 1.2rem rgba(39, 52, 63, 0.08);
}

.typing-dots span {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: #778594;
  animation: typingPulse 900ms infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 120ms;
}

.typing-dots span:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes typingPulse {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }

  50% {
    transform: translateY(-0.22rem);
    opacity: 1;
  }
}

.composer {
  position: relative;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  margin: 0.95rem;
  padding: 0.6rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.upload-status {
  position: absolute;
  right: 0.7rem;
  bottom: calc(100% + 0.35rem);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  background: var(--ink);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
}

.attach-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.attachment-preview {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  max-width: min(19rem, 34vw);
}

.attachment-items {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding: 0.35rem 0.15rem;
}

.attachment-item {
  position: relative;
  flex: 0 0 auto;
  width: 2.55rem;
  height: 2.55rem;
}

.attachment-item img {
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 8px;
  object-fit: cover;
}

.attachment-item button {
  position: absolute;
  top: -0.45rem;
  right: -0.45rem;
  display: grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
}

.attachment-clear {
  flex: 0 0 auto;
  height: 2.2rem;
  border: 0;
  border-radius: 8px;
  padding: 0 0.55rem;
  background: color-mix(in srgb, var(--panel) 82%, var(--ink) 7%);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 850;
}

.send-button {
  display: grid;
  place-items: center;
  width: 2.55rem;
  height: 2.55rem;
  border: 0;
  border-radius: 8px;
  background: var(--yellow);
  color: var(--ink);
}

.send-button:hover {
  background: var(--yellow-strong);
}

.profile-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  border-left: 1px solid var(--line);
  padding: 1rem;
}

.profile-card,
.memo {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.2rem 1rem;
  text-align: center;
}

.avatar--profile {
  width: 5.8rem;
  height: 5.8rem;
  margin-bottom: 0.95rem;
  font-size: 1.75rem;
}

.profile-card h3 {
  margin-bottom: 0.35rem;
  font-size: 1.2rem;
}

.profile-card p {
  margin-bottom: 1rem;
  color: var(--muted);
  line-height: 1.45;
}

.profile-actions {
  display: flex;
  gap: 0.7rem;
}

.round-action {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 82%, var(--ink) 7%);
  color: var(--ink);
}

.round-action:hover {
  background: var(--yellow);
}

.memo {
  padding: 1rem;
}

.memo h3 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.memo p {
  margin-bottom: 0.8rem;
  color: #494d54;
  line-height: 1.45;
}

.memo span {
  color: var(--accent);
  font-weight: 800;
}

.room-details dl {
  display: grid;
  gap: 0.55rem;
  margin: 0;
}

.room-details div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.room-details dt {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.room-details dd {
  margin: 0;
  color: var(--ink);
  font-weight: 900;
}

.my-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem;
  text-align: left;
}

.my-card h3 {
  margin-bottom: 0.15rem;
  font-size: 1rem;
}

.my-card p {
  margin-bottom: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar--me {
  width: 2.8rem;
  height: 2.8rem;
  background: var(--yellow);
  color: var(--ink);
}

.small-button,
.primary-button {
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.small-button {
  height: 2.15rem;
  padding: 0 0.75rem;
  background: color-mix(in srgb, var(--panel) 82%, var(--ink) 7%);
  color: var(--ink);
}

.small-button:hover {
  background: var(--yellow);
}

.settings-wide-button {
  width: 100%;
  margin-top: 0.85rem;
}

.room-members h3 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.room-member-list {
  display: grid;
  gap: 0.55rem;
}

.room-member {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border-radius: 8px;
  padding: 0.55rem;
  background: var(--surface);
}

.room-member .avatar {
  width: 2.45rem;
  height: 2.45rem;
}

.room-member p {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.empty-state {
  padding: 2rem 1rem;
  color: var(--muted);
  text-align: center;
}

.notice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  margin: 0 0.45rem 0.65rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.notice h3 {
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}

.notice p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.notice span {
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 850;
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

.dialog {
  width: min(27rem, calc(100vw - 2rem));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.dialog::backdrop {
  background: rgba(23, 25, 29, 0.38);
}

.dialog__panel {
  display: grid;
  gap: 0.95rem;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.dialog__header h2 {
  margin-bottom: 0;
  font-size: 1.15rem;
}

.dialog__close {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 82%, var(--ink) 7%);
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
}

.dialog label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.dialog input {
  height: 2.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 0.8rem;
  outline: 0;
  background: var(--surface);
  color: var(--ink);
}

.dialog input:focus {
  border-color: var(--yellow-strong);
}

.toggle-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.toggle-row small {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
}

.toggle-row input {
  width: 3rem;
  height: 1.65rem;
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.18rem;
  background: #d7d4cc;
  transition: background 160ms ease;
}

.toggle-row input::before {
  content: "";
  display: block;
  width: 1.29rem;
  height: 1.29rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0.1rem 0.35rem rgba(23, 25, 29, 0.22);
  transition: transform 160ms ease;
}

.toggle-row input:checked {
  background: var(--accent);
}

.toggle-row input:checked::before {
  transform: translateX(1.35rem);
}

.theme-toggle {
  color: var(--ink);
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.online-dialog {
  width: min(34rem, calc(100vw - 2rem));
}

.online-section {
  display: grid;
  gap: 0.8rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.online-section p,
.online-status {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.online-status {
  padding: 0.7rem 0.8rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 82%, var(--ink) 7%);
}

.online-status:empty {
  display: none;
}

.online-user,
.online-room-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.online-room-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: end;
}

.online-room-form .primary-button {
  padding: 0 0.85rem;
}

.online-room-list {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.55rem;
}

.online-room-card {
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.online-room-card p {
  margin-bottom: 0;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 850;
}

.room__online {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 900;
}

.primary-button {
  height: 2.8rem;
  background: var(--yellow);
  color: var(--ink);
}

.primary-button:hover {
  background: var(--yellow-strong);
}

.danger-button {
  height: 2.8rem;
  border: 0;
  border-radius: 8px;
  background: #ffe1df;
  color: #9a2f28;
  font-weight: 850;
}

.danger-button:hover {
  background: #ffc8c4;
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  z-index: 10;
  transform: translate(-50%, 1rem);
  max-width: min(30rem, calc(100vw - 2rem));
  padding: 0.75rem 0.95rem;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 750;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.image-dialog {
  width: min(62rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  border: 0;
  border-radius: 8px;
  padding: 0;
  overflow: visible;
  background: transparent;
  color: #fff;
}

.image-dialog::backdrop {
  background: rgba(0, 0, 0, 0.82);
}

.image-dialog img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 7rem);
  border-radius: 8px;
  object-fit: contain;
  background: #111;
}

.image-dialog p {
  margin: 0.75rem 2.8rem 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 750;
}

.image-dialog > span {
  position: absolute;
  right: 0;
  bottom: 0;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 850;
}

.image-dialog__close {
  position: absolute;
  top: -0.75rem;
  right: -0.75rem;
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font-size: 1.45rem;
  line-height: 1;
}

.image-dialog__nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  color: #111;
  font-size: 2rem;
  line-height: 1;
  transform: translateY(-50%);
}

.image-dialog__nav--previous {
  left: 0.7rem;
}

.image-dialog__nav--next {
  right: 0.7rem;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 4.75rem minmax(18rem, 23rem) minmax(0, 1fr);
  }

  .profile-panel {
    display: none;
  }
}

@media (max-width: 760px) {
  body {
    background: var(--surface);
  }

  .app-shell {
    display: block;
    height: 100vh;
    min-height: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .profile-panel {
    display: none;
  }

  .rail {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 8;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    height: 4.15rem;
    padding: 0.55rem 0.75rem;
    border-top: 1px solid rgba(23, 25, 29, 0.14);
  }

  .rail__button--bottom {
    margin-top: 0;
  }

  .chat-list,
  .conversation {
    width: 100%;
    height: calc(100% - 4.15rem);
  }

  .chat-list {
    border-right: 0;
  }

  .conversation {
    display: none;
  }

  .app-shell.is-chat-open .chat-list {
    display: none;
  }

  .app-shell.is-chat-open .conversation {
    display: grid;
  }

  .conversation__back {
    display: grid;
  }

  .rooms {
    height: calc(100% - 11.75rem);
  }

  .message-row {
    max-width: 88%;
  }

  .message-actions {
    opacity: 1;
  }

  .composer {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
  }

  .attachment-preview {
    max-width: 34vw;
  }
}
