:root {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  --font-ui:
    "Pretendard Variable", Pretendard, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR",
    "Malgun Gothic", sans-serif;
  --canvas: #101216;
  --surface: #191c22;
  --ink: #edf0f5;
  --muted: #a2adbd;
  --line: #343a45;
  --accent: #ffa57d;
  --on-accent: #26130c;
  --danger: #ffa0a0;
  --hover: color-mix(in srgb, var(--ink) 6%, var(--surface));
  --selected: color-mix(in srgb, var(--accent) 12%, var(--surface));
  --overlay: #0009;
  --shadow: #0003;
  --viewport-height: 100dvh;
  --text-caption: 0.75rem;
  --text-ui: 0.875rem;
  --text-body: 1rem;
  --text-heading: 1.25rem;
  font: 16px/1.6 var(--font-ui);
  background: var(--canvas);
  color: var(--ink);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --canvas: #f5f6f8;
  --surface: #fff;
  --ink: oklch(0.141 0.005 285.823);
  --muted: #566171;
  --line: oklch(0.92 0.004 286.32);
  --accent: #9a3412;
  --on-accent: #fff;
  --danger: #b4232c;
  --shadow: #00000014;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-width: 0;
  min-height: 0;
  width: 100%;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button,
a,
summary {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.5;
}
a {
  color: inherit;
  text-decoration: none;
}
button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
::selection {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
}
input,
textarea,
select {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--canvas);
  color: var(--ink);
}
input,
select {
  min-height: 44px;
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}
textarea {
  resize: vertical;
}
input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  height: 18px;
  accent-color: var(--accent);
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3,
p,
label {
  word-break: keep-all;
  overflow-wrap: anywhere;
}
h1,
h2,
h3 {
  line-height: 1.4;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 20;
  transform: translateY(-150%);
  padding: 12px;
  background: var(--surface);
}
.skip-link:focus {
  transform: none;
}
.app-shell {
  width: 100%;
  height: var(--viewport-height);
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
}
.app-shell.has-details {
  grid-template-columns: 264px minmax(0, 1fr) 280px;
}
.chat-sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow: auto;
}
.site-header {
  min-height: 56px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand img {
  flex: none;
}
.brand small {
  display: block;
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0;
  line-height: 1.3;
}
.mode-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
}
.mode-button {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  min-height: 44px;
  padding: 8px 12px;
  font-size: var(--text-ui);
  font-weight: 500;
}
.mode-button span {
  width: 20px;
  text-align: center;
  font-size: 21px;
  font-weight: 400;
}
.mode-button.is-active {
  font-weight: 600;
  background: var(--selected);
  color: var(--accent);
}
.mode-button:hover:not(:disabled):not(.is-active) {
  background: var(--hover);
  color: var(--ink);
}
.active-conversation {
  margin: 4px 12px 12px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--canvas);
  color: var(--ink);
  text-align: left;
  padding: 10px 12px;
  overflow-wrap: anywhere;
}
.chat-sidebar .chat-profile {
  margin: auto 0 0;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}
