/* =========================
   VARIABLES DE DISEÑO
========================= */
:root {
    --background: #000000;
    --text: #e7e9ea;
    --secondary: #71767b;
    --border: #2f3336;
    --accent: #1d9bf0;
    --hover: #080808;
    --like: #f91880;
    --retweet: #00ba7c;
    --surface: #16181c;
    --surface-hover: #ffffff0d;
    --surface-shadow: #ffffff15;
    --control-border: #536471;
    --avatar-background: #30343b;
    --cover-background: #293238;
    --context-text: #8b98a5;
    --accent-button: #0073ba;
    --accent-hover: #0066a6;
    --danger-text: #ff8a93;
    --danger-button: #bc1b2b;
    --danger-hover: #a81826;
    color-scheme: dark;
}

:root[data-theme="dim"] {
    --background: #15202b;
    --text: #edf2f6;
    --secondary: #a0aebb;
    --border: #384654;
    --hover: #192631;
    --surface: #22303c;
    --control-border: #576979;
    --avatar-background: #3c5163;
    --cover-background: #354b5d;
    --context-text: #a8b6c2;
}

:root[data-theme="light"] {
    --background: #ffffff;
    --text: #17212a;
    --secondary: #51606d;
    --border: #d5dee5;
    --accent: #0069ad;
    --hover: #f6f8fa;
    --like: #c11665;
    --retweet: #007653;
    --surface: #edf2f6;
    --surface-hover: #17212a0d;
    --surface-shadow: #17212a26;
    --control-border: #778896;
    --avatar-background: #45647a;
    --cover-background: #d6e2eb;
    --context-text: #51606d;
    --danger-text: #b51c32;
    color-scheme: light;
}
/* =========================
   ESTILOS GENERALES
========================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    background: var(--background);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont,
                 "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
}
button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font: inherit;
}
button, a {
    -webkit-tap-highlight-color: transparent;
}
.app {
    max-width: 600px;
    height: 100dvh;
    margin: 0 auto;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    padding-top: env(safe-area-inset-top);
}
/* =========================
   ENCABEZADO
========================= */
.header {
    min-height: 58px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    font-size: 23px;
    font-weight: 800;
    letter-spacing: -1px;
}
.settings-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
}
/* =========================
   AVATAR
========================= */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--avatar-background);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}
.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profile-button .avatar {
    width: 34px;
    height: 34px;
}
/* =========================
   PESTAÑAS
========================= */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}
.tab {
    flex: 1;
    padding: 17px 0;
    color: var(--secondary);
    font-weight: 600;
    position: relative;
}
.tab.active {
    color: var(--text);
}
.tab.active::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 65px;
    height: 4px;
    background: var(--accent);
    border-radius: 10px;
}
/* =========================
   TIMELINE
========================= */
.timeline {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 85px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
/* =========================
   PUBLICACIONES
========================= */
.tweet {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}
.tweet:hover {
    background: var(--hover);
}
.tweet-content {
    flex: 1;
    min-width: 0;
}
.tweet-header {
    display: flex;
    align-items: flex-start;
    gap: 5px;
}
.tweet-author {
    flex: 1;
    min-width: 0;
}
.tweet-author-line {
    display: flex;
    align-items: baseline;
    gap: 5px;
}
.tweet-author-name {
    min-width: 0;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.tweet-author-name:hover,
.profile-return:hover {
    text-decoration: underline;
}
.tweet-header strong {
    font-size: 15px;
}

#tweetList .tweet {
    cursor: pointer;
}

.tweet-open {
    display: block;
    width: 100%;
    text-align: left;
}

.tweet-detail {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    background: var(--background);
}

.tweet-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 0 8px;
    border-bottom: 1px solid var(--border);
}

.tweet-detail-header h2 {
    font-size: 19px;
}

.detail-metadata {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px;
    margin: 0 0 12px;
    font-size: 13px;
}

.detail-metadata .tweet-date {
    display: inline;
    margin: 0;
}

.tweet-detail-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom);
}

