:root {
  color-scheme: light;
  --room-pill-width: clamp(104px, calc((100vw - 92px) / 3), 148px);
  --bg: #f6f1e8;
  --bg-deep: #efe6d6;
  --panel: rgba(255, 252, 247, 0.92);
  --panel-strong: rgba(255, 248, 240, 0.96);
  --panel-soft: rgba(255, 251, 245, 0.78);
  --panel-elevated: rgba(255, 250, 244, 0.94);
  --input: rgba(255, 255, 255, 0.82);
  --line: rgba(31, 41, 55, 0.12);
  --line-strong: rgba(31, 41, 55, 0.18);
  --text: #1f2937;
  --muted: #6b7280;
  --muted-strong: #4b5563;
  --accent: #d97706;
  --accent-strong: #b45309;
  --danger: #b91c1c;
  --danger-soft: rgba(185, 28, 28, 0.1);
  --shadow: 0 24px 60px rgba(66, 39, 7, 0.14);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  min-height: 100%;
  background: var(--bg-deep);
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Avenir Next", "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(217, 119, 6, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(20, 184, 166, 0.14), transparent 30%),
    linear-gradient(135deg, #f6f1e8, #efe6d6);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(rgba(31, 41, 55, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 41, 55, 0.018) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.32), transparent 85%);
}

body.modal-open {
  overflow: hidden;
}

.language-switcher {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 18px rgba(66, 39, 7, 0.06);
  backdrop-filter: blur(18px);
}

.language-switcher-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.language-switcher-select {
  min-height: 36px;
  width: auto;
  min-width: 128px;
  padding: 8px 34px 8px 12px;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.96);
}

a {
  color: inherit;
}

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

.page-glow {
  position: fixed;
  z-index: -1;
  width: 42vw;
  height: 42vw;
  min-width: 280px;
  min-height: 280px;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.34;
  pointer-events: none;
}

.page-glow-left {
  top: -8vw;
  left: -12vw;
  background: rgba(217, 119, 6, 0.18);
}

.page-glow-right {
  right: -16vw;
  bottom: 8vh;
  background: rgba(20, 184, 166, 0.14);
}

.chat-shell {
  width: 100%;
  padding: 10px 10px calc(14px + env(safe-area-inset-bottom, 0px));
}

