:root{
  --bg: #0b1020;
  --panel: rgba(255,255,255,.06);
  --card: rgba(255,255,255,.08);
  --card2: rgba(255,255,255,.10);
  --border: rgba(255,255,255,.12);

  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.68);
  --muted2: rgba(255,255,255,.52);

  --ok: #4ade80;
  --bad: #fb7185;

  --shadow: 0 18px 55px rgba(0,0,0,.45);
  --shadow2: 0 10px 26px rgba(0,0,0,.35);

  --r: 18px;
  --r2: 14px;

  --mono: ui-monospace, Menlo, Consolas, monospace;
  --sans: system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}

/* page */
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(900px 480px at 10% 10%, rgba(99,102,241,.24), transparent 60%),
    radial-gradient(760px 460px at 95% 15%, rgba(34,197,94,.18), transparent 60%),
    radial-gradient(900px 560px at 55% 110%, rgba(251,113,133,.16), transparent 55%),
    var(--bg);
}

.shell{
  max-width: 1040px;
  margin: 26px auto;
  padding: 0 16px 26px;
}

/* top bar */
.topbar{
  display:flex;
  gap:14px;
  align-items:center;
  justify-content:space-between;
  margin-bottom: 14px;
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
  min-width: 260px;
}
.logo{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255,255,255,.10);
  border: 1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow: var(--shadow2);
}
.title{ font-weight: 720; letter-spacing: .2px; font-size: 1.05rem; }
.subtitle{ color: var(--muted); font-size: .92rem; margin-top: 2px; }

.top-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  justify-content:flex-end;
}

.badge{
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: .86rem;
}

/* main card */
.card{
  border-radius: var(--r);
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.06));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 16px;
  overflow:hidden;
}

/* controls */
.controls{
  display:flex;
  flex-wrap:wrap;
  gap: 12px;
  align-items:center;
  justify-content:space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}

.btnrow{ display:flex; gap:10px; flex-wrap:wrap; }

.btn{
  appearance:none;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 14px;
  cursor:pointer;
  font-weight: 650;
  letter-spacing: .2px;
  transition: transform .06s ease, background .12s ease, border-color .12s ease, opacity .12s ease;
  box-shadow: 0 10px 22px rgba(0,0,0,.22);
}
.btn:hover{ background: rgba(255,255,255,.11); border-color: rgba(255,255,255,.20); }
.btn:active{ transform: translateY(1px); }
.btn:disabled{
  opacity:.45;
  cursor:not-allowed;
  box-shadow:none;
}

.btn-primary{
  background: linear-gradient(180deg, rgba(99,102,241,.52), rgba(99,102,241,.30));
  border-color: rgba(99,102,241,.60);
}
.btn-primary:hover{ background: linear-gradient(180deg, rgba(99,102,241,.60), rgba(99,102,241,.34)); }

.btn-secondary{
  background: linear-gradient(180deg, rgba(255,255,255,.13), rgba(255,255,255,.08));
}
.btn-ghost{
  background: transparent;
  box-shadow:none;
}

/* toggle */
.toggle{
  display:flex;
  gap:10px;
  align-items:center;
  user-select:none;
  color: var(--muted);
  font-weight: 600;
}

.toggle input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}

.toggle-ui{
  width: 44px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.toggle-ui::after{
  content:"";
  position:absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255,255,255,.86);
  transition: transform .14s ease, background .14s ease;
}
.toggle input:checked + .toggle-ui{
  background: rgba(34,197,94,.22);
  border-color: rgba(34,197,94,.42);
}
.toggle input:checked + .toggle-ui::after{
  transform: translateX(18px);
  background: rgba(255,255,255,.92);
}
.toggle-text{ font-size: .95rem; }

/* output */
.output{ padding-top: 12px; }
.output-head{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:10px;
  margin-bottom: 8px;
}
.label{
  font-weight: 760;
  letter-spacing: .15px;
  color: rgba(255,255,255,.86);
}
.hint{
  color: var(--muted2);
  font-size: .90rem;
}

.out{
  border-radius: var(--r2);
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(0,0,0,.22);
  padding: 14px 14px;
  min-height: 52px;
  font-family: var(--mono);
  word-break: break-all;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(0,0,0,.22);
  outline: none;
}
.out:hover{ border-color: rgba(255,255,255,.24); }
.out:focus-visible{
  box-shadow: 0 0 0 4px rgba(99,102,241,.26), 0 10px 26px rgba(0,0,0,.22);
  border-color: rgba(99,102,241,.55);
}
.masked{ letter-spacing: 2px; }

.note{
  margin-top: 8px;
  color: var(--muted2);
  font-size: .88rem;
}

/* tiles */
.grid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
}

.tile{
  border-radius: var(--r2);
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  padding: 12px;
  box-shadow: 0 10px 22px rgba(0,0,0,.16);
}

.mono{ font-family: var(--mono); color: rgba(255,255,255,.88); }
.types{ white-space: pre-wrap; }

@media (min-width: 900px){
  .grid{ grid-template-columns: 1.35fr 1fr .85fr; }
}

/* checks */
.checks{ margin-top: 14px; }
.checks-wrap{ margin-top: 8px; }

.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: var(--muted);
  font-size: .92rem;
  margin: 6px 8px 0 0;
}
.pill.ok{ border-color: rgba(74,222,128,.26); color: rgba(74,222,128,.95); }
.pill.bad{ border-color: rgba(251,113,133,.28); color: rgba(251,113,133,.95); }

/* status bar */
.statusbar{
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.10);
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.status{
  color: rgba(255,255,255,.86);
  font-weight: 650;
}
.tiny{ font-size: .86rem; }
.muted{ color: var(--muted); }

/* reduced motion */
@media (prefers-reduced-motion: reduce){
  .btn, .toggle-ui::after{ transition:none; }
}

/* =========================
   Responsive hardening
   ========================= */

/* 1) éviter tout overflow horizontal */
html, body { overflow-x: hidden; }
.card, .tile, .out { max-width: 100%; }

/* 2) textes longs (hash/types/password) : wrap propre */
.mono, .types, #hash, #entropy {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* 3) output: confortable sur mobile */
.out{
  min-height: 56px;
  line-height: 1.35;
  font-size: clamp(.95rem, 2.8vw, 1.05rem);
  padding: 14px;
}

/* 4) topbar: passe en colonne sur petit écran */
@media (max-width: 720px){
  .topbar{
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .top-actions{
    justify-content: flex-start;
  }
}

/* 5) controls: boutons + toggle empilés proprement */
@media (max-width: 720px){
  .controls{
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .btnrow{
    width: 100%;
  }
  .btn{
    width: 100%;
    justify-content: center;
  }
  .toggle{
    width: 100%;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.05);
  }
}

/* 6) grid: 1 colonne (mobile) -> 2 -> 3 */
.grid{
  grid-template-columns: 1fr;
}
@media (min-width: 720px){
  .grid{ grid-template-columns: 1fr 1fr; }
}
@media (min-width: 980px){
  .grid{ grid-template-columns: 1.35fr 1fr .85fr; }
}

/* 7) types: limiter la largeur et rendre lisible */
.types{
  font-size: clamp(.86rem, 2.4vw, .98rem);
  line-height: 1.35;
}

/* 8) badges: wrap propre */
.badge{
  white-space: nowrap;
}
