/* Même ambiance « Salle obscure » que l'appli du Mac, pensée pour le pouce. */
:root {
  --night: #07080c;
  --panel: #11131a;
  --raised: #191c25;
  --glass: rgba(255, 255, 255, .07);
  --glass-hover: rgba(255, 255, 255, .13);
  --edge: rgba(255, 255, 255, .12);
  --text: #f4f5f8;
  --soft: #c9cdd6;
  --muted: #9ba1b0;
  --red: #ff4d5e;
  --gold: #ffd166;
  --green: #7ee2a8;
  --marquee: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(120% 60% at 80% -10%, #12304d 0%, var(--night) 55%) fixed, var(--night);
  color: var(--text);
  font: 16px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

input, button {
  font: inherit;
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--edge);
  border-radius: 999px;
  padding: 12px 18px;
}
input { width: 100%; font-size: 16px; /* évite le zoom automatique d'iOS */ }
input::placeholder { color: var(--muted); }
input:focus-visible { outline: none; border-color: rgba(255, 255, 255, .4); background-color: var(--glass-hover); }
button { cursor: pointer; font-weight: 600; -webkit-tap-highlight-color: transparent; }
button:active { background: var(--glass-hover); }
button.primary { background: var(--text); color: var(--night); border-color: var(--text); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
code { color: var(--soft); }

.logo { margin: 0; font: 800 30px/1 var(--marquee); text-transform: uppercase; letter-spacing: .04em; }
.logo span { color: var(--red); }

/* ——— Connexion ——— */
#login { max-width: 420px; margin: 0 auto; padding: 18vh 20px 0; }
#login p { color: var(--soft); }
#login form { display: flex; flex-direction: column; gap: 12px; }
.error { color: var(--red); }

/* ——— En-tête ——— */
.top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 12px;
  padding: 14px 16px 12px;
  background: rgba(7, 8, 12, .8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 var(--edge);
}
.sync { grid-column: 1; grid-row: 2; margin: 0; color: var(--muted); font-size: 12.5px; }
.tabs { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 2px; padding: 4px; border-radius: 999px; background: var(--glass); border: 1px solid var(--edge); }
.tabs button { border: 0; background: none; padding: 8px 12px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.tabs button.active { background: var(--text); color: var(--night); }
.count:not(:empty) { display: inline-block; min-width: 18px; margin-left: 2px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

[data-screen] { padding: 16px; max-width: 640px; margin: 0 auto; }
.hint { color: var(--muted); text-align: center; margin: 28px 0; }

/* ——— Listes ——— */
.results { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 8px;
  border-radius: 14px;
  background: var(--glass);
  border: 1px solid var(--edge);
  text-align: left;
  font-weight: 400;
}
.row img, .noposter { flex: none; width: 54px; height: 81px; border-radius: 8px; object-fit: cover; background: var(--raised); }
.noposter { display: grid; place-items: center; font-size: 22px; }
.info { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.info strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sub { color: var(--muted); font-size: 13.5px; }
.note { color: var(--soft); font-size: 13.5px; font-style: italic; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.chip { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: var(--glass-hover); color: var(--soft); }
.tag { align-self: flex-start; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--glass-hover); color: var(--soft); }
.tag.owned { color: var(--green); }
.tag.wished, .tag.pending-add { color: var(--gold); }
.tag.pending-remove { color: var(--red); }
.icon { flex: none; width: 40px; height: 40px; padding: 0; border-radius: 50%; color: var(--muted); }

/* ——— Volet ——— */
dialog {
  width: 100%;
  max-width: 640px;
  max-height: 88dvh;
  margin: auto auto 0;
  padding: 0;
  border: 1px solid var(--edge);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: var(--panel);
  color: var(--text);
}
dialog::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); }
dialog[open] { animation: rise .2s ease-out; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.sheet-in { display: flex; flex-direction: column; gap: 14px; padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; gap: 14px; align-items: flex-end; }
.sheet-head img { width: 84px; height: 126px; border-radius: 10px; object-fit: cover; flex: none; }
.sheet-head h2 { margin: 0; font-size: 21px; line-height: 1.2; }
.sheet-head .sub { margin: 4px 0 0; }
.overview { margin: 0; color: var(--soft); font-size: 14.5px; max-height: 30dvh; overflow: auto; }
.overview:empty, .status:empty { display: none; }
.status { margin: 0; color: var(--gold); font-weight: 600; font-size: 14px; }
.btns { display: flex; gap: 10px; }
.btns button { flex: 1; }

/* ——— Message ——— */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--text);
  color: var(--night);
  font-weight: 600;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