.chat-card {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.chat-card::before {
  content: none;
}

.shell-topbar,
.entry-stage,
.chat-panel,
.site-footer {
  position: relative;
  z-index: 1;
}

.shell-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.topbar-utility {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.page-intro {
  display: grid;
  gap: 6px;
  max-width: 760px;
}

.page-kicker {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-summary {
  margin: 0;
  color: var(--muted-strong);
  font-size: 0.98rem;
  line-height: 1.6;
}

.brand-mark {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.54);
  backdrop-filter: blur(18px);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 50px;
  padding: 0 20px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.entry-stage {
  display: grid;
  gap: 0;
}

.home-intro-grid {
  margin-top: 14px;
}

.home-intro-panel {
  gap: 18px;
}

.home-intro-panel h2,
.home-feature h3 {
  margin: 0;
}

.home-intro-panel h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.home-feature-grid {
  display: grid;
  gap: 12px;
}

.home-feature {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid rgba(31, 41, 55, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.52);
}

.home-feature p {
  margin: 0;
  color: var(--muted-strong);
  line-height: 1.6;
}

.feedback-grid {
  display: grid;
  gap: 14px;
}

.feedback-info-panel {
  gap: 18px;
}

.feedback-title {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.feedback-tips-grid {
  display: grid;
  gap: 12px;
}

.feedback-tip-card {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid rgba(31, 41, 55, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.52);
}

.feedback-tip-card h2,
.feedback-tip-card p {
  margin: 0;
}

.feedback-tip-card h2 {
  font-size: 1rem;
}

.feedback-tip-card p {
  color: var(--muted-strong);
  line-height: 1.6;
}

.feedback-form-panel {
  gap: 14px;
}

.feedback-upload-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.feedback-upload-row .secondary-button {
  width: auto;
}

.feedback-upload-button {
  width: auto;
}

.feedback-form-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.feedback-counter {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.feedback-image-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.feedback-image-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(31, 41, 55, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
}

.feedback-image-preview {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  background: rgba(31, 41, 55, 0.06);
}

.feedback-image-remove {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.entry-panel,
.chat-overview,
.messages,
.chat-form,
.modal-card {
  border: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.composer {
  display: grid;
  gap: 12px;
}

.compact {
  margin-top: 0;
}

.entry-panel,
.chat-overview,
.chat-form {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.96), rgba(255, 247, 238, 0.9));
}

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

.field span {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
}

.field.disabled span {
  color: rgba(107, 114, 128, 0.62);
}

.password-box {
  position: relative;
}

input,
select {
  width: 100%;
  min-height: 54px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  background: var(--input);
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

input::placeholder {
  color: rgba(107, 114, 128, 0.58);
}

textarea {
  min-height: 180px;
  resize: vertical;
  font: inherit;
}

textarea::placeholder {
  color: rgba(107, 114, 128, 0.58);
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(107, 114, 128, 0.8) 50%),
    linear-gradient(135deg, rgba(107, 114, 128, 0.8) 50%, transparent 50%);
  background-position:
    calc(100% - 22px) calc(50% - 2px),
    calc(100% - 16px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.password-box input {
  padding-right: 62px;
}

.field.disabled input {
  color: rgba(107, 114, 128, 0.62);
  background: rgba(248, 250, 252, 0.95);
  cursor: not-allowed;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.96);
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.field.disabled .password-toggle {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--accent-strong);
  border-color: rgba(217, 119, 6, 0.24);
  background: rgba(255, 248, 235, 1);
  outline: none;
}

.eye-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
}

.eye-icon.hidden {
  display: none;
}

.eye-icon svg {
  width: 100%;
  height: 100%;
}

input:focus,
select:focus,
textarea:focus,
.message-input-shell:focus-within {
  outline: none;
  border-color: rgba(217, 119, 6, 0.35);
  box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.08);
}

.action-row {
  display: grid;
  gap: 10px;
}

.status {
  min-height: 22px;
  padding: 13px 14px;
  border: 1px solid rgba(31, 41, 55, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--muted-strong);
}

.status:empty {
  display: none;
}

.status.error {
  border-color: rgba(185, 28, 28, 0.16);
  background: var(--danger-soft);
  color: var(--danger);
}

.legal-note {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--muted);
}

.legal-note a,
.site-footer a {
  color: var(--accent);
  text-decoration: none;
}

.legal-note a:hover,
.site-footer a:hover {
  text-decoration: underline;
}

.hidden {
  display: none;
}

.chat-panel {
  margin-top: 14px;
}

.chat-overview {
  position: relative;
  z-index: 3;
  overflow: visible;
  padding: 0;
  border: 0;
  background: transparent;
  backdrop-filter: none;
}

.chat-overview .status {
  margin-top: 12px;
}

.chat-workspace {
  position: relative;
  display: grid;
  gap: 14px;
  margin-top: 14px;
  z-index: 1;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-top: 18px;
  padding: 4px 4px 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.nickname-row {
  display: grid;
  gap: 12px;
}

.nickname-field {
  grid-template-columns: minmax(84px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.nickname-field span {
  white-space: nowrap;
}

.nickname-field input {
  min-width: 0;
}

.admin-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-head h3 {
  margin: 0;
  font-size: 1.1rem;
}

.admin-hint {
  margin: 12px 0 0;
  line-height: 1.7;
  color: var(--muted);
}

.admin-tools,
.share-tools {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.settings-sections {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.settings-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(31, 41, 55, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
}

.settings-section.disabled {
  opacity: 0.72;
}

.settings-section .admin-hint {
  margin: 0;
}

.field-help {
  margin: -2px 0 0;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--muted);
}

.field-help.error {
  color: var(--danger);
}

.settings-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.settings-action-row .secondary-button {
  width: auto;
}

.room-banner {
  display: grid;
  gap: 14px;
  padding: 20px 18px 18px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius-md) + 2px);
  background: rgba(255, 255, 255, 0.64);
}

.room-banner-head {
  display: grid;
  grid-template-areas:
    "brand utility"
    "title title"
    "actions actions";
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px 14px;
  align-items: center;
  position: relative;
}

.room-banner h2,
.room-label {
  margin: 0;
}

.room-brand-mark {
  grid-area: brand;
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--text);
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  font-size: clamp(1.25rem, 5vw, 2rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  justify-self: start;
  white-space: nowrap;
}

.room-topbar-utility {
  grid-area: utility;
  justify-self: end;
}

.room-banner-title {
  grid-area: title;
  display: grid;
  gap: 6px;
  justify-items: center;
  min-width: 0;
  text-align: center;
  justify-self: center;
}

.room-banner h2 {
  font-size: clamp(1.25rem, 5vw, 2rem);
  line-height: 1.1;
}

.room-label {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.room-mode-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

.room-header-actions {
  grid-area: actions;
  display: grid;
  grid-template-columns: repeat(3, var(--room-pill-width));
  align-items: center;
  gap: 10px;
  justify-content: center;
  width: 100%;
}

.room-actions-menu {
  position: relative;
  width: var(--room-pill-width);
  min-width: var(--room-pill-width);
  z-index: 8;
}

.room-actions-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  line-height: 1;
}

.room-header-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  width: var(--room-pill-width);
  min-width: var(--room-pill-width);
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  box-sizing: border-box;
  white-space: nowrap;
  line-height: 1;
  text-align: center;
  appearance: none;
  -webkit-appearance: none;
}

.room-actions-toggle.room-header-pill {
  width: 100%;
  min-width: 100%;
  justify-content: center;
}

.room-actions-toggle-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding-right: 12px;
}

.room-actions-chevron {
  position: absolute;
  right: 18px;
  width: 9px;
  height: 9px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 160ms ease;
}

.room-actions-toggle[aria-expanded="true"] .room-actions-chevron {
  transform: rotate(-135deg) translateX(-1px);
}

.room-actions-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 12;
  display: grid;
  gap: 6px;
  width: min(280px, calc(100vw - 56px));
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: rgba(255, 251, 243, 0.98);
  box-shadow: 0 18px 36px rgba(66, 39, 7, 0.12);
  backdrop-filter: blur(18px);
  transform-origin: top right;
}

.room-actions-panel.hidden {
  display: none;
}

.room-actions-panel:not(.hidden) {
  animation: room-actions-drop 160ms ease;
}

@keyframes room-actions-drop {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.menu-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 46px;
  width: 100%;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.menu-action-button:hover,
.menu-action-button:focus-visible {
  border-color: rgba(217, 119, 6, 0.16);
  background: rgba(255, 248, 235, 1);
  outline: none;
}

.menu-action-button.danger {
  color: var(--danger);
  background: rgba(185, 28, 28, 0.06);
}

.menu-action-button.danger:hover,
.menu-action-button.danger:focus-visible {
  border-color: rgba(185, 28, 28, 0.16);
  background: rgba(185, 28, 28, 0.1);
}

.menu-action-button[disabled] {
  opacity: 0.58;
  cursor: not-allowed;
}

.online-pill {
  border: 1px solid rgba(217, 119, 6, 0.18);
  border-radius: 999px;
  background: rgba(255, 248, 235, 0.95);
  color: var(--accent-strong);
}

.messages {
  height: min(46vh, 520px);
  overflow-y: auto;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.7);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(217, 119, 6, 0.25) transparent;
}

.messages::-webkit-scrollbar {
  width: 8px;
}

.messages::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(217, 119, 6, 0.22);
}

.message + .message {
  margin-top: 12px;
}

.message {
  padding: 14px;
  border: 1px solid rgba(217, 119, 6, 0.12);
  border-radius: 18px;
  background: #fffdf8;
}

.message.deleted {
  border-style: dashed;
  border-color: rgba(180, 83, 9, 0.28);
  background: rgba(255, 251, 235, 0.9);
}

.message-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 12px;
  font-size: 0.88rem;
}

