:root {
    --bg: #e9efe6;
    --panel: rgba(245, 245, 245, 0.96);
    --text: #202020;
    --muted: #7c7c7c;
    --border: rgba(32, 32, 32, 0.08);
    --accent: #07c160;
    --accent-soft: rgba(7, 193, 96, 0.12);
    --success: #2f7d57;
    --error: #b44747;
    --bubble-self: #95ec69;
    --bubble-other: #ffffff;
    --shadow: 0 18px 38px rgba(24, 44, 24, 0.08);
    --mobile-nav-height: 0px;
    --mobile-browser-bar-gap: 0px;
    --mobile-nav-offset: 0px;
}

body.theme-friend {
    --bg: #edf4f0;
    --accent: #2d8d6d;
    --accent-soft: rgba(45, 141, 109, 0.14);
    --bubble-self: #dff5ec;
}

body.theme-business {
    --bg: #edf2f9;
    --accent: #446699;
    --accent-soft: rgba(68, 102, 153, 0.14);
    --bubble-self: #e0ebfb;
}

body.theme-family {
    --bg: #fff4e8;
    --accent: #cc8a24;
    --accent-soft: rgba(204, 138, 36, 0.14);
    --bubble-self: #fff0d9;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "PingFang SC", sans-serif;
    background:
        linear-gradient(180deg, rgba(246, 248, 245, 0.35), rgba(233, 239, 230, 0.35));
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: var(--text);
    overflow: hidden;
}

body.page-install {
    overflow-x: hidden;
    overflow-y: auto;
}

html,
body {
    height: 100%;
}

a {
    color: var(--accent);
    text-decoration: none;
}

.page-shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 16px 16px 90px;
    height: 100vh;
}

.install-page-shell {
    height: auto;
    min-height: 100vh;
}

.app-frame {
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.site-header,
.user-pill,
.section-title,
.stats,
.chat-panel-header,
.composer-bar,
.copy-row,
.invite-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.site-header,
.card,
.chat-panel {
    background: var(--panel);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.site-header {
    padding: 18px 22px;
    border-radius: 24px;
}

.user-pill {
    gap: 10px;
}

.header-avatar {
    width: 34px;
    height: 34px;
}

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

.chat-shell {
    margin-top: 16px;
    min-height: 0;
    flex: 1;
    overflow: hidden;
    height: 100%;
}

.chat-panel {
    border-radius: 28px;
    padding: 18px 18px 14px;
    min-height: 0;
    height: 100%;
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    background: rgba(255, 255, 255, 0.54);
    overflow: hidden;
}

.login-shell {
    max-width: 520px;
    margin: 0 auto;
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-panel {
    min-height: auto;
    width: min(100%, 460px);
}

.page-login .site-header {
    display: none;
}

.page-join .site-header {
    display: none;
}

.page-login .login-panel,
.page-join .login-panel {
    padding: 18px 20px 20px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 14px 32px rgba(28, 38, 28, 0.08);
    height: auto;
    min-height: 0;
    display: block;
    align-self: center;
}

.page-login .chat-panel-header,
.page-join .chat-panel-header {
    padding: 0;
    gap: 6px;
    align-items: flex-start;
    justify-content: flex-start;
}

.page-login .chat-panel-header h2,
.page-join .chat-panel-header h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.25;
}

.page-login .eyebrow,
.page-join .eyebrow {
    margin-bottom: 6px;
    font-size: 11px;
}

.page-login .login-copy,
.page-join .login-copy {
    margin-top: 10px;
}

.page-login .login-copy p,
.page-join .login-copy p {
    font-size: 13px;
    line-height: 1.65;
    color: var(--muted);
}

.page-login .form-grid,
.page-join .form-grid {
    gap: 10px;
    margin-top: 14px;
}

.page-login .chat-shell.login-shell,
.page-join .chat-shell.login-shell {
    min-height: calc(100vh - 32px);
    margin-top: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-login .form-grid label,
.page-join .form-grid label {
    font-size: 13px;
    color: #4d4d4d;
}

.page-login .form-grid input,
.page-login .form-grid button,
.page-join .form-grid input,
.page-join .form-grid button {
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 16px;
}

.page-login .form-grid button,
.page-join .form-grid button {
    margin-top: 4px;
    font-weight: 600;
}

.chat-summary {
    text-align: right;
    color: var(--muted);
}

.chat-summary strong {
    display: block;
    font-size: 26px;
    color: var(--text);
}

.chat-summary span {
    font-size: 12px;
}

.chat-stream {
    margin-top: 20px;
    padding: 8px 4px 14px;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.chat-row.is-self {
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent), #f1a893);
    flex-shrink: 0;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chat-sender {
    width: 50px;
    display: grid;
    gap: 6px;
    justify-items: center;
    flex-shrink: 0;
}

.chat-sender-name {
    width: 100%;
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
    color: var(--muted);
    word-break: break-word;
}

.chat-bubble-wrap {
    max-width: min(72%, 680px);
    display: grid;
    gap: 6px;
}

.chat-bubble-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 0;
}

.chat-row.is-self .chat-bubble-meta {
    justify-content: flex-end;
}

.chat-bubble {
    background: var(--bubble-other);
    border: 1px solid var(--border);
    border-radius: 6px 18px 18px 18px;
    padding: 12px 14px;
    display: grid;
    gap: 10px;
}

.chat-stream.has-custom-background {
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    border-radius: 20px;
}

.chat-row.is-self .chat-bubble {
    background: var(--bubble-self);
    border-radius: 18px 6px 18px 18px;
}

.chat-bubble p,
.moment-card p,
.login-copy p {
    margin: 0;
    line-height: 1.6;
}

.chat-composer {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: grid;
    gap: 8px;
    align-self: end;
}

.composer-preview-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.composer-preview-row[hidden] {
    display: none !important;
}

.emoji-panel {
    display: grid;
    gap: 10px;
    padding: 8px 0 2px;
}

.emoji-panel[hidden] {
    display: none !important;
}

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

.emoji-option,
.emoji-trigger {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background: #f1f1f1;
    color: #5f5f5f;
    border: 1px solid var(--border);
    font-size: 20px;
    line-height: 1;
}

.emoji-option {
    font-size: 18px;
}

.emoji-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.emoji-page-button {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.88);
    color: var(--muted);
    border: 1px solid var(--border);
}

.emoji-page-indicator {
    font-size: 12px;
    color: var(--muted);
}

.composer-preview-list {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    overflow: hidden;
    flex: 1;
}

.composer-preview-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 160px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border);
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
}