.tweet-detail .tweet {
    position: relative;
    display: block;
    padding: 16px;
}

.tweet-detail .tweet:hover {
    background: var(--background);
}

.tweet-detail .tweet > .avatar {
    position: absolute;
}

.tweet-detail .tweet-header {
    min-height: 40px;
    padding-left: 52px;
}

.tweet-detail .tweet-text {
    margin: 18px 0;
    font-size: 20px;
}

.tweet-detail .tweet-actions {
    max-width: none;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.thread-heading {
    padding: 16px 16px 4px;
    font-size: 14px;
}

.thread-parent {
    padding: 12px 16px 0;
    color: var(--accent);
    text-align: left;
    overflow-wrap: anywhere;
}

.thread-parent:hover {
    text-decoration: underline;
}

.tweet-detail .thread-reply {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    grid-template-areas: ". context" "avatar body";
    column-gap: 10px;
    align-items: start;
    margin-inline-start: var(--thread-indent, 0px);
    padding: 9px 16px 4px;
    border: 0;
}

.tweet-detail .thread-reply + .thread-reply {
    margin-block-start: 4px;
}

.tweet-detail .thread-reply:hover {
    background: transparent;
}

.tweet-detail .thread-reply > .avatar {
    position: static;
    grid-area: avatar;
    width: 34px;
    height: 34px;
    font-size: 14px;
    z-index: 1;
}

.thread-connected::after {
    content: "";
    grid-area: avatar;
    justify-self: center;
    align-self: stretch;
    width: 2px;
    margin-block: 37px -32px;
    border-radius: 2px;
    background: var(--border);
    pointer-events: none;
}

.thread-reply > .tweet-content {
    grid-area: body;
}

.tweet-detail .thread-reply .tweet-header {
    min-height: 0;
    padding-left: 0;
}

.tweet-detail .thread-reply .tweet-date {
    font-size: 12px;
}

.tweet-detail .thread-reply .tweet-text {
    margin: 5px 0 3px;
    font-size: 15px;
}

.tweet-detail .thread-reply .tweet-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0 clamp(6px, 2vw, 14px);
    padding-top: 0;
    border-top: 0;
}

.thread-reply .tweet-actions button {
    min-width: 26px;
    min-height: 30px;
}

.thread-reply .tweet-actions svg {
    width: 16px;
    height: 16px;
}

.thread-context {
    grid-area: context;
    margin-bottom: 4px;
    color: var(--context-text);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.reply-count {
    font-size: 13px;
}

#composeContext {
    overflow-wrap: anywhere;
}
.tweet-handle {
    color: var(--secondary);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tweet-date {
    display: block;
    margin-top: 2px;
    color: var(--secondary);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.tweet-date-inline {
    flex: 0 0 auto;
    margin: 0;
    white-space: nowrap;
}

.tweet-date-inline::before {
    content: "·";
    margin-inline-end: 4px;
}
.tweet-menu {
    margin-left: auto;
    color: var(--secondary);
    flex-shrink: 0;
}
.tweet-menu svg {
    width: 19px;
    height: 19px;
}
.tweet-text {
    margin-top: 5px;
    margin-bottom: 13px;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
/* =========================
   INTERACCIONES
========================= */
.tweet-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 440px;
    color: var(--secondary);
}
.tweet-actions button {
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s;
}
.tweet-actions svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.7;
}
.tweet-actions button:hover {
    color: var(--accent);
}
.tweet-actions button[aria-label="Me gusta"]:hover {
    color: var(--like);
}
.tweet-actions button[aria-label="Retweet"]:hover {
    color: var(--retweet);
}
/* =========================
   BOTÓN NUEVA PUBLICACIÓN
========================= */
.compose-button {
    position: absolute;
    bottom: 78px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: var(--accent-button);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px #00000066;
    transition: background 0.2s;
    z-index: 10;
}
.compose-button svg {
    width: 26px;
    height: 26px;
}
.compose-button:hover {
    background: var(--accent-hover);
}
/* =========================
   NAVEGACIÓN INFERIOR
========================= */
.bottom-nav {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    border-top: 1px solid var(--border);
    background: var(--background);
    padding-bottom: env(safe-area-inset-bottom);
    flex-shrink: 0;
}
.nav-button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary);
}
.nav-button svg {
    width: 25px;
    height: 25px;
    stroke-width: 1.8;
}
.nav-button.active {
    color: var(--text);
}
.nav-button:hover,
.settings-button:hover {
    background: var(--surface);
}
/* =========================
   ADAPTACIÓN A CELULARES
========================= */
@media (max-width: 600px) {
    .app {
        width: 100%;
        border-left: none;
        border-right: none;
    }
    .tweet {
        padding: 12px;
        gap: 10px;
    }
    .compose-button {
        right: 16px;
    }
}
/* =========================
   PANTALLA DE ESCRITURA
========================= */
.compose-screen {
    position: absolute;
    inset: 0;
    background: var(--background);
    z-index: 100;
    display: flex;
    flex-direction: column;
}
.compose-screen[hidden] {
    display: none;
}
.compose-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
}
.post-button {
    background: var(--accent-button);
    color: white;
    font-weight: 700;
    padding: 9px 20px;
    border-radius: 25px;
}
.post-button:disabled {
    opacity: 0.5;
    cursor: default;
}
.compose-body {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    flex: 1;
    min-height: 0;
}
#tweetInput {
    background: transparent;
    color: var(--text);
    border: none;
    outline: none;
    resize: none;
    width: 100%;
    height: 100%;
    font-family: inherit;
    font-size: 20px;
    line-height: 1.5;
}
#tweetInput::placeholder {
    color: var(--secondary);
}

