/* Retro pager. Uses only tokens from theme.css. Escrowed; theme.css is the customer surface.
   No backdrop-filter anywhere: it renders as a black box in some FiveM NUI builds. */

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: clamp(11px, 1.25vh, 18px); }

body {
  font-family: var(--font-ui);
  color: var(--label);
  background: transparent;
  height: 100vh;
  overflow: hidden;
  user-select: none;
}

.hidden { display: none !important; }

/* ── Positioning ── */
#device, #toasts { position: fixed; }
body[data-position="bottom-right"] #device { right: 2rem; bottom: 2rem; }
body[data-position="bottom-left"]  #device { left: 2rem;  bottom: 2rem; }
body[data-position="top-right"]    #device { right: 2rem; top: 2rem; }
body[data-position="top-left"]     #device { left: 2rem;  top: 2rem; }
body[data-position="center"]       #device { left: 50%; top: 50%; transform: translate(-50%, -50%); }

/* Toasts sit on the opposite edge so they never cover the device. */
#toasts { top: 2rem; right: 2rem; display: flex; flex-direction: column; gap: 0.6rem; }
body[data-position^="top"] #toasts { top: auto; bottom: 2rem; }
body[data-position$="left"] #toasts { right: auto; left: 2rem; }

/* ── Device shell ── */
.device {
  --cols: 24;
  width: max-content;
  padding: 1.6rem 1.1rem 1.1rem;
  border-radius: 1.8rem 1.8rem 2.2rem 2.2rem;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0) 32%),
    linear-gradient(170deg, var(--shell-hi) 0%, var(--shell-mid) 48%, var(--shell-lo) 100%);
  box-shadow:
    inset 0 2px 0 var(--shell-edge),
    inset 0 -6px 10px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(0, 0, 0, 0.35),
    0 12px 22px rgba(0, 0, 0, 0.55);
}
/* belt clip nub */
.device::before {
  content: "";
  position: absolute; top: -0.45rem; left: 50%;
  width: 4rem; height: 0.7rem;
  transform: translateX(-50%);
  border-radius: 0.5rem 0.5rem 0 0;
  background: linear-gradient(var(--shell-hi), var(--shell-mid));
  box-shadow: inset 0 1px 0 var(--shell-edge), inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.brand-row { display: flex; align-items: center; gap: 0.7rem; padding: 0 0.4rem 0.7rem; }
.brand { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; color: var(--label); text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5); }
.model { flex: 1; font-size: 0.65rem; font-weight: 600; letter-spacing: 0.4em; color: rgba(255, 255, 255, 0.55); text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4); }
.led { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: #3a1414; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.6); }
.led.on { background: #ff3b3b; box-shadow: 0 0 8px 2px rgba(255, 59, 59, 0.75); animation: led 1s steps(2, jump-none) infinite; }

/* ── LCD ── */
.bezel {
  padding: 0.55rem;
  border-radius: 0.8rem;
  background: var(--lcd-bezel);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.85), 0 1px 0 rgba(255, 255, 255, 0.28);
}

.lcd {
  font-family: var(--font-lcd);
  font-size: var(--lcd-size);
  line-height: 1;
  width: calc(var(--cols) * 1ch);
  padding: 0.35rem 0.4rem 0.3rem;
  box-sizing: content-box;
  border-radius: 0.35rem;
  color: var(--lcd-ink);
  text-shadow: 1px 1px 0 rgba(28, 38, 22, 0.16);
  text-transform: uppercase;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.06) 0 1px, transparent 1px 3px),
    linear-gradient(var(--lcd-bg), var(--lcd-bg-lo));
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.35);
}