.composer-preview-chip strong,
.composer-preview-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.composer-preview-chip strong {
    font-size: 11px;
    color: var(--accent);
}

.composer-preview-chip.is-overflow {
    justify-content: center;
    min-width: 44px;
}

.composer-send-bubble {
    width: auto;
    min-width: 74px;
    height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 8px 18px rgba(7, 193, 96, 0.22);
}

.chat-input-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px 40px 64px;
    gap: 8px;
    align-items: center;
}

.attach-trigger {
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 24px;
    line-height: 1;
    border-radius: 50%;
    background: #f1f1f1;
    color: #5f5f5f;
    border: 1px solid var(--border);
}

.attach-menu {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.attach-menu[hidden] {
    display: none !important;
}

.attach-option {
    width: auto;
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--text);
}

.composer-status {
    min-height: 18px;
    color: var(--muted);
    font-size: 13px;
}

.chat-panel-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-trigger {
    width: auto;
    min-width: 92px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 13px;
}

.chat-title-block h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

.chat-search-panel {
    position: absolute;
    top: 18px;
    right: 18px;
    bottom: 18px;
    width: min(360px, calc(100% - 36px));
    border-radius: 24px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 36px rgba(20, 24, 20, 0.12);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    z-index: 35;
    overflow: hidden;
}

.chat-search-panel[hidden] {
    display: none !important;
}

.chat-search-header,
.chat-search-input-row,
.chat-search-date-row,
.chat-search-item,
.chat-search-file,
.chat-search-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-search-header {
    justify-content: space-between;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--border);
}

.chat-search-body {
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: 14px 16px 16px;
}

.chat-search-input-row input,
.chat-search-date-row input {
    border-radius: 16px;
    background: rgba(246, 246, 246, 0.94);
}

.chat-search-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.search-tab,
.search-date-button,
.search-load-more,
.search-close {
    width: auto;
}

.search-tab {
    padding: 9px 12px;
    border-radius: 999px;
    background: rgba(242, 242, 242, 0.95);
    color: var(--muted);
    border: 1px solid var(--border);
    white-space: nowrap;
}

