/* =========================================================
   ADASTRUM — HUD stylesheet
   ========================================================= */

/* Self-hosted fonts (SIL Open Font License) — no request to third-party servers */
@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
/* Black Han Sans, subset to the 3 glyphs 나라얀 only (≈4 KB) */
@font-face {
  font-family: "Black Han Sans";
  src: url("fonts/blackhansans-narayan.woff2") format("woff2");
  font-weight: 400;
  font-display: block;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrainsmono-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0a0b09;
  --bg-2: #11130f;
  --panel: #0f110d;
  --line: #2b3027;
  --line-2: #3d4437;
  --text: #e9ede3;
  --dim: #8d9486;          /* ≥ 5:1 on --bg */
  --acid: #d4ff1e;         /* primary accent */
  --acid-ink: #0a0b09;
  --acid-dim: #5b6d12;
  --neon: #ff2e88;         /* secondary accent — used sparingly */
  --warn: #ffb21e;
  --ok: var(--acid);
  --err: var(--neon);

  --f-wide: "Archivo", "Arial Black", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --gap: 16px;
  --radius: 0;
  --tap: 52px;
  --ease: cubic-bezier(.2, .7, .1, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--bg-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-2) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: -1px -1px;
  color: var(--text);
  font-family: var(--f-wide);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.small { font-size: 12px; }
.dim { color: var(--dim); }
.center { text-align: center; }
.accent { color: var(--acid); }
[hidden] { display: none !important; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid var(--acid); outline-offset: 3px; }
::selection { background: var(--acid); color: var(--acid-ink); }

/* subtle CRT scanlines */
.scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 50;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.018) 0 1px, transparent 1px 3px);
  mix-blend-mode: screen;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(10, 11, 9, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none;
  font-weight: 900; font-stretch: 125%; letter-spacing: .02em; font-size: 18px;
}
.brand-mark {
  width: 18px; height: 18px; background: var(--acid);
  clip-path: polygon(0 0, 100% 0, 100% 30%, 30% 30%, 30% 100%, 0 100%);
  position: relative;
}
.topmeta { display: flex; gap: 18px; margin: 0; font-size: 11px; }
.topmeta div { display: flex; gap: 6px; }
.topmeta dt { color: var(--dim); }
.topmeta dd { margin: 0; font-weight: 700; }

[data-tone="idle"] { color: var(--dim); }
[data-tone="ok"]   { color: var(--acid); }
[data-tone="busy"] { color: var(--acid); }
[data-tone="warn"] { color: var(--warn); }
[data-tone="err"]  { color: var(--neon); }

/* ---------- Layout ---------- */
.layout {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  display: grid;
  gap: var(--gap);
}

/* ---------- Hero ---------- */
.hero { position: relative; padding: 18px 0 8px; border-bottom: 1px solid var(--line); }
.tag { margin: 0 0 10px; font-size: 12px; color: var(--dim); }
.idx { color: var(--acid); }
h1 {
  margin: 0;
  font-weight: 900;
  font-stretch: 125%;
  text-transform: uppercase;
  font-size: clamp(40px, 11vw, 112px);
  line-height: .88;
  letter-spacing: -.01em;
}
h1 .outline {
  color: transparent;
  -webkit-text-stroke: 2px var(--acid);
}
.lede { max-width: 56ch; margin: 18px 0 14px; color: var(--text); font-stretch: 100%; font-size: 16px; }
.hero-deco { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 11px; color: var(--dim); }
.hero-deco span::before { content: "+ "; color: var(--acid); }
.hero-deco span.plain::before { content: none; }
.hero-hatch {
  position: absolute; right: 0; top: 18px; width: 22%; max-width: 220px; height: 64px;
}
.hatch {
  background: repeating-linear-gradient(-45deg, var(--acid) 0 2px, transparent 2px 9px);
  opacity: .55;
}