.chat-sidebar .profile-caption {
  flex-basis: 100%;
  font-size: 12px;
}
.chat-sidebar .profile-summary {
  gap: 0 8px;
}
.chat-sidebar #profile-name {
  flex: 1;
  min-width: 0;
}
.chat-sidebar .profile-form input {
  flex-basis: 100%;
}
.site-footer {
  flex: none;
  border-top: 1px solid var(--line);
  padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  color: var(--muted);
}
.connection {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 4px;
  font-size: 12px;
}
.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.connection-dot.is-online {
  background: var(--accent);
}
.connection-dot.is-error {
  background: var(--danger);
}
.sidebar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0 4px;
}
.sidebar-actions .text-button {
  font-size: 12px;
  padding: 8px 4px;
}
.chat-workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--canvas);
}
html:not(.embedded) .conversation-header,
html:not(.embedded) .site-header {
  padding-top: max(8px, env(safe-area-inset-top));
}
.conversation {
  display: flex;
  flex-direction: column;
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
}
.conversation-header {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  flex: none;
  min-height: 56px;
  gap: 4px 12px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--canvas);
}
.conversation-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.conversation-heading > div {
  min-width: 0;
}
.conversation-header h1,
.conversation-header h2 {
  font-size: var(--text-body);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.conversation-header p {
  color: var(--muted);
  font-size: var(--text-caption);
  line-height: 1.5;
}
.conversation-icon {
  font-size: 23px;
  color: var(--muted);
  flex: none;
}
.conversation-tools {
  flex: none;
}
.conversation-tool-list {
  position: fixed;
  top: var(--tools-top, 56px);
  right: max(12px, env(safe-area-inset-right));
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: min(280px, calc(100% - 24px));
  max-height: calc(var(--viewport-height) - var(--tools-top, 56px) - 12px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 6px 18px var(--shadow);
}
.conversation-tool-list > * {
  flex-shrink: 0;
}
.conversation-tool-list :is(.text-button, .chat-setting) {
  min-height: 44px;
  justify-content: flex-start;
  font-size: var(--text-ui);
  padding-inline: 12px;
}
.conversation-tool-list #leave-button,
.conversation-tool-list #private-leave {
  color: var(--danger);
}
.conversation-tools-toggle,
.composer-attachments summary {
  list-style: none;
}
.conversation-tools-toggle::-webkit-details-marker,
.composer-attachments summary::-webkit-details-marker {
  display: none;
}
#next-button {
  flex: none;
  white-space: nowrap;
}
.workspace-empty,
.waiting-panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 32px 24px;
}
.workspace-empty h2,
.waiting-panel h2 {
  font-size: var(--text-heading);
  font-weight: 600;
  max-width: 24ch;
  text-wrap: balance;
}
.workspace-empty p,
.waiting-panel p {
  color: var(--muted);
  font-size: var(--text-ui);
}
.workspace-empty .button {
  margin-top: 8px;
}
.empty-brand {
  margin-bottom: 8px;
  flex: none;
}
.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
  gap: 8px;
  padding: 8px 16px;
  background: var(--selected);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.messages {
  min-height: 0;
  min-width: 0;
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  overflow-anchor: none;
  padding: 16px 24px;
}
.message-row {
  position: relative;
  margin: 20px -8px 0;
  padding: 2px 8px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.message-author {
  display: inline;
  color: var(--ink);
  font-size: var(--text-ui);
  font-weight: 600;
}
.message-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  user-select: none;
}
.message-header time {
  color: var(--muted);
  font-size: var(--text-caption);
  font-variant-numeric: tabular-nums;
}
.message-row.is-grouped {
  margin-top: 0;
}
.is-grouped .message-header {
  font-size: 0;
  height: 0;
}
.is-grouped .message-header > * {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.is-mine .message-author {
  color: var(--ink);
}
.message-bubble {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: var(--text-body);
  line-height: 1.65;
  padding: 2px 0;
  min-width: 0;
}
.message-bubble .message-text {
  display: block;
  max-width: 72ch;
}
.message-bubble img {
  display: block;
  max-width: min(340px, 100%);
  max-height: 340px;
  object-fit: contain;
  border-radius: 6px;
}
.message-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  color: var(--muted);
  font-size: var(--text-caption);
  line-height: 1.5;
  user-select: none;
}
.message-meta.is-failed {
  color: var(--danger);
}
.message-quote {
  display: block;
  border: 0;
  border-left: 2px solid var(--line);
  color: var(--muted);
  background: transparent;
  padding: 4px 8px;
  margin-bottom: 4px;
  max-width: 100%;
  text-align: left;
  white-space: normal;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.message-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  user-select: none;
}
.message-actions button {
  min-height: 32px;
  padding: 4px 8px;
  font-size: 12px;
}
.message-action-list {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
.message-more {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 6px;
  min-width: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.message-delete {
  color: var(--danger);
}
.message-reactions {
  color: var(--muted);
}
.message-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.message-edit textarea {
  flex-basis: 100%;
  min-height: 80px;
  font-size: 16px;
}
.message-edit .text-button {
  min-height: 44px;
}
.message-retry {
  user-select: none;
}
.message-bubble .text-button {
  user-select: none;
}
.system-message {
  margin: 12px 0;
  padding: 4px 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.new-messages {
  align-self: center;
  flex: none;
  margin: 4px 0;
  font-size: 13px;
}
.typing-label {
  flex: none;
  min-height: 22px;
  margin: 0 24px;
  font-size: 12px;
  color: var(--muted);
}
.chat-settings {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 8px 0;
  margin-block: 4px;
  border-block: 1px solid var(--line);
  font-size: var(--text-ui);
  color: var(--muted);
}
.chat-setting {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
}
.chat-settings .text-button {
  font-size: var(--text-ui);
}
.composer {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: end;
  flex: none;
  margin: 0 24px 8px;
  padding: 8px;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.composer:focus-within {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.composer textarea {
  grid-column: 2;
  width: 100%;
  min-height: 44px;
  max-height: min(140px, calc(var(--viewport-height) * 0.2));
  padding: 10px 4px;
  resize: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: var(--text-body);
  line-height: 1.5;
  overflow: auto;
}
.composer textarea:focus-visible {
  outline: none;
}
.composer-attachments {
  position: relative;
  align-self: end;
}
.composer-attachments summary {
  cursor: pointer;
}
.photo-actions {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  width: 216px;
  max-height: min(240px, var(--attachments-space, 50dvh));
  overflow: auto;
  overscroll-behavior: contain;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 6px 18px var(--shadow);
}
.photo-actions .text-button {
  font-size: var(--text-ui);
  flex-shrink: 0;
  justify-content: flex-start;
  gap: 12px;
}
.control-icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.send-button {
  grid-column: 3;
  justify-self: end;
  align-self: end;
  min-width: 44px;
  height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 22px;
}
.message-reply-preview {
  grid-column: 1 / -1;
  min-width: 0;
  width: 100%;
  padding: 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
  user-select: none;
}
.message-reply-preview {
  max-height: min(96px, calc(var(--viewport-height) * 0.18));
  overflow: auto;
}
.message-reply-preview strong {
  color: var(--ink);
}
.composer > .message-reply-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  gap: 2px 8px;
}
.message-reply-label,
.message-reply-text {
  grid-column: 1;
}
.message-reply-label {
  font-weight: 600;
  color: var(--ink);
}
.message-reply-close {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  justify-self: center;
}
.conversation-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 0 24px max(12px, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: var(--text-caption);
  flex: none;
}
.button,
.text-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 500;
  line-height: 1.4;
}
.button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--text-ui);
}
.button-primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--on-accent);
}
.button-full {
  width: 100%;
  margin-top: 8px;
}
.text-button,
.icon-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: var(--text-ui);
}
.icon-button {
  min-width: 44px;
  font-size: 22px;
  flex: none;
}
.text-button:hover:not(:disabled),
.icon-button:hover:not(:disabled),
.button-secondary:hover:not(:disabled) {
  background: var(--hover);
  color: var(--ink);
}
.button-primary:hover:not(:disabled),
.send-button:hover:not(:disabled) {
  filter: brightness(0.94);
}
.sidebar-toggle,
.sidebar-close {
  display: none;
}
dialog {
  width: min(440px, calc(100% - 24px));
  max-height: calc(var(--viewport-height) - 24px);
  margin: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  overflow: auto;
}
dialog::backdrop {
  background: var(--overlay);
}
dialog.is-panel[open] {
  position: static;
  grid-column: 3;
  width: auto;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 16px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
}
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.dialog-heading h2,
dialog > h2,
dialog form > h2 {
  font-size: 19px;
}
dialog h3 {
  font-size: 15px;
  margin: 16px 0 8px;
}
dialog p,
.help-list {
  font-size: 14px;
  line-height: 1.65;
}
dialog label:not(.checkbox-label) {
  display: block;
  font-size: 14px;
  margin: 16px 0 8px;
  font-weight: 600;
}
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}
.optional,
.field-help {
  color: var(--muted);
  font-size: 12px;
}
.field-help,
.form-error {
  margin-top: 12px;
}
.form-error {
  color: var(--danger);
  font-size: 13px;
}
.form-error:empty {
  display: none;
}
.checkbox-label {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
  min-height: 44px;
  margin: 12px 0;
}
.member-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.member-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.member-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.member-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.member-controls .text-button {
  font-size: 12px;
}
.help-list {
  padding-left: 20px;
}
.help-list li + li {
  margin-top: 12px;
}
.noscript {
  padding: 24px;
  text-align: center;
}
.embedded .brand {
  display: none;
}
.embedded .site-header {
  min-height: 16px;
  padding: 0 8px;
}
.embedded #main-chat-link,
.embedded #theme-toggle {
  display: none;
}
@media (hover: hover) and (pointer: fine) {
  .message-row:hover {
    background: var(--hover);
  }
  .message-actions {
    position: absolute;
    top: 4px;
    right: 8px;
  }
  .message-more {
    opacity: 0;
  }
  .message-row:hover .message-more,
  .message-row:focus-within .message-more,
  .message-row.is-acting .message-more {
    opacity: 1;
  }
  .message-action-list {
    position: absolute;
    right: 0;
    top: 36px;
    z-index: 2;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 4px;
    flex-wrap: nowrap;
  }
  .message-row:has(.message-more) .message-author {
    padding-right: 44px;
  }
}
@media (max-width: 767px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .chat-sidebar {
    display: none;
    border: 0;
  }
  .app-shell[data-sidebar-open="true"] .chat-sidebar {
    display: flex;
  }
  .app-shell[data-sidebar-open="true"] .chat-workspace {
    display: none;
  }
  .sidebar-toggle,
  .sidebar-close {
    display: inline-flex;
  }
  .embedded .site-header {
    min-height: 44px;
    justify-content: flex-end;
  }
  .conversation-header {
    padding: 6px 8px;
    gap: 4px;
  }
  .conversation-icon {
    display: none;
  }
  .messages {
    padding: 8px 16px;
  }
  .composer {
    margin: 0 12px max(12px, env(safe-area-inset-bottom));
  }
  .typing-label {
    margin: 0 16px;
  }
  .conversation-footer {
    display: none;
  }
  #composer-help {
    display: none;
  }
  .message-actions button,
  .message-more {
    min-height: 44px;
    min-width: 44px;
  }
  .workspace-empty {
    padding: 20px;
  }
  dialog {
    padding: 16px;
  }
}
html[data-compact-height="true"] {
  .typing-label:empty,
  .conversation-footer {
    display: none;
  }
  .conversation-header {
    min-height: 44px;
    padding-block: 2px;
    max-height: max(56px, calc(var(--viewport-height) * 0.35));
    overflow: auto;
  }
  .workspace-empty {
    gap: 8px;
    padding: 12px;
    justify-content: flex-start;
  }
  .empty-brand {
    width: 36px;
    height: 36px;
    margin: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