.lcd-title, .lcd-foot, .row { height: 1.15em; line-height: 1.15em; white-space: pre; overflow: hidden; }
.lcd-title { display: flex; justify-content: space-between; border-bottom: 2px solid var(--lcd-ink); margin-bottom: 0.15em; font-weight: 400; }
.lcd-body { height: calc(5 * 1.15em); }
.lcd-foot { display: flex; justify-content: space-between; margin-top: 0.15em; border-top: 1px solid var(--lcd-ink); opacity: 0.75; }
.lcd-foot.flash { opacity: 1; justify-content: center; font-weight: 400; animation: blink 0.5s steps(2, jump-none) 3; }

.row.area { height: auto; overflow: visible; }
.row.sel { background: var(--lcd-ink); color: var(--lcd-bg); text-shadow: none; }
.row.dim { opacity: 0.6; }
.row.field { display: flex; gap: 0.5ch; }
.row.field .lbl { flex: none; }
.row.field.cycle { cursor: pointer; }
.row.field.cycle:focus-visible, .lcd input:focus, .lcd textarea:focus { outline: none; background: rgba(28, 38, 22, 0.14); }

.lcd input, .lcd textarea {
  flex: 1; min-width: 0; width: 100%;
  font: inherit; color: inherit; text-shadow: inherit; text-transform: inherit;
  line-height: 1.15em;
  background: transparent; border: 0; border-bottom: 1px dotted var(--lcd-ink);
  padding: 0; border-radius: 0;
  caret-color: var(--lcd-ink);
  user-select: text;
}
.lcd textarea {
  height: calc(3 * 1.15em); resize: none; border-bottom: 0; overflow: hidden; display: block;
  /* ruled lines so the message area is visible while empty */
  background: repeating-linear-gradient(transparent 0 calc(1.15em - 1px), rgba(28, 38, 22, 0.35) calc(1.15em - 1px) 1.15em);
}
.lcd ::placeholder { color: var(--lcd-ink); opacity: 0.4; }

/* ── Buttons ── */
.buttons { display: grid; grid-template-columns: 1.1fr 1fr 1fr 1.3fr; gap: 0.6rem; padding: 0.9rem 0.3rem 0.1rem; }
.key {
  height: 2.2rem;
  border: 0; border-radius: 0.6rem;
  font: 700 0.75rem var(--font-ui); letter-spacing: 0.08em;
  color: var(--btn-label);
  background: linear-gradient(var(--btn-hi), var(--btn-lo));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 3px 0 #0a090d, 0 4px 6px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: transform 60ms steps(1), box-shadow 60ms steps(1);
}
.key:hover { color: #fff; }
.key:active, .key.pressed { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 0 #0a090d; }
.key:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.key-ok { color: #fff; background: linear-gradient(var(--accent-strong), var(--accent-dark)); }

/* ── Toasts: mini LCD strips ── */
.toast {
  font-family: var(--font-lcd);
  font-size: var(--lcd-size);
  line-height: 1.15;
  width: calc(var(--cols, 24) * 1ch + 1.2rem);
  padding: 0.35rem 0.4rem;
  text-transform: uppercase;
  color: var(--lcd-ink);
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.06) 0 1px, transparent 1px 3px), linear-gradient(var(--lcd-bg), var(--lcd-bg-lo));
  border: 0.4rem solid var(--lcd-bezel);
  border-radius: 0.7rem;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.55), inset 0 0 10px rgba(0, 0, 0, 0.3);
}
body { --cols: 24; }
.toast .t-head { display: flex; justify-content: space-between; border-bottom: 2px solid var(--lcd-ink); margin-bottom: 0.15em; }
.toast .t-head .star { animation: blink 0.6s steps(2, jump-none) infinite; }
.toast.urgent .t-head { background: var(--lcd-ink); color: var(--lcd-bg); border-bottom-color: var(--lcd-ink); }
.toast .t-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.toast.leaving { opacity: 0; }

/* ── Motion: stepped, like a real LCD ── */
@keyframes blink { 50% { opacity: 0; } }
@keyframes led { 50% { opacity: 0.25; } }

@media (prefers-reduced-motion: reduce) {
  .led.on, .toast .t-head .star, .lcd-foot.flash { animation: none; }
}
