:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #657083;
  --line: #dbe2ea;
  --panel: #ffffff;
  --canvas: #f4f7fb;
  --host: #0f766e;
  --guest: #2563eb;
  --warm: #f59e0b;
  --danger: #dc2626;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
  --color-bg: #f6f7f9;
  --color-surface: #ffffff;
  --color-text-primary: #101828;
  --color-text-secondary: #667085;
  --color-text-tertiary: #667085;
  --color-border: #e4e7ec;
  --color-brand-primary: var(--guest);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf2f7;
  --muted: #a5b0bd;
  --line: #35414e;
  --panel: #1c242d;
  --canvas: #111820;
  --host: #287f79;
  --guest: #327ba9;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
  --color-bg: #111820;
  --color-surface: #1b232c;
  --color-text-primary: #edf2f7;
  --color-text-secondary: #aab5c2;
  --color-text-tertiary: #8b98a7;
  --color-border: #35414e;
  --color-brand-primary: #347fae;
}

:root[data-theme="light"] {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

html {
  height: 100%;
}

body,
#app {
  min-height: 100%;
}

body {
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(245, 158, 11, 0.12), transparent 42%),
    var(--canvas);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.shell {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  padding: 20px;
}

.join-shell {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  padding: clamp(48px, 8vh, 96px) 24px 48px;
  background: var(--color-bg);
  color: var(--color-text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.join-frame {
  width: min(100%, 480px);
  margin: 0 auto;
}

.join-shell .join-panel {
  width: 100%;
  padding: 32px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 24px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.06);
}

.join-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.join-home-toolbar {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.join-home-toolbar .join-brand {
  min-width: 0;
  flex: 1 1 auto;
}

.join-brand-name {
  color: var(--color-text-primary);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.join-language-picker {
  display: flex;
  min-width: 0;
  flex: 0 0 auto;
  position: relative;
  align-items: center;
  height: 42px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  padding: 0 28px 0 12px;
  transition: border-color 150ms ease;
}

.join-language-picker::after {
  position: absolute;
  top: 16px;
  right: 12px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--color-text-secondary);
  border-bottom: 1.5px solid var(--color-text-secondary);
  content: "";
  pointer-events: none;
  transform: rotate(45deg);
}

.join-language-select {
  appearance: none;
  -webkit-appearance: none;
  width: 145px;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--color-text-primary);
  padding: 0;
  font-size: 14px;
  cursor: pointer;
  text-overflow: ellipsis;
}

.join-language-select:focus-visible {
  outline: 2px solid var(--color-brand-primary);
  outline-offset: 3px;
  border-radius: 4px;
}

.join-mark {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border-radius: 12px;
  background: var(--color-brand-primary);
  color: white;
}

.join-mark svg {
  width: 21px;
  height: 21px;
  stroke-width: 1.8;
}

.join-tagline {
  margin: 22px 0 0;
  color: var(--color-text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.join-intro {
  margin-top: 28px;
}

.join-intro h1 {
  color: var(--color-text-primary);
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.22;
}

.join-intro p {
  margin: 8px 0 0;
  color: var(--color-text-secondary);
  font-size: 15px;
  line-height: 1.5;
}

.join-form {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.join-code-field {
  display: grid;
  gap: 10px;
}

.join-code-label {
  color: #475467;
  font-size: 14px;
  font-weight: 600;
}

.join-code-control {
  position: relative;
  width: min(100%, 330px);
  margin: 0 auto;
}

.join-code-cells {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.join-code-cell {
  display: grid;
  min-width: 0;
  height: 58px;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: 25px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.join-code-cell.is-filled {
  border-color: #c8d2e1;
}

.join-code-control:focus-within .join-code-cell.is-current {
  border-color: var(--color-brand-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.join-code-control.has-error .join-code-cell {
  border-color: var(--danger);
}

.join-code-control.has-error:focus-within .join-code-cell.is-current {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.1);
}

.join-code-input {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  padding: 0;
  font-size: 16px;
  outline: none;
  text-align: center;
  cursor: text;
}

.join-code-input:focus-visible {
  outline: 2px solid var(--color-brand-primary);
  outline-offset: 3px;
}

.join-code-control.has-error .join-code-input:focus-visible {
  outline-color: var(--danger);
}

.join-code-input:disabled {
  cursor: wait;
}

.join-shell .join-submit {
  display: flex;
  width: 100%;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 14px;
  background: var(--color-brand-primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  transition: filter 150ms ease, background-color 150ms ease;
}

.join-shell .join-submit:not(:disabled):hover {
  filter: brightness(0.97);
}

.join-shell .join-submit:not(:disabled):active {
  filter: brightness(0.93);
}

.join-shell .join-submit:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.32);
  outline-offset: 3px;
}

.join-shell .join-submit:disabled {
  background: #e4e7ec;
  color: #98a2b3;
  cursor: not-allowed;
}

.join-shell .join-submit.is-loading {
  background: var(--color-brand-primary);
  color: #fff;
  cursor: wait;
  filter: none;
  opacity: 0.76;
}

.join-shell .join-submit svg {
  width: 18px;
  height: 18px;
}

.join-error {
  min-height: 0;
  margin: -4px 0 0;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.4;
}

.join-hint {
  margin: 16px 0 0;
  color: var(--color-text-tertiary);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.guest-shell {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
}

.guest-shell .app-frame {
  height: 100%;
  width: min(760px, 100%);
}

.guest-shell .solo-chat {
  height: 100%;
  min-height: 0;
  border-radius: 8px;
  box-shadow: none;
}

.guest-shell .panel {
  background: rgba(255, 255, 255, 0.96);
}

.guest-shell .chat {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.guest-shell .messages {
  min-height: 0;
}

.app-frame {
  display: grid;
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1180px, 100%);
  min-width: 0;
  margin: 0 auto;
}

.topbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 18px;
}

.top-actions,
.host-action-row {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
}

.host-brand-row {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.host-brand-row .brand {
  flex: 1 1 0;
}

.host-name-button {
  width: 112px;
  min-width: 96px;
  min-height: 40px;
  flex: 0 0 auto;
  padding: 4px 8px;
  font-size: 13px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.host-profile-controls {
  display: flex;
  min-width: 0;
  align-items: end;
  gap: 8px;
}

.host-profile-controls .language-field {
  width: 138px;
  flex: 0 0 138px;
}

.host-profile-controls .language-field > span {
  display: none;
}

.host-profile-controls .language-field .select {
  min-height: 40px;
  padding: 0 28px 0 9px;
  font-size: 14px;
}

.name-field {
  width: min(220px, 44%);
  flex: 1 1 180px;
}

.name-input {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-button {
  display: inline-flex;
  max-width: 170px;
  min-height: 42px;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 11px;
}

.profile-button:hover {
  border-color: #9aa8ba;
}

.profile-button svg {
  width: 17px;
  flex: 0 0 auto;
}

.profile-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guest-header-actions {
  display: flex;
  width: min(100%, 560px);
  min-width: 0;
  align-items: end;
  gap: 8px;
}

.guest-header-actions .guest-language-field {
  display: flex;
  height: 42px;
  min-width: 0;
  align-items: center;
  gap: 8px;
  flex: 2 1 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding-left: 10px;
}

.guest-header-actions .guest-language-field span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.guest-header-actions .guest-language-field .select {
  height: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0 30px 0 0;
}

.guest-action-button {
  display: inline-flex;
  height: 42px;
  min-height: 42px;
  max-height: 42px;
  min-width: 0;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  overflow: hidden;
  padding: 0 8px;
  text-decoration: none;
  white-space: nowrap;
  font-size: 13px;
}

.guest-action-button span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.guest-action-button:hover {
  border-color: #9aa8ba;
  color: var(--host);
}

.guest-action-button svg {
  width: 17px;
  height: 17px;
}

.host-action-row {
  width: 100%;
  display: grid;
  min-width: 0;
  align-items: stretch;
  justify-content: stretch;
  gap: 8px;
}

.host-primary-actions,
.host-secondary-actions {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-auto-rows: 52px;
  gap: 8px;
}

.host-primary-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.host-secondary-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.host-primary-actions .btn,
.host-secondary-actions .btn,
.host-name-input,
.host-language-select {
  width: 100%;
  min-width: 0;
  height: 52px;
  min-height: 52px;
  max-height: 52px;
  overflow: hidden;
}

.host-primary-actions .btn,
.host-secondary-actions .btn {
  padding: 5px 8px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.host-name-input {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 12px;
  text-align: center;
  text-overflow: ellipsis;
}

.host-language-select {
  text-align: center;
  text-overflow: ellipsis;
}

.language-field {
  width: min(260px, 48%);
  flex: 0 1 260px;
}

.compact {
  min-width: 170px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  font-size: 18px;
}

.brand-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.1;
}

.brand-subtitle {
  max-width: 100%;
  overflow-wrap: anywhere;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: 0.82fr 1.18fr;
  gap: 18px;
  align-items: stretch;
}

.guest-grid {
  grid-template-columns: minmax(0, 760px);
  justify-content: center;
}

.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(219, 226, 234, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.invite {
  display: flex;
  min-height: 650px;
  flex-direction: column;
  padding: 22px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.5);
}

.modal {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100vh - 36px);
  min-height: 0;
  overflow-y: auto;
}

.history-modal {
  width: min(620px, 100%);
  padding: 24px;
}

.history-modal h2 {
  margin: 0;
  padding-right: 46px;
  font-size: 24px;
}

.name-modal {
  padding: 24px;
}

.name-modal h2 {
  margin: 0 0 16px;
  padding-right: 44px;
  font-size: 24px;
}

.name-modal form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.name-modal .btn {
  min-height: 46px;
}

.history-note {
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.history-open {
  display: grid;
  min-width: 0;
  gap: 4px;
  padding: 12px 14px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.history-open:hover {
  background: #f8fafc;
}

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

.history-open span {
  color: var(--muted);
  font-size: 12px;
}

.history-delete {
  border-left: 1px solid var(--line);
  background: white;
  color: var(--muted);
  font-size: 22px;
}

.history-delete:hover {
  background: #fef2f2;
  color: var(--danger);
}

.history-empty {
  margin: 24px 0;
  color: var(--muted);
  text-align: center;
}

.icon-btn {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
}

.close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: 1px solid var(--line);
}

.invite-copy {
  margin-bottom: 18px;
}

.foreign-copy {
  padding-right: 42px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--host);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.headline {
  margin: 0;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1;
}

.body-copy {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.qr-zone {
  display: grid;
  flex: 1;
  place-items: center;
  padding: 18px 0;
}

.qr-card {
  width: min(330px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  text-align: center;
}

#qr {
  display: grid;
  min-height: 244px;
  place-items: center;
}

#qr img,
#qr canvas {
  width: min(244px, 100%) !important;
  height: min(244px, 100%) !important;
}

.qr-fallback {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.local-prompt {
  margin: 16px 0 0;
  font-size: 23px;
  font-weight: 800;
  line-height: 1.2;
}

.room-link {
  display: block;
  margin-top: 10px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.controls {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.control-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.select,
.input {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 12px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--ink);
  color: white;
  font-weight: 800;
}

.composer .btn {
  min-height: 46px;
  align-self: start;
}

.btn.secondary {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.btn.warning {
  background: var(--warm);
  color: #1f2937;
}

.chat {
  display: grid;
  min-height: 650px;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.host-chat {
  grid-template-rows: minmax(0, 1fr) auto;
}

.solo-chat {
  height: 100%;
  min-height: 0;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

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

.room-meta h2 {
  margin: 0;
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-meta p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.chat-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.chat-tools .select {
  width: 145px;
}

.guest-language-field {
  width: min(100%, 230px);
  flex: 0 0 230px;
}

.guest-language-field .select {
  min-width: 0;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding: 20px 22px;
}

.delivery-status {
  align-self: center;
  margin: 8px 16px -8px;
  padding: 5px 10px;
  border: 1px solid rgba(47, 125, 224, 0.20);
  border-radius: 999px;
  background: rgba(47, 125, 224, 0.10);
  color: #245f9f;
  font-size: 12px;
  line-height: 1.25;
}

.delivery-status.is-offline {
  border-color: rgba(178, 102, 12, 0.24);
  background: rgba(244, 174, 74, 0.17);
  color: #8d5108;
}

.encounter-banner {
  display: grid;
  justify-items: center;
  gap: 3px;
  align-self: center;
  max-width: min(100%, 460px);
  margin: 2px auto 5px;
  padding: 4px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
}

.encounter-place {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.encounter-place svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.encounter-map-links a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.encounter-time {
  color: var(--muted);
  opacity: 0.78;
  font-size: 11px;
}

.empty {
  margin: auto;
  max-width: 370px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.msg {
  display: grid;
  width: max-content;
  max-width: min(72%, 680px);
  gap: 4px;
}

.msg.mine {
  align-self: flex-end;
}

.msg.theirs {
  align-self: flex-start;
}

.msg-content-row {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: flex-end;
  gap: 3px;
}

.msg.theirs .msg-content-row {
  justify-content: flex-start;
}

.msg.mine .msg-content-row {
  justify-content: flex-end;
}

.bubble {
  border-radius: 8px;
  padding: 10px 14px;
  background: white;
  border: 1px solid var(--line);
  line-height: 1.45;
  white-space: normal;
  width: auto;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
  font-size: 17px;
}

.bubble p {
  margin: 0;
  white-space: pre-wrap;
}

.image-message {
  display: block;
  margin-bottom: 8px;
}

.image-message img {
  display: block;
  width: min(280px, 100%);
  max-height: 320px;
  border-radius: 6px;
  object-fit: cover;
}

.typing-dots {
  display: inline-flex;
  min-width: 36px;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.35;
  animation: dotPulse 1.1s infinite ease-in-out;
}

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

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

@keyframes dotPulse {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }

  40% {
    transform: translateY(-3px);
    opacity: 0.9;
  }
}

.bubble .original {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(101, 112, 131, 0.24);
  color: var(--muted);
  font-size: 15px;
}

.bubble .outbound {
  margin-top: 8px;
  margin-bottom: 0;
  padding-top: 8px;
  padding-bottom: 0;
  border-top: 1px solid rgba(101, 112, 131, 0.24);
  border-bottom: 0;
}

.mine .bubble .original {
  border-bottom-color: rgba(255, 255, 255, 0.35);
  color: rgba(255, 255, 255, 0.82);
}

.mine .bubble .outbound {
  border-top-color: rgba(255, 255, 255, 0.35);
}

.mine .bubble {
  justify-self: end;
  background: var(--host);
  border-color: var(--host);
  color: white;
}

.msg.guest-mine .bubble {
  background: var(--guest);
  border-color: var(--guest);
}

.msg-meta {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.mine .msg-meta {
  justify-content: flex-end;
  text-align: right;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  align-content: start;
  align-items: stretch;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 14px;
  background: rgba(255, 255, 255, 0.82);
}

.telegram-composer {
  --composer-control-size: 48px;
  grid-template-columns: var(--composer-control-size) minmax(0, 1fr) var(--composer-control-size);
  align-content: center;
  align-items: center;
  gap: 8px;
}

.file-input {
  display: none;
}

.composer-icon {
  display: grid;
  width: var(--composer-control-size, 46px);
  min-width: var(--composer-control-size, 46px);
  max-width: var(--composer-control-size, 46px);
  height: var(--composer-control-size, 46px);
  min-height: var(--composer-control-size, 46px);
  max-height: var(--composer-control-size, 46px);
  place-items: center;
  align-self: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  padding: 0;
}

.composer-icon:hover {
  border-color: #9aa8ba;
  color: var(--ink);
}

.composer-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.25;
}

.attachment-button,
.composer-action.is-voice {
  border-radius: 50%;
}

.composer-action.is-send {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.composer-action.is-send:hover {
  border-color: var(--host);
  background: var(--host);
  color: white;
}

.composer-action.is-voice {
  border-color: var(--line);
  background: white;
  color: var(--muted);
}

.composer-action.is-voice:hover {
  border-color: #9aa8ba;
  background: white;
  color: var(--ink);
}

.composer-action.is-voice.is-recording {
  border-color: var(--danger);
  background: var(--danger);
  color: white;
  animation: recordingPulse 1.2s infinite ease-in-out;
}

.composer-action.is-transcribing svg {
  animation: locationSpin 1s linear infinite;
}

.attachment-preview {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 48px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  padding: 0 0 10px;
}

.attachment-preview img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
}

.attachment-preview span {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-remove {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
}

.preview-remove svg {
  width: 17px;
}

@keyframes recordingPulse {
  50% {
    opacity: 0.68;
  }
}

.text-input {
  min-height: 46px;
  max-height: 110px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  overflow-y: auto;
  line-height: 1.35;
}

.telegram-composer .text-input {
  height: var(--composer-control-size);
  min-height: var(--composer-control-size);
  max-height: var(--composer-control-size);
  align-self: center;
  border-radius: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
}

.host-only {
  display: block;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 10;
  transform: translateX(-50%);
  border-radius: 8px;
  background: var(--ink);
  color: white;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  font-size: 14px;
}

@media (max-width: 880px) {
  html,
  body,
  #app {
    height: 100%;
  }

  .shell {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    padding: 12px;
  }

  .guest-shell {
    position: fixed;
    inset: 0;
    width: 100%;
    padding: max(6px, env(safe-area-inset-top)) 6px max(6px, env(safe-area-inset-bottom));
  }

  .app-frame {
    display: grid;
    height: 100%;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .guest-shell .app-frame {
    display: block;
    height: 100%;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 16px;
  }

  .brand-title {
    font-size: 17px;
  }

  .brand-subtitle {
    font-size: 12px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .top-actions,
  .host-action-row {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }

  .top-actions .btn,
  .top-actions .field {
    flex: 1;
  }

  .top-actions .btn {
    min-height: 40px;
    min-width: 0;
    flex: 1 1 0;
    padding: 0 8px;
    font-size: 13px;
    white-space: nowrap;
    -webkit-text-size-adjust: 100%;
  }

  .host-brand-row {
    align-items: center;
    flex-direction: row;
    gap: 8px;
  }

  .host-profile-controls {
    width: 118px;
    flex: 0 0 118px;
    justify-content: flex-end;
    gap: 5px;
  }

  .host-name-button {
    width: 106px;
    min-width: 96px;
    min-height: 40px;
    font-size: 12px;
  }

  .host-profile-controls .language-field {
    width: 118px;
    flex: 0 0 118px;
  }

  .language-field {
    width: 118px;
    flex: 0 0 118px;
    min-width: 0;
  }

  .language-field .select {
    min-width: 0;
    min-height: 40px;
    padding: 0 25px 0 8px;
    font-size: 13px;
  }

  .compact {
    min-width: min(100%, 160px);
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .invite,
  .chat {
    min-height: auto;
  }

  .chat {
    height: 100%;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .host-chat {
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .guest-shell .chat {
    height: 100%;
  }

  .solo-chat {
    min-height: auto;
  }

  .chat-header {
    padding: 12px;
  }

  .room-meta h2 {
    font-size: 17px;
  }

  .room-meta p {
    font-size: 12px;
  }

  .control-row,
  .composer {
    grid-template-columns: 1fr;
  }

  .msg {
    max-width: 88%;
  }

  .chat-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .guest-shell .chat-header {
    gap: 8px;
    padding: 10px 12px;
  }

  .guest-shell .room-meta h2 {
    font-size: 20px;
  }

  .guest-shell .room-meta p {
    font-size: 13px;
    line-height: 1.35;
  }

  .guest-shell .chat-tools .select {
    min-height: 40px;
    width: 100%;
  }

  .guest-language-field {
    width: auto;
    max-width: none;
  }

  .guest-language-field .select {
    min-height: 0;
  }

  .guest-header-actions {
    display: flex;
    width: 100%;
    align-items: end;
    gap: 6px;
  }

  .guest-header-actions .guest-language-field {
    height: 40px;
    flex: 2 1 0;
  }

  .guest-action-button {
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    padding: 0 6px;
    font-size: 12px;
  }

  .guest-shell .messages {
    padding: 14px 12px;
  }

  .guest-shell .composer {
    grid-template-columns: 1fr;
    align-content: start;
    gap: 8px;
    padding: 10px 12px;
  }

  .guest-shell .telegram-composer,
  .telegram-composer {
    --composer-control-size: 42px;
    grid-template-columns: var(--composer-control-size) minmax(0, 1fr) var(--composer-control-size);
  }

  .composer-icon {
    width: var(--composer-control-size, 42px);
    min-width: var(--composer-control-size, 42px);
    max-width: var(--composer-control-size, 42px);
    height: var(--composer-control-size, 42px);
    min-height: var(--composer-control-size, 42px);
    max-height: var(--composer-control-size, 42px);
  }

  .guest-shell .text-input {
    height: var(--composer-control-size);
    min-height: var(--composer-control-size);
    max-height: 82px;
  }

  .guest-shell .composer .btn {
    min-height: 42px;
  }

  .chat-tools {
    justify-content: flex-start;
    width: 100%;
  }

  .chat-tools .btn {
    min-height: 38px;
  }

  .chat-tools .select {
    flex: 1;
    min-width: 150px;
  }
}

@media (max-width: 520px) {
  .host-action-row,
  .host-primary-actions,
  .host-secondary-actions {
    gap: 6px;
  }

  .host-primary-actions .btn,
  .host-secondary-actions .btn,
  .host-name-input,
  .host-language-select {
    height: 48px;
    min-height: 48px;
    max-height: 48px;
    padding: 5px 8px;
    font-size: 12px;
    line-height: 1.2;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .host-primary-actions,
  .host-secondary-actions {
    grid-auto-rows: 48px;
  }

  .headline {
    font-size: 34px;
  }

  .local-prompt {
    font-size: 20px;
  }
}

/* Guest chat header stays compact while keeping the room name readable. */
.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;
}

.about-modal {
  width: min(500px, 100%);
  padding: 24px;
}

.about-heading {
  display: flex;
  align-items: center;
  justify-content: center;
}

.about-kicker {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.about-lead {
  margin: 24px 0 8px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
}

.about-body {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.about-download {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  padding: 14px;
}

.about-download-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: white;
  color: var(--guest);
}

.about-download-icon svg {
  width: 17px;
  height: 17px;
}

.about-download h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
}

.about-download p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.about-download-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.about-store-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 7px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 8px 9px;
  font-size: 12px;
  font-weight: 700;
}

.about-store-link > svg {
  grid-row: span 2;
  width: 16px;
  height: 16px;
  color: var(--guest);
}

.about-store-link > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.about-store-link small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
}

.attachment-preview {
  display: flex;
  grid-column: 1 / -1;
  min-width: 0;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  padding: 0 0 10px;
}

.attachment-tile {
  position: relative;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
}

.attachment-tile img {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
}

.attachment-tile .preview-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
}

.attachment-tile .preview-remove svg {
  width: 13px;
  height: 13px;
}

.attachment-menu,
.emoji-picker {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  padding: 8px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
}

.attachment-menu button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  padding: 0 10px;
  font-size: 12px;
}

.attachment-menu button:hover {
  background: #eef2f7;
}

.attachment-menu svg {
  width: 17px;
  height: 17px;
  color: var(--guest);
}

.emoji-picker {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.emoji-picker button,
.reaction-menu button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: transparent;
  font-size: 21px;
}

.emoji-picker button:hover,
.reaction-menu button:hover {
  background: #eef2f7;
}

.composer-input-wrap {
  position: relative;
  min-width: 0;
}

.composer-input-wrap .text-input {
  width: 100%;
  padding-right: 42px;
}

.emoji-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  transform: translateY(-50%);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
}

.emoji-toggle:hover {
  background: #eef2f7;
  color: var(--ink);
}

.emoji-toggle svg {
  width: 18px;
  height: 18px;
}

.draft-location {
  display: flex;
  grid-column: 1 / -1;
  min-width: 0;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 0 0 9px;
}

.draft-location-icon {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--guest);
}

.draft-location-icon svg {
  width: 17px;
}

.draft-location-label {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draft-location > button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 7px;
  background: #f8fafc;
  color: var(--muted);
}

.draft-location > button svg {
  width: 16px;
}

.location-modal {
  width: min(680px, 100%);
  padding: 20px;
}

.location-modal-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  margin: 0 42px 14px 0;
}

.location-modal-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--guest);
}

.location-modal-icon svg {
  width: 20px;
  height: 20px;
}

.location-modal-heading h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
}

.location-modal-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.location-hint {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.location-current-button {
  min-height: 44px;
}

.location-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin: 0 42px 12px 0;
}

.location-search-input {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
}

.location-search-input > svg {
  position: absolute;
  left: 13px;
  z-index: 1;
  width: 17px;
  color: var(--muted);
  pointer-events: none;
}

.location-search-form .text-input,
.location-search-input .text-input {
  min-width: 0;
  width: 100%;
  padding-left: 40px;
}

.location-search-form .btn {
  min-height: 46px;
}

.location-map-shell {
  position: relative;
  overflow: hidden;
  min-height: 250px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #e7eef2;
}

.location-map {
  width: 100%;
  height: min(38vh, 340px);
  min-height: 250px;
}

.location-map .leaflet-control-attribution {
  font-size: 9px;
}

.location-map-tip {
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 500;
  display: inline-flex;
  max-width: calc(100% - 28px);
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 5px 18px rgba(15, 23, 42, 0.15);
  color: var(--muted);
  padding: 6px 10px;
  font-size: 11px;
  transform: translateX(-50%);
  pointer-events: none;
}

.location-map-tip svg {
  width: 14px;
  flex: 0 0 auto;
}

.location-map-unavailable {
  position: absolute;
  inset: 0;
  z-index: 600;
  display: none;
  place-items: center;
  background: rgba(244, 247, 251, 0.94);
  color: var(--muted);
  padding: 24px;
  text-align: center;
  font-size: 13px;
}

.location-map-unavailable.is-visible {
  display: grid;
}

.location-selection-pin {
  border: 0;
  background: transparent;
}

.location-selection-pin span {
  display: block;
  width: 24px;
  height: 24px;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  background: var(--guest);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.3);
  transform: rotate(-45deg);
}

.location-selection-pin span::after {
  display: block;
  width: 7px;
  height: 7px;
  margin: 6px auto 0;
  border-radius: 50%;
  background: #fff;
  content: "";
}

.location-result-marker-label {
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--guest);
  font-size: 11px;
  font-weight: 800;
}

.location-result-marker-label::before {
  display: none;
}

.location-selection-summary {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafc;
  padding: 9px 11px;
}

.location-selection-summary > span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.location-selection-summary small {
  color: var(--muted);
  font-size: 11px;
}

.location-selection-summary strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-selection-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--guest);
}

.location-selection-icon svg {
  width: 17px;
}

.location-search-status,
.location-results-title {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.location-search-status.is-error {
  color: var(--danger);
}

.location-search-status.is-busy {
  display: flex;
  align-items: center;
  gap: 7px;
}

.location-search-fallback {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  border: 1px solid rgba(37, 99, 235, 0.28);
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--guest);
  padding: 7px 9px;
  font-size: 12px;
  text-align: left;
}

.location-search-fallback:hover {
  background: rgba(37, 99, 235, 0.14);
}

.location-search-fallback svg {
  width: 14px;
  flex: 0 0 auto;
}

.location-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(37, 99, 235, 0.2);
  border-top-color: var(--guest);
  border-radius: 50%;
  animation: locationSpin 0.8s linear infinite;
}

@keyframes locationSpin {
  to {
    transform: rotate(360deg);
  }
}

.location-results {
  display: grid;
  max-height: 150px;
  gap: 5px;
  margin-top: 7px;
  overflow-y: auto;
}

.location-result {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  padding: 7px 9px;
  text-align: left;
}

.location-result:hover {
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.08);
}

.location-result-icon {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.12);
  color: var(--guest);
}

.location-result-icon svg {
  width: 15px;
}

.location-result-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.location-result-copy strong,
.location-result-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-result-copy strong {
  font-size: 12px;
}

.location-result-copy small {
  color: var(--muted);
  font-size: 11px;
}

.location-result-arrow {
  width: 15px;
  color: var(--muted);
}

.location-modal-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.location-modal-actions .btn {
  display: inline-flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.location-modal-actions .btn svg {
  width: 16px;
}

.location-card {
  display: grid;
  min-width: 220px;
  gap: 10px;
  padding: 2px 0;
}

.location-card-heading {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 8px;
}

.location-card-heading > div {
  min-width: 0;
}

.location-card-heading strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.35;
}

.location-pin {
  display: grid;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.22);
}

.location-pin svg {
  width: 15px;
  height: 15px;
}

.location-accuracy {
  display: block;
  margin-top: 2px;
  opacity: 0.74;
  font-size: 11px;
}

.location-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-top: 1px solid rgba(128, 128, 128, 0.24);
  padding-top: 8px;
}

.location-card-actions a {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(128, 128, 128, 0.24);
  border-radius: 7px;
  color: inherit;
  padding: 0 8px;
  font-size: 11px;
  text-decoration: none;
}

.location-card-actions a:hover {
  background: rgba(255, 255, 255, 0.2);
}

.location-card-actions svg {
  width: 13px;
  height: 13px;
}

.image-message-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.image-message-grid .image-message {
  margin: 0;
}

.image-message-grid .image-message img {
  width: 100%;
  max-width: 240px;
  max-height: 240px;
}

.message-reactions {
  display: flex;
  flex: 0 0 auto;
  min-width: 0;
  align-items: center;
  gap: 5px;
  padding-bottom: 2px;
}

.reaction-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.reaction-pill,
.reaction-trigger {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  padding: 0 7px;
  font-size: 12px;
}

.reaction-trigger {
  width: 22px;
  height: 22px;
  min-height: 22px;
  justify-content: center;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.reaction-trigger svg {
  width: 15px;
  height: 15px;
}

.reaction-tools {
  position: relative;
}

.reaction-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 5px);
  z-index: 4;
  display: flex;
  max-width: min(260px, calc(100vw - 32px));
  gap: 2px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  padding: 4px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.mine .message-reactions {
  justify-content: flex-end;
}

.mine .reaction-pill,
.mine .reaction-trigger {
  border-color: rgba(15, 118, 110, 0.26);
}

.mine .reaction-trigger {
  border-color: transparent;
}

.guest-shell .messages {
  overscroll-behavior: contain;
}

@media (max-width: 600px) {
  .location-modal {
    padding: 16px;
  }

  .location-search-form {
    margin-right: 0;
  }

  .location-map {
    height: 34vh;
    min-height: 220px;
  }

  .location-map-tip {
    max-width: calc(100% - 20px);
    font-size: 10px;
  }

  .location-modal-actions .btn {
    min-height: 42px;
    padding: 0 8px;
    font-size: 12px;
  }

  .guest-chat-header {
    padding: 8px 10px;
  }

  .guest-header-row {
    gap: 6px;
  }

  .about-modal {
    padding: 20px;
  }

  .about-lead {
    margin-top: 20px;
    font-size: 16px;
  }

  .guest-shell .telegram-composer {
    grid-template-columns: var(--composer-control-size) minmax(0, 1fr) var(--composer-control-size);
  }

  .location-search-form {
    grid-template-columns: 1fr;
  }

  .location-search-form .btn {
    width: 100%;
  }
}

@media (max-width: 880px) {
  .join-shell {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    padding: clamp(48px, 8vh, 96px) 24px 48px;
  }
}

@media (max-width: 767px) {
  .join-shell {
    display: block;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
    padding: calc(20px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
    background: var(--color-bg);
  }

  .join-frame {
    width: 100%;
    max-width: none;
  }

  .join-shell .join-panel {
    display: flex;
    min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 44px);
    flex-direction: column;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .join-home-toolbar {
    gap: 8px;
  }

  .join-brand-name {
    font-size: 21px;
  }

  .join-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .join-language-picker {
    height: 40px;
    padding-right: 25px;
    padding-left: 10px;
  }

  .join-language-picker::after {
    top: 15px;
    right: 10px;
  }

  .join-language-select {
    width: 118px;
    font-size: 13px;
  }

  .join-tagline {
    margin-top: 24px;
  }

  .join-intro {
    margin-top: 42px;
  }

  .join-intro h1 {
    font-size: 30px;
  }

  .join-form {
    margin-top: 28px;
  }

  .join-code-control {
    width: 100%;
  }

  .join-code-cells {
    gap: clamp(6px, 2vw, 8px);
  }
}

@media (max-width: 359px) {
  .join-home-toolbar {
    gap: 6px;
  }

  .join-language-select {
    width: 110px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .join-language-picker,
  .join-code-cell,
  .join-shell .join-submit {
    transition: none;
  }
}

/* KKgo visitor chat: warm, compact, and intentionally scoped away from the join page. */
.guest-shell {
  --kk-yellow: #f7d817;
  --kk-coral: #ff6552;
  --kk-blue: #4f8fbd;
  --kk-bg: #eaf2f7;
  --kk-chat-bg: #b9cde0;
  --kk-surface: #fffdfc;
  --kk-text: #222222;
  --kk-text-secondary: #66727e;
  --kk-text-tertiary: #87929d;
  --kk-border: #e4e8eb;
  --kk-yellow-soft: #fff4ba;
  --kk-blue-soft: #edf5fa;
  --ink: var(--kk-text);
  --muted: var(--kk-text-secondary);
  --line: var(--kk-border);
  --panel: var(--kk-surface);
  --guest: var(--kk-blue);
  --host: var(--kk-blue);
  --shadow: 0 12px 40px rgba(34, 34, 34, 0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: 20px;
  overflow: hidden;
  background: var(--kk-bg);
  color: var(--kk-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.guest-shell .app-frame {
  display: block;
  width: min(760px, 100%);
  height: min(880px, calc(100dvh - 40px));
  min-height: 0;
}

.guest-shell .solo-chat {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(79, 143, 189, 0.12);
  border-radius: 24px;
  background: var(--kk-surface);
  box-shadow: var(--shadow);
}

.guest-shell .chat {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.guest-shell .guest-chat-header {
  display: block;
  flex: 0 0 auto;
  padding: 10px 16px;
  border-bottom: 1px solid var(--kk-border);
  background: var(--kk-surface);
}

.guest-header-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.kkgo-logo {
  display: block;
  width: 102px;
  height: 40px;
  flex: 0 0 auto;
  aspect-ratio: 2.56 / 1;
  background-image: url("/assets/kkgo-horizontal-light-h40.webp");
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

:root[data-theme="dark"] .kkgo-logo {
  background-image: url("/assets/kkgo-horizontal-dark-h40.webp");
}

.guest-header-tools {
  display: flex;
  min-width: 0;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.guest-language-control {
  position: relative;
  display: inline-flex;
  width: auto;
  min-width: 0;
  height: 38px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--kk-border);
  border-radius: 10px;
  background: var(--kk-surface);
  color: var(--kk-text);
  padding: 0 10px;
}

.guest-language-control .select {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  padding: 0;
}

.guest-language-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.guest-language-label svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  stroke-width: 2;
}

.guest-name-chip,
.guest-about-button {
  display: inline-flex;
  width: auto;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  max-width: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
  border: 1px solid var(--kk-border);
  border-radius: 11px;
  background: var(--kk-surface);
  color: var(--kk-text);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 600;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.guest-name-chip {
  flex: 0 0 auto;
}

.guest-name-chip > span:last-child,
.guest-about-button > span {
  white-space: nowrap;
}

.guest-about-button {
  flex: 0 0 auto;
}

.guest-name-chip:hover,
.guest-about-button:hover {
  border-color: rgba(79, 143, 189, 0.35);
  background: #f2f7fa;
}

.guest-shell .delivery-status {
  flex: 0 0 auto;
  justify-self: center;
  margin: 9px auto -2px;
  border-color: rgba(79, 143, 189, 0.18);
  background: rgba(79, 143, 189, 0.08);
  color: #3d7298;
}

.guest-shell .delivery-status.is-offline {
  border-color: rgba(247, 216, 23, 0.42);
  background: #fff8d8;
  color: #645817;
}

.guest-shell .messages {
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  gap: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 20px 22px 24px;
  background: linear-gradient(180deg, rgba(234, 242, 247, 0.24), transparent 180px);
  scrollbar-color: rgba(79, 143, 189, 0.24) transparent;
  scrollbar-width: thin;
}

.guest-shell .msg {
  max-width: min(72%, 620px);
  gap: 4px;
}

.guest-shell .msg-meta {
  color: var(--kk-text-tertiary);
  font-size: 11px;
  line-height: 1.3;
}

.guest-shell .message-sender-emoji {
  color: var(--kk-coral);
  font-size: 12px;
}

.guest-shell .bubble {
  border: 1px solid rgba(79, 143, 189, 0.1);
  border-radius: 18px 18px 18px 5px;
  background: var(--kk-blue-soft);
  color: var(--kk-text);
  padding: 10px 14px;
  font-size: 15px;
  line-height: 1.5;
}

.guest-shell .msg.guest-mine .bubble {
  border-color: rgba(247, 216, 23, 0.25);
  border-radius: 18px 18px 5px 18px;
  background: var(--kk-yellow-soft);
  color: var(--kk-text);
}

.guest-shell .bubble .original,
.guest-shell .bubble .outbound {
  border-color: rgba(34, 34, 34, 0.12);
  color: var(--kk-text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.guest-shell .msg.guest-mine .bubble .original,
.guest-shell .msg.guest-mine .bubble .outbound {
  border-color: rgba(34, 34, 34, 0.15);
  color: #62605a;
}

.guest-shell .guest-empty-state {
  display: flex;
  width: min(100%, 390px);
  min-height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  padding: 24px 16px;
  text-align: center;
}

.guest-empty-icon {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 1px solid rgba(79, 143, 189, 0.13);
  border-radius: 18px;
  background: rgba(79, 143, 189, 0.09);
  color: var(--kk-blue);
}

.guest-empty-icon svg {
  width: 25px;
  height: 25px;
  stroke-width: 1.75;
}

.guest-empty-state h3 {
  margin: 12px 0 5px;
  color: var(--kk-text);
  font-size: 23px;
  font-weight: 650;
  line-height: 1.35;
}

.guest-empty-state p {
  max-width: 320px;
  margin: 0;
  color: var(--kk-text-secondary);
  font-size: 15px;
  line-height: 1.5;
}

.guest-shell .telegram-composer {
  --composer-control-size: 44px;
  width: 100%;
  min-width: 0;
  flex: 0 0 auto;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: end;
  gap: 8px;
  border-top: 1px solid var(--kk-border);
  background: var(--kk-surface);
  padding: 11px 16px 14px;
}

.guest-shell .composer-icon {
  align-self: end;
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--kk-text-secondary);
}

.guest-shell .composer-icon:hover {
  border-color: var(--kk-border);
  background: #f5f8fa;
  color: var(--kk-text);
}

.guest-shell .composer-action.is-send {
  border-color: var(--kk-yellow);
  background: var(--kk-yellow);
  color: var(--kk-text);
}

.guest-shell .composer-action.is-send:hover {
  border-color: #e6c911;
  background: #f0d016;
  color: var(--kk-text);
}

.guest-shell .composer-action.is-voice.is-recording {
  border-color: var(--kk-coral);
  background: var(--kk-coral);
  color: #fff;
}

.guest-shell .composer-input-wrap {
  align-self: end;
  width: 100%;
  min-width: 0;
}

.guest-shell .telegram-composer .text-input,
.guest-shell .composer-input-wrap .text-input {
  display: block;
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 48px;
  max-height: 132px;
  align-self: end;
  overflow-x: hidden;
  overflow-y: hidden;
  border: 1px solid rgba(79, 143, 189, 0.12);
  border-radius: 22px;
  background: #f1f6f9;
  color: var(--kk-text);
  padding: 12px 44px 11px 14px;
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.guest-shell .guest-message-textarea::placeholder {
  color: #818d96;
  opacity: 1;
}

.guest-shell .guest-message-textarea:focus {
  border-color: var(--kk-blue);
  background: #fff;
}

.guest-shell .composer-input-wrap .emoji-toggle {
  top: auto;
  right: 8px;
  bottom: 8px;
  width: 30px;
  height: 30px;
  transform: none;
  color: var(--kk-text-secondary);
}

.guest-shell .composer-input-wrap .emoji-toggle:hover {
  padding: 0;
  place-items: center;
  background: rgba(79, 143, 189, 0.09);
}

.guest-shell :where(button, select, a, input, textarea):focus-visible {
  outline: 2px solid var(--kk-blue);
  outline-offset: 2px;
}

.guest-shell .guest-language-control .select:focus-visible {
  outline-offset: 1px;
}

.guest-shell .about-modal,
.guest-shell .name-modal,
.invite.modal {
  border: 1px solid rgba(79, 143, 189, 0.13);
  border-radius: 22px;
  background: var(--kk-surface);
  box-shadow: 0 18px 56px rgba(34, 34, 34, 0.16);
}

.guest-shell .about-modal {
  width: min(520px, 100%);
  max-height: min(90dvh, 760px);
  padding: 26px;
}

.guest-shell .about-heading {
  align-items: center;
  padding: 4px 0 0;
}

.guest-shell .about-logo {
  width: 92px;
  height: 36px;
}

.guest-shell .about-lead {
  position: relative;
  margin: 23px 0 9px;
  color: var(--kk-text);
  font-size: 18px;
  font-weight: 700;
}

.guest-shell .about-lead::after {
  display: block;
  width: 34px;
  height: 3px;
  margin-top: 9px;
  border-radius: 99px;
  background: var(--kk-yellow);
  content: "";
}

.guest-shell .about-body {
  color: var(--kk-text-secondary);
  font-size: 14px;
  line-height: 1.7;
}

.guest-shell .about-download {
  margin-top: 21px;
  border-color: rgba(79, 143, 189, 0.1);
  border-radius: 16px;
  background: #f0f6f9;
  padding: 16px;
}

.guest-shell .about-download-icon {
  color: var(--kk-blue);
}

.guest-shell .about-store-link {
  border-color: var(--kk-border);
  border-radius: 11px;
}

.guest-shell .about-store-link > svg {
  color: var(--kk-blue);
}

.guest-shell .name-modal {
  width: min(420px, 100%);
  padding: 26px;
}

.guest-shell .guest-name-modal h2 {
  margin-bottom: 5px;
  color: var(--kk-text);
  font-size: 22px;
}

.guest-shell .guest-name-identity {
  display: grid;
  width: 40px;
  height: 40px;
  margin: 0 0 14px;
  place-items: center;
  border: 1px solid rgba(34, 34, 34, 0.06);
  border-radius: 13px;
  background: #fff5bf;
  color: var(--kk-text);
  font-size: 21px;
  line-height: 1;
}

.guest-shell .name-modal-intro {
  margin: 0 0 18px;
  color: var(--kk-text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.guest-shell .guest-name-modal form {
  grid-template-columns: 1fr;
  gap: 12px;
}

.guest-shell .guest-name-modal .text-input {
  width: 100%;
  border-radius: 12px;
  background: #f7f9fa;
}

.guest-shell .guest-name-save {
  min-height: 48px;
  border-radius: 13px;
  background: var(--kk-yellow);
  color: var(--kk-text);
  font-weight: 700;
}

.guest-shell .guest-name-save:hover {
  background: #f0d016;
}

.invite.modal {
  --kk-surface: #fffdfc;
  --kk-text: #222222;
  --kk-text-secondary: #66727e;
  --kk-border: #e4e8eb;
  width: min(540px, 100%);
  min-height: 0;
  max-height: min(90dvh, 760px);
  padding: 25px;
}

.invite.modal .kkgo-logo {
  margin-bottom: 16px;
}

.invite.modal .headline {
  color: var(--kk-text);
  font-size: 25px;
  line-height: 1.2;
}

.invite.modal .body-copy {
  margin-top: 8px;
  font-size: 14px;
}

.invite.modal .qr-card {
  border-color: var(--kk-border);
  border-radius: 18px;
  background: #f7fafb;
  box-shadow: none;
}

.invite.modal .qr-zone {
  min-height: 0;
}

.invite.modal .local-prompt {
  color: var(--kk-text-secondary);
  font-size: 14px;
}

.invite.modal .close {
  border: 1px solid var(--kk-border);
  border-radius: 10px;
  background: var(--kk-surface);
  color: var(--kk-text-secondary);
}

.guest-shell .close {
  border-color: var(--kk-border);
  border-radius: 10px;
  background: var(--kk-surface);
  color: var(--kk-text-secondary);
}

@media (max-width: 880px) {
  .guest-shell {
    position: relative;
    inset: auto;
    width: 100%;
    padding: 16px;
  }

  .guest-shell .app-frame {
    display: block;
    width: min(760px, 100%);
    height: min(880px, calc(100dvh - 32px));
  }
}

@media (max-width: 767px) {
  html,
  body,
  #app {
    height: 100%;
    min-height: 100dvh;
  }

  html.guest-chat-active,
  html.guest-chat-active body,
  html.guest-chat-active body #app {
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .guest-shell {
    position: static;
    inset: auto;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    padding: max(16px, env(safe-area-inset-top)) 0 0;
    overflow: hidden;
  }

  .guest-shell .app-frame {
    display: flex;
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
  }

  .guest-shell .solo-chat {
    width: 100%;
    height: 100%;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .guest-shell .guest-chat-header {
    padding: 8px 14px;
  }

  .guest-shell .kkgo-logo {
    width: 88px;
    height: 36px;
  }

  .guest-shell .guest-header-tools {
    gap: 6px;
  }

  .guest-shell .guest-language-control {
    height: 38px;
    border-radius: 10px;
    padding: 0 9px;
  }

  .guest-shell .guest-language-label {
    font-size: 12px;
  }

  .guest-shell .guest-name-chip,
  .guest-shell .guest-about-button {
    height: 38px;
    min-height: 38px;
    border-radius: 10px;
    padding: 0 9px;
    font-size: 12px;
  }

  .guest-shell .messages {
    padding: 14px 12px 18px;
  }

  .guest-shell .msg {
    max-width: min(84%, 620px);
  }

  .guest-shell .bubble {
    padding: 9px 12px;
    font-size: 15px;
  }

  .guest-shell .guest-empty-state {
    width: 100%;
    padding: 20px 12px;
  }

  .guest-shell .telegram-composer {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 6px;
    padding: 8px max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .guest-shell .composer-icon {
    width: 42px;
    min-width: 42px;
    max-width: 42px;
    height: 42px;
    min-height: 42px;
    max-height: 42px;
  }

  .guest-shell .about-modal,
  .guest-shell .name-modal,
  .invite.modal {
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 22px 18px;
    border-radius: 20px;
  }

  .guest-shell .about-logo {
    width: 82px;
    height: 32px;
  }

  .guest-shell .about-download {
    gap: 9px;
    padding: 12px;
  }
}

@media (max-width: 359px) {
  .guest-shell .guest-chat-header {
    padding-right: 8px;
    padding-left: 8px;
  }

  .guest-shell .kkgo-logo {
    width: 82px;
    height: 32px;
  }

  .guest-shell .guest-header-tools {
    gap: 4px;
  }

  .guest-shell .guest-language-control {
    height: 36px;
    padding: 0 7px;
  }

  .guest-shell .guest-name-chip,
  .guest-shell .guest-about-button {
    height: 36px;
    min-height: 36px;
    padding: 0 7px;
    font-size: 11px;
  }

  .guest-shell .telegram-composer {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    gap: 4px;
    padding-right: max(8px, env(safe-area-inset-right));
    padding-left: max(8px, env(safe-area-inset-left));
  }

  .guest-shell .composer-icon {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    height: 40px;
    min-height: 40px;
    max-height: 40px;
  }

  .guest-shell .telegram-composer .text-input {
    padding-right: 38px;
    padding-left: 12px;
  }
}

@media (max-height: 640px) and (min-width: 768px) {
  .guest-shell .guest-chat-header {
    padding-top: 9px;
    padding-bottom: 8px;
  }

  .guest-shell .messages {
    padding-top: 12px;
    padding-bottom: 16px;
  }

  .guest-shell .telegram-composer {
    padding-top: 8px;
    padding-bottom: 9px;
  }
}


/* First-paint system theme and compact in-page controls. */
:root[data-theme="dark"] body {
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.1), transparent 34%),
    linear-gradient(315deg, rgba(245, 158, 11, 0.08), transparent 42%),
    var(--canvas);
  color: var(--ink);
}

:root[data-theme="dark"] .join-code-label {
  color: #c0cad5;
}

:root[data-theme="dark"] .join-code-cell.is-filled {
  border-color: #566272;
}

:root[data-theme="dark"] .join-shell .join-panel {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

:root[data-theme="dark"] .join-shell .join-submit:disabled {
  background: #303943;
  color: #8793a0;
}

.theme-toggle {
  display: inline-grid;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: transparent;
  color: var(--color-text-secondary);
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.theme-toggle:hover {
  border-color: var(--color-text-tertiary);
  background: color-mix(in srgb, var(--color-surface) 78%, var(--color-text-secondary) 22%);
  color: var(--color-text-primary);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
}

.guest-shell .theme-toggle {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  border-color: transparent;
  border-radius: 10px;
  color: var(--kk-text-secondary);
}

.guest-shell .theme-toggle:hover {
  border-color: var(--kk-border);
  background: color-mix(in srgb, var(--kk-surface) 84%, var(--kk-text) 16%);
  color: var(--kk-text);
}

:root[data-theme="dark"] .guest-shell {
  --kk-yellow: #e5ca3b;
  --kk-coral: #ff786a;
  --kk-blue: #75b3d8;
  --kk-bg: #111820;
  --kk-chat-bg: #1a2631;
  --kk-surface: #1c252e;
  --kk-text: #edf2f7;
  --kk-text-secondary: #afbac6;
  --kk-text-tertiary: #8997a6;
  --kk-border: #35414c;
  --kk-yellow-soft: #4a4427;
  --kk-blue-soft: #243542;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.38);
}

:root[data-theme="dark"] .guest-shell .messages {
  background: linear-gradient(180deg, rgba(117, 179, 216, 0.055), transparent 180px);
  scrollbar-color: rgba(117, 179, 216, 0.26) transparent;
}

:root[data-theme="dark"] .guest-shell .delivery-status {
  border-color: rgba(117, 179, 216, 0.24);
  background: rgba(117, 179, 216, 0.1);
  color: #b8d8eb;
}

:root[data-theme="dark"] .guest-shell .delivery-status.is-offline {
  border-color: rgba(229, 202, 59, 0.34);
  background: #37331e;
  color: #eee0a0;
}

:root[data-theme="dark"] .guest-shell .guest-name-chip,
:root[data-theme="dark"] .guest-shell .guest-about-button,
:root[data-theme="dark"] .guest-shell .guest-language-control {
  border-color: var(--kk-border);
  background: var(--kk-surface);
  color: var(--kk-text);
}

:root[data-theme="dark"] .guest-shell .guest-name-chip:hover,
:root[data-theme="dark"] .guest-shell .guest-about-button:hover,
:root[data-theme="dark"] .guest-shell .composer-icon:hover {
  background: #28333e;
}

:root[data-theme="dark"] .guest-shell .guest-language-control .select {
  color: var(--kk-text);
}

:root[data-theme="dark"] .guest-shell .guest-language-control .select option {
  background: var(--kk-surface);
  color: var(--kk-text);
}

:root[data-theme="dark"] .guest-shell .msg.guest-mine .bubble .original,
:root[data-theme="dark"] .guest-shell .msg.guest-mine .bubble .outbound {
  color: #d4cfae;
}

:root[data-theme="dark"] .guest-shell .telegram-composer .text-input,
:root[data-theme="dark"] .guest-shell .composer-input-wrap .text-input {
  border-color: #3a4855;
  background: #26323c;
  color: var(--kk-text);
}

:root[data-theme="dark"] .guest-shell .guest-message-textarea::placeholder {
  color: #9aa7b3;
}

:root[data-theme="dark"] .guest-shell .about-download {
  background: #26323b;
}

:root[data-theme="dark"] .guest-shell .guest-name-identity {
  border-color: #554e2d;
  background: #49432b;
  color: var(--kk-text);
}

:root[data-theme="dark"] .guest-shell .guest-name-modal .text-input {
  border-color: #3a4855;
  background: #26323c;
  color: var(--kk-text);
}

:root[data-theme="dark"] .reaction-menu,
:root[data-theme="dark"] .message-action-menu {
  border-color: var(--kk-border);
  background: var(--kk-surface);
  color: var(--kk-text);
}

.original-disclosure {
  display: grid;
  justify-items: start;
  gap: 4px;
  margin-top: 7px;
}

.bubble .original.auxiliary-original {
  width: 100%;
  margin: 0;
  padding: 7px 0 0;
  border-top: 1px solid rgba(101, 112, 131, 0.2);
  border-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.guest-shell .bubble .original.auxiliary-original {
  border-top-color: rgba(34, 34, 34, 0.14);
  color: var(--kk-text-secondary);
  font-size: 12px;
}

.guest-shell .msg.guest-mine .bubble .original.auxiliary-original {
  border-top-color: rgba(34, 34, 34, 0.16);
  color: #62605a;
}

:root[data-theme="dark"] .guest-shell .msg.guest-mine .bubble .original.auxiliary-original {
  border-top-color: rgba(240, 230, 180, 0.2);
  color: #d4cfae;
}

.original-toggle {
  min-height: 26px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 1px 0;
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.original-toggle:hover {
  color: var(--color-text-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.guest-shell .original-toggle {
  color: var(--kk-text-secondary);
}

.guest-shell .msg.guest-mine .original-toggle {
  color: #625e4b;
}

:root[data-theme="dark"] .guest-shell .msg.guest-mine .original-toggle {
  color: #e0d7a9;
}

.message-action-tools {
  position: relative;
  flex: 0 0 auto;
  align-self: flex-end;
  padding-bottom: 2px;
}

.message-action-trigger {
  display: grid;
  width: 26px;
  height: 26px;
  min-height: 26px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.message-action-trigger:hover,
.message-action-trigger[aria-expanded="true"] {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.message-action-trigger svg {
  width: 16px;
  height: 16px;
}

.message-action-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 5px);
  z-index: 5;
  display: grid;
  min-width: 150px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 4px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.message-action-menu button {
  min-height: 36px;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  padding: 6px 9px;
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
}

.message-action-menu button:hover {
  background: color-mix(in srgb, var(--panel) 82%, var(--color-text-secondary) 18%);
}

.delivery-status {
  display: flex;
  max-width: calc(100% - 24px);
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  text-align: center;
}

.delivery-reconnect {
  min-height: 30px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 650;
}

.delivery-reconnect:hover {
  background: rgba(255, 255, 255, 0.2);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
  }
}


/* Responsive send-location picker restored on the 0.7.4 chat page. */
.location-modal-backdrop {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 20px;
  background: rgba(17, 24, 39, .58);
  overscroll-behavior: contain;
}
.location-modal {
  display: flex;
  box-sizing: border-box;
  width: min(720px, calc(100vw - 40px));
  height: min(780px, calc(var(--kk-visual-height, 100dvh) - 32px));
  max-height: calc(var(--kk-visual-height, 100dvh) - 32px);
  min-width: 0;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  background: var(--panel);
}
.location-modal-header { display:flex; min-width:0; min-height:44px; flex:0 0 auto; align-items:center; justify-content:space-between; gap:12px; }
.location-modal-header h2 { min-width:0; margin:0; color:var(--ink); font-size:18px; line-height:1.3; }
.location-modal .location-close { display:grid; box-sizing:border-box; width:44px; min-width:44px; height:44px; min-height:44px; flex:0 0 44px; place-items:center; border:1px solid var(--line); border-radius:50%; background:var(--panel); color:var(--ink); }
.location-modal .location-close:hover { background:var(--bg); }
.location-close svg { width:20px; height:20px; }
.location-search-area { position:relative; z-index:800; min-width:0; flex:0 0 auto; }
.location-search-form { display:block; min-width:0; margin:0; }
.location-search-input .text-input { box-sizing:border-box; width:100%; min-width:0; height:46px; min-height:44px; border-radius:13px; padding-left:42px; }
.location-search-input > svg { left:14px; width:17px; }
.location-search-suggestions { position:absolute; z-index:2; top:calc(100% + 6px); right:0; left:0; display:grid; max-height:min(240px, 34dvh); gap:4px; overflow-x:hidden; overflow-y:auto; border:1px solid var(--line); border-radius:14px; background:var(--panel); padding:6px; box-shadow:0 12px 32px rgba(17,24,39,.18); }
.location-search-suggestions:empty { display:none; }
.location-search-status { margin:4px 6px; color:var(--muted); font-size:12px; line-height:1.4; }
.location-search-status.is-error { color:var(--danger); }
.location-result { min-height:48px; grid-template-columns:30px minmax(0,1fr) 16px; border-radius:10px; }
.location-search-fallback { display:flex; width:100%; min-height:44px; margin:0; border:0; border-radius:10px; background:transparent; color:var(--guest); }
.location-map-shell { position:relative; display:flex; min-width:0; min-height:0; flex:1 1 auto; overflow:hidden; border:1px solid var(--line); border-radius:16px; background:#e7eef2; }
.location-map { width:100%; height:100%; min-width:0; min-height:0; flex:1 1 auto; }
.location-map-unavailable { z-index:510; padding:20px; }
.location-current-button { position:absolute; right:12px; bottom:24px; z-index:700; display:grid; box-sizing:border-box; width:46px; min-width:46px; height:46px; min-height:46px; place-items:center; border:1px solid rgba(34,34,34,.12); border-radius:50%; background:var(--panel); color:var(--guest,#4f8fbd); box-shadow:0 3px 14px rgba(17,24,39,.2); }
.location-current-button svg { width:20px; height:20px; }
.location-current-button:disabled { cursor:wait; opacity:.8; }
.location-selection-summary { display:flex; min-width:0; min-height:54px; flex:0 0 auto; align-items:center; gap:10px; margin:0; border:0; border-radius:12px; background:color-mix(in srgb, var(--panel) 90%, var(--guest) 10%); padding:6px 10px; }
.location-selection-icon { width:34px; height:34px; flex:0 0 34px; border-radius:10px; }
.location-selection-copy { display:grid; min-width:0; gap:2px; }
.location-selection-copy strong, .location-selection-copy small { display:-webkit-box; min-width:0; overflow:hidden; overflow-wrap:anywhere; text-overflow:ellipsis; white-space:normal; -webkit-box-orient:vertical; -webkit-line-clamp:2; line-clamp:2; line-height:1.35; }
.location-selection-copy strong { color:var(--ink); font-size:13px; font-weight:600; }
.location-selection-copy small { min-height:14px; color:var(--muted); font-size:11px; }
.location-action-error { flex:0 0 auto; margin:-6px 2px 0; color:var(--danger); font-size:12px; line-height:1.35; }
.location-action-error:empty { display:none; }
.location-send-button { display:flex; box-sizing:border-box; width:100%; min-width:0; min-height:50px; flex:0 0 auto; align-items:center; justify-content:center; gap:8px; border:1px solid #e6c911; border-radius:13px; background:#f7d817; color:#222; padding:10px 16px; font-size:15px; font-weight:650; }
.location-send-button svg { width:18px; height:18px; }
.location-send-button:disabled { cursor:not-allowed; opacity:.55; }
.location-modal :where(button,input):focus-visible { outline:2px solid #4f8fbd; outline-offset:2px; }
.location-modal .leaflet-control-zoom { margin-bottom:76px; }
.location-map .amap-toolbar { right:10px !important; bottom:76px !important; }
@media (max-width: 1023px) and (min-width: 768px) {
.location-modal-backdrop { padding:16px; }
.location-modal { width:min(760px, calc(100vw - 32px)); max-height:calc(var(--kk-visual-height, 100dvh) - 32px); height:min(780px, calc(var(--kk-visual-height, 100dvh) - 32px)); }
}
@media (max-width: 767px) {
.location-modal-backdrop { display:flex; align-items:stretch; padding:0; overflow:hidden; }
.location-modal { width:100%; height:var(--kk-visual-height, 100dvh); max-height:var(--kk-visual-height, 100dvh); gap:10px; border:0; border-radius:0; padding:max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
.location-map-shell, .location-map { min-height:160px; }
.location-current-button { right:10px; bottom:20px; }
}
@media (max-width: 359px) {
.location-modal { gap:8px; padding-right:max(8px, env(safe-area-inset-right)); padding-left:max(8px, env(safe-area-inset-left)); }
.location-modal-header h2 { font-size:16px; }
.location-selection-summary { min-height:48px; }
.location-send-button { min-height:46px; }
}
@media (max-height: 560px) {
.location-modal { gap:7px; padding-top:max(6px, env(safe-area-inset-top)); padding-bottom:max(6px, env(safe-area-inset-bottom)); }
.location-modal-header { min-height:40px; }
  .location-modal .location-close { width:40px; min-width:40px; height:40px; min-height:40px; }
.location-map-shell, .location-map { min-height:0; }
.location-selection-summary { min-height:46px; }
.location-send-button { min-height:44px; }
}
