:root {
  --bg: #09090b;
  --ink: #e8e2d6;
  --muted: #8d877c;
  --blood: #a3161b;
  --brass: #d6b169;
  --paper: #ebe2cc;
  --paper-ink: #2a2420;
  --paper-muted: #7a6f60;
  --hand: #1f2d63;
}

* { box-sizing: border-box; }

/* Çentikli ekranlar için güvenli alanlar */
:root {
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
  /* iOS Safari yatayda yazıları kendiliğinden büyütmesin */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-touch-callout: none;
}
button { touch-action: manipulation; }
img { -webkit-user-drag: none; }

#app, #app canvas { position: fixed; inset: 0; display: block; touch-action: none; }

.vignette {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 45%, rgba(0, 0, 0, .78) 100%);
}

/* ── HUD ─────────────────────────────────────────── */
.hud-actions { position: fixed; top: calc(18px + var(--sat)); right: calc(20px + var(--sar)); display: flex; gap: 8px; z-index: 4; }
.btn.lid, .btn.back { display: none; }
.btn.lid.on, .btn.back.on { display: inline-block; }
.btn.mute { padding: 7px 9px; line-height: 0; }
.btn.mute svg { width: 18px; height: 18px; }
.btn.mute .cross { display: none; }
.btn.mute.off .cross { display: inline; }
.btn.mute.off .wave { display: none; }
.btn.back { position: fixed; top: calc(18px + var(--sat)); left: calc(20px + var(--sal)); z-index: 4; }
.btn.fs { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; }
.btn.fs .fs-icon { width: 16px; height: 16px; display: block; }
.btn.fs .fs-exit { display: none; }
.btn.fs .fs-enter { display: block; }
.btn.fs.active .fs-exit { display: block; }
.btn.fs.active .fs-enter { display: none; }
.btn.fs.active { border-color: rgba(214, 177, 105, .4); color: #fff; }
.btn.fs .fs-text-short { display: none; }
.btn.fs .fs-text-long { display: inline; }
.hud-actions:has(.lid.on) .btn.fs .fs-text-long { display: none; }
.hud-actions:has(.lid.on) .btn.fs .fs-text-short { display: inline; }

.inventory {
  position: fixed; left: calc(20px + var(--sal)); bottom: calc(26px + var(--sab)); display: flex; gap: 8px; z-index: 4;
  opacity: 0; transform: translateY(8px); transition: opacity .4s, transform .4s; pointer-events: none;
}
.inventory.on { opacity: 1; transform: none; }
.inv-slot {
  width: 54px; height: 54px; border-radius: 8px; display: grid; place-items: center;
  background: rgba(16, 14, 14, .7); border: 1px solid rgba(214, 177, 105, .45);
}
.inv-slot svg { width: 40px; height: 40px; }

.toast {
  position: fixed; left: 50%; bottom: calc(84px + var(--sab)); transform: translate(-50%, 8px); z-index: 6;
  max-width: calc(100% - 32px - var(--sal) - var(--sar)); text-align: center;
  font: 400 15px 'Special Elite', monospace; color: #f0e9dc; letter-spacing: .03em;
  background: rgba(10, 9, 9, .82); border: 1px solid rgba(255, 255, 255, .1);
  padding: 10px 18px; border-radius: 6px; opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ── Modal (kasa, kitap, fotoğraf) ───────────────── */
.modal {
  position: fixed; inset: 0; z-index: 8; display: flex; overflow-y: auto; overscroll-behavior: contain;
  padding: calc(24px + var(--sat)) calc(24px + var(--sar)) calc(24px + var(--sab)) calc(24px + var(--sal));
  background: rgba(0, 0, 0, .6); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; visibility: hidden; transition: opacity .3s, visibility 0s .3s;
}
.modal.open { opacity: 1; visibility: visible; transition: opacity .3s; }
/* margin:auto ortalar; içerik taşarsa üstü kesilmeden kaydırılır (place-items'ın aksine) */
.modal-body { position: relative; max-width: 100%; margin: auto; }
.modal-x {
  position: absolute; top: -14px; right: -14px; z-index: 2; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .25); background: #141212; color: #eee; font-size: 20px; cursor: pointer;
}
.modal-btn {
  display: block; margin: 14px auto 0; font: 500 12px 'IBM Plex Mono', monospace; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink); background: rgba(20, 18, 18, .8);
  border: 1px solid rgba(255, 255, 255, .2); padding: 9px 16px; border-radius: 6px; cursor: pointer;
}