.cursor {
  display: inline-block; width: .5em; height: .82em;
  margin-left: .08em; vertical-align: baseline;
  background: var(--acid);
  animation: blink 1.05s steps(1) infinite;
}
h1 .cursor { height: .7em; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Mode tabs ---------- */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line-2); }
.mode {
  appearance: none; border: 0; cursor: pointer;
  min-height: 72px; padding: 12px 14px;
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  text-align: left;
  background: transparent; color: var(--dim);
  font-family: var(--f-wide); font-weight: 900; font-stretch: 125%;
}
.mode + .mode { border-left: 1px solid var(--line-2); }
.mode .idx { grid-row: 1 / span 2; font-size: 13px; color: inherit; }
.mode-name { font-size: clamp(16px, 4.6vw, 24px); line-height: 1; }
.mode .sub { font-size: 10px; font-weight: 500; letter-spacing: .2em; }
.mode[aria-selected="true"] { background: var(--acid); color: var(--acid-ink); }
.mode[aria-selected="false"]:active { background: var(--bg-2); }

/* ---------- Warning band ---------- */
.warnband {
  display: flex; gap: 12px; align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--neon);
  background:
    linear-gradient(90deg, rgba(255,46,136,.10), transparent 70%),
    var(--bg);
  position: relative;
}
.warnband::after {
  content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 46px;
  background: repeating-linear-gradient(-45deg, var(--neon) 0 6px, transparent 6px 12px);
  opacity: .5;
}
.warnband p { margin: 0; padding-right: 48px; font-size: 14px; font-stretch: 100%; }
.warnband strong { font-stretch: 115%; letter-spacing: .02em; }
.warn-glyph { color: var(--neon); font-size: 18px; }
.mobile-note { display: block; color: var(--dim); font-size: 13px; }

/* ---------- Panels & frames ---------- */
.view { display: grid; gap: var(--gap); }

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 34px 16px 16px;
  min-width: 0;
}
.plabel {
  position: absolute; top: 0; left: 0;
  padding: 3px 8px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  background: var(--line); color: var(--text);
}
.pref {
  position: absolute; top: 4px; right: 10px;
  font-size: 10px; color: var(--dim); letter-spacing: .1em;
}

/* square-bracket corners */
.frame {
  --c: var(--acid); --l: 14px; --w: 2px;
  border-color: var(--line);
  background:
    linear-gradient(var(--c), var(--c)) top left / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) top left / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) top right / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) top right / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) bottom left / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) bottom left / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) bottom right / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) bottom right / var(--w) var(--l),
    var(--panel);
  background-repeat: no-repeat;
}

/* ---------- Status ---------- */
.status-panel { padding-bottom: 14px; }
.status {
  margin: 4px 0 4px;
  font-size: clamp(20px, 6vw, 36px);
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.1;
  text-transform: uppercase;
  word-break: break-word;
}
.status::before { content: "■ "; font-size: .7em; vertical-align: .12em; }
.status[data-tone="busy"]::before { animation: blink .6s steps(1) infinite; }
.status .cursor { height: .78em; }
.status-sub { margin: 0; color: var(--text); font-stretch: 100%; font-size: 15px; }

.glitch { animation: glitch .32s steps(2) 1; }
@keyframes glitch {
  0%   { transform: translate(0); text-shadow: none; clip-path: inset(0 0 0 0); }
  20%  { transform: translate(-3px, 1px); text-shadow: 3px 0 var(--neon), -3px 0 var(--acid); clip-path: inset(10% 0 45% 0); }
  40%  { transform: translate(3px, -1px); text-shadow: -2px 0 var(--neon), 2px 0 var(--acid); clip-path: inset(55% 0 5% 0); }
  60%  { transform: translate(-1px, 0); clip-path: inset(0 0 0 0); }
  100% { transform: translate(0); text-shadow: none; clip-path: inset(0 0 0 0); }
}