.message-head span {
  color: var(--muted);
}

.message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.encrypt-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(217, 119, 6, 0.12);
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-weight: 700;
}

.deleted-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(146, 64, 14, 0.1);
  color: #9a3412;
  font-size: 0.74rem;
  font-weight: 700;
}

.message-body {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  line-height: 1.65;
  white-space: pre-wrap;
}

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

.message-deleted-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.encrypted-text {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 12px;
  background: rgba(31, 41, 55, 0.06);
  color: var(--muted);
}

.message-image-wrap {
  display: inline-flex;
  align-items: flex-start;
  max-width: 100%;
}

.message-image {
  display: block;
  width: min(100%, 320px);
  border: 1px solid rgba(31, 41, 55, 0.1);
  border-radius: 14px;
  cursor: zoom-in;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.message-input-shell {
  display: grid;
  gap: 10px;
  grid-column: 1 / -1;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--input);
}

.message-editor {
  min-height: 112px;
  width: 100%;
  padding: 0;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}

.message-editor:empty::before {
  content: attr(data-placeholder);
  color: rgba(107, 114, 128, 0.58);
  pointer-events: none;
}

.image-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  grid-column: 1;
  position: relative;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.88);
  cursor: pointer;
}

.tool-icon-button {
  width: 48px;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: transform 160ms ease, filter 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.tool-button-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.emoji-picker-wrap {
  position: relative;
}

.emoji-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.emoji-picker-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 7;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  width: min(320px, calc(100vw - 56px));
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: rgba(255, 251, 243, 0.98);
  box-shadow: 0 18px 36px rgba(66, 39, 7, 0.12);
  backdrop-filter: blur(18px);
}