.keypad {
  width: 280px; padding: 22px; border-radius: 10px;
  background: linear-gradient(180deg, #34383d, #23262a); box-shadow: 0 24px 60px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.kp-screen {
  height: 58px; margin-bottom: 18px; border-radius: 4px; display: grid; place-items: center;
  background: #0d1710; color: #5fd28a; font: 500 30px 'IBM Plex Mono', monospace; letter-spacing: .4em;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, .7);
}
.kp-screen.err { color: #ff5a5a; }
.kp-screen.ok { color: #9dffb9; }
.kp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kp-grid button {
  height: 50px; border-radius: 6px; border: 0; cursor: pointer;
  background: linear-gradient(180deg, #a3a8ae, #80858b); color: #15171a;
  font: 600 18px 'IBM Plex Mono', monospace; box-shadow: 0 3px 0 #4b4f54;
}
.kp-grid button:active { transform: translateY(2px); box-shadow: 0 1px 0 #4b4f54; }
.shake { animation: shake .4s; }
@keyframes shake {
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.book-page {
  width: min(420px, 90vw); padding: 40px 36px 50px; color: #2a2420; text-align: center;
  background: linear-gradient(90deg, #d9ccae, #efe5cc 12%, #f2e9d2); border-radius: 2px 8px 8px 2px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .7); font-family: Georgia, serif;
}
.book-title { margin: 0; font-size: 12px; letter-spacing: .3em; color: #7a6f60; }
.book-chapter { margin: 26px 0; font-size: 18px; }
.book-cipher { margin: 0; font: 500 22px/1.6 'IBM Plex Mono', monospace; letter-spacing: .12em; word-spacing: .3em; }

.photo-view { text-align: center; }
.photo-single {
  display: block; width: auto; height: auto; max-width: min(360px, 82vw);
  max-height: calc(100vh - 56px); max-height: calc(100dvh - 56px - var(--sat) - var(--sab));
  box-shadow: 0 24px 60px rgba(0, 0, 0, .7);
}
.photo-flip {
  position: relative; width: min(300px, 80vw); aspect-ratio: 300 / 360; margin: 0 auto;
  transform-style: preserve-3d; transition: transform .7s; box-shadow: 0 24px 60px rgba(0, 0, 0, .7);
}
.photo-flip.flipped { transform: rotateY(180deg); }
.photo-front, .photo-back { position: absolute; inset: 0; width: 100%; height: 100%; backface-visibility: hidden; }
.photo-back {
  display: grid; place-items: center; padding: 24px; transform: rotateY(180deg);
  background: #ece6d8; color: var(--hand); font: 500 30px/1.25 Caveat, cursive;
}
.photo-back p { margin: 0; }

.note-paper {
  width: min(380px, 88vw); padding: 34px 32px 30px; color: var(--hand);
  background:
    repeating-linear-gradient(180deg, transparent 0 33px, rgba(70, 100, 160, .18) 33px 34px),
    linear-gradient(180deg, #f6f0de, #ece3cc);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .7); border-radius: 2px; transform: rotate(-1.2deg);
  font: 500 27px/34px Caveat, cursive;
}
.note-paper p { margin: 0; }
.note-sign { text-align: right; margin-top: 10px !important; }

.calendar-view img {
  display: block; width: auto; height: auto; max-width: min(360px, 82vw);
  max-height: calc(100vh - 56px); max-height: calc(100dvh - 56px - var(--sat) - var(--sab));
  box-shadow: 0 24px 60px rgba(0, 0, 0, .7); border-radius: 2px;
}

/* ── Başlangıç ──────────────────────────────────── */
.start {
  position: fixed; inset: 0; z-index: 9; display: grid; place-items: center;
  padding: calc(16px + var(--sat)) calc(16px + var(--sar)) calc(16px + var(--sab)) calc(16px + var(--sal));
  background: radial-gradient(ellipse at 50% 40%, rgba(20, 10, 10, .55), rgba(0, 0, 0, .92));
  transition: opacity 1s, visibility 0s 1s;
}
.start.done { opacity: 0; visibility: hidden; }
.start-card { text-align: center; }
.start-kicker { margin: 0; font-size: 12px; letter-spacing: .3em; color: var(--muted); text-transform: uppercase; }
.start h1 {
  margin: 14px 0 10px; font: 400 clamp(36px, 8vw, 64px)/1 'Special Elite', monospace; letter-spacing: .06em; color: #efe8dc;
}
.start h1 span { color: var(--blood); }
.start-sub { margin: 0 0 28px; color: var(--muted); font-size: 14px; }
.start-btn { font-size: 14px; padding: 12px 26px; }
.btn {
  font: 500 12px 'IBM Plex Mono', monospace; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink); background: rgba(20, 18, 18, .6); border: 1px solid rgba(255, 255, 255, .14);
  padding: 9px 14px; border-radius: 6px; cursor: pointer;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: border-color .2s, color .2s;
}
/* Dokunmatikte :hover parmak kalktıktan sonra da yapışık kalır */
@media (hover: hover) {
  .btn:hover { border-color: rgba(214, 177, 105, .7); color: #fff; }
}
.btn:active { border-color: rgba(214, 177, 105, .7); color: #fff; }

.hint {
  position: fixed; bottom: calc(34px + var(--sab)); left: 50%; transform: translateX(-50%);
  max-width: calc(100% - 32px - var(--sal) - var(--sar)); text-align: center;
  font-size: 12px; color: var(--muted); letter-spacing: .04em;
  background: rgba(10, 10, 12, .6); padding: 8px 16px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .08); transition: opacity .4s; pointer-events: none;
}
.hint b { color: var(--ink); font-weight: 500; }
.hint.hidden { opacity: 0; }

.disclaimer {
  position: fixed; bottom: calc(10px + var(--sab)); left: 50%; transform: translateX(-50%);
  font-size: 10px; color: #5d5850; letter-spacing: .06em; white-space: nowrap; pointer-events: none;
}

.tooltip {
  position: fixed; top: 0; left: 0; pointer-events: none; z-index: 6;
  font: 500 12px 'IBM Plex Mono', monospace; color: var(--ink);
  background: rgba(12, 10, 10, .85); border: 1px solid rgba(214, 177, 105, .35);
  padding: 5px 9px; border-radius: 4px; opacity: 0; transition: opacity .15s; white-space: nowrap;
}
.tooltip b { color: var(--brass); font-weight: 500; margin-right: 4px; }
.tooltip.on { opacity: 1; }

/* ── Dosya paneli ────────────────────────────────── */
.panel {
  position: fixed; top: 0; right: 0; z-index: 5;
  width: min(440px, 42vw); height: 100%;
  display: flex; flex-direction: column;
  padding: calc(28px + var(--sat)) calc(22px + var(--sar)) calc(28px + var(--sab)) 0;
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  transform: translateX(110%); transition: transform .55s cubic-bezier(.2, .8, .2, 1);
}
.panel.open { transform: none; }

.file {
  position: relative; margin: auto 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, .35), transparent 60%),
    linear-gradient(180deg, #efe6d1, var(--paper));
  color: var(--paper-ink);
  padding: 34px 26px 22px; border-radius: 3px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .65), inset 0 0 40px rgba(120, 90, 40, .12);
  font-family: 'Special Elite', monospace;
}
.file-tab {
  position: absolute; top: -18px; left: 22px;
  background: #efe6d1; padding: 5px 14px 3px; border-radius: 6px 6px 0 0;
  font-size: 12px; letter-spacing: .12em;
}
.file-x {
  position: absolute; top: 8px; right: 10px; border: 0; background: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--paper-muted); padding: 4px 6px;
}
@media (hover: hover) { .file-x:hover { color: var(--paper-ink); } }

.stamp {
  position: absolute; top: 40px; right: 26px;
  border: 3px double var(--blood); color: var(--blood);
  padding: 4px 9px; font-size: 13px; line-height: 1.15; text-align: center; letter-spacing: .12em;
  transform: rotate(-12deg); opacity: .8; mix-blend-mode: multiply;
}

.kicker {
  margin: 0; font: 400 10px 'IBM Plex Mono', monospace; text-transform: uppercase;
  letter-spacing: .16em; color: var(--paper-muted);
}
.name { margin: 8px 0 0; font-size: 28px; font-weight: 400; line-height: 1.1; padding-right: 80px; }
.alias { margin: 4px 0 0; font-size: 14px; color: #6b2a22; }

.facts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px;
  margin: 20px 0 6px; padding: 14px 0; border-top: 1px dashed rgba(0, 0, 0, .25);
  border-bottom: 1px dashed rgba(0, 0, 0, .25);
}
.facts .wide { grid-column: 1 / -1; }
.facts dt {
  font: 400 10px 'IBM Plex Mono', monospace; text-transform: uppercase; letter-spacing: .12em;
  color: var(--paper-muted);
}
.facts dd { margin: 3px 0 0; font-size: 15px; }

.file section h3 {
  margin: 16px 0 6px; font: 500 10px 'IBM Plex Mono', monospace; text-transform: uppercase;
  letter-spacing: .16em; color: var(--paper-muted);
}
.file section p { margin: 0; font-size: 14px; line-height: 1.5; }
.file .hand { font: 500 23px/1.15 Caveat, cursive; color: var(--hand); }

.file-nav { display: flex; gap: 8px; margin-top: 22px; }
.file-nav button {
  flex: 1; font: 500 11px 'IBM Plex Mono', monospace; letter-spacing: .06em; text-transform: uppercase;
  color: var(--paper-ink); background: transparent; border: 1px solid rgba(0, 0, 0, .3);
  padding: 9px 6px; border-radius: 3px; cursor: pointer;
}
@media (hover: hover) { .file-nav button:hover { background: rgba(0, 0, 0, .06); } }
.file-nav button:active { background: rgba(0, 0, 0, .08); }

/* ── Yükleniyor ─────────────────────────────────── */
.loader {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: var(--bg);
  font: 400 14px 'Special Elite', monospace; letter-spacing: .2em; color: var(--muted);
  transition: opacity 1s .2s, visibility 0s 1.2s;
}
.loader.done { opacity: 0; visibility: hidden; }

/* ── Dizüstü yazı alanı (görünmez; metin 3B ekrana çizilir) ── */
.laptop-input {
  /* En üstte: iOS odaklanınca alanı görünür kılmak için sayfayı kaydırmasın */
  position: fixed; top: calc(8px + var(--sat)); left: 50%; width: 1px; height: 1px; padding: 0; border: 0;
  opacity: 0; pointer-events: none; font-size: 16px; /* iOS 16px altında sayfayı yakınlaştırır */
}

/* ── Bitiş ──────────────────────────────────────── */
.end {
  position: fixed; inset: 0; z-index: 11; display: grid; place-items: center;
  padding: calc(24px + var(--sat)) calc(24px + var(--sar)) calc(24px + var(--sab)) calc(24px + var(--sal));
  background: radial-gradient(ellipse at 50% 45%, rgba(26, 11, 13, .97), rgba(0, 0, 0, .995));
  opacity: 0; visibility: hidden; transition: opacity 2.4s ease, visibility 0s 2.4s;
}
.end.on { opacity: 1; visibility: visible; transition: opacity 2.4s ease; }
.end-card { max-width: 900px; text-align: center; }
.end-msg {
  margin: 0; font: 700 clamp(38px, 7vw, 76px)/1.15 Caveat, cursive; color: #efe8dc;
  opacity: 0; transform: translateY(10px); transition: opacity 1.6s 1.4s, transform 1.6s 1.4s;
}
.end-sign {
  margin: 18px 0 0; text-align: right; font: 700 clamp(34px, 6vw, 64px)/1 Caveat, cursive; color: var(--blood);
  opacity: 0; transition: opacity 1.4s 2.8s;
}
.end.on .end-msg { opacity: 1; transform: none; }
.end.on .end-sign { opacity: 1; }
.answer-status { margin-top: 28px; font-size: 13px; line-height: 1.6; color: var(--ink); }
.answer-status .btn:disabled { opacity: .5; }

/* ── Dar ekran (telefon dikey) ─────────────────── */
@media (max-width: 759px) {
  .hud-actions { top: calc(10px + var(--sat)); right: calc(12px + var(--sar)); }
  .btn.back { top: calc(10px + var(--sat)); left: calc(12px + var(--sal)); }
  .btn { padding: 11px 14px; } /* parmakla rahat dokunulsun */
  .btn.fs { padding: 9px 12px; gap: 6px; }
  /* Envanter solda, ipucu sağında: üst üste binmesinler */
  .inventory { left: calc(12px + var(--sal)); bottom: calc(12px + var(--sab)); }
  .inv-slot { width: 48px; height: 48px; }
  .hint {
    left: calc(72px + var(--sal)); right: calc(12px + var(--sar)); bottom: calc(14px + var(--sab));
    transform: none; max-width: none; font-size: 11px; border-radius: 10px; padding: 7px 10px;
  }
  .toast { bottom: calc(76px + var(--sab)); font-size: 14px; }
  .disclaimer { display: none; }
  .keypad { width: min(300px, 86vw); }
  .kp-grid button { height: 56px; }
}

/* ── Dar ve uzun ekran (telefon dikey): dosya alttan çekmece ──
   viewer.js panelin gerçek boyutunu okur; burada değişen her şey oraya da yansır. */
@media (max-width: 759px) and (min-height: 501px) {
  .panel {
    top: auto; bottom: 0; width: 100%; height: 58vh; height: 58dvh;
    padding: 22px 12px calc(12px + var(--sab)); transform: translateY(110%);
  }
  .file { margin: 0; padding: 30px 18px 18px; }
  .name { font-size: 22px; padding-right: 70px; }
  .stamp { right: 16px; top: 34px; font-size: 11px; }
  .facts { gap: 10px 14px; }
  .file-nav button { padding: 12px 4px; }
}

/* ── Alçak ekran (telefon yatay) ─────────────────── */
@media (max-height: 500px) {
  .hud-actions { top: calc(10px + var(--sat)); right: calc(12px + var(--sar)); }
  .btn.back { top: calc(10px + var(--sat)); left: calc(12px + var(--sal)); }
  .btn { padding: 10px 13px; }
  .hint {
    left: 50%; right: auto; transform: translateX(-50%); border-radius: 999px;
    font-size: 11px; bottom: calc(10px + var(--sab)); padding: 6px 12px;
    max-width: calc(100% - 140px - var(--sal) - var(--sar)); /* envanterle çakışmasın */
  }
  .disclaimer { display: none; }
  .inventory { left: calc(12px + var(--sal)); bottom: calc(10px + var(--sab)); }
  .inv-slot { width: 44px; height: 44px; }
  .inv-slot svg { width: 32px; height: 32px; }
  .toast { bottom: calc(52px + var(--sab)); font-size: 14px; padding: 8px 14px; }

  /* Dosya: sağda yan panel, alçak ekrana göre sıkıştırılmış */
  .panel {
    width: calc(min(400px, 46vw) + var(--sar));
    padding: calc(22px + var(--sat)) calc(12px + var(--sar)) calc(10px + var(--sab)) 0;
  }
  .file { margin: auto 0; padding: 26px 18px 14px; }
  .file-tab { top: -16px; font-size: 11px; }
  .name { font-size: 20px; padding-right: 64px; }
  .alias { font-size: 13px; }
  .stamp { top: 30px; right: 14px; font-size: 10px; padding: 3px 7px; }
  .facts { gap: 8px 14px; margin: 12px 0 4px; padding: 10px 0; }
  .facts dd { font-size: 13px; }
  /* Gezinme düğmeleri panel kaydırılsa da altta görünür kalsın */
  .file-nav {
    position: sticky; bottom: 0; z-index: 1;
    margin: 12px -18px -14px; padding: 8px 18px 14px; border-radius: 0 0 3px 3px;
    background: linear-gradient(180deg, rgba(235, 226, 204, .85), var(--paper) 40%);
  }
  .file-nav button { padding: 10px 4px; font-size: 10px; }

  /* Modallar: ölçüler sabit değil, görünür yüksekliğe göre. Android'de tam ekran
     değilken yatayda adres + sistem çubukları yüzünden ~250 px kalabiliyor. */
  .modal { padding: calc(14px + var(--sat)) calc(20px + var(--sar)) calc(14px + var(--sab)) calc(20px + var(--sal)); }
  .modal-x { top: -10px; right: -10px; width: 32px; height: 32px; }

  /* Tuş takımı yan yana: solda ekran, sağda tuşlar. Yükseklik = 4 tuş + boşluklar. */
  .keypad {
    --kb: clamp(30px, calc((100dvh - 86px - var(--sat) - var(--sab)) / 4), 46px);
    display: flex; align-items: stretch; gap: 12px; width: auto; padding: 12px;
  }
  .kp-screen {
    width: 150px; height: auto; margin: 0; font-size: 24px; letter-spacing: .3em;
  }
  .kp-grid { grid-template-columns: repeat(3, calc(var(--kb) * 1.45)); gap: 6px; }
  .kp-grid button { height: var(--kb); font-size: 16px; }

  .book-page { padding: 22px 28px 24px; }
  .book-chapter { margin: 12px 0; }
  .book-cipher { font-size: 19px; }

  /* Not: 8 satır + boşluklar ekrana sığacak satır yüksekliği; çizgiler de ona uyar */
  .note-paper {
    --lh: clamp(19px, calc((100dvh - 84px - var(--sat) - var(--sab)) / 8), 27px);
    padding: 16px 26px 14px; font-size: calc(var(--lh) * .82); line-height: var(--lh);
    background:
      repeating-linear-gradient(180deg, transparent 0 calc(var(--lh) - 1px), rgba(70, 100, 160, .18) calc(var(--lh) - 1px) var(--lh)),
      linear-gradient(180deg, #f6f0de, #ece3cc);
  }
  .note-sign { margin-top: 4px !important; }
  .photo-single, .calendar-view img {
    max-height: calc(100vh - 28px);
    max-height: calc(100dvh - 28px - var(--sat) - var(--sab));
  }

  .start h1 { margin: 6px 0; font-size: clamp(30px, 11vh, 52px); }
  .start-sub { margin-bottom: 14px; }
  .start-btn { padding: 10px 24px; }
}

/* ── Çok alçak ekran (Android yatay, tam ekran değil: ~250–300 px) ── */
@media (max-height: 300px) {
  .hud-actions { top: calc(6px + var(--sat)); gap: 6px; }
  .btn.back { top: calc(6px + var(--sat)); }
  .btn { padding: 8px 11px; font-size: 11px; }
  .btn.mute { padding: 6px 8px; }
  .btn.fs { padding: 6px 9px; }
  .inventory { bottom: calc(6px + var(--sab)); }
  .inv-slot { width: 38px; height: 38px; }
  .inv-slot svg { width: 28px; height: 28px; }
  .hint { bottom: calc(6px + var(--sab)); padding: 5px 10px; font-size: 10px; }
  .toast { bottom: calc(44px + var(--sab)); font-size: 13px; padding: 6px 12px; }

  .panel { padding-top: calc(18px + var(--sat)); padding-bottom: calc(6px + var(--sab)); }
  .file { padding: 20px 14px 10px; }
  .name { font-size: 18px; }
  .stamp { top: 22px; }
  .facts { gap: 6px 12px; margin: 8px 0 2px; padding: 8px 0; }
  .facts dd { font-size: 12px; margin-top: 1px; }
  .file-nav { margin: 8px -14px -10px; padding: 6px 14px 10px; }
  .file-nav button { padding: 8px 4px; }

  .modal { padding-top: calc(10px + var(--sat)); padding-bottom: calc(10px + var(--sab)); }
  .kp-screen { width: 130px; font-size: 20px; }
  .book-page { padding: 16px 24px 18px; }
  .book-chapter { margin: 8px 0; font-size: 16px; }
  .book-cipher { font-size: 17px; }

  .start-kicker { font-size: 10px; }
  .start h1 { font-size: clamp(26px, 12vh, 40px); }
  .start-sub { font-size: 12px; margin-bottom: 10px; }
}

@media (max-width: 400px) {
  .btn.fs .fs-text-long { display: none; }
  .btn.fs .fs-text-short { display: inline; }
}