.compose-content {
    flex: 1;
    min-width: 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.compose-content #tweetInput {
    flex: 1;
    min-height: 72px;
}

.media-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tweet-media {
    margin: 8px 0 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.tweet-media img,
.tweet-media video {
    display: block;
    width: 100%;
    max-height: 340px;
    object-fit: contain;
}

.tweet-detail .tweet-media img,
.tweet-detail .tweet-media video {
    max-height: 65dvh;
}

.media-preview .tweet-media img,
.media-preview .tweet-media video {
    max-height: min(200px, 28dvh);
}

#mediaError:not(:empty) {
    padding-bottom: 10px;
    color: var(--danger-text);
}

.compose-draft {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    padding-bottom: 10px;
    font-size: 13px;
}

#discardDraft {
    padding: 4px 0;
    color: var(--accent);
}

#discardDraft:hover {
    text-decoration: underline;
}

.schedule-field {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding-bottom: 10px;
    font-size: 14px;
}

.schedule-field input {
    min-width: 0;
    max-width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--control-border);
    border-radius: 8px;
    background: var(--background);
    color: var(--text);
    font: inherit;
    font-size: 16px;
}

#clearSchedule {
    color: var(--accent);
}

.scheduled-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
}

.scheduled-heading h2 {
    font-size: 20px;
}

