/* rmd-mangas — liquid-glass manga reader for the Ray-Ban Display. */
:root {
  --bg: #0b0d12;
  --ink: #f3f5fa;
  --ink-soft: #aab1c2;
  --ink-mute: #6d7588;
  --accent: #7aa2ff;
  --accent-2: #c79bff;
  --glass-bg: rgba(28, 33, 46, 0.55);
  --glass-bg-hi: rgba(52, 60, 82, 0.72);
  --glass-bord: rgba(255, 255, 255, 0.14);
  --glass-blur: blur(22px) saturate(150%);
  --focus: #8fb0ff;
  --radius: 22px;
  --radius-sm: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { width: 600px; height: 600px; overflow: hidden; }
body {
  background:
    radial-gradient(120% 90% at 15% 0%, #1b2236 0%, rgba(27,34,54,0) 55%),
    radial-gradient(120% 90% at 100% 100%, #271b3a 0%, rgba(39,27,58,0) 50%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, "SF Pro Display", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
#app { width: 600px; height: 600px; position: relative; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* ---- glass primitives ---- */
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-bord);
  box-shadow: 0 8px 30px rgba(0,0,0,0.38), inset 0 1px 0 rgba(255,255,255,0.16);
}

/* ---- header / bars ---- */
.glass-bar { background: var(--glass-bg); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border-bottom: 1px solid var(--glass-bord); }
.header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; flex: none; }
.brand { font-size: 27px; font-weight: 800; letter-spacing: -0.5px; flex: 1; background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand.sm { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn, .back-btn {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--glass-bord);
  background: rgba(255,255,255,0.06); color: var(--ink); font-size: 28px; line-height: 1; cursor: pointer;
}
.back-btn { font-size: 34px; }
.icon-btn .ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.focusable:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(143,176,255,0.4), 0 8px 22px rgba(0,0,0,0.4); }

/* ---- tabs ---- */
.tabs { display: flex; gap: 6px; padding: 8px 14px; flex: none; }
.tab { flex: 1; padding: 9px 6px; border-radius: 999px; border: 1px solid transparent; background: transparent; color: var(--ink-soft); font-size: 16px; font-weight: 600; cursor: pointer; }
.tab.active { background: rgba(122,162,255,0.18); border-color: rgba(122,162,255,0.4); color: #fff; }

/* ---- content / scroll ---- */
.content { flex: 1; overflow-y: auto; padding: 14px 16px 28px; scrollbar-width: none; }
.content::-webkit-scrollbar { display: none; }
.content.centered { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 16px; padding: 30px; }

/* ---- manga grid ---- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mcard { display: flex; flex-direction: column; border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; border: 1px solid transparent; background: rgba(255,255,255,0.04); }
.mcard:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(143,176,255,0.45), 0 10px 26px rgba(0,0,0,0.5); transform: translateY(-2px); }
.mcard .cov { width: 100%; aspect-ratio: 11/16; object-fit: cover; background: #1a1f2c; display: block; }
.mcard .cov-ph { width: 100%; aspect-ratio: 11/16; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg,#202739,#161b27); font-size: 30px; }
.mcard .ct { padding: 8px 10px 10px; }
.mcard .ct-title { font-size: 15px; font-weight: 700; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mcard .ct-sub { font-size: 12px; color: var(--ink-mute); margin-top: 3px; }
.badge-new { display: inline-block; font-size: 11px; font-weight: 700; color: #bfe3c8; background: rgba(70,180,120,0.2); border: 1px solid rgba(95,205,145,0.4); padding: 1px 7px; border-radius: 999px; }

/* ---- search ---- */
.search-field { flex: 1; height: 46px; display: flex; align-items: center; padding: 0 16px; border-radius: 999px; font-size: 18px; }
.search-text { white-space: nowrap; overflow: hidden; }
.search-text:empty::before { content: "Rechercher un manga…"; color: var(--ink-mute); }
.caret { color: var(--accent); animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.kb { margin-top: 16px; padding: 10px; border-radius: var(--radius); display: flex; flex-direction: column; gap: 7px; }
.kb-row { display: flex; gap: 7px; justify-content: center; }
.key { flex: 1; min-width: 0; height: 46px; display: flex; align-items: center; justify-content: center; border-radius: 11px; border: 1px solid var(--glass-bord); background: rgba(255,255,255,0.05); color: var(--ink); font-size: 18px; font-weight: 600; cursor: pointer; }
.key:focus { outline: none; border-color: var(--focus); background: rgba(143,176,255,0.25); box-shadow: 0 0 0 2px rgba(143,176,255,0.4); }
.key.wide { flex: 2.4; }
.key.go { background: rgba(122,162,255,0.25); border-color: rgba(122,162,255,0.5); }

/* ---- manga detail ---- */
.hero { display: flex; gap: 16px; margin-bottom: 16px; }
.hero-cover { width: 150px; aspect-ratio: 11/16; object-fit: cover; border-radius: var(--radius-sm); background: #1a1f2c; flex: none; box-shadow: 0 10px 26px rgba(0,0,0,0.5); }
.hero-meta { min-width: 0; padding-top: 4px; }
.hero-name { font-size: 23px; font-weight: 800; line-height: 1.15; }
.hero-sub { font-size: 14px; color: var(--ink-soft); margin-top: 8px; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { font-size: 12px; color: var(--ink-soft); background: rgba(255,255,255,0.06); border: 1px solid var(--glass-bord); padding: 3px 9px; border-radius: 999px; }
.cta { width: 100%; height: 54px; border: none; border-radius: 16px; font-size: 19px; font-weight: 800; color: #0b0d12; cursor: pointer; background: linear-gradient(90deg, var(--accent), var(--accent-2)); box-shadow: 0 10px 26px rgba(122,162,255,0.35); }
.cta:focus { outline: none; box-shadow: 0 0 0 3px rgba(255,255,255,0.5), 0 10px 26px rgba(122,162,255,0.45); }
.desc { font-size: 15px; line-height: 1.55; color: var(--ink-soft); margin: 16px 2px; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.chapters-head { font-size: 14px; font-weight: 700; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.6px; margin: 8px 2px 10px; }
.chapters { display: flex; flex-direction: column; gap: 8px; }
.chrow { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: var(--radius-sm); border: 1px solid var(--glass-bord); background: var(--glass-bg); cursor: pointer; }
.chrow:focus { outline: none; border-color: var(--focus); background: var(--glass-bg-hi); box-shadow: 0 0 0 2px rgba(143,176,255,0.4); }
.chrow.ext { opacity: 0.55; }
.chrow.read .ch-n { color: var(--ink-mute); }
.ch-n { font-size: 17px; font-weight: 700; flex: none; min-width: 64px; }
.ch-meta { flex: 1; min-width: 0; }
.ch-t { font-size: 14px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-sub { font-size: 12px; color: var(--ink-mute); margin-top: 2px; }
.ch-flag { font-size: 11px; color: var(--ink-mute); flex: none; }

/* ---- reader ---- */
#reader { background: #000; }
.reader-pages { flex: 1; overflow-y: auto; scrollbar-width: none; display: flex; flex-direction: column; align-items: center; }
.reader-pages::-webkit-scrollbar { display: none; }
.reader-pages img { width: 100%; display: block; background: #0a0a0a; }
.reader-hud { position: absolute; left: 12px; right: 12px; bottom: 12px; height: 56px; border-radius: 999px; display: flex; align-items: center; gap: 12px; padding: 0 8px 0 8px; z-index: 5; }
.reader-hud .back-btn { width: 42px; height: 42px; }
.reader-info { flex: 1; text-align: center; font-size: 15px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.hud-next { height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(122,162,255,0.5); background: rgba(122,162,255,0.22); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; }
.hud-next:focus, .reader-hud .back-btn:focus { outline: none; box-shadow: 0 0 0 3px rgba(143,176,255,0.5); }

/* ---- lock / pairing ---- */
.lock-title { font-size: 34px; font-weight: 800; background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { font-size: 16px; color: var(--ink-soft); line-height: 1.5; max-width: 460px; }
.sub.hint { font-size: 13px; color: var(--ink-mute); }
.sub.err { color: #ff8a8a; min-height: 20px; }
.pin { display: flex; gap: 10px; }
.digit { width: 54px; height: 70px; display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 800; border-radius: 14px; border: 1px solid var(--glass-bord); background: var(--glass-bg); }
.digit:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(143,176,255,0.45); }
.pin-ok { width: 66px; height: 70px; border-radius: 14px; border: 1px solid rgba(122,162,255,0.5); background: rgba(122,162,255,0.25); color: #fff; font-size: 30px; font-weight: 800; cursor: pointer; }
.pin-ok:focus { outline: none; box-shadow: 0 0 0 3px rgba(143,176,255,0.5); }

/* ---- misc ---- */
.state { text-align: center; color: var(--ink-mute); font-size: 15px; padding: 26px 10px; }
.spinner { width: 30px; height: 30px; margin: 26px auto; border: 3px solid rgba(255,255,255,0.15); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(14px); opacity: 0; transition: all 0.25s; background: rgba(20,24,34,0.92); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--glass-bord); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 15px; z-index: 20; pointer-events: none; max-width: 80%; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