/* ---------- Buttons ---------- */
.btn {
  appearance: none; -webkit-appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 12px 18px;
  border: 2px solid var(--acid); border-radius: var(--radius);
  background: transparent; color: var(--acid);
  font-family: var(--f-wide); font-weight: 800; font-stretch: 112%;
  font-size: 15px; letter-spacing: .04em; text-transform: uppercase; text-align: center;
  cursor: pointer; user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
  transition: background-color .12s, color .12s, transform .06s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--acid); color: var(--acid-ink); }
.btn-primary:active { background: #b6dc10; }
.btn-ghost { border-color: var(--line-2); color: var(--text); }
.btn-ghost:active { border-color: var(--acid); color: var(--acid); }
.btn-danger { border-color: var(--line-2); color: var(--dim); }
.btn-danger:active { border-color: var(--neon); color: var(--neon); }
.btn-xl { min-height: 64px; font-size: 18px; padding: 16px 22px; width: 100%; }
.btn-sm { min-height: 40px; padding: 6px 12px; font-size: 12px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .35; cursor: not-allowed; pointer-events: none; }

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: transparent; color: var(--acid); }
  .btn-ghost:hover, .btn-danger:hover { border-color: var(--acid); color: var(--acid); }
  .btn-danger:hover { border-color: var(--neon); color: var(--neon); }
  .mode[aria-selected="false"]:hover { color: var(--text); background: var(--bg-2); }
}

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.btn-row > .btn { flex: 1 1 160px; }

/* ---------- Drop zone ---------- */
.dropzone { padding: 44px 16px 24px; transition: border-color .15s; }
.drop-inner { display: grid; justify-items: center; gap: 14px; text-align: center; }
.reticle { width: 96px; height: 96px; fill: none; stroke: var(--line-2); stroke-width: 2; }
.reticle .acc { stroke: var(--acid); stroke-width: 3; }
.drop-hint { margin: 0; font-weight: 900; font-stretch: 125%; font-size: clamp(18px, 3.6vw, 30px); line-height: 1.1; }
.drop-or { margin: 0; color: var(--dim); font-size: 12px; }
.dropzone .btn-xl { max-width: 460px; }
.dropzone.dragover { --c: var(--neon); border-color: var(--acid); }
.dropzone.dragover .reticle { stroke: var(--acid); }
.dropzone.dragover .reticle .acc { stroke: var(--neon); }

/* hide drag & drop wording on touch-only devices */
@media (hover: none), (pointer: coarse) {
  .pointer-fine { display: none; }
}

/* ---------- Session grid ---------- */
.session-grid { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); }

.code-big {
  margin: 4px 0 6px;
  font-size: clamp(40px, 13vw, 68px);
  font-weight: 700;
  letter-spacing: .14em;
  line-height: 1;
  color: var(--acid);
  word-break: break-all;
}
.code-big .dash { color: var(--line-2); }
.barcode { display: block; width: 100%; height: 34px; margin: 6px 0 14px; }
.barcode rect { fill: var(--text); }

.field-label { display: block; margin-bottom: 6px; font-size: 11px; color: var(--dim); letter-spacing: .12em; }
.link-field {
  width: 100%; min-height: 48px; padding: 10px 12px;
  border: 1px solid var(--line-2); border-radius: 0;
  background: var(--bg); color: var(--text);
  font-size: 14px;
  -webkit-user-select: all; user-select: all;
}
.feedback { min-height: 1.4em; margin: 10px 0 0; font-size: 12px; color: var(--acid); }
.feedback.err { color: var(--neon); }

.inline-warn {
  margin: 12px 0 0; padding: 10px 12px;
  border-left: 3px solid var(--warn);
  background: rgba(255, 178, 30, .08);
  font-size: 14px; font-stretch: 100%;
}

.qr-panel { display: grid; justify-items: center; }
.qr-wrap {
  width: min(100%, 340px);
  aspect-ratio: 1;
  background: var(--acid);
  padding: 0;
  display: grid; place-items: center;
}
.qr-wrap svg { width: 100%; height: 100%; display: block; shape-rendering: crispEdges; }
.qr-wrap .qr-missing { color: var(--acid-ink); font-family: var(--f-mono); font-size: 12px; padding: 16px; text-align: center; }