.tweet-pin {
    margin-bottom: 5px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
}
.compose-footer {
    margin-top: auto;
    padding: 0 16px;
    padding-bottom: env(safe-area-inset-bottom);
}
.compose-info {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
    padding: 14px 0;
}
.compose-info svg {
    width: 17px;
    height: 17px;
}
.compose-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border);
    padding: 16px 0;
}
.compose-icons {
    display: flex;
    align-items: center;
    gap: 20px;
    color: var(--accent);
}
.compose-icons svg {
    width: 21px;
    height: 21px;
}
#characterCount {
    font-size: 13px;
    color: var(--secondary);
}
#characterCount.limit {
    color: var(--danger-text);
}
/* =========================
   INTERACCIONES ACTIVAS
========================= */
.tweet-actions .liked {
    color: var(--like);
}
.tweet-actions .liked svg {
    fill: var(--like);
    stroke: var(--like);
}
.tweet-actions .retweeted {
    color: var(--retweet);
}
.tweet-actions .bookmarked {
    color: var(--accent);
}
.tweet-actions .bookmarked svg {
    fill: var(--accent);
    stroke: var(--accent);
}
.like-count,
.retweet-count {
    font-size: 13px;
}
.like-count:empty,
.retweet-count:empty {
    display: none;
}
.tweet-actions button:active {
    transform: scale(0.9);
}
/* =========================
   MENÚ DE PUBLICACIONES
========================= */
.tweet-content {
    position: relative;
}
.tweet-options {
    position: absolute;
    top: 25px;
    right: 0;
    width: 220px;
    max-width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 4px 18px var(--surface-shadow);
    overflow: hidden;
    z-index: 20;
}
.tweet-options[hidden] {
    display: none;
}
.tweet-options button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 15px;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
}
.tweet-options button:hover {
    background: var(--surface-hover);
}
.tweet-options svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.delete-option {
    color: var(--danger-text);
}
/* =========================
   CONFIRMACIÓN DE ELIMINACIÓN
========================= */
.delete-overlay {
    position: absolute;
    inset: 0;
    background: rgba(91, 112, 131, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}
.delete-overlay[hidden] {
    display: none;
}
.delete-modal {
    background: var(--background);
    width: 320px;
    max-width: 100%;
    border-radius: 16px;
    padding: 32px;
}
.delete-modal h2 {
    font-size: 20px;
    margin-bottom: 12px;
}
.delete-modal p {
    color: var(--secondary);
    font-size: 15px;
    line-height: 1.4;
    margin-bottom: 24px;
}
.delete-modal button {
    width: 100%;
    min-height: 44px;
    border-radius: 30px;
    font-weight: 700;
}
.confirm-delete {
    background: var(--danger-button);
    color: white;
    margin-bottom: 12px;
}
.confirm-delete:hover {
    background: var(--danger-hover);
}
.cancel-delete {
    border: 1px solid var(--control-border);
}
.cancel-delete:hover {
    background: var(--surface);
}

[hidden] {
    display: none !important;
}

.compose-button {
    bottom: calc(78px + env(safe-area-inset-bottom));
}

.profile-cover {
    aspect-ratio: 3 / 1;
    background: var(--cover-background);
}

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

.profile-details {
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
}

.profile-controls {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-top: 12px;
    margin-bottom: 12px;
}

.profile-avatar {
    width: clamp(74px, 22vw, 124px);
    height: auto;
    aspect-ratio: 1;
    border: 4px solid var(--background);
    font-size: 32px;
}

.profile-controls .profile-avatar {
    margin-top: -52px;
}

.profile-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.messages-timeline {
    padding-bottom: 0;
    overflow: hidden;
}

.messages-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.messages-header {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    overflow-wrap: anywhere;
}

.messages-header h2 { font-size: 20px; }

.dm-inbox,
.dm-history {
    flex: 1;
    min-height: 0;
    list-style: none;
    overflow-y: auto;
}

.dm-inbox-button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    text-align: left;
}

.dm-inbox-button:hover { background: var(--hover); }

.dm-peer-info { min-width: 0; }

.dm-peer-info > * {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dm-history { padding: 14px 16px; }

.dm-message {
    width: fit-content;
    max-width: min(90%, 420px);
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 14px;
    background: var(--surface);
    overflow-wrap: anywhere;
}

.dm-outgoing {
    margin-inline-start: auto;
    background: var(--accent-button);
    color: white;
}

.dm-message p {
    margin: 3px 0;
    white-space: pre-wrap;
}

.dm-message strong,
.dm-message time { font-size: 12px; }

.dm-message time { color: var(--context-text); }
.dm-outgoing time { color: inherit; }

.dm-status { padding: 8px 16px 12px; }

.dm-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
}

.dm-form textarea {
    flex: 1;
    min-width: 0;
    resize: none;
    padding: 8px 10px;
    border: 1px solid var(--control-border);
    border-radius: 12px;
    background: var(--background);
    color: var(--text);
    font: inherit;
    font-size: 16px;
}

.outline-button {
    border: 1px solid var(--control-border);
    border-radius: 999px;
    padding: 8px 16px;
    font-weight: 700;
}