.search-tab.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.search-date-button,
.search-load-more {
    border-radius: 999px;
    padding: 10px 14px;
}

.search-close {
    min-width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background: rgba(242, 242, 242, 0.95);
    color: var(--muted);
    border: 1px solid var(--border);
    font-size: 24px;
    line-height: 1;
}

.chat-search-results {
    min-height: 0;
    overflow-y: auto;
    display: grid;
    align-content: start;
    gap: 10px;
    padding-right: 4px;
}

.chat-search-empty {
    padding: 22px 12px;
    border-radius: 18px;
    background: rgba(247, 247, 247, 0.92);
    color: var(--muted);
    text-align: center;
}

.chat-search-item,
.chat-search-file {
    align-items: flex-start;
    padding: 12px;
    border-radius: 18px;
    background: rgba(247, 247, 247, 0.94);
    border: 1px solid var(--border);
    cursor: pointer;
}

.chat-search-item strong,
.chat-search-file strong {
    display: block;
    margin-bottom: 4px;
}

.chat-search-item p,
.chat-search-file p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
    word-break: break-word;
}

.chat-search-meta {
    justify-content: space-between;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
}

.chat-search-media-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.chat-search-media-card {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: rgba(240, 240, 240, 0.96);
    cursor: pointer;
}

.chat-search-media-card img,
.chat-search-media-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chat-search-media-badge {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 4px 7px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    font-size: 11px;
}

.chat-row.is-focused .chat-bubble {
    box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.22);
}

.profile-shortcut {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.85);
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 13px;
}

.composer-shortcut {
    min-width: 52px;
    height: 40px;
    padding: 0 12px;
    white-space: nowrap;
    background: var(--accent);
    color: #fff;
    border-color: transparent;
    gap: 4px;
}

.composer-shortcut::after {
    content: '>';
    font-size: 14px;
    line-height: 1;
}

.admin-shortcut {
    background: rgba(7, 193, 96, 0.12);
    color: var(--accent);
}

.form-grid,
.moments-list,
.invite-list {
    display: grid;
    gap: 12px;
}

input,
textarea,
button,
select {
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 12px 14px;
    font: inherit;
}

textarea {
    resize: vertical;
    min-height: 44px;
}

.chat-input-wrap textarea {
    min-height: 40px;
    max-height: 120px;
    padding: 10px 14px;
    border-radius: 22px;
    resize: none;
    background: #fff;
}

.send-button {
    border-radius: 22px;
    background: var(--accent);
    font-weight: 600;
}

button {
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    border: none;
}

.copy-button {
    width: auto;
    min-width: 92px;
}

.invite-box,
.moment-card,
.invite-item,
.empty-state,
.version-box,
.storage-card {
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px 16px;
}

.chat-attachment {
    display: grid;
    gap: 10px;
}

.chat-attachment-preview,
.chat-attachment-video {
    display: block;
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.06);
}

.chat-attachment-preview img,
.chat-attachment-video {
    width: 100%;
    max-height: 320px;
    object-fit: contain;
}

.chat-file-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid var(--border);
}

.chat-file-card small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.chat-file-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.chat-download-link {
    font-size: 14px;
    font-weight: 600;
}

.version-box p,
.update-notes p {
    margin: 6px 0;
}

.update-notes {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.invite-item p {
    margin: 6px 0 0;
    word-break: break-all;
    color: var(--muted);
}

.copy-row input {
    flex: 1;
}

.layout-grid {
    margin-top: 20px;
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding-bottom: 12px;
}

.profile-grid {
    align-items: start;
}

.profile-identity {
    display: flex;
    gap: 18px;
    align-items: center;
}

.profile-avatar-form,
.profile-background-form {
    margin: 0;
}

.profile-avatar-trigger,
.profile-background-trigger {
    display: grid;
    gap: 10px;
    justify-items: center;
    cursor: pointer;
    color: var(--muted);
}

.profile-avatar-large {
    width: 64px;
    height: 64px;
}

.profile-avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.avatar-choice {
    display: grid;
    gap: 8px;
    justify-items: center;
    text-align: center;
    padding: 12px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.55);
}

.quick-avatar-form {
    margin: 0;
}

.avatar-choice-button {
    display: grid;
    gap: 8px;
    justify-items: center;
    text-align: center;
    padding: 12px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.55);
    color: var(--text);
}

.avatar-choice-button.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.avatar-choice img {
    width: 52px;
    height: 52px;
    border-radius: 50%;
}

