:root {
    color-scheme: dark;
    --bg:#0b0f17;
    --bg2:#101826;
    --panel:#151d2b;
    --panel2:#1b2637;
    --muted:#9aa7b8;
    --text:#f5f8fc;
    --line:#2b384a;
    --accent:#8ab4ff;
    --accent2:#b6cdfd;
    --danger:#ff8a8a;
    --ok:#80d99b;
    --warn:#ffd166;
}
* { box-sizing: border-box; }
body { margin:0; font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: radial-gradient(circle at top left, #182235 0, var(--bg) 40%); color:var(--text); }
a { color:var(--accent); text-decoration:none; }
a:hover { text-decoration:underline; }
.container { width:min(1380px, calc(100% - 32px)); margin:0 auto; }
.nav { position:sticky; top:0; z-index:20; background:rgba(10,14,22,.92); backdrop-filter: blur(10px); border-bottom:1px solid var(--line); }
.nav-inner { display:flex; gap:18px; align-items:center; min-height:64px; }
.brand { font-weight:900; letter-spacing:.02em; color:var(--text); display:flex; align-items:center; gap:10px; }
.brand-mark { display:inline-grid; place-items:center; width:36px; height:36px; border-radius:12px; background:linear-gradient(135deg, var(--accent), #d7b7ff); color:#07101f; font-weight:900; }
.nav-links { display:flex; gap:10px; flex-wrap:wrap; margin-left:auto; align-items:center; }
.nav-links a, .link-button { color:var(--text); opacity:.86; font-size:14px; background:none; border:0; cursor:pointer; padding:8px 10px; border-radius:10px; }
.nav-links a.active, .nav-links a:hover, .link-button:hover { background:var(--panel2); opacity:1; text-decoration:none; }
.main { padding:30px 0 70px; }
.footer { color:var(--muted); font-size:12px; border-top:1px solid var(--line); padding:18px 0; }
h1 { margin:0; font-size:clamp(30px, 4vw, 46px); line-height:1.05; }
h2 { margin:0 0 14px; }
h3 { margin:0 0 8px; }
.eyebrow { margin:0 0 6px; color:var(--accent2); text-transform:uppercase; font-weight:800; font-size:12px; letter-spacing:.14em; }
.page-head { display:flex; gap:16px; align-items:center; justify-content:space-between; margin-bottom:18px; }
.page-head.inline { margin-bottom:0; align-items:flex-start; }
.grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap:16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stat-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap:16px; }
.stat-card, .card { background:linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.015)); border:1px solid var(--line); border-radius:18px; padding:18px; box-shadow:0 18px 35px rgba(0,0,0,.18); }
a.stat-card { color:var(--text); }
a.stat-card:hover { text-decoration:none; border-color:#45617f; }
.stat { font-size:38px; font-weight:900; }
.muted { color:var(--muted); }
.small { font-size:13px; }
.strong { font-weight:800; color:var(--text); }
.mt { margin-top:18px; }
.mt-small { margin-top:12px; }
.table { width:100%; border-collapse:collapse; }
.table th, .table td { border-bottom:1px solid var(--line); padding:11px 8px; text-align:left; vertical-align:middle; }
.table-comfortable th, .table-comfortable td { padding:13px 10px; }
.table th { color:var(--muted); font-weight:700; font-size:13px; }
.badge { display:inline-block; padding:5px 9px; border:1px solid var(--line); border-radius:999px; font-size:12px; color:#d8e0eb; background:#101722; white-space:nowrap; }
.badge-ok { border-color:#245d39; color:#c9ffd8; background:#0f2117; }
.badge-danger { border-color:#683131; color:#ffd2d2; background:#211111; }
.form { display:grid; gap:13px; max-width:760px; }
input, select, textarea { width:100%; background:#0f141e; color:var(--text); border:1px solid var(--line); border-radius:12px; padding:10px 12px; outline:none; }
input:focus, select:focus, textarea:focus { border-color:var(--accent); box-shadow:0 0 0 3px rgba(138,180,255,.12); }
textarea { min-height:120px; }
button,
.button,
.button-secondary,
.button-danger,
.button-link,
.actions.compact a {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:6px;
    min-height:38px;
    padding:10px 14px;
    border:1px solid transparent;
    border-radius:12px;
    font-weight:800;
    line-height:1;
    cursor:pointer;
    text-align:center;
    white-space:nowrap;
    text-decoration:none;
    appearance:none;
}
button,
.button {
    background:var(--accent);
    color:#07101f;
    border-color:rgba(138,180,255,.25);
}
button:hover,
.button:hover,
.button-secondary:hover,
.button-danger:hover,
.button-link:hover,
.actions.compact a:hover {
    text-decoration:none;
    filter:brightness(1.06);
}
.button-secondary,
.button-link,
.actions.compact a {
    background:#243249;
    color:var(--text);
    border-color:#34445c;
}
.button-secondary:hover,
.button-link:hover,
.actions.compact a:hover {
    background:#2b3a54;
}
.button-danger,
.actions .button-danger {
    background:#4a2020;
    color:#ffd4d4;
    border-color:#6b3030;
}
.button-danger:hover,
.actions .button-danger:hover {
    background:#5a2626;
}
.button-small {
    min-height:32px;
    padding:7px 10px;
    border-radius:9px;
    font-size:12px;
}
.alert { border-radius:14px; padding:13px 15px; margin-bottom:16px; border:1px solid var(--line); background:#111722; }
.alert-danger { border-color:#5f2a2a; color:#ffd2d2; }
.alert-ok { border-color:#225b36; color:#cfffdc; }
.actions { display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.actions.compact { gap:6px; }
.actions.compact form { display:inline; }
.actions.compact button, .actions.compact .button, .actions.compact .button-secondary, .actions.compact a { min-height:30px; padding:7px 9px; font-size:12px; border-radius:9px; }
.filters { display:grid; grid-template-columns: minmax(240px, 1fr) 220px auto; gap:12px; align-items:center; margin-bottom:18px; }
.inline-form { display:grid; grid-template-columns: 110px 110px minmax(220px,1fr) 160px 120px auto; gap:10px; align-items:center; }
.mini-form { display:grid; grid-template-columns: minmax(160px,1fr) 150px 110px auto auto; gap:8px; margin-top:10px; align-items:center; }
.checkline { display:flex; gap:8px; align-items:center; }
.checkline input { width:auto; }
.media-title-cell { display:flex; align-items:center; gap:12px; min-width:260px; }
.poster-mini { width:42px; height:62px; object-fit:cover; border-radius:8px; border:1px solid var(--line); }
.poster { width:170px; max-width:100%; object-fit:cover; border-radius:14px; border:1px solid var(--line); }
.media-hero { display:flex; gap:20px; align-items:flex-start; }
.hero-content { flex:1; min-width:0; }
.overview { color:#d2d9e4; max-width:950px; line-height:1.6; }
.meta-line { display:flex; gap:10px; flex-wrap:wrap; color:var(--muted); align-items:center; margin-top:10px; }
.progress { height:8px; background:#0c121c; border:1px solid var(--line); border-radius:999px; overflow:hidden; margin-top:7px; max-width:180px; }
.progress span { display:block; height:100%; background:linear-gradient(90deg, var(--accent), var(--ok)); border-radius:999px; }
.section-title { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:12px; }
.result-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap:16px; }
.result-card { display:grid; grid-template-columns: 110px 1fr; gap:14px; padding:14px; border:1px solid var(--line); border-radius:16px; background:#111824; }
.result-card .poster { width:110px; }
.clamp { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.clamp-4 { display:-webkit-box; -webkit-line-clamp:4; -webkit-box-orient:vertical; overflow:hidden; }
code { color:#dbe8ff; word-break:break-word; }
details summary { cursor:pointer; }
@media (max-width: 860px) {
    .page-head, .media-hero { display:block; }
    .page-head .actions { margin-top:12px; }
    .filters, .inline-form, .mini-form { grid-template-columns:1fr; }
    .table { display:block; overflow-x:auto; }
    .poster { width:120px; margin-bottom:12px; }
}
.no-margin { margin: 0; }
.episode-list { display:grid; gap:10px; }
.episode-row { display:flex; justify-content:space-between; align-items:center; gap:12px; border:1px solid var(--line); background:rgba(255,255,255,.025); border-radius:14px; padding:12px; }
.episode-row form { flex:0 0 auto; }
.season-details { padding:0; overflow:hidden; }
.season-details > summary { list-style:none; padding:18px; cursor:pointer; }
.season-details > summary::-webkit-details-marker { display:none; }
.season-summary { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.season-summary h2 { margin:0 0 4px; }
.season-details[open] .season-summary { border-bottom:1px solid var(--line); }
.season-actions { padding: 0 18px; }
.season-details .table { margin-bottom:8px; }
@media (max-width: 860px) {
    .episode-row, .season-summary { display:block; }
    .episode-row form, .season-summary .badge { margin-top:10px; display:inline-block; }
}

.footer-inner { display:flex; justify-content:space-between; gap:14px; align-items:center; flex-wrap:wrap; }
.tmdb-footer { color:var(--muted); }
.tmdb-wordmark { display:inline-flex; align-items:center; justify-content:center; min-width:96px; height:42px; padding:0 16px; border-radius:12px; border:1px solid #01b4e4; color:#90cea1; background:#081c22; font-weight:900; letter-spacing:.08em; }

/* V1.3 - jaquettes jeux */
.cover-editor { display:grid; grid-template-columns:minmax(260px, 1fr) 190px; gap:16px; align-items:start; }
.cover-preview-wrap { display:grid; justify-items:center; gap:8px; }
.game-cover-preview { width:160px; height:220px; object-fit:cover; border-radius:14px; border:1px solid var(--line); background:#0f141e; }
.game-cover-placeholder { width:160px; height:220px; display:grid; place-items:center; text-align:center; color:var(--muted); border:1px dashed var(--line); border-radius:14px; background:#0f141e; }
.game-cover-mini { width:46px; height:64px; object-fit:cover; border-radius:8px; border:1px solid var(--line); background:#0f141e; flex:0 0 auto; }
.game-cover-empty { display:grid; place-items:center; color:var(--muted); font-size:12px; font-weight:900; letter-spacing:.08em; }
@media (max-width: 860px) { .cover-editor { grid-template-columns:1fr; } }

/* V1.3.1 - liste films en cartes alignées */
.button-link { display:inline-block; text-align:center; }
.movie-list { display:grid; gap:14px; }
.movie-card {
    display:grid;
    grid-template-columns:82px minmax(0, 1fr) 140px;
    gap:16px;
    align-items:start;
    padding:14px;
}
.movie-poster-wrap { width:82px; }
.movie-poster {
    width:82px;
    height:122px;
    object-fit:cover;
    border-radius:12px;
    border:1px solid var(--line);
    background:#0f141e;
}
.movie-poster-empty {
    display:grid;
    place-items:center;
    color:var(--muted);
    font-weight:900;
    letter-spacing:.12em;
}
.movie-main { min-width:0; }
.movie-title-row {
    display:flex;
    justify-content:space-between;
    gap:14px;
    align-items:flex-start;
}
.movie-title {
    margin:0;
    font-size:18px;
    line-height:1.25;
}
.movie-meta-line {
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    align-items:center;
    margin-top:8px;
}
.movie-overview {
    margin:12px 0 0;
    color:#d2d9e4;
    line-height:1.45;
}
.movie-info-grid {
    display:grid;
    grid-template-columns:repeat(4, minmax(120px, 1fr));
    gap:10px;
    margin-top:14px;
}
.movie-info-grid > div {
    min-width:0;
    padding:10px;
    border:1px solid var(--line);
    border-radius:12px;
    background:rgba(255,255,255,.018);
}
.movie-info-label {
    display:block;
    color:var(--muted);
    font-size:11px;
    font-weight:800;
    text-transform:uppercase;
    letter-spacing:.08em;
    margin-bottom:4px;
}
.movie-info-grid strong {
    display:block;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    font-size:13px;
}
.movie-action-group,
.movie-side-actions {
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    align-items:center;
}
.movie-action-group form,
.movie-side-actions form { margin:0; }
.movie-action-group button,
.movie-side-actions button,
.movie-side-actions .button-link {
    padding:8px 10px;
    border-radius:10px;
    font-size:12px;
    line-height:1;
}
.movie-side-actions {
    justify-content:flex-end;
    align-content:flex-start;
}
.movie-side-actions > * { width:100%; }
.movie-side-actions button,
.movie-side-actions .button-link { width:100%; }
@media (max-width: 1050px) {
    .movie-card { grid-template-columns:82px minmax(0, 1fr); }
    .movie-side-actions {
        grid-column:1 / -1;
        justify-content:flex-start;
    }
    .movie-side-actions > * { width:auto; }
    .movie-side-actions button,
    .movie-side-actions .button-link { width:auto; }
}
@media (max-width: 760px) {
    .movie-card { grid-template-columns:1fr; }
    .movie-poster-wrap { width:auto; }
    .movie-poster { width:96px; height:144px; }
    .movie-title-row { display:block; }
    .movie-action-group-top { margin-top:12px; }
    .movie-info-grid { grid-template-columns:1fr 1fr; }
}
@media (max-width: 520px) {
    .movie-info-grid { grid-template-columns:1fr; }
}


/* V1.3.2 - filtres persistants */
.filters-persistent { grid-template-columns:minmax(220px, 1fr) 220px auto auto; }
.filter-state { grid-column:1 / -1; }
@media (max-width: 860px) {
    .filters-persistent { grid-template-columns:1fr; }
    .filter-state { grid-column:auto; }
}

/* V1.3.3 - TMDb-first create flow */
.create-flow-note h2,
.empty-search-card h3 {
    margin-top: 0;
}
.tmdb-create-search {
    align-items: center;
}
.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin: 1.5rem 0 .75rem;
}
.tmdb-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}
.tmdb-result-card {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}
.tmdb-result-poster img,
.tmdb-result-poster .poster-placeholder {
    width: 92px;
    height: 138px;
    border-radius: .75rem;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.06);
    color: rgba(255,255,255,.55);
    font-weight: 800;
}
.tmdb-result-body h3 {
    margin: 0 0 .25rem;
}
.tmdb-result-body p {
    margin-bottom: 0;
}
.tmdb-result-card form {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
}
.warning-card,
.danger-card {
    border-color: rgba(255, 196, 87, .35);
}
.danger-card {
    border-color: rgba(255, 100, 100, .45);
}
@media (max-width: 640px) {
    .tmdb-result-card {
        grid-template-columns: 76px minmax(0, 1fr);
    }
    .tmdb-result-poster img,
    .tmdb-result-poster .poster-placeholder {
        width: 76px;
        height: 114px;
    }
    .section-title-row {
        display: block;
    }
}

/* V1.3.4 - boutons d'action cohérents */
.filters .button-secondary,
.filters .button-link {
    min-height:40px;
}
.filter-state {
    grid-column: 1 / -1;
}
.table .actions.compact {
    justify-content:flex-start;
}
.movie-side-actions .button,
.movie-side-actions .button-secondary,
.movie-side-actions .button-danger,
.movie-side-actions .button-link,
.movie-side-actions button {
    width:100%;
}