.emoji-picker-panel.hidden {
  display: none;
}

.emoji-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 1.25rem;
  background: rgba(255, 255, 255, 0.88);
  cursor: pointer;
}

.emoji-option:hover,
.emoji-option:focus-visible {
  border-color: rgba(217, 119, 6, 0.16);
  background: rgba(255, 248, 235, 1);
  outline: none;
}

.image-status {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--muted);
}

.image-status.error {
  color: var(--danger);
}

.message-status {
  grid-column: 1 / -1;
  margin: 8px 0 0 0;
  padding: 13px 14px;
  border: 1px solid rgba(31, 41, 55, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--muted-strong);
  min-height: 22px;
}

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

.message-status.error {
  border-color: rgba(185, 28, 28, 0.16);
  background: var(--danger-soft);
  color: var(--danger);
}

.messages > .message-status {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 0 12px;
  backdrop-filter: blur(12px);
}

.editor-image-token {
  display: inline-flex;
  vertical-align: middle;
  margin: 2px 6px 2px 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(249, 250, 251, 0.9);
}

.inline-image-preview {
  display: block;
  width: 78px;
  height: 78px;
  object-fit: cover;
  border-radius: 10px;
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  width: 100%;
  padding: 0 20px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.primary-button {
  border: 0;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 12px 26px rgba(180, 83, 9, 0.18);
}

.secondary-button {
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: rgba(255, 255, 255, 0.88);
}

.share-room-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: none;
}

/* Keep the three top-right pills visually identical. */
.room-header-actions .room-header-pill {
  min-height: 40px;
  width: 100%;
  min-width: 0;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.84rem;
  box-sizing: border-box;
}