.profile-background-preview {
    width: min(100%, 360px);
    aspect-ratio: 16 / 9;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.58);
    background-size: cover;
    background-position: center;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 18px;
    color: var(--muted);
}

.profile-return-bar {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 25;
    display: flex;
    justify-content: center;
    width: min(100%, 420px);
    padding: 0 16px calc(env(safe-area-inset-bottom, 0px));
}

.profile-return-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 160px;
    padding: 12px 18px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    box-shadow: var(--shadow);
    gap: 6px;
}

.profile-return-button::before {
    content: '<';
    font-size: 16px;
    line-height: 1;
}

.storage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.storage-card {
    display: grid;
    gap: 10px;
}

.hero-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), var(--accent-soft));
}

.stats {
    flex-wrap: wrap;
    margin-top: 18px;
}

.stats div {
    min-width: 120px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.55);
}

.stats strong {
    display: block;
    font-size: 28px;
}

.alert,
.inline-error {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 16px;
}

.alert-success {
    background: rgba(47, 125, 87, 0.12);
    color: var(--success);
}

.alert-error,
.inline-error {
    background: rgba(180, 71, 71, 0.12);
    color: var(--error);
}

.admin-links-column {
    display: grid;
    gap: 12px;
}

.table-wrap {
    overflow-x: auto;
    margin-top: 18px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

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

.site-footer {
    margin-top: 10px;
    text-align: center;
    color: var(--muted);
    padding-bottom: 6px;
}

.site-footer p {
    margin: 4px 0;
}

.bottom-nav {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: min(1240px, 100%);
    padding: 8px 14px calc(8px + env(safe-area-inset-bottom, 0px));
    display: none;
    justify-content: center;
    gap: 10px;
    background: rgba(248, 248, 248, 0.95);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(14px);
    z-index: 30;
}

.bottom-nav a {
    flex: 1;
    max-width: 140px;
    text-align: center;
    padding: 9px 8px;
    border-radius: 12px;
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
    line-height: 1.1;
}

.bottom-nav a.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.settings-shell {
    margin-top: 16px;
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 16px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.settings-tabs {
    display: grid;
    gap: 10px;
    align-content: start;
}

.settings-tab {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.58);
    color: var(--muted);
    border: 1px solid var(--border);
}

.settings-tab.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.settings-panel {
    min-height: 0;
    overflow: auto;
}

.settings-card {
    min-height: 100%;
}

.compact-form {
    margin-top: 14px;
}

@media (max-width: 900px) {
    .page-shell {
        padding: 14px;
    }

    .chat-panel {
        min-height: calc(100vh - 170px);
        padding: 16px 14px 12px;
        border-radius: 22px;
    }

    .chat-bubble-wrap {
        max-width: 86%;
    }
}

@media (max-width: 640px) {
    html,
    body,
    .app-frame {
        height: 100dvh;
        overflow: hidden;
    }

    body.page-dashboard {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100dvh;
        overflow: hidden;
    }

    body.page-install {
        position: static;
        width: auto;
        height: auto;
        overflow-y: auto;
    }

    body {
        background: linear-gradient(180deg, var(--bg), #f9f6f2);
    }

    .page-shell {
        padding: 0;
        height: 100dvh;
        min-height: 100dvh;
    }

    .install-page-shell {
        padding: 16px;
        height: auto;
        min-height: 100dvh;
    }

    .page-dashboard .page-shell {
        position: fixed;
        inset: 0;
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
        overflow: hidden;
        display: block;
    }

    .page-login .page-shell {
        padding: 0 16px;
    }

    .page-join .page-shell {
        padding: 0 16px;
    }

    .page-login .chat-shell.login-shell {
        margin-top: 0;
        min-height: calc(100dvh - 32px);
        align-items: center;
        justify-content: center;
    }

    .page-join .chat-shell.login-shell {
        margin-top: 0;
        min-height: calc(100dvh - 32px);
        align-items: center;
        justify-content: center;
    }

    .page-login .login-panel {
        border-radius: 24px;
        padding: 18px 16px 18px;
    }

    .page-join .login-panel {
        border-radius: 24px;
        padding: 18px 16px 18px;
    }

    .site-header,
    .chat-panel,
    .card {
        border-radius: 0;
        border-left: none;
        border-right: none;
        box-shadow: none;
    }

    .site-header,
    .card,
    .chat-panel {
        padding-left: 16px;
        padding-right: 16px;
    }

    .site-header,
    .chat-panel-header,
    .composer-bar,
    .invite-item,
    .copy-row,
    .stats {
        flex-direction: column;
        align-items: stretch;
    }

    .chat-panel {
        min-height: calc(100vh - 124px);
    }

    .page-dashboard .site-header {
        display: none;
    }

    .page-dashboard .chat-shell {
        position: absolute;
        inset: 0;
        margin-top: 0;
        overflow: hidden;
        min-height: 0;
    }

    .page-dashboard .chat-panel {
        height: 100%;
        min-height: 100%;
        width: 100%;
        padding-top: 8px;
        padding-bottom: 0;
        display: grid;
        grid-template-rows: auto minmax(0, 1fr) auto;
        gap: 0;
    }

    .page-dashboard .chat-panel-header {
        flex-direction: row;
        align-items: center;
        padding: 4px 0 8px;
        gap: 8px;
    }

    .page-dashboard .chat-title-block {
        flex: 1;
        text-align: center;
        padding-left: 40px;
    }

    .page-dashboard .chat-title-block h2 {
        font-size: 18px;
    }

    .page-dashboard .chat-panel-actions {
        width: auto;
        gap: 8px;
    }

    .page-dashboard .search-trigger {
        min-width: 78px;
        padding: 8px 12px;
        font-size: 12px;
    }

    .page-dashboard .chat-summary {
        display: block;
        min-width: 44px;
        text-align: center;
    }

    .page-dashboard .profile-shortcut {
        padding: 6px 10px;
        font-size: 12px;
    }

    .page-dashboard .chat-stream {
        margin-top: 8px;
        min-height: 0;
        height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
        touch-action: pan-y;
        padding-bottom: 10px;
    }

    .page-dashboard .chat-composer {
        margin-top: 0;
        padding-top: 8px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        background: rgba(255, 255, 255, 0.72);
        flex-shrink: 0;
    }

    .page-dashboard .site-footer {
        display: none;
    }

    .page-dashboard .alert {
        display: none;
    }

    .site-footer {
        display: none;
    }

    .chat-bubble-wrap {
        max-width: calc(100% - 46px);
    }

    .chat-sender {
        width: 44px;
        gap: 4px;
    }

    .chat-sender-name {
        font-size: 11px;
    }

    .chat-input-wrap {
        grid-template-columns: minmax(0, 1fr) 36px 36px 58px;
    }

    .composer-status,
    .profile-identity {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-background-preview {
        width: 100%;
    }

    .composer-shortcut {
        min-width: 52px;
        font-size: 12px;
        padding: 0 8px;
    }

    .emoji-option,
    .emoji-trigger {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .emoji-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .chat-summary strong {
        font-size: 16px;
        line-height: 1;
    }

    .chat-summary span {
        display: none;
    }

    .chat-search-panel {
        top: 0;
        right: 0;
        bottom: 0;
        width: min(100%, 360px);
        border-radius: 18px 0 0 18px;
    }

    .chat-search-body {
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    }

    .composer-send-bubble {
        min-width: 68px;
        height: 36px;
        padding: 0 14px;
    }

    .profile-return-bar {
        bottom: 12px;
        padding: 0 16px calc(env(safe-area-inset-bottom, 0px));
        background: transparent;
    }

    .profile-return-button {
        width: min(220px, 100%);
    }

    .chat-panel-actions {
        width: 100%;
        justify-content: space-between;
    }

    .layout-grid {
        grid-template-columns: 1fr;
        gap: 0;
        margin-top: 0;
    }

    .settings-shell {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .settings-tabs {
        display: flex;
        overflow: auto;
    }

    .settings-tab {
        white-space: nowrap;
    }

    .bottom-nav {
        height: var(--mobile-nav-height);
        width: calc(100% - 20px);
        bottom: calc(env(safe-area-inset-bottom, 0px) + var(--mobile-nav-offset));
        gap: 6px;
        padding-top: 5px;
        padding-left: 10px;
        padding-right: 10px;
        padding-bottom: 5px;
        border: 1px solid rgba(0, 0, 0, 0.06);
        border-radius: 16px;
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
    }

    .bottom-nav a {
        max-width: 120px;
        padding: 8px 6px;
        border-radius: 10px;
        font-size: 12px;
    }
}

