.skchat {
  --skchat-accent: #B1976B;
  --skchat-accent-2: #d8c3a1;
  --skchat-text: #2b2b2b;
  --skchat-muted: #8a8478;
  --skchat-line: #ece6db;
  --skchat-bg: #f6f3ee;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  background: #fff;
  color: var(--skchat-text);
  border-radius: 18px;
  box-shadow: 0 6px 24px rgba(177, 151, 107, .18);
  overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}
.skchat *, .skchat *::before, .skchat *::after { box-sizing: border-box; }
.skchat [hidden] { display: none !important; }

.skchat__head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  color: #fff; font-weight: 600; font-size: 16px;
  background: linear-gradient(135deg, var(--skchat-accent), var(--skchat-accent-2));
}
.skchat__dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 8px rgba(255, 255, 255, .9);
}

.skchat__list {
  height: var(--skchat-height, 420px);
  overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--skchat-bg);
}
.skchat__empty { margin: auto; color: var(--skchat-muted); font-size: 14px; text-align: center; }

.skchat__msg { max-width: 84%; align-self: flex-start; }
.skchat__msg.is-own { align-self: flex-end; }
.skchat__meta {
  display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center;
  margin: 0 6px 3px; font-size: 12px; color: var(--skchat-muted);
}
.skchat__msg.is-own .skchat__meta { justify-content: flex-end; }
.skchat__who { color: var(--skchat-text); font-weight: 600; }
.skchat__badge {
  padding: 0 7px; border-radius: 999px; font-size: 11px;
  background: #fff; border: 1px solid var(--skchat-line); color: var(--skchat-muted);
}
.skchat__bubble {
  padding: 9px 13px;
  background: #fff; border: 1px solid var(--skchat-line);
  border-radius: 16px 16px 16px 4px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.skchat__msg.is-own .skchat__bubble {
  color: #fff; border: 0;
  background: linear-gradient(135deg, var(--skchat-accent), var(--skchat-accent-2));
  border-radius: 16px 16px 4px 16px;
}
.skchat__del {
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; font-size: 12px; color: #c0392b;
}

.skchat__form, .skchat__login {
  padding: 12px; background: #fff; border-top: 1px solid var(--skchat-line);
}
.skchat__form { display: grid; gap: 8px; }
.skchat__login { text-align: center; color: var(--skchat-muted); font-size: 14px; }
.skchat__row { display: flex; gap: 8px; }
.skchat__ident { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13.5px; }
.skchat__ident label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; margin: 0; }

.skchat__name, .skchat__text {
  width: 100%; margin: 0;
  font: inherit; color: var(--skchat-text);
  padding: 10px 12px; background: #fff;
  border: 1px solid var(--skchat-line); border-radius: 12px; outline: none;
}
.skchat__name[hidden] { display: none; }
.skchat__text { resize: none; height: 44px; max-height: 120px; }
.skchat__name:focus, .skchat__text:focus {
  border-color: var(--skchat-accent);
  box-shadow: 0 0 0 3px rgba(177, 151, 107, .2);
}

.skchat__send {
  flex: none; margin: 0; padding: 0 22px;
  border: 0; border-radius: 12px; cursor: pointer;
  font: inherit; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--skchat-accent), var(--skchat-accent-2));
  box-shadow: 0 4px 16px rgba(177, 151, 107, .55);
  transition: transform .12s, box-shadow .12s;
}
.skchat__send:hover { transform: translateY(-1px); box-shadow: 0 6px 22px rgba(177, 151, 107, .7); }
.skchat__send:disabled { opacity: .6; cursor: default; transform: none; }

.skchat__error { min-height: 16px; font-size: 12.5px; color: #c0392b; }
.skchat__hint { font-size: 11.5px; color: var(--skchat-muted); }

.skchat__emoji-btn {
  flex: none; width: 44px; height: 44px; margin: 0; padding: 0;
  font-size: 20px; line-height: 1; cursor: pointer;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  background: #fff; border: 1px solid var(--skchat-line); border-radius: 12px;
  transition: border-color .12s, box-shadow .12s;
}
.skchat__emoji-btn:hover, .skchat__emoji-btn[aria-expanded="true"] {
  border-color: var(--skchat-accent);
  box-shadow: 0 0 0 3px rgba(177, 151, 107, .2);
}

.skchat__emojis {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 2px;
  max-height: 150px; overflow-y: auto; padding: 8px;
  background: #fff; border: 1px solid var(--skchat-line); border-radius: 12px;
  box-shadow: 0 6px 24px rgba(177, 151, 107, .18);
}
.skchat__emojis[hidden] { display: none; }
.skchat__emojis button {
  margin: 0; padding: 4px 0; border: 0; border-radius: 8px; cursor: pointer;
  font-size: 21px; line-height: 1.2; background: none;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.skchat__emojis button:hover { background: var(--skchat-bg); }

.skchat__bubble, .skchat__text {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

.skchat__act {
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; font-size: 12px; color: var(--skchat-accent);
}
.skchat__act:hover, .skchat__del:hover { text-decoration: underline; }
.skchat__edited { font-style: italic; }

.skchat__editbox { display: grid; gap: 6px; min-width: min(420px, 74vw); }
.skchat__editbox textarea {
  width: 100%; margin: 0; min-height: 64px; resize: vertical;
  font: inherit; color: var(--skchat-text);
  padding: 9px 12px; background: #fff;
  border: 1px solid var(--skchat-accent); border-radius: 12px; outline: none;
  box-shadow: 0 0 0 3px rgba(177, 151, 107, .2);
}
.skchat__editbtns { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.skchat__editbtns .skchat__save {
  margin: 0; padding: 6px 16px; border: 0; border-radius: 10px; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--skchat-accent), var(--skchat-accent-2));
  box-shadow: 0 3px 12px rgba(177, 151, 107, .5);
}
.skchat__editbtns .skchat__save:disabled { opacity: .6; cursor: default; }
.skchat__editerr { margin-right: auto; font-size: 12px; color: #c0392b; }

.skchat__mod {
  padding: 6px 14px; text-align: right; background: #fff;
  border-top: 1px solid var(--skchat-line);
}
.skchat__clear {
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; font-size: 12px; color: #c0392b;
}
.skchat__clear:hover { text-decoration: underline; }

.skchat__status {
  padding: 7px 14px; font-size: 12.5px; color: #c0392b;
  background: #fff6f5; border-top: 1px solid #f3d4d0;
  overflow-wrap: anywhere;
}
.skchat__status[hidden] { display: none; }

@media (max-width: 480px) {
  .skchat__msg { max-width: 94%; }
}
