:root {
    --bg: #15202b;
    --bg-elevated: #1e2732;
    --border: #38444d;
    --text: #f7f9f9;
    --text-dim: #8899a6;
    --accent: #1d9bf0;
    --accent-hover: #1a8cd8;
    --danger: #f4212e;
    --like: #f91880;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.4;
}

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

.layout {
    max-width: 600px;
    margin: 0 auto;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    min-height: 100vh;
}

header.topbar {
    position: sticky;
    top: 0;
    background: rgba(21, 32, 43, 0.85);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
    z-index: 10;
}

header.topbar h1 {
    font-size: 19px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Deuxieme ligne fixe pour la navigation : ne rentre jamais en concurrence
   avec le titre, donc jamais de retour a la ligne impose par une langue plus longue. */
.topbar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-top: 10px;
}

.topbar-nav .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
}
header.topbar .actions a,
header.topbar .actions button {
    margin: 0;
}

.lang-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    flex-shrink: 0;
}
.lang-switch a {
    color: var(--text-dim);
    text-decoration: none;
    padding: 2px 6px;
    border-radius: 6px;
}
.lang-switch a:hover {
    color: var(--text);
    text-decoration: none;
    background: rgba(239, 243, 244, 0.1);
}
.lang-switch a.active {
    color: var(--accent);
    font-weight: 700;
}
.topbar-nav .lang-switch {
    padding-left: 12px;
    border-left: 1px solid var(--border);
}
.auth-wrapper .lang-switch {
    justify-content: center;
    margin-bottom: 16px;
}

.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}
.btn:hover {
    background: var(--accent-hover);
    text-decoration: none;
}
.btn.secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn.secondary:hover {
    background: rgba(239, 243, 244, 0.1);
}
.btn.danger {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--danger);
}

.auth-wrapper {
    position: relative;
    z-index: 1;
    max-width: 400px;
    margin: 60px auto;
    padding: 32px 28px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 16px;
}

/* Apercu flou et non interactif du vrai fil d'actualite, en arriere-plan des pages
   de connexion/inscription. Ne doit jamais capter le focus ni les clics. */
.timeline-bg-preview {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
    user-select: none;
}
.timeline-bg-inner {
    max-width: 600px;
    margin: 0 auto;
    filter: blur(10px);
    opacity: 0.45;
    transform: scale(1.08);
}
.auth-wrapper h1 {
    text-align: center;
    margin-bottom: 24px;
}

.field {
    margin-bottom: 16px;
}
.field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-dim);
}
.field input[type=text],
.field input[type=password],
.field input[type=file],
.field textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 15px;
}
.field textarea {
    resize: vertical;
}
.field input:focus, .field textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.checkbox-field label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
}
.checkbox-field input[type=checkbox] {
    width: auto;
    accent-color: var(--accent);
}

.hp-field {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.error {
    background: rgba(244, 33, 46, 0.1);
    border: 1px solid var(--danger);
    color: #ff8a94;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}
.success {
    background: rgba(0, 186, 124, 0.1);
    border: 1px solid #00ba7c;
    color: #7bf1cf;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.switch-link {
    text-align: center;
    margin-top: 18px;
    color: var(--text-dim);
    font-size: 14px;
}

.composer {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 17px;
}
.avatar.small {
    width: 36px;
    height: 36px;
    font-size: 14px;
}
.avatar.large {
    width: 96px;
    height: 96px;
    font-size: 34px;
}

.composer-body {
    flex: 1;
}
.composer-body textarea {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 17px;
    resize: none;
    min-height: 70px;
    font-family: inherit;
}
.composer-body textarea:focus {
    outline: none;
}
.composer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border);
    padding-top: 10px;
    margin-top: 8px;
}
.composer-footer .counter {
    color: var(--text-dim);
    font-size: 13px;
    margin-right: 12px;
}
.file-label {
    color: var(--accent);
    cursor: pointer;
    font-size: 13px;
    border: 1px dashed var(--border);
    padding: 6px 10px;
    border-radius: 8px;
    display: inline-block;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}
.file-label input {
    display: none;
}
.file-label-active {
    border: 1px solid var(--accent);
    background: rgba(29, 155, 240, 0.12);
}
.file-name {
    color: var(--text-dim);
    font-size: 12px;
    margin-left: 8px;
}