/* ---------- File list ---------- */
.filelist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); max-height: 360px; overflow-y: auto; }
.file {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 4px 12px; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.file-idx { font-family: var(--f-mono); font-size: 11px; color: var(--dim); }
.file-name { font-family: var(--f-mono); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-family: var(--f-mono); font-size: 12px; color: var(--dim); text-align: right; }
.file-state {
  grid-column: 2 / -1;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em;
}
.file-state[data-tone="idle"] { color: var(--dim); }
.mini-bar { flex: 1; height: 4px; background: var(--line); position: relative; max-width: 220px; }
.mini-bar i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--acid); }
.file .btn-sm { min-height: 40px; }

.total { margin: 12px 0 0; display: flex; justify-content: space-between; font-size: 13px; color: var(--dim); }
.total b { color: var(--text); }

/* ---------- Progress ---------- */
.pbar {
  --seg: 9px; --gapw: 3px;
  position: relative; height: 26px;
  background: repeating-linear-gradient(90deg, var(--line) 0 var(--seg), transparent var(--seg) calc(var(--seg) + var(--gapw)));
  margin: 6px 0 14px;
}
.pbar-fill {
  position: absolute; inset: 0 auto 0 0; width: 0%;
  background: repeating-linear-gradient(90deg, var(--acid) 0 var(--seg), transparent var(--seg) calc(var(--seg) + var(--gapw)));
  transition: width .25s linear;
}
.pbar.err .pbar-fill { background: repeating-linear-gradient(90deg, var(--neon) 0 var(--seg), transparent var(--seg) calc(var(--seg) + var(--gapw))); }
.pstats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.pstats div { background: var(--panel); padding: 8px 10px; display: grid; }
.pstats span { font-size: 10px; color: var(--dim); letter-spacing: .14em; }
.pstats b { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-panel [data-k="file"] { margin: 10px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Log ---------- */
.log {
  margin: 0; padding: 0; list-style: none;
  max-height: 200px; overflow-y: auto;
  font-size: 12px; line-height: 1.6;
}
.log li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; }
.log time { color: var(--dim); }
.log li[data-tone="ok"] span { color: var(--acid); }
.log li[data-tone="err"] span { color: var(--neon); }
.log li[data-tone="warn"] span { color: var(--warn); }
.log li:last-child span::after { content: "_"; animation: blink 1.05s steps(1) infinite; }

/* ---------- Receive entry ---------- */
.code-form { display: grid; gap: 12px; max-width: 520px; }
.code-input {
  width: 100%; min-height: 72px; padding: 8px 14px;
  border: 2px solid var(--line-2); border-radius: 0;
  background: var(--bg); color: var(--acid);
  font-size: clamp(30px, 9vw, 44px); font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
}
.code-input::placeholder { color: var(--line-2); }
.code-input:focus { border-color: var(--acid); outline: none; }
.code-input[aria-invalid="true"] { border-color: var(--neon); }
.entry-panel .small { margin: 14px 0 0; }

/* ---------- Spec strip ---------- */
.specs { display: grid; gap: 0; border-top: 1px solid var(--line); margin-top: 12px; }
.spec { padding: 16px 0; border-bottom: 1px solid var(--line); }
.spec h2 { margin: 4px 0 6px; font-weight: 900; font-stretch: 125%; font-size: 20px; letter-spacing: .02em; }
.spec p { margin: 0; color: var(--dim); font-stretch: 100%; font-size: 14px; }

/* ---------- Footer ---------- */
.footer {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  max-width: 1180px; margin: 0 auto; padding: 18px 16px calc(24px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font-size: 11px; color: var(--dim); letter-spacing: .1em;
}
.footer .sep { color: var(--neon); font-size: 8px; }
.foot-barcode { width: 140px; height: 22px; margin: 0 0 0 auto; opacity: .7; }

.noscript { padding: 20px; color: var(--neon); text-align: center; }

/* ---------- Reveal (scan sweep) ---------- */
.reveal { animation: sweep .55s var(--ease) both; }
@keyframes sweep {
  from { clip-path: inset(0 0 100% 0); }
  to   { clip-path: inset(0 0 0 0); }
}
.reveal::after {
  content: ""; position: absolute; left: 0; right: 0; height: 2px; top: 0;
  background: var(--acid); box-shadow: 0 0 12px var(--acid);
  animation: scanline .55s var(--ease) both;
  pointer-events: none;
}
.hero.reveal::after { display: none; }
@keyframes scanline {
  from { top: 0; opacity: 1; }
  90%  { top: calc(100% - 2px); opacity: 1; }
  to   { top: calc(100% - 2px); opacity: 0; }
}


.ref-note { margin: 0 0 4px; font-family: var(--f-wide); font-stretch: 100%; font-size: 13px; }

/* =========================================================
   Larger screens
   ========================================================= */
@media (min-width: 640px) {
  .pstats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .specs { grid-template-columns: repeat(3, 1fr); }
  .spec { padding: 18px 18px 18px 0; border-bottom: 0; }
  .spec + .spec { padding-left: 18px; border-left: 1px solid var(--line); }
  .mobile-note { display: inline; }
}

@media (min-width: 900px) {
  :root { --gap: 20px; }
  .layout { padding-top: 28px; }
  .session-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: start;
  }
  .code-panel     { grid-column: 1 / span 7; }
  .qr-panel       { grid-column: 8 / span 5; grid-row: span 2; }
  #sendSession .manifest-panel { grid-column: 1 / span 7; }
  #sendSession .progress-panel { grid-column: 1 / span 7; }
  #sendSession .log-panel      { grid-column: 8 / span 5; }

  .recv-grid .manifest-panel { grid-column: 1 / span 7; grid-row: span 2; }
  .recv-grid .progress-panel { grid-column: 8 / span 5; }
  .recv-grid .log-panel      { grid-column: 8 / span 5; }

  .dropzone { padding: 64px 24px 40px; min-height: 360px; display: grid; place-items: center; }
  .reticle { width: 128px; height: 128px; }
  .panel { padding: 38px 22px 22px; }
}

@media (max-width: 420px) {
  .topmeta { gap: 10px; }
  .hide-sm { display: none !important; }
  .hero-hatch { display: none; }
}

/* =========================================================
   Reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    transition: none !important;
  }
  .cursor, .log li:last-child span::after, .status[data-tone="busy"]::before { animation: none !important; opacity: 1; }
  .reveal::after { display: none; }
}

/* Windows high-contrast / forced colors */
@media (forced-colors: active) {
  .frame, .panel { border: 1px solid CanvasText; }
  .pbar-fill { background: Highlight; }
}

/* Mobile: during an active session, drop the hero so status & controls are on screen */
@media (max-width: 639px) {
  body.in-session .hero, body.in-session .specs { display: none; }
  .pstats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pstats div:last-child { grid-column: 1 / -1; }
}

/* =========================================================
   Brand + background signature (나라얀)
   ========================================================= */
.brand { letter-spacing: .06em; }
.brand-sub {
  margin-left: 8px; padding: 1px 5px;
  font-size: 9px; font-weight: 700; letter-spacing: .14em; font-stretch: 100%;
  color: var(--acid-ink); background: var(--acid);
  vertical-align: 3px;
}
.foot-brand { color: var(--text); font-weight: 700; letter-spacing: .3em; }

.hero { isolation: isolate; }
.hangul-bg {
  position: absolute; inset: 0; z-index: -1;
  pointer-events: none; user-select: none; -webkit-user-select: none;
}
.hangul-word {
  position: absolute;
  right: 0; bottom: 26px;
  font-family: "Black Han Sans", var(--f-wide);
  font-size: clamp(110px, 18vw, 270px);
  line-height: .9;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(212, 255, 30, .22);
  background: repeating-linear-gradient(-45deg, rgba(212, 255, 30, .09) 0 2px, transparent 2px 10px);
  -webkit-background-clip: text; background-clip: text;
}
.hangul-tag {
  position: absolute; right: 0; bottom: 8px;
  font-size: 10px; letter-spacing: .2em; white-space: nowrap;
  color: rgba(212, 255, 30, .38);
}

@media (max-width: 639px) {
  .hangul-word { font-size: 40vw; right: 0; bottom: 54px; -webkit-text-stroke: 1px rgba(212, 255, 30, .3); }
  .hangul-tag { display: none; }
}
@media (max-width: 479px) {
  .brand-sub { display: none; }
  .topmeta div:first-child { display: none; }
}
@media (forced-colors: active) { .hangul-bg { display: none; } }

/* =========================================================
   Mobile: decluttered layout — only what's needed to act
   ========================================================= */
@media (max-width: 639px) {
  :root { --gap: 12px; }
  .layout { padding-top: 14px; padding-bottom: 24px; }

  /* hero: title (+ background signature) and FAMI only */
  .hero { padding: 6px 0 12px; }
  .hero .tag, .hero .lede { display: none; }
  .hero h1 { margin-bottom: 10px; }
  .hero-deco span:not(.plain) { display: none; }

  /* tabs: name only */
  .mode { min-height: 56px; padding: 8px 12px; }
  .mode .sub { display: none; }

  /* warning: one short block, no stripe */
  .warnband { padding: 8px 12px; }
  .warnband::after, .wb-long { display: none; }
  .warnband p { padding-right: 0; font-size: 13px; }

  /* panels: drop decorative reference codes (friends' refs stay) */
  .pref:not(.keep) { display: none; }
  .panel { padding: 32px 14px 14px; }
  .status-panel { padding-bottom: 12px; }

  /* drop zone: the big button is enough */
  .dropzone { padding: 36px 14px 18px; }
  .reticle { width: 64px; height: 64px; }
  .drop-note { display: none; }

  /* session: essentials only */
  .ref-note, #barcode { display: none; }
  .code-big { font-size: 40px; margin-bottom: 10px; }
  .log { max-height: 88px; }
  .progress-panel.idle { display: none; }  /* shown once a transfer starts */

  /* bottom of page */
  .specs, .foot-tech { display: none; }
  .footer { padding-top: 12px; }
}

/* Connection route (direct / relayed) */
.route { margin: 10px 0 0; font-size: 12px; letter-spacing: .04em; color: var(--dim); }
.route b { font-weight: 700; }
.route[data-tone="ok"] b { color: var(--acid); }
.route[data-tone="warn"] b { color: var(--warn); }

/* ---------- Message with the files ---------- */
.msg-field { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line-2); }
.msg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.msg-count { font-size: 11px; color: var(--dim); }
.msg-input {
  display: block; width: 100%; min-height: 84px; resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--line-2); border-radius: 0;
  background: var(--bg); color: var(--text);
  font-family: var(--f-mono); font-size: 16px; line-height: 1.45; /* 16px: no zoom on iOS */
}
.msg-input:focus { outline: none; border-color: var(--acid); }
.msg-input::placeholder { color: var(--dim); opacity: .8; }
.msg-input:disabled { opacity: .5; }
.msg-note { margin: 6px 0 0; font-family: var(--f-wide); font-stretch: 100%; }

.msg-box {
  margin: 0 0 14px; padding: 12px 14px 14px;
  border-left: 3px solid var(--acid);
  background:
    repeating-linear-gradient(-45deg, rgba(212, 255, 30, .05) 0 2px, transparent 2px 9px),
    var(--bg);
}
.msg-box figcaption { font-size: 11px; letter-spacing: .12em; color: var(--acid); margin-bottom: 6px; }
.msg-text {
  margin: 0;
  font-family: var(--f-mono); font-size: 15px; line-height: 1.5; color: var(--text);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
@media (max-width: 639px) { .msg-note { display: none; } }
