:root{
  --bg: #0f1116;
  --panel: #151925;
  --panel-2: #1a2030;
  --text: #e9eef5;
  --muted: #aab3c5;
  --accent: #4c7df3;         /* accent principal */
  --accent-2: #f34d6a;       /* accent secondaire (duo type "Smash" bleu/rouge) */
  --ring: #6b8cff88;
  --ok: #39c074;
  --err: #ff6b6b;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --shadow-2: 0 6px 18px rgba(0,0,0,.25);
  --focus: 0 0 0 3px var(--ring);
}

*{ box-sizing:border-box; }
html,body{
  height:100%;
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji","Segoe UI Emoji";
  background: radial-gradient(1200px 600px at 20% -10%, #1b2235 10%, transparent 60%),
              radial-gradient(1200px 700px at 120% 110%, #2a1b25 20%, transparent 60%),
              var(--bg);
  color: var(--text);
  line-height:1.6;
  -webkit-font-smoothing: antialiased;
}

img, picture{
  max-width:100%;
  display:block;
}

.wrap{
  min-height:100%;
  display:grid;
  place-items:center;
  padding: clamp(16px, 4vw, 48px);
}

.card{
  width: min(980px, 100%);
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Header */
.card-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background:
    radial-gradient(1200px 400px at -10% -50%, rgba(76,125,243,.12) 0%, transparent 60%),
    radial-gradient(900px 380px at 110% 130%, rgba(243,77,106,.10) 0%, transparent 60%);
}
.brand{
  display:flex; align-items:center; gap:12px;
}
.brand-badge{
  width:40px; height:40px; border-radius:10px;
  background: conic-gradient(from 210deg, var(--accent) 0 50%, var(--accent-2) 50% 100%);
  box-shadow: 0 8px 20px rgba(76,125,243,.35), 0 8px 20px rgba(243,77,106,.25) inset;
  border: 1px solid rgba(255,255,255,.15);
}
.brand-title{
  font-weight:700; letter-spacing:.3px;
}

/* Tabs */
.tabs{
  display:flex; gap:8px; background:rgba(255,255,255,.03);
  padding:6px; border-radius:12px;
}
.tab{
  appearance:none; border:none; cursor:pointer;
  padding:10px 14px; border-radius:10px;
  color:var(--muted); background:transparent;
  font-weight:600;
  transition: transform .15s ease, color .2s ease, background .2s ease;
}
.tab[aria-selected="true"]{
  color:var(--text);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}
.tab:focus-visible{ outline: none; box-shadow: var(--focus); }

.card-body{
  display:grid;
  grid-template-columns: minmax(auto, 560px);
  justify-content:center;
  padding: clamp(16px, 4vw, 28px);
}

/* Left column: forms */
.pane{
  display:none;
  animation: fade .25s ease;
}
.pane.active{ display:block; }

@keyframes fade{
  from{ opacity:0; transform: translateY(6px); }
  to{ opacity:1; transform: translateY(0); }
}

.panel{
  background: rgba(0,0,0,.18);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding: clamp(16px, 3vw, 24px);
}
.panel h2{
  margin:0 0 6px; font-size: clamp(18px, 2.4vw, 22px);
}
.panel p.muted{
  margin:0 0 18px; color: var(--muted); font-size: 14px;
}

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

.field{
  display:grid; gap:6px;
}
.field label{
  font-size: 14px; color: var(--muted);
}
.input, .file{
  width:100%;
  padding: 12px 13px;
  border-radius: 12px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  color: var(--text);
  outline:none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.input::placeholder{ color: #96a0b8; }
.input:focus{ border-color: rgba(255,255,255,.22); box-shadow: var(--focus); background: rgba(255,255,255,.06); }

.hint{ font-size: 12px; color: var(--muted); }
.error{ font-size: 13px; color: var(--err); min-height: 18px; }

.actions{
  display:flex; align-items:center; gap:12px; margin-top:4px;
}
.btn{
  appearance: none; border: none; cursor:pointer;
  padding: 12px 16px; border-radius: 12px; font-weight:700;
  color:#0b0e16; background: linear-gradient(180deg, #8fb0ff, #6b8cff);
  box-shadow: 0 10px 24px rgba(76,125,243,.35);
  transition: transform .12s ease, filter .2s ease, box-shadow .2s ease;
}
.btn:hover{ filter:brightness(1.05); }
.btn:active{ transform: translateY(1px) scale(.995); }
.btn.alt{
  background: linear-gradient(180deg, #ff8aa0, #f34d6a);
  color: #170a0e; box-shadow: 0 10px 24px rgba(243,77,106,.35);
}

.switch{
  margin-left:auto; color:var(--muted); font-size:14px;
}
.switch button{
  color: var(--accent); background:none; border:none; cursor:pointer; padding:0; font-weight:700;
}
.switch button:focus-visible{ outline: none; box-shadow: var(--focus); }

/* Right column: flavor */
.flavor{
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding: clamp(16px, 3vw, 24px);
  background:
    radial-gradient(360px 260px at 85% 10%, rgba(76,125,243,.12), transparent 60%),
    radial-gradient(360px 260px at 0% 100%, rgba(243,77,106,.12), transparent 60%),
    rgba(0,0,0,.18);
}
.flavor h3{ margin: 0 0 10px; font-size: clamp(18px, 2.4vw, 22px); }
.flavor p{ margin: 0 0 16px; color: var(--muted); }
.badges{ display:flex; flex-wrap: wrap; gap:8px; }
.badge{
  padding:6px 10px; border-radius: 999px; font-size: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
}

/* Avatar upload preview */
.avatar-wrap{
  display:flex; align-items:center; gap:14px; flex-wrap:wrap;
}
.avatar{
  width:56px; height:56px; border-radius:50%;
  background: #0b0f18;
  border: 1px solid rgba(255,255,255,.12);
  overflow:hidden; display:grid; place-items:center;
  font-size:12px; color:var(--muted);
}
.avatar img{ width:100%; height:100%; object-fit:cover; display:block; }

/* Password visibility toggle */
.input-wrap{
  position: relative;
}
.toggle-eye{
  position:absolute; right:10px; top:50%; translate: 0 -50%;
  background:none; border:none; color:var(--muted); cursor:pointer; padding:6px;
  border-radius:8px;
}
.toggle-eye:focus-visible{ outline:none; box-shadow: var(--focus); }

/* Home page layout */
body.home{
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

.site-header{
  background: rgba(255,255,255,.03);
  border-bottom: 1px solid rgba(255,255,255,.07);
  backdrop-filter: blur(8px);
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 14px clamp(20px, 6vw, 80px);
  position:sticky;
  top:0;
  z-index:50;
  gap:18px;
  flex-wrap:wrap;
}

.site-header .brand{
  display:flex;
  align-items:center;
  gap:10px;
}

.site-header .brand-logo{
  width:38px;
  height:38px;
  border-radius:8px;
  background: conic-gradient(from 210deg, var(--accent) 0 50%, var(--accent-2) 50% 100%);
  box-shadow: 0 4px 10px rgba(76,125,243,.35), 0 4px 10px rgba(243,77,106,.25) inset;
  border: 1px solid rgba(255,255,255,.15);
}

.site-header .brand-title{
  font-size:18px;
  color: var(--text);
  text-decoration:none;
  font-weight:700;
  letter-spacing:.3px;
}

.site-header nav ul{
  list-style:none;
  display:flex;
  gap:18px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.site-header nav a{
  text-decoration:none;
  color:var(--muted);
  font-weight:600;
  transition:color .2s ease;
}

.site-header nav a:hover{
  color:var(--text);
}

body.home main{
  flex:1;
  padding: 4vw clamp(24px, 6vw, 80px);
  display:flex;
  flex-direction:column;
  gap:40px;
  width:min(1180px, 100%);
  margin:0 auto 48px;
}

body.home .hero{
  text-align:center;
  padding: 40px 20px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  box-shadow: var(--shadow);
}

body.home .hero h1{
  font-size: clamp(28px, 4vw, 42px);
  margin-bottom:10px;
}

body.home .hero p{
  color:var(--muted);
  font-size: clamp(14px, 2vw, 18px);
  max-width:700px;
  margin:auto;
}

body.home .hero a.btn{
  display:inline-block;
  margin-top:22px;
  padding: 14px 20px;
  border-radius: 12px;
  background: linear-gradient(180deg, #8fb0ff, #6b8cff);
  color:#0b0e16;
  font-weight:700;
  box-shadow: 0 10px 24px rgba(76,125,243,.35);
  text-decoration:none;
  transition: transform .12s ease, filter .2s ease;
}

body.home .hero a.btn:hover{
  filter:brightness(1.05);
}

body.home .posts{
  display:grid;
  gap:24px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

body.home .posts.posts-grid{
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

body.home .post{
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  overflow:hidden;
  transition: transform .2s ease;
}

body.home .post:hover{
  transform: translateY(-4px);
}

body.home .post img{
  width:100%;
  height:180px;
  object-fit:cover;
  display:block;
}

body.home .post-content{
  padding: 16px 18px;
  display:flex;
  flex-direction:column;
  gap:8px;
}

body.home .post-content h3{
  font-size:18px;
  font-weight:700;
  color:var(--text);
}

.post-actions{
  display:flex;
  gap:8px;
  margin-top:10px;
}

.post-actions form{
  margin:0;
  display:flex;
}

.post-action-btn{
  border:none;
  background: rgba(255,255,255,.08);
  color:var(--text);
  width:36px;
  height:36px;
  border-radius:50%;
  display:grid;
  place-items:center;
  font-size:18px;
  cursor:pointer;
  transition: background .2s ease, transform .2s ease;
}

.post-action-btn:hover{
  background: rgba(255,255,255,.15);
  transform: translateY(-1px);
}

.post-action-btn.danger{
  background: rgba(243,77,106,.2);
}

.post-action-btn.danger:hover{
  background: rgba(243,77,106,.35);
}

.popup-confirmation{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.6);
  display:none;
  align-items:center;
  justify-content:center;
  padding:24px;
  z-index:1000;
}
.popup-confirmation.is-open{
  display:flex;
}
.popup-content{
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  padding: 24px;
  width:min(320px, 90%);
  box-shadow: var(--shadow);
  position:relative;
  text-align:center;
}
.popup-content p{
  margin:0 0 16px;
  color:var(--text);
  font-weight:600;
}
.popup-buttons{
  display:flex;
  gap:12px;
  justify-content:center;
}
.popup-content .btn{
  border:none;
  cursor:pointer;
}
.popup-content .btn.cancel{
  background: rgba(255,255,255,.12);
  color: var(--text);
}
.popup-close{
  position:absolute;
  top:10px;
  right:10px;
  border:none;
  background: none;
  color:var(--muted);
  font-size:20px;
  cursor:pointer;
}

.post-meta-small{
  margin:0;
  font-size:13px;
  color:var(--muted);
  letter-spacing:.04em;
  text-transform:uppercase;
}

body.home .post-content p{
  font-size:14px;
  color:var(--muted);
  line-height:1.4;
}

body.home .post-content a{
  margin-top:auto;
  color: var(--accent);
  text-decoration:none;
  font-weight:600;
  font-size:14px;
}

body.home .post-content a:hover{
  text-decoration:underline;
}

body.home footer{
  padding: 24px 6vw;
  text-align:center;
  color:var(--muted);
  font-size:14px;
  border-top:1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.02);
}

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

.user-card{
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border:1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding:18px;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.user-info{
  display:flex;
  gap:12px;
  align-items:center;
}

.user-avatar{
  width:52px;
  height:52px;
  border-radius:12px;
  background: rgba(255,255,255,.08);
  display:grid;
  place-items:center;
  font-weight:700;
  color:var(--text);
  overflow:hidden;
}
.user-avatar img{
  width:100%;
  height:100%;
  object-fit:cover;
}

.user-card h3{
  margin:0;
  font-size:18px;
}

.user-card p{
  margin:0;
  color:var(--muted);
}

.user-delete-form{
  margin:0;
}

.btn.danger{
  background: rgba(243,77,106,.8);
  color:#fff;
}

.btn.danger:hover{
  filter:brightness(1.05);
}

.user-note{
  font-size:14px;
  color:var(--muted);
  font-style:italic;
}

.about-content{
  display:grid;
  gap:20px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-top:20px;
}

.about-content article{
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border:1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding:18px;
  box-shadow: var(--shadow-2);
}

.about-content h2{
  margin:0 0 10px;
}

/* Article page layout */
body.article{
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

body.article main{
  flex:1;
  padding: clamp(24px, 5vw, 64px) clamp(24px, 6vw, 80px) 72px;
  display:flex;
  flex-direction:column;
  gap:36px;
  width:min(920px, 100%);
  margin:0 auto;
}

body.article .toggle-comments{
  align-self:flex-start;
}

body.article .featured-post{
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}

body.article .post-media img{
  width:100%;
  height: clamp(240px, 45vw, 420px);
  object-fit:cover;
  display:block;
}

body.article .post-body{
  padding: clamp(20px, 4vw, 36px);
  display:flex;
  flex-direction:column;
  gap:16px;
}

body.article .post-meta{
  text-transform:uppercase;
  letter-spacing:.1em;
  font-size:12px;
  color:var(--muted);
}

body.article h1{
  margin:0;
  font-size: clamp(26px, 4vw, 40px);
}

body.article .post-body p{
  color:var(--muted);
  line-height:1.6;
  margin:0;
}

body.article .comments{
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 32px);
  box-shadow: var(--shadow-2);
  display:flex;
  flex-direction:column;
  gap:24px;
}

body.article .comments.is-hidden{
  display:none;
}

body.article .comments-header{
  display:flex;
  align-items:center;
  gap:12px;
}

body.article .comments-header h2{
  margin:0;
  font-size: clamp(20px, 3vw, 26px);
}

body.article .comments-header .count{
  color:var(--muted);
  font-size:14px;
}

body.article .comment-list{
  display:flex;
  flex-direction:column;
  gap:18px;
}

body.article .comment{
  display:flex;
  gap:12px;
  padding:12px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

body.article .comment:last-child{
  border-bottom:none;
  padding-bottom:0;
}

body.article .comment .avatar{
  width:44px;
  height:44px;
  border-radius:12px;
  background: rgba(255,255,255,.08);
  display:grid;
  place-items:center;
  font-weight:700;
  color:var(--text);
}

body.article .comment .author{
  font-weight:600;
  margin:0 0 4px;
  display:flex;
  align-items:center;
  gap:8px;
}

.comment-meta{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}

body.article .comment p{
  margin:0;
  color:var(--muted);
}

body.article .comment-form{
  display:flex;
  flex-direction:column;
  gap:16px;
}

body.article .comment-form h3{
  margin:0;
  font-size: clamp(18px, 3vw, 22px);
}

body.article .comment-form .form-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap:16px;
}

body.article .comment-form label{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:14px;
  color:var(--muted);
}

body.article .comment-form input,
body.article .comment-form textarea{
  padding: 12px 13px;
  border-radius: var(--radius-sm);
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: var(--text);
  font-family: inherit;
  font-size:14px;
  resize: vertical;
}

body.article .comment-form input:focus,
body.article .comment-form textarea:focus{
  outline:none;
  border-color: rgba(255,255,255,.25);
  box-shadow: var(--focus);
  background: rgba(255,255,255,.06);
}

body.article .comment-login-hint{
  color: var(--muted);
  font-size:14px;
}

body.article .comment-login-hint a{
  color: var(--accent);
  text-decoration:none;
  font-weight:600;
}

body.article .comment-login-hint a:hover{
  text-decoration:underline;
}

.comment-delete-form{
  margin-left:auto;
}

.comment-delete-btn{
  border:none;
  background: rgba(243,77,106,.15);
  color:#fff;
  width:28px;
  height:28px;
  border-radius:50%;
  cursor:pointer;
  display:grid;
  place-items:center;
  font-size:14px;
  transition: background .2s ease;
}

.comment-delete-btn:hover{
  background: rgba(243,77,106,.3);
}

.nav-user {
  display: flex;
  align-items: center;
}

.avatar-nav {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  transition: transform 0.2s ease;
}

.avatar-nav:hover {
  transform: scale(1.05);
}


@media (max-width: 720px){
  .site-header{
    padding:12px 18px;
  }
  .site-header nav ul{
    width:100%;
    justify-content:flex-start;
  }
  .site-header nav a{
    font-size:14px;
  }
  body.home main,
  body.article main{
    padding: 28px 18px;
  }
  body.article .comment{
    flex-direction:column;
  }
  body.article .comment .avatar{
    width:36px;
    height:36px;
    border-radius:10px;
  }
  body.article .comments-header{
    flex-direction:column;
    align-items:flex-start;
  }
}