.post {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}
.post-body {
    flex: 1;
    min-width: 0;
}
.post-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}
.post-header .name {
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}
.post-header .name:hover,
.post-header .username:hover {
    text-decoration: underline;
}
.post-header .username,
.post-header .time,
.post-header .time a {
    color: var(--text-dim);
    font-size: 14px;
    text-decoration: none;
}
.post-content {
    margin-top: 4px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.post-content a {
    color: var(--accent);
}

.post-images {
    display: grid;
    gap: 2px;
    margin-top: 10px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.post-images img {
    width: 100%;
    object-fit: cover;
    display: block;
}
.post-images.count-1 {
    grid-template-columns: 1fr;
}
.post-images.count-1 img {
    max-height: 500px;
}
.post-images.count-2 {
    grid-template-columns: 1fr 1fr;
}
.post-images.count-2 img {
    height: 260px;
}
.post-images.count-3 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}
.post-images.count-3 img:first-child {
    grid-row: 1 / 3;
    height: 100%;
}
.post-images.count-3 img:not(:first-child) {
    height: 129px;
}
.post-images.count-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}
.post-images.count-4 img {
    height: 160px;
}

.empty-state {
    padding: 60px 24px;
    text-align: center;
    color: var(--text-dim);
}

.profile-header {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 16px;
    align-items: center;
}
.profile-header .name {
    font-size: 20px;
    font-weight: 700;
}
.profile-header .username {
    color: var(--text-dim);
}

.member-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.member-row .info {
    flex: 1;
    min-width: 0;
}
.member-row .name {
    font-weight: 700;
}
.member-row .username,
.member-row .joined {
    color: var(--text-dim);
    font-size: 13px;
}
.member-row a {
    color: inherit;
    text-decoration: none;
}
.member-row a:hover {
    text-decoration: underline;
}

.cover-photo {
    height: 160px;
    background: linear-gradient(135deg, var(--bg-elevated), var(--border));
    background-size: cover;
    background-position: center;
}
.public-profile-header {
    padding: 0 16px 16px;
    border-bottom: 1px solid var(--border);
}
.public-profile-header .avatar.large {
    margin-top: -48px;
    border: 4px solid var(--bg);
}
.public-profile-header .name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
}
.public-profile-header .name {
    font-size: 20px;
    font-weight: 700;
}
.public-profile-header .username {
    color: var(--text-dim);
}
.profile-bio {
    margin-top: 10px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.profile-website {
    margin-top: 8px;
    display: inline-block;
    font-size: 14px;
}
.profile-joined {
    margin-top: 8px;
    color: var(--text-dim);
    font-size: 13px;
}

.reply-context {
    padding: 10px 16px 0;
    color: var(--text-dim);
    font-size: 14px;
}
.reply-context a {
    color: var(--accent);
}

.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.lightbox-overlay.is-open {
    display: flex;
}
.lightbox-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
}
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    display: none;
}
.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}
.lightbox-prev {
    left: 16px;
}
.lightbox-next {
    right: 16px;
}

footer.hint {
    padding: 16px;
    color: var(--text-dim);
    font-size: 12px;
    text-align: center;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
}
.pagination-status {
    color: var(--text-dim);
    font-size: 13px;
}
.pagination-disabled {
    color: var(--border);
    font-size: 14px;
}

.post-actions {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-top: 10px;
}
.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.link-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
}
.link-btn:hover {
    text-decoration: underline;
    color: var(--text);
}
.link-btn.danger-link:hover {
    color: var(--danger);
}
.report-details summary {
    color: var(--text-dim);
    font-size: 13px;
    cursor: pointer;
    list-style: none;
}
.report-details summary:hover {
    color: var(--text);
    text-decoration: underline;
}
.report-details summary::-webkit-details-marker {
    display: none;
}
.report-details form {
    margin-top: 8px;
}
.report-details input[type=text] {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 6px 10px;
    font-size: 13px;
}

.admin-section {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}
.admin-section h2 {
    font-size: 17px;
    margin: 0 0 12px;
}
.report-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
}
.report-card .meta {
    color: var(--text-dim);
    font-size: 13px;
    margin-bottom: 8px;
}
.report-card .content {
    margin-bottom: 8px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.report-card img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    display: block;
    margin-bottom: 8px;
}
.report-card .buttons {
    display: flex;
    gap: 10px;
}
.report-card .buttons form {
    display: inline;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.user-table th, .user-table td {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 1px solid var(--border);
}
.user-table th {
    color: var(--text-dim);
    font-weight: 600;
    font-size: 13px;
}
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}
.badge.banned {
    background: rgba(244, 33, 46, 0.15);
    color: #ff8a94;
}
.badge.admin {
    background: rgba(29, 155, 240, 0.15);
    color: var(--accent);
}