.danger-button {
  border: 0;
  color: white;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.chat-form .primary-button {
  grid-column: 2;
  justify-self: end;
  width: auto;
  min-width: 112px;
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.file-button:hover,
.tool-icon-button:hover,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.danger-button:focus-visible,
.file-button:focus-visible,
.tool-icon-button:focus-visible {
  filter: brightness(1.04);
  transform: translateY(-1px);
  outline: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: end;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 41, 55, 0.44);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  width: min(100%, 620px);
  margin: 0 auto;
  padding: 18px;
  border-radius: 26px 26px 18px 18px;
  background: rgba(255, 247, 247, 0.96);
  box-shadow: 0 24px 60px rgba(31, 41, 55, 0.18);
}

.share-modal-card,
.image-preview-card {
  background: rgba(255, 251, 243, 0.97);
}

.image-preview-card {
  width: min(100%, 960px);
}

.image-preview-content {
  display: block;
  width: 100%;
  max-height: calc(100vh - 220px);
  margin-top: 18px;
  object-fit: contain;
  border-radius: 18px;
  background: rgba(31, 41, 55, 0.04);
}

#share-room-link {
  font-size: 0.9rem;
}

.share-secret-note {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid rgba(185, 28, 28, 0.14);
  border-radius: 16px;
  background: rgba(185, 28, 28, 0.06);
  color: var(--danger);
  font-weight: 700;
  line-height: 1.6;
}

.share-secret-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.share-secret-copy {
  display: grid;
  gap: 6px;
  flex: 1 1 220px;
}

.share-secret-note p {
  margin: 0;
}

.share-secret-note strong,
.share-secret-note span {
  color: inherit;
  font-weight: 700;
}

.share-copy-button {
  width: auto;
  min-height: 38px;
  padding: 0 14px;
  flex: 0 0 auto;
  font-size: 0.84rem;
  border-color: rgba(185, 28, 28, 0.18);
  color: inherit;
  background: rgba(255, 255, 255, 0.74);
}

.share-copy-button[disabled] {
  border-color: rgba(209, 213, 219, 0.9);
  color: rgba(107, 114, 128, 0.9);
  background: rgba(243, 244, 246, 0.96);
  box-shadow: none;
  cursor: not-allowed;
}

.share-copy-button[disabled]:hover,
.share-copy-button[disabled]:focus-visible {
  filter: none;
  transform: none;
}

.modal-head {
  display: grid;
  gap: 14px;
}

.modal-head h3 {
  margin: 4px 0 0;
  font-size: 1.35rem;
}

.hero {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2.2rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.legal-page {
  padding-top: 2px;
}

.legal-copy {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.96), rgba(255, 247, 238, 0.9));
  line-height: 1.7;
}

.legal-copy h2 {
  margin: 22px 0 8px;
  font-size: 1.02rem;
}

.legal-copy p,
.legal-copy ul {
  margin: 0 0 12px;
}

.legal-copy ul {
  padding-left: 20px;
}

