/* ---------- fonts (SIL Open Font License, see fonts/) ---------- */
@font-face { font-family: 'Playfair Display'; font-weight: 400; font-style: normal; font-display: swap;
  src: url(fonts/playfair-display-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Playfair Display'; font-weight: 400; font-style: normal; font-display: swap;
  src: url(fonts/playfair-display-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Playfair Display'; font-weight: 700; font-style: normal; font-display: swap;
  src: url(fonts/playfair-display-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Playfair Display'; font-weight: 700; font-style: normal; font-display: swap;
  src: url(fonts/playfair-display-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Playfair Display'; font-weight: 400; font-style: italic; font-display: swap;
  src: url(fonts/playfair-display-latin-400-italic.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Playfair Display'; font-weight: 400; font-style: italic; font-display: swap;
  src: url(fonts/playfair-display-latin-ext-400-italic.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Courier Prime'; font-weight: 400; font-style: normal; font-display: swap;
  src: url(fonts/courier-prime-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Courier Prime'; font-weight: 400; font-style: normal; font-display: swap;
  src: url(fonts/courier-prime-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Courier Prime'; font-weight: 700; font-style: normal; font-display: swap;
  src: url(fonts/courier-prime-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Courier Prime'; font-weight: 700; font-style: normal; font-display: swap;
  src: url(fonts/courier-prime-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Courier Prime'; font-weight: 400; font-style: italic; font-display: swap;
  src: url(fonts/courier-prime-latin-400-italic.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Courier Prime'; font-weight: 400; font-style: italic; font-display: swap;
  src: url(fonts/courier-prime-latin-ext-400-italic.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* Russian: Playfair has Cyrillic; Courier Prime does not, so PT Mono fills in its Cyrillic letters. */
@font-face { font-family: 'Playfair Display'; font-weight: 400; font-style: normal; font-display: swap;
  src: url(fonts/playfair-display-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Playfair Display'; font-weight: 700; font-style: normal; font-display: swap;
  src: url(fonts/playfair-display-cyrillic-700-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Playfair Display'; font-weight: 400; font-style: italic; font-display: swap;
  src: url(fonts/playfair-display-cyrillic-400-italic.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Courier Prime'; font-weight: 400; font-style: normal; font-display: swap;
  src: url(fonts/pt-mono-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
/* Arabic: Noto Naskh Arabic stands in for both fonts. */
@font-face { font-family: 'Playfair Display'; font-weight: 400; font-style: normal; font-display: swap;
  src: url(fonts/noto-naskh-arabic-arabic-400-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Playfair Display'; font-weight: 700; font-style: normal; font-display: swap;
  src: url(fonts/noto-naskh-arabic-arabic-700-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Courier Prime'; font-weight: 400; font-style: normal; font-display: swap;
  src: url(fonts/noto-naskh-arabic-arabic-400-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Courier Prime'; font-weight: 700; font-style: normal; font-display: swap;
  src: url(fonts/noto-naskh-arabic-arabic-700-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }

/* ---------- tokens ---------- */
:root {
  --night: #0d1726;
  --night-2: #142238;
  --night-3: #1c2e4a;
  --gold: #d4b26a;
  --gold-soft: #a88b4e;
  --ivory: #efe6d2;
  --muted: #9aa6b8;
  --paper: #f4ecd9;
  --paper-edge: #e3d6b8;
  --ink: #2a2219;
  --ink-soft: #5b4f40;
  --kraft: #c9a979;
  --kraft-dark: #a9875a;
  --wax: #8e1f1f;
  --ok: #3f7a4b;
  --bad: #9a3a2a;
  --display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --type: 'Courier Prime', 'Courier New', Courier, monospace;
  --ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, Menlo, Consolas, 'Roboto Mono', 'DejaVu Sans Mono', 'Courier New', monospace;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--night);
  background-image:
    radial-gradient(ellipse at 50% -10%, rgba(212,178,106,.12), transparent 60%),
    repeating-linear-gradient(45deg, rgba(212,178,106,.025) 0 2px, transparent 2px 22px),
    repeating-linear-gradient(-45deg, rgba(212,178,106,.025) 0 2px, transparent 2px 22px);
  background-attachment: fixed;
  color: var(--ivory);
  font: 16px/1.5 var(--ui);
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--gold); }

.wrap { max-width: 680px; margin: 0 auto; padding: 0 16px; }
.screen { padding-top: 12px; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 28px); animation: fade .25s ease; }
.screen.no-nav { padding-bottom: calc(var(--safe-b) + 32px); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen { animation: none; } }

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(13,23,38,.94);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(212,178,106,.25);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar .wrap { display: flex; align-items: center; gap: 8px; height: 52px; }
.topbar .brand { flex: 1; min-width: 0; font-family: var(--display); color: var(--gold); font-size: 17px; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: none; border: 0; padding: 10px; margin: -6px; border-radius: 10px; color: var(--gold); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:active { background: rgba(212,178,106,.12); }
.icon-btn svg { width: 24px; height: 24px; }

/* ---------- bottom nav ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(10,18,30,.97);
  border-top: 1px solid rgba(212,178,106,.25);
  padding-bottom: var(--safe-b);
}
.nav .wrap { display: grid; grid-template-columns: repeat(4, 1fr); height: var(--nav-h); padding: 0 4px; }
.nav a { text-decoration: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; letter-spacing: .02em; position: relative; }
.nav a svg { width: 24px; height: 24px; }
.nav a.on { color: var(--gold); }
.nav a .dot { position: absolute; top: 9px; left: calc(50% + 9px); width: 8px; height: 8px; border-radius: 50%; background: var(--wax); box-shadow: 0 0 0 2px var(--night); }

/* ---------- typography ---------- */
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.2; }
.screen-title { color: var(--gold); font-size: 28px; margin: 14px 0 6px; }
.lead { color: var(--muted); margin: 0 0 18px; }
.deco { display: flex; align-items: center; gap: 12px; color: var(--gold-soft); margin: 18px 0; }
.deco::before, .deco::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-soft), transparent); }
.deco span { font-size: 12px; letter-spacing: .3em; }

/* ---------- buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 52px; padding: 12px 18px;
  border-radius: 12px; border: 1px solid var(--gold);
  background: linear-gradient(180deg, #e2c47f, #c19c52);
  color: #1b1408; font-weight: 600; font-size: 17px; text-decoration: none; text-align: center;
  box-shadow: 0 2px 0 rgba(0,0,0,.35);
}
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--gold); }
.btn.quiet { background: transparent; border-color: rgba(154,166,184,.4); color: var(--muted); font-weight: 500; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stack > * + * { margin-top: 10px; }

/* ---------- cover ---------- */
.cover { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; justify-content: center; padding: calc(env(safe-area-inset-top,0px) + 32px) 0 calc(var(--safe-b) + 32px); text-align: center; }
.cover .frame { border: 1px solid rgba(212,178,106,.55); outline: 1px solid rgba(212,178,106,.25); outline-offset: 6px; padding: 34px 18px 30px; margin: 0 6px 34px; position: relative; }
.cover .frame::before, .cover .frame::after { content: '◆'; position: absolute; left: 50%; transform: translateX(-50%); color: var(--gold); background: var(--night); padding: 0 10px; font-size: 12px; }
.cover .frame::before { top: -9px; }
.cover .frame::after { bottom: -9px; }
.cover .kicker { font-size: 12px; letter-spacing: .32em; text-transform: uppercase; color: var(--gold-soft); }
.cover h1 { font-size: clamp(34px, 11vw, 54px); color: var(--gold); margin: 14px 0 12px; letter-spacing: .01em; }
.cover .ship { font-family: var(--display); font-style: italic; color: var(--ivory); opacity: .9; font-size: 17px; }
.cover .meta { color: var(--muted); font-size: 14px; margin-top: 16px; }
.sunburst { width: 120px; height: 60px; margin: 0 auto 6px; display: block; color: var(--gold-soft); }

/* ---------- paper documents ---------- */
.paper {
  background: var(--paper);
  background-image: linear-gradient(rgba(255,255,255,.35), rgba(255,255,255,0) 40%), repeating-linear-gradient(0deg, rgba(120,90,40,.025) 0 1px, transparent 1px 3px);
  color: var(--ink);
  border-radius: 4px;
  padding: 22px 18px 26px;
  box-shadow: 0 1px 0 var(--paper-edge), 0 10px 30px rgba(0,0,0,.45);
  font-family: var(--type);
  font-size: 16px; line-height: 1.55;
  position: relative;
  overflow-wrap: break-word;
}
.paper h1, .paper h2, .paper h3 { color: var(--ink); }
.paper h1 { font-size: 24px; margin: 0 0 6px; }
.paper h2 { font-size: 19px; margin: 22px 0 8px; border-bottom: 1px solid rgba(42,34,25,.25); padding-bottom: 4px; }
.paper h3 { font-size: 17px; margin: 18px 0 6px; }
.paper p { margin: 0 0 12px; }
.paper ul, .paper ol { margin: 0 0 12px; padding-left: 22px; }
.paper li { margin: 0 0 6px; }
.paper hr { border: 0; border-top: 1px dashed rgba(42,34,25,.35); margin: 18px 0; }
.paper strong { font-weight: 700; }
.paper blockquote { margin: 0 0 12px; padding: 10px 12px; border-left: 3px solid var(--kraft-dark); background: rgba(169,135,90,.12); }
.paper blockquote p:last-child { margin: 0; }
.paper .table { overflow-x: auto; margin: 0 -18px 14px; padding: 0 18px; -webkit-overflow-scrolling: touch; }
.paper table { border-collapse: collapse; font-size: 14px; line-height: 1.4; min-width: 100%; }
.paper th, .paper td { border: 1px solid rgba(42,34,25,.3); padding: 6px 8px; text-align: left; vertical-align: top; }
.paper th { background: rgba(42,34,25,.07); font-weight: 700; }
.paper .figure { overflow-x: auto; margin: 0 -18px 14px; padding: 4px 18px; -webkit-overflow-scrolling: touch; }
.paper pre { font-family: var(--mono); font-size: 11.5px; line-height: 1.35; margin: 0; color: var(--ink); width: max-content; }
.doc-label { display: inline-block; font-family: var(--ui); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--wax); border: 1.5px solid var(--wax); padding: 2px 8px; border-radius: 3px; margin-bottom: 10px; transform: rotate(-1.5deg); opacity: .85; }
.scroll-tip { font-family: var(--ui); font-size: 12px; color: var(--ink-soft); margin: -6px 0 12px; }

/* ---------- case file ---------- */
.env { margin: 0 0 18px; border-radius: 10px; overflow: hidden; background: var(--night-2); border: 1px solid rgba(212,178,106,.22); }
.env-head { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: linear-gradient(180deg, var(--kraft), var(--kraft-dark)); color: #2b1f10; position: relative; }
.env-head::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: rgba(0,0,0,.25); }
.env-num { font-family: var(--display); font-size: 30px; font-weight: 700; line-height: 1; width: 38px; text-align: center; opacity: .8; }
.env-titles { flex: 1; min-width: 0; }
.env-kicker { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; opacity: .75; }
.env-title { font-family: var(--display); font-size: 19px; font-weight: 700; line-height: 1.2; }
.env-count { font-size: 12px; opacity: .8; white-space: nowrap; }
.env-body { padding: 4px 0; }
.doc-link { display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-decoration: none; color: var(--ivory); border-top: 1px solid rgba(255,255,255,.06); }
.doc-link:first-child { border-top: 0; }
.doc-link:active { background: rgba(212,178,106,.08); }
.doc-link .ex { font-size: 12px; color: var(--gold-soft); width: 34px; flex: none; text-align: center; font-variant-numeric: tabular-nums; }
.doc-link .t { flex: 1; min-width: 0; line-height: 1.3; }
.doc-link .badge { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #fff; background: var(--wax); border-radius: 20px; padding: 2px 8px; flex: none; }
.doc-link .tick { color: var(--gold-soft); flex: none; width: 18px; height: 18px; }
.doc-link.is-read .t { color: #c9cfd8; }
.letter-link { background: var(--night-2); border: 1px solid rgba(212,178,106,.22); border-radius: 10px; margin-bottom: 18px; }
.folders { display: grid; gap: 14px; margin-bottom: 22px; }
.folder { position: relative; display: flex; align-items: center; gap: 14px; padding: 18px 16px 16px; margin-top: 10px; text-decoration: none; color: #2b1f10; background: linear-gradient(180deg, var(--kraft), var(--kraft-dark)); border-radius: 0 10px 10px 10px; box-shadow: 0 6px 16px rgba(0,0,0,.35); }
.folder::before { content: ''; position: absolute; left: 0; top: -10px; width: 92px; height: 12px; background: var(--kraft); border-radius: 8px 8px 0 0; }
.folder:active { transform: translateY(1px); }
.folder .tab { font-family: var(--display); font-size: 30px; font-weight: 700; line-height: 1; width: 34px; text-align: center; opacity: .75; flex: none; }
.folder .ft { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.folder .fn { font-family: var(--display); font-size: 20px; font-weight: 700; line-height: 1.2; }
.folder .fnote { font-size: 14px; line-height: 1.35; opacity: .85; }
.folder .fmeta { font-size: 12px; letter-spacing: .04em; opacity: .75; margin-top: 2px; }
.folder svg { width: 20px; height: 20px; flex: none; opacity: .7; }
.folder.done { filter: saturate(.8); }
.file-end { text-align: center; color: var(--muted); padding: 6px 0 4px; }
.file-end .btn { margin-top: 12px; }

.doc-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.doc-nav .btn { font-size: 15px; min-height: 48px; }
.doc-nav .btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 14px; padding: 8px 0; }

/* ---------- hints ---------- */
.card { background: var(--night-2); border: 1px solid rgba(212,178,106,.22); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 19px; color: var(--gold); }
.card h2 small { display: block; font-family: var(--ui); font-weight: 400; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.hint { border-top: 1px solid rgba(255,255,255,.07); padding: 12px 0; }
.hint:first-of-type { border-top: 0; padding-top: 0; }
.hint .hl { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-soft); margin-bottom: 6px; }
.hint .ht { font-family: var(--type); color: var(--ivory); }
.hint .btn { min-height: 44px; font-size: 15px; }
.hint .locked { color: var(--muted); font-size: 14px; }

.doc-photo { float: right; width: 92px; height: 110px; margin: -4px -4px 10px 14px; background: #fbf6ea; padding: 5px 5px 14px; box-shadow: 0 3px 8px rgba(0,0,0,.28); transform: rotate(2.5deg); position: relative; }
.doc-photo::before { content: ''; position: absolute; top: -9px; left: 50%; width: 34px; height: 14px; margin-left: -17px; background: rgba(214,200,160,.75); transform: rotate(-4deg); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.doc-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; display: block; filter: sepia(.15); }
.paper .doc-photo + .doc-label + h1 { margin-right: 0; }
@media (max-width: 360px) { .doc-photo { width: 78px; height: 94px; } }

/* ---------- suspects ---------- */
.letter-link .sub { color: var(--muted); font-size: 13px; }
.letter-link + .letter-link { margin-top: -8px; }
.letter-link > svg { width: 18px; height: 18px; color: var(--gold-soft); flex: none; }
.suspects { display: grid; gap: 16px; }
.suspect { background: var(--paper); color: var(--ink); border-radius: 4px; padding: 16px; box-shadow: 0 10px 26px rgba(0,0,0,.4); }
.sp-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.portrait { position: relative; width: 76px; height: 92px; flex: none; background: #d9c9a6; border: 4px solid #fbf6ea; box-shadow: 0 2px 6px rgba(0,0,0,.25); transform: rotate(-2deg); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.portrait span { font-family: var(--display); font-size: 26px; font-weight: 700; color: rgba(42,34,25,.45); }
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }
.sp-id { min-width: 0; }
.sp-id h2 { font-size: 20px; margin: 0 0 2px; color: var(--ink); }
.sp-role { font-family: var(--type); font-size: 14px; color: var(--ink-soft); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- notes ---------- */

/* ---------- shared notes ---------- */
.composer { display: flex; gap: 8px; align-items: flex-end; margin: 0 0 16px; }
.composer textarea { flex: 1; min-width: 0; resize: none; overflow: hidden; border: 0; border-radius: 6px; padding: 10px 12px; background: var(--paper); color: var(--ink); font: 16px/1.45 var(--type); box-shadow: inset 0 0 0 1px rgba(42,34,25,.25); }
.composer textarea:focus { outline: 2px solid var(--gold); }
.btn.small { width: auto; min-height: 44px; padding: 8px 16px; font-size: 15px; flex: none; }
.suspect .composer { margin: 10px 0 0; }
.note-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.note { background: var(--paper); color: var(--ink); border-radius: 3px; padding: 10px 12px 8px; box-shadow: 0 4px 12px rgba(0,0,0,.3); }
.suspect .note { box-shadow: none; background: rgba(169,135,90,.12); border-left: 3px solid var(--kraft-dark); }
.note.pending { opacity: .7; }
.note-about { font-family: var(--ui); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--wax); margin-bottom: 4px; }
.note-text { font-family: var(--type); font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; font-family: var(--ui); font-size: 12px; color: var(--ink-soft); }
.note-del { border: 0; background: none; color: var(--ink-soft); font-size: 20px; line-height: 1; padding: 4px 8px; margin: -4px -8px; border-radius: 6px; }
.note-del:active { background: rgba(42,34,25,.1); }
.net-msg, .empty { color: var(--muted); font-size: 14px; text-align: center; margin: 8px 0 14px; }

/* ---------- start, join, invite ---------- */
.cover-help { color: var(--muted); font-size: 14px; text-align: center; margin: 4px 0 0; }
.gate .card { padding: 18px 16px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; letter-spacing: .06em; color: var(--gold-soft); margin-bottom: 6px; }
.field input { width: 100%; min-height: 50px; border-radius: 10px; border: 1px solid rgba(212,178,106,.45); background: var(--night); color: var(--ivory); padding: 10px 14px; font: 18px var(--ui); }
.field input:focus { outline: 2px solid var(--gold); border-color: transparent; }
.field .code-input { font: 700 22px var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.gate-form .form-msg { text-align: left; margin: 0 0 12px; }
.gate .btn + .btn, .gate .card + .btn { margin-top: 14px; }
.invite { text-align: center; }
.invite .qr { width: 200px; height: 200px; margin: 0 auto 14px; background: #fff; border-radius: 10px; padding: 8px; }
.invite .qr svg { width: 100%; height: 100%; display: block; }
.table-code { font: 700 34px var(--mono); letter-spacing: .1em; color: var(--gold); margin-bottom: 8px; }
.table-code span { display: inline-block; width: 2px; }
.invite p { color: #c9cfd8; font-size: 15px; margin: 0 0 8px; }
.invite .sub { color: var(--muted); font-size: 13px; }

/* ---------- answers ---------- */
.q { background: var(--night-2); border: 1px solid rgba(212,178,106,.22); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.q h2 { font-size: 19px; margin: 0 0 4px; color: var(--ivory); }
.q h2 .qn { color: var(--gold); margin-right: 6px; }
.q .ev { font-size: 14px; color: var(--muted); margin: 0 0 12px; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid rgba(255,255,255,.1); border-radius: 8px; margin-top: 8px; cursor: pointer; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt .k { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--gold-soft); color: var(--gold); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.opt .ot { padding-top: 3px; line-height: 1.35; }
.opt.sel { border-color: var(--gold); background: rgba(212,178,106,.1); }
.opt.sel .k { background: var(--gold); color: #1b1408; border-color: var(--gold); }
.opt:has(input:focus-visible) { outline: 2px solid var(--gold); }
.form-msg { color: #e8a090; font-size: 14px; text-align: center; min-height: 20px; margin: 4px 0 10px; }

/* ---------- verdict ---------- */
.verdict-head { text-align: center; padding: 10px 0 6px; }
.verdict-head .rank { font-family: var(--display); color: var(--gold); font-size: clamp(30px, 9vw, 40px); font-weight: 700; margin: 6px 0 4px; }
.verdict-head .score { color: var(--ivory); font-size: 17px; }
.verdict-head .small { color: var(--muted); font-size: 14px; margin-top: 6px; }
.res { background: var(--night-2); border: 1px solid rgba(212,178,106,.22); border-radius: 10px; padding: 16px; margin-bottom: 14px; }
.res .rh { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.res .rh h3 { flex: 1; margin: 0; font-size: 17px; color: var(--ivory); }
.pill { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; border-radius: 20px; padding: 3px 10px; white-space: nowrap; }
.pill.ok { background: var(--ok); color: #fff; }
.pill.bad { background: var(--bad); color: #fff; }
.res .row { font-size: 15px; margin: 4px 0; }
.nw { white-space: nowrap; }
.res .row b { color: var(--gold-soft); font-weight: 600; }
.res .why { font-family: var(--type); font-size: 15px; color: #d9d3c4; background: rgba(0,0,0,.18); border-radius: 6px; padding: 10px 12px; margin-top: 10px; }
.check { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 15px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--gold); }
.help { font-size: 13px; color: var(--muted); text-align: center; margin: 0 0 16px; }
details.more { margin: 18px 0; }
details.more summary { cursor: pointer; color: var(--gold); font-weight: 600; padding: 10px 0; }
.the-end { text-align: center; font-family: var(--display); font-style: italic; color: var(--gold); font-size: 20px; margin: 28px 0 10px; }

/* ---------- sheet / dialog ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(4,8,14,.6); display: flex; align-items: flex-end; justify-content: center; animation: ofade .15s ease; }
@keyframes ofade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 520px; background: var(--night-2); border: 1px solid rgba(212,178,106,.3); border-bottom: 0; border-radius: 16px 16px 0 0; padding: 20px 16px calc(var(--safe-b) + 18px); animation: up .2s ease; max-height: 85vh; overflow: auto; }
@keyframes up { from { transform: translateY(30px); opacity: .5; } }
@media (min-width: 600px) { .overlay { align-items: center; } .sheet { border-radius: 16px; border-bottom: 1px solid rgba(212,178,106,.3); } }
.sheet h2 { margin: 0 0 8px; color: var(--gold); font-size: 21px; }
.sheet p { margin: 0 0 18px; color: #c9cfd8; }
.menu-list { list-style: none; margin: 0 0 14px; padding: 0; }
.menu-list li + li { border-top: 1px solid rgba(255,255,255,.07); }
.menu-list a, .menu-list button { display: flex; width: 100%; align-items: center; gap: 12px; padding: 14px 4px; background: none; border: 0; color: var(--ivory); text-decoration: none; text-align: left; font-size: 16px; }
.menu-list svg { width: 22px; height: 22px; color: var(--gold-soft); flex: none; }
.menu-list .sub { color: var(--muted); font-size: 13px; }
.menu-list .danger { color: #e8a090; }
.lang-pill { display: inline-flex; align-items: center; gap: 8px; margin: 0 auto 26px; border: 1px solid rgba(212,178,106,.4); background: none; color: var(--ivory); border-radius: 20px; padding: 7px 16px 7px 12px; font: inherit; font-size: 15px; cursor: pointer; }
.lang-pill svg { width: 18px; height: 18px; color: var(--gold); }
.lang-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 16px; }
.lang-list button { border: 1px solid rgba(212,178,106,.35); background: none; color: var(--ivory); border-radius: 10px; padding: 12px 8px; font: inherit; font-size: 16px; cursor: pointer; }
.lang-list button.on { background: var(--gold); color: #1b1408; border-color: var(--gold); }
.warn { background: rgba(154,58,42,.25); border: 1px solid rgba(232,160,144,.4); color: #f2c7bc; border-radius: 8px; padding: 10px 12px; font-size: 14px; margin: 12px 0; }

/* ---------- right-to-left (Arabic) ---------- */
[dir=rtl] .paper ul, [dir=rtl] .paper ol { padding-left: 0; padding-right: 22px; }
[dir=rtl] .paper blockquote, [dir=rtl] .suspect .note { border-left: 0; border-right: 3px solid var(--kraft-dark); }
[dir=rtl] .paper th, [dir=rtl] .paper td, [dir=rtl] .gate-form .form-msg, [dir=rtl] .menu-list a, [dir=rtl] .menu-list button { text-align: right; }
[dir=rtl] .doc-photo { float: left; margin: -4px 14px 10px -4px; transform: rotate(-2.5deg); }
[dir=rtl] .folder::before { left: auto; right: 0; }
[dir=rtl] .nav a .dot { left: auto; right: calc(50% + 9px); }
[dir=rtl] .q h2 .qn { margin-right: 0; margin-left: 6px; }
[dir=rtl] .dir-icon { transform: scaleX(-1); }
[dir=rtl] .paper pre, .code-input, .table-code { direction: ltr; text-align: left; }
.code-input, .table-code { unicode-bidi: isolate; }
/* Arabic letters join; spacing and slanted text break them apart. */
[lang=ar] body * { letter-spacing: 0 !important; }
[lang=ar] em, [lang=ar] i, [lang=ar] .ship, [lang=ar] .the-end { font-style: normal; }
[lang=ar] body { line-height: 1.7; }

