/* Layout: fixed game sidebar on wide screens (drawer below 1200px), a quiet cover grid where details
   appear on hover. 18+ covers stay blurred until the visitor confirms their age (html[data-age="ok"]).
   Airi appears only as the footer mascot and ducks away from every 18+ view. Dark-first; pink via toggle. */
:root {
  --bg: #1b181d;
  --panel: #141216;
  --card: #221e25;
  --raise: #2b2630;
  --line: #372f3c;
  --fg: #f4eef3;
  --muted: #a99eae;
  --accent: #f48fb6;
  --accent-ink: #2b1220;
  --accent-soft: rgba(244, 143, 182, 0.14);
  --adult: #e5484d;
  --adult-soft: rgba(229, 72, 77, 0.14);
  --fb: #166fe5;
  --fb-hover: #1460c7;
  --shadow: rgba(0, 0, 0, 0.5);
  --scrim: rgba(8, 6, 9, 0.6);
  --on-cover: #ffffff;
  --cover-shade: rgba(16, 10, 16, 0.9);
  --font-display: "Mitr", "Noto Sans Thai", "Leelawadee UI", system-ui, sans-serif;
  --font-body: "Noto Sans Thai", "Leelawadee UI", system-ui, -apple-system, "Segoe UI", sans-serif;
  --side-w: 272px;
  color-scheme: dark;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
:root[data-theme="light"] {
  --bg: #fff5f8;
  --panel: #fde8f0;
  --card: #ffffff;
  --raise: #fff0f5;
  --line: #f1d0dd;
  --fg: #3d2230;
  --muted: #86606f;
  --accent: #c8366a;
  --accent-ink: #ffffff;
  --accent-soft: rgba(200, 54, 106, 0.1);
  --adult: #d12f3c;
  --adult-soft: rgba(209, 47, 60, 0.1);
  --shadow: rgba(140, 50, 85, 0.16);
  --scrim: rgba(60, 20, 40, 0.35);
  --cover-shade: rgba(48, 16, 32, 0.88);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 40; background: var(--panel);
}
img { max-width: 100%; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; line-height: 1.3; text-wrap: balance; margin: 0; }

/* ---------- Sidebar ---------- */
.side {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 30;
  width: var(--side-w);
  padding-block: calc(20px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-bottom, 0px));
  padding-left: calc(16px + env(safe-area-inset-left, 0px));
  padding-right: 16px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 18px;
  overflow-y: auto; overscroll-behavior: contain;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-name { display: flex; flex-direction: column; line-height: 1.15; padding-left: 4px; }
.brand-name b { font-family: var(--font-display); font-weight: 600; font-size: 22px; }
.brand-name span { font-family: var(--font-display); color: var(--accent); font-size: 16px; }

.search { position: relative; margin: 0; }
.search input {
  width: 100%; padding: 9px 12px 9px 36px;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
}
.search input::placeholder { color: var(--muted); }
.search svg { position: absolute; left: 11px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 8px; text-decoration: none; font-size: 15px;
}
.nav a:hover { background: var(--raise); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav svg { width: 18px; height: 18px; flex: none; }

.side-label {
  font-size: 12px; letter-spacing: 0.06em; color: var(--muted); font-weight: 600;
  margin: 0 0 6px 10px;
}
.games { display: flex; flex-direction: column; gap: 2px; list-style: none; margin: 0; padding: 0; }
.games a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  padding: 6px 10px; border-radius: 8px; text-decoration: none; font-size: 14px;
}
.games a:hover { background: var(--raise); }
.games a[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.games .count {
  font-size: 12px; min-width: 24px; text-align: center; padding: 0 6px; border-radius: 99px;
  background: var(--raise); color: var(--muted); font-variant-numeric: tabular-nums;
}
.games .r18 { color: var(--adult); font-size: 11px; font-weight: 700; margin-left: 6px; }

.rating { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.rating a { flex: 1; padding: 5px 0; border-radius: 7px; text-align: center; text-decoration: none; font-size: 13px; }
.rating a:hover { background: var(--raise); }
.rating a[aria-pressed="true"] { background: var(--raise); font-weight: 600; }
.rating a[data-rating="adult"][aria-pressed="true"] { background: var(--adult-soft); color: var(--adult); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.tally { padding: 10px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.tally p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.tally strong { display: block; font-family: var(--font-display); font-weight: 500; font-size: 17px; color: var(--fg); }
.age-note { display: none; margin: 0; font-size: 12px; color: var(--muted); padding: 0 4px; }
:root[data-age="ok"] .age-note { display: block; }
.age-note button { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font-size: 12px; }
.theme-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: none; cursor: pointer; font-size: 14px;
}
.theme-btn:hover { background: var(--raise); }
.theme-btn svg { width: 16px; height: 16px; }

/* ---------- Main ---------- */
.main { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: none; }
.content {
  flex: 1;
  padding-block: 28px 140px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.inner { max-width: 1400px; margin: 0 auto; width: 100%; }

.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 18px; }
.head h1 { font-size: 26px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--card);
  cursor: pointer; font-size: 13px; white-space: nowrap;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

.filter-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -6px 0 16px; font-size: 14px; color: var(--muted); }
.filter-note button { border: 0; background: none; color: var(--accent); cursor: pointer; text-decoration: underline; padding: 0; }

/* ---------- Grid + cards ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; } }
@media (min-width: 980px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; } }
@media (min-width: 1280px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.card {
  display: flex; flex-direction: column; text-decoration: none; min-width: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px var(--shadow); border-color: var(--accent); }
.card.is-adult:hover { border-color: var(--adult); }
.cover { position: relative; aspect-ratio: 2 / 3; max-width: 100%; overflow: hidden; background: var(--raise); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s ease, filter 0.3s ease; }
.card:hover .cover img { transform: scale(1.04); }
.wip .cover img { filter: grayscale(0.35) brightness(0.85); }

/* 18+ covers: blurred with a lock mark until the age check is confirmed */
:root:not([data-age="ok"]) .card.is-adult .cover img,
.cover.locked img { filter: blur(18px) brightness(0.65) saturate(1.1); transform: scale(1.15); }
:root:not([data-age="ok"]) .card.is-adult:hover .cover img { transform: scale(1.15); }
.lock-mark {
  position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--on-cover); text-align: center; padding: 12px;
}
.lock-mark b { font-family: var(--font-display); font-weight: 600; font-size: 34px; line-height: 1; }
.lock-mark span { font-size: 12px; opacity: 0.9; }
:root[data-age="ok"] .lock-mark { display: none; }

.badges { position: absolute; top: 8px; left: 8px; z-index: 2; display: flex; flex-wrap: wrap; gap: 4px; transition: opacity 0.2s ease; }
.badge {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px;
  background: var(--accent); color: var(--accent-ink);
}
.badge.adult { background: var(--adult); color: #ffffff; }
.badge.wip { background: var(--panel); color: var(--fg); border: 1px solid var(--line); }

.peek {
  position: absolute; inset: 0; z-index: 3; display: none;
  color: var(--on-cover); font-size: 12px; line-height: 1.45;
  background: linear-gradient(to top, var(--cover-shade) 0%, rgba(0, 0, 0, 0.6) 55%, rgba(0, 0, 0, 0.55) 100%);
  opacity: 0; transition: opacity 0.2s ease;
}
.peek-info { position: absolute; inset: 0; padding: 10px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }
.peek-text { display: flex; flex-direction: column; gap: 6px; }
.peek-lock { position: absolute; inset: 0; padding: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 2px; }
:root:not([data-age="ok"]) .card.is-adult .peek-info { display: none; }
:root[data-age="ok"] .peek-lock { display: none; }
@media (hover: hover) {
  .peek { display: block; }
  .card:hover .peek, .card:focus-visible .peek { opacity: 1; }
  .card:hover .badges { opacity: 0; }
}
.stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stats span { display: inline-flex; align-items: center; gap: 4px; }
.stats svg { width: 13px; height: 13px; }
.peek .ver { font-weight: 600; }
.peek p { margin: 0; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tags span { padding: 1px 7px; border-radius: 99px; background: rgba(255, 255, 255, 0.16); font-size: 11px; }

.meta { padding: 9px 10px 10px; min-width: 0; }
.meta .name { margin: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta .game { margin: 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty { padding: 32px 0; text-align: center; }
.empty h1, .empty h2 { font-size: 22px; }
.empty p { margin: 6px 0 14px; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line); background: var(--card);
  cursor: pointer; text-decoration: none; font-weight: 600; font-size: 14px;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.adult { background: var(--adult); border-color: var(--adult); color: #ffffff; }
.btn.fb-btn { background: var(--fb); border-color: var(--fb); color: #ffffff; }
.btn.fb-btn:hover { background: var(--fb-hover); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }

/* ---------- Age check (18+ mod pages) ---------- */
.gate { max-width: 520px; margin: 24px auto 0; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.gate-cover { width: 150px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.gate-badge {
  font-family: var(--font-display); font-weight: 600; font-size: 15px; padding: 2px 12px; border-radius: 99px;
  background: var(--adult-soft); color: var(--adult); border: 1px solid var(--adult);
}
.gate h1 { font-size: 24px; }
.gate p { margin: 0; color: var(--muted); }
.gate .row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 6px; }
:root[data-age="ok"] .gate { display: none; }
:root:not([data-age="ok"]) .adult-page .detail { display: none; }

/* ---------- Mod page ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 14px; margin-bottom: 16px; }
.back:hover { color: var(--accent); }
.back svg { width: 16px; height: 16px; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
@media (min-width: 860px) { .detail { grid-template-columns: 260px minmax(0, 1fr); gap: 36px; align-items: start; } }
.d-cover { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); max-width: 260px; width: 100%; }
.d-body { min-width: 0; display: flex; flex-direction: column; gap: 22px; max-width: 760px; }
.eyebrow { margin: 0 0 4px; color: var(--accent); font-weight: 600; font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.d-body h1 { font-size: 30px; }
.lede { margin: 8px 0 0; color: var(--muted); max-width: 62ch; }
.dl {
  display: flex; flex-direction: column; gap: 10px; padding: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
}
.dl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.dl small { color: var(--muted); font-size: 13px; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 20px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.facts a { color: var(--accent); }
.sec h2 { font-size: 19px; margin-bottom: 10px; }
.sec ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.sec ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.sec p { margin: 0; }
.log { list-style: none; padding: 0 !important; }
.log li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; }
.log time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }
.report { margin: 0; color: var(--muted); font-size: 13px; }
.report a { color: var(--accent); }
.page-text p { margin: 0; }

/* ---------- Forms (contact page) ---------- */
.form { display: flex; flex-direction: column; gap: 16px; max-width: 640px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field .label { font-weight: 600; font-size: 14px; }
.opt { font-weight: 400; color: var(--muted); font-size: 13px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--card); color: var(--fg); font-size: 15px;
}
.field textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.hint { color: var(--muted); font-size: 12px; }
#c-images { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center;
  padding: 18px 12px; border: 1.5px dashed var(--line); border-radius: 12px; background: var(--card);
  cursor: pointer; font-weight: 600 !important; color: var(--fg);
}
.file-drop small { font-weight: 400; color: var(--muted); font-size: 12px; }
.file-drop:hover, .file-drop.over { border-color: var(--accent); background: var(--accent-soft); }
#c-images:focus-visible + .thumbs, .file-drop:focus-within { outline: 2px solid var(--accent); }
.file-drop.full { opacity: 0.5; pointer-events: none; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs figure, .thumbs a { position: relative; margin: 0; width: 84px; height: 84px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); background: var(--raise); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-remove {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, 0.65); color: #ffffff; cursor: pointer; font-size: 16px; line-height: 1;
}
.turnstile:empty { display: none; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.form-status { margin: 0; font-size: 14px; color: var(--muted); }
.form-status.ok { color: #4cc38a; font-weight: 600; }
.form-status.error { color: var(--adult); font-weight: 600; }
:root[data-theme="light"] .form-status.ok { color: #1a7f4b; }

/* ---------- Admin ---------- */
.admin { display: flex; flex-direction: column; gap: 14px; max-width: 860px; }
.admin h1 { font-size: 26px; }
.admin h2 { font-size: 19px; }
.muted { color: var(--muted); margin: 0; }
.admin-bar { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font-size: inherit; }
.login-box { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.dev-login { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; border: 1px dashed var(--line); border-radius: 10px; }
.dev-login small { color: var(--muted); width: 100%; }
.inbox { display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.msg.done { opacity: 0.7; }
.msg-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; }
.msg-game { font-weight: 600; }
.msg-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-contact { margin: 0; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.msg-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn.danger { background: var(--adult); border-color: var(--adult); color: #ffffff; }

/* ---------- Footer + Airi ---------- */
.foot {
  position: relative; border-top: 1px solid var(--line); background: var(--panel);
  padding-block: 18px calc(18px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  font-size: 13px; color: var(--muted);
}
.foot .inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px; padding-right: 120px; }
.foot b { color: var(--fg); font-family: var(--font-display); font-weight: 500; }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--accent); }
.foot-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
/* Facebook page link in Facebook's own blue so it reads as Facebook at a glance */
.foot .foot-fb {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px 3px 10px; border-radius: 99px;
  background: var(--fb); color: #ffffff; font-weight: 600; text-decoration: none;
}
.foot .foot-fb:hover { background: var(--fb-hover); color: #ffffff; }
.foot-fb svg { width: 14px; height: 14px; }

/* The dock clips only along the footer's top edge, so Airi can duck down behind it */
.airi-dock {
  position: absolute; right: max(24px, env(safe-area-inset-right, 0px)); bottom: 100%; width: 104px;
  clip-path: inset(-160px -60px 0 -200px);
}
.foot-airi {
  position: relative; display: block; width: 100%;
  padding: 0; border: 0; background: none; cursor: pointer;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
  /* Coming back: she rises from behind the footer edge (the dock clips her, so no fade is needed) */
  transition: transform 0.5s cubic-bezier(0.3, 0.7, 0.4, 1) 0.1s, opacity 0s linear 0s, visibility 0s linear 0s;
}
/* On 18+ views: covers her eyes and hops first, then visibly ducks down behind the footer edge.
   Opacity and visibility only flip once she is fully out of sight. */
.no-airi .foot-airi {
  transform: translateY(105%); opacity: 0; visibility: hidden; pointer-events: none;
  transition: transform 0.42s cubic-bezier(0.45, 0, 0.6, 1) 0.55s, opacity 0s linear 0.97s, visibility 0s linear 0.97s;
}
/* Same, but quicker, when a click is about to open an 18+ page (the page changes after 650ms) */
.airi-leaving.no-airi .foot-airi {
  transition: transform 0.28s cubic-bezier(0.45, 0, 0.6, 1) 0.34s, opacity 0s linear 0.62s, visibility 0s linear 0.62s;
}
.airi-body { position: relative; display: block; transform-origin: 50% 100%; animation: airi-breathe 4.5s ease-in-out infinite; }
/* Images ignore the pointer, so right-click / long-press lands on the button, not an image */
.foot-airi img {
  display: block; width: 100%; height: auto; transition: opacity 0.2s ease;
  pointer-events: none; -webkit-user-drag: none;
}
.foot-airi .asleep, .foot-airi .covered { position: absolute; left: 0; top: 0; opacity: 0; }
.foot-airi .covered { transition: none; }
.foot-airi.sleeping .asleep { opacity: 1; }
.foot-airi.sleeping .awake { opacity: 0; }
.startle {
  position: absolute; left: 72%; top: -2%; font-family: var(--font-display); font-weight: 600; font-size: 24px;
  line-height: 1; color: var(--accent); opacity: 0; pointer-events: none;
}
.zzz { position: absolute; left: 16%; top: 12%; width: 0; height: 0; pointer-events: none; }
.zzz i {
  position: absolute; left: 0; top: 0; font-family: var(--font-display); font-style: normal; font-weight: 600;
  line-height: 1; color: var(--accent); opacity: 0;
}
.zzz i:nth-child(1) { font-size: 13px; }
.zzz i:nth-child(2) { font-size: 16px; }
.zzz i:nth-child(3) { font-size: 20px; }
.foot-airi.sleeping .zzz i { animation: airi-z 2.4s ease-out infinite; }
.foot-airi.sleeping .zzz i:nth-child(2) { animation-delay: 0.8s; }
.foot-airi.sleeping .zzz i:nth-child(3) { animation-delay: 1.6s; }
.snore {
  position: absolute; right: 86%; top: 0; display: grid; padding: 2px 10px; border-radius: 99px;
  background: var(--card); border: 1px solid var(--line); color: var(--fg); font-size: 12px; white-space: nowrap;
  opacity: 0; transition: opacity 0.3s ease; pointer-events: none;
}
.snore b { grid-area: 1 / 1; font-weight: 500; }
.snore b:nth-child(2) { opacity: 0; }
.foot-airi.sleeping .snore { opacity: 1; }
.foot-airi.sleeping .snore b:nth-child(1) { animation: snore-a 3s steps(1) infinite; }
.foot-airi.sleeping .snore b:nth-child(2) { animation: snore-b 3s steps(1) infinite; }
@media (hover: hover) {
  .foot-airi:hover .asleep { opacity: 1; }
  .foot-airi:hover .awake { opacity: 0; }
  .foot-airi:hover .snore { opacity: 1; }
  .foot-airi:hover .zzz i { animation: airi-z 2.4s ease-out infinite; }
  .foot-airi:hover .zzz i:nth-child(2) { animation-delay: 0.8s; }
  .foot-airi:hover .zzz i:nth-child(3) { animation-delay: 1.6s; }
  .foot-airi:hover .snore b:nth-child(1) { animation: snore-a 3s steps(1) infinite; }
  .foot-airi:hover .snore b:nth-child(2) { animation: snore-b 3s steps(1) infinite; }
}
/* A mouse click wakes her up for a moment (pointing at her makes her doze off again afterwards) */
.foot-airi.poked .awake { opacity: 1; }
.foot-airi.poked .asleep, .foot-airi.poked .snore { opacity: 0; }
.foot-airi.poked .zzz i { animation: none; }
.foot-airi.poked .airi-body { animation: airi-startle 0.4s ease-out; }
/* While a page is opening, show or hide Airi instantly: no flash on pages that open in 18+ mode */
.airi-instant .foot-airi, .airi-instant .foot-airi img { transition: none !important; }
.airi-swap .foot-airi img { transition: none !important; }
.airi-instant .airi-body, .airi-instant .startle { animation: none !important; }
.no-airi .foot-airi img { transition: opacity 0.12s ease; }
.no-airi .foot-airi .covered { opacity: 1; }
.no-airi .foot-airi .awake, .no-airi .foot-airi .asleep { opacity: 0; }
.no-airi .foot-airi .zzz, .no-airi .foot-airi .snore { opacity: 0; }
.no-airi .airi-body { animation: airi-startle 0.4s ease-out; }
.no-airi .startle { animation: airi-mark 0.45s ease-out forwards; }
@keyframes airi-startle {
  0% { transform: translateY(0); }
  35% { transform: translateY(-9px); }
  70% { transform: translateY(1px); }
  100% { transform: translateY(0); }
}
@keyframes airi-mark {
  0% { opacity: 0; transform: translateY(6px) scale(0.4); }
  45% { opacity: 1; transform: translateY(-2px) scale(1.2); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes airi-breathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(1.5px) scaleY(0.99); } }
@keyframes airi-z {
  0% { opacity: 0; transform: translate(0, 0) scale(0.6); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(-22px, -48px) scale(1.15); }
}
@keyframes snore-a { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes snore-b { 0% { opacity: 0; } 50% { opacity: 1; } }

.toast {
  position: fixed; left: 50%; translate: -50% 0; z-index: 60;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 10px;
  background: var(--fg); color: var(--bg); font-size: 14px; box-shadow: 0 8px 24px var(--shadow);
}
.scrim { position: fixed; inset: 0; z-index: 25; background: var(--scrim); }

/* ---------- Narrow screens: sidebar becomes a drawer ---------- */
@media (max-width: 1199px) {
  .side { transform: translateX(-102%); transition: transform 0.25s ease; box-shadow: 0 0 40px var(--shadow); }
  .side.open { transform: none; }
  .main { margin-left: 0; }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
    padding-block: 10px;
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    background: var(--panel); border-bottom: 1px solid var(--line);
  }
  .topbar .brand-name b { font-size: 17px; }
  .topbar .brand-name span { font-size: 13px; }
  .icon-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none;
    border-radius: 9px; border: 1px solid var(--line); background: var(--card); cursor: pointer;
  }
  .icon-btn svg { width: 20px; height: 20px; }
  .topbar .brand { flex: 1; min-width: 0; }
}
@media (max-width: 520px) {
  .head h1 { font-size: 22px; }
  .foot .inner { padding-right: 84px; }
  .airi-dock { width: 76px; }
  .d-cover { max-width: 200px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .foot-airi.sleeping .zzz i { opacity: 1; }
  .zzz i:nth-child(2) { transform: translate(-8px, -16px); }
  .zzz i:nth-child(3) { transform: translate(-16px, -34px); }
  @media (hover: hover) { .foot-airi:hover .zzz i { opacity: 1; } }
}
