:root {
  --ink: #2a2520;
  --muted: #6d6358;
  --panel: rgba(250, 246, 238, 0.82);
  --line: rgba(60, 45, 30, 0.14);
  --accent: #b5634a;
  --on: #2a2520;
  --on-ink: #fbf6ec;
}
body.night {
  --ink: #eef1f8;
  --muted: #a3acc2;
  --panel: rgba(20, 26, 44, 0.78);
  --line: rgba(200, 210, 240, 0.16);
  --on: #ffc874;
  --on-ink: #1b1f2e;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #e9e2d2; color: var(--ink);
  font: 14px/1.4 ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent; }
body.night { background: #141a2c; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }

.title { position: fixed; top: max(14px, env(safe-area-inset-top)); left: 16px; pointer-events: none;
  text-shadow: 0 1px 0 rgba(255,255,255,.35); }
body.night .title { text-shadow: none; }
.title h1 { margin: 0; font: 600 22px/1.1 Georgia, "Times New Roman", serif; letter-spacing: .01em; }
.title p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }

.lift { position: fixed; right: 16px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 6px;
  padding: 10px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 6px 24px rgba(40,30,20,.12); }
.lift-label { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); text-align: center; }
.lift button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); font-weight: 600; font-size: 14px;
  transition: background .15s, color .15s; }
.lift button[data-level="4"] { font-size: 12px; }
.lift button.on { background: var(--on); color: var(--on-ink); border-color: transparent; }

.tools { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom)); display: flex; gap: 4px;
  padding: 5px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 6px 24px rgba(40,30,20,.12); }
.tools button { padding: 8px 14px; border-radius: 999px; font-weight: 550; font-size: 13px; white-space: nowrap; }
.tools button.on { background: var(--on); color: var(--on-ink); }

.hint { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(max(16px, env(safe-area-inset-bottom)) + 56px);
  font-size: 12px; color: var(--muted); background: var(--panel); padding: 5px 12px; border-radius: 999px; pointer-events: none;
  transition: opacity .6s; white-space: nowrap; }
.hint.gone { opacity: 0; }

.card { position: fixed; left: 16px; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 60px); width: min(340px, calc(100vw - 32px));
  padding: 16px 18px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 10px 30px rgba(40,30,20,.16);
  animation: rise .25s ease-out; }
.card[hidden] { display: none; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
.card h2 { margin: 0 28px 2px 0; font: 600 18px/1.2 Georgia, serif; }
.card p { margin: 0 0 10px; color: var(--muted); font-size: 12.5px; }
.card ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.card li { font-size: 12px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; }
.card a { display: inline-block; margin-top: 12px; color: var(--accent); font-weight: 600; text-decoration: none; }
body.night .card a { color: var(--on); }
.close { position: absolute; top: 8px; right: 10px; width: 28px; height: 28px; border-radius: 50%; font-size: 20px; line-height: 1; color: var(--muted); }

.loading { position: fixed; inset: 0; display: grid; place-items: center; background: #e9e2d2; transition: opacity .6s; z-index: 5;
  font: 500 15px Georgia, serif; color: #6d6358; }
.loading.gone { opacity: 0; pointer-events: none; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; }

@media (max-width: 600px) {
  .title h1 { font-size: 19px; }
  .lift { right: 10px; padding: 8px 6px; }
  .lift button { width: 38px; height: 38px; }
  .tools button { padding: 8px 11px; font-size: 12.5px; }
  .card { left: 12px; width: calc(100vw - 80px); }
}