.outline-button:hover {
    background: var(--surface);
}

.outline-button:disabled {
    opacity: 0.5;
    cursor: default;
}

#profileName,
.profile-bio,
.profile-meta {
    overflow-wrap: anywhere;
}

.profile-joined {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.profile-joined svg {
    width: 16px;
    height: 16px;
}

.profile-tabs {
    display: flex;
    gap: 6px;
    margin: 10px 12px;
    padding-block: 3px;
    overflow-x: auto;
}

.profile-tabs button {
    flex: 1 0 auto;
    padding: 7px 10px;
    border-radius: 999px;
    color: var(--secondary);
    font-size: 13px;
    font-weight: 600;
}

.profile-tabs button[aria-pressed="true"] {
    background: var(--surface);
    color: var(--text);
}

.muted {
    color: var(--secondary);
}

.profile-bio {
    margin-top: 14px;
    white-space: pre-wrap;
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 10px;
}

.profile-posts-heading {
    margin-top: 18px;
    padding: 12px 0;
    font-weight: 700;
}

.profile-switcher {
    margin-top: 16px;
}

.profile-follow-counts {
    margin-top: 8px;
    font-size: 14px;
}

.profile-return {
    margin-top: 12px;
    color: var(--accent);
}

.profile-directory {
    margin-top: 16px;
}

.profile-directory h3 {
    margin-bottom: 8px;
    font-size: 15px;
}

.profile-directory ul {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
}

.profile-directory li {
    min-width: 0;
    max-width: 100%;
}

.profile-directory button {
    overflow-wrap: anywhere;
    text-align: left;
}

.profile-switcher > label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

.profile-switcher-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.profile-switcher select,
.reply-author select {
    flex: 1 1 180px;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid var(--control-border);
    border-radius: 8px;
    background: var(--background);
    color: var(--text);
    font: inherit;
}

.reply-author {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.profile-switcher .outline-button {
    white-space: nowrap;
}

.timeline-empty {
    padding: 24px 16px;
    color: var(--secondary);
}

.timeline-heading {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-size: 20px;
}

.search-panel {
    display: grid;
    gap: 8px;
    font-size: 15px;
}

.search-panel h2 {
    font-size: 20px;
}

.search-panel input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--control-border);
    border-radius: 8px;
    background: var(--background);
    color: var(--text);
    font: inherit;
}

.profile-dialog {
    width: min(480px, calc(100% - 24px));
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    margin: auto;
    padding: 0;
    color: var(--text);
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.tweet-detail,
.compose-screen {
    padding-top: env(safe-area-inset-top);
}

@media (max-width: 600px) {
    .profile-fields input,
    .profile-fields textarea,
    .profile-fields select,
    .profile-switcher select,
    .reply-author select,
    .search-panel input {
        font-size: 16px;
    }
}

.profile-dialog::backdrop {
    background: #5b708366;
}

.profile-dialog-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--background);
    border-bottom: 1px solid var(--border);
}

.profile-dialog-header h2 {
    font-size: 19px;
}

.profile-fields {
    display: grid;
    gap: 9px;
    padding: 16px;
}

.profile-fields > label {
    margin-top: 6px;
    font-weight: 600;
}

.profile-fields select,
.profile-fields input:not([type="file"]),
.profile-fields textarea {
    width: 100%;
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--background);
    color: var(--text);
    font: inherit;
}

.backup-settings {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
    margin-top: 8px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.backup-settings legend {
    padding-inline: 4px;
    font-weight: 600;
}

#backupStatus {
    flex-basis: 100%;
    overflow-wrap: anywhere;
}

.profile-image-field {
    min-width: 0;
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.profile-image-field input {
    max-width: 100%;
}

.profile-image-field .outline-button,
#cancelProfile {
    justify-self: start;
}

.draft-cover {
    border-radius: 6px;
    overflow: hidden;
}

#profileError:empty {
    display: none;
}

#profileError,
.storage-notice {
    color: var(--danger-text);
}

.storage-notice {
    padding: 10px 16px;
}

.tweet-header strong {
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