@media (max-width: 699px) {
  .language-switcher-label {
    display: none;
  }

  .language-switcher-select {
    min-width: 118px;
  }

  .language-switcher {
    width: auto;
    max-width: 100%;
  }

  .chat-shell {
    padding: 6px 6px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .shell-topbar {
    gap: 6px;
    margin-bottom: 6px;
    align-items: flex-start;
  }

  .hero-head {
    align-items: flex-start;
  }

  .chat-panel {
    margin-top: 6px;
  }

  .chat-workspace {
    gap: 6px;
    margin-top: 6px;
  }

  .chat-overview .status {
    margin-top: 6px;
  }

  .room-banner {
    gap: 8px;
    padding: 12px 12px 10px;
  }

  .room-banner-head {
    gap: 8px;
  }

  .room-banner-title {
    gap: 2px;
  }

  .room-brand-mark,
  .room-banner h2 {
    font-size: clamp(1.08rem, 4.4vw, 1.5rem);
  }

  .room-mode-note {
    margin-top: 6px;
    font-size: 0.82rem;
  }

  .messages {
    height: min(54vh, 560px);
    padding: 8px;
  }

  .message + .message {
    margin-top: 6px;
  }

  .message {
    padding: 8px 9px;
    border-radius: 12px;
  }

  .message-head {
    gap: 4px 8px;
    font-size: 0.82rem;
  }

  .message-body,
  .message-deleted-note {
    margin-top: 4px;
  }

  .message-body {
    gap: 6px;
    line-height: 1.55;
  }

  .message-deleted-note {
    font-size: 0.78rem;
  }

  .chat-form {
    gap: 6px;
    padding: 10px;
  }

  .nickname-row {
    gap: 6px;
  }

  .nickname-field {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
  }

  .chat-form .field {
    gap: 6px;
  }

  .chat-form input {
    min-height: 48px;
    padding: 12px 14px;
  }

  .message-input-shell {
    gap: 6px;
    padding: 8px 10px;
  }

  .message-editor {
    min-height: 72px;
  }

  .site-footer {
    gap: 8px;
    margin-top: 8px;
    padding-top: 0;
  }

  .image-tools {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
    width: auto;
  }

  .file-button {
    min-height: 40px;
  }

  .tool-icon-button {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
  }

  .emoji-picker-wrap {
    width: 40px;
    z-index: 10;
  }

  .emoji-button {
    padding: 0;
  }

  .emoji-picker-panel {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 112px);
    width: auto;
    max-width: none;
    max-height: min(42vh, 280px);
    overflow-y: auto;
    z-index: 30;
  }

  .room-header-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  .room-header-actions .room-header-pill {
    min-height: 36px;
    width: 100%;
    min-width: 0;
    padding: 0 8px;
    font-size: 0.72rem;
  }

  .room-actions-menu {
    position: relative;
    width: 100%;
    min-width: 0;
  }

  .room-actions-toggle.room-header-pill {
    width: 100%;
    min-width: 0;
    padding-right: 24px;
  }

  .room-actions-toggle-label {
    padding-right: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .room-actions-chevron {
    right: 11px;
    width: 7px;
    height: 7px;
  }

  .room-actions-panel {
    left: 0;
    right: auto;
    top: calc(100% + 8px);
    width: min(280px, calc(100vw - 40px));
    max-width: calc(100vw - 40px);
    max-height: min(52vh, 320px);
    overflow-y: auto;
    transform-origin: top left;
    z-index: 18;
  }
}

@media (min-width: 700px) {
  .chat-shell {
    padding: 14px 16px 18px;
  }

  .shell-topbar {
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
  }

  .action-row,
  .room-header-actions {
    display: grid;
    align-items: center;
  }

  .room-banner-head {
    grid-template-areas: "brand title utility actions";
    grid-template-columns: minmax(0, 1fr) auto auto auto;
  }

  .room-banner-title {
    justify-self: center;
  }

  .room-header-actions {
    grid-template-columns: repeat(3, var(--room-pill-width));
    justify-content: flex-end;
    width: auto;
  }

  .action-row > * {
    width: auto;
  }

  .home-feature-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nickname-field {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .modal {
    align-items: center;
    padding: 24px;
  }

  .modal-card {
    border-radius: 28px;
    padding: 22px;
  }

  .modal-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }
}

@media (min-width: 960px) {
  .chat-shell {
    padding: 18px 20px 24px;
  }

  .chat-panel {
    margin-top: 18px;
  }

  .room-banner {
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    padding: 22px 22px 18px;
  }

  .room-actions-panel {
    width: 280px;
  }

  .messages {
    height: min(52vh, 560px);
    padding: 18px;
  }

  .chat-form {
    align-items: end;
  }

  .chat-form .message-input-shell,
  .chat-form .image-status {
    grid-column: 1 / -1;
  }

  .feedback-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    align-items: start;
  }
}
