/* Liberandum screen simulator: the frame around the simulated phone.
   Uses the site's tokens (css/style.css) when present, with fallbacks. */
.lbsim {
  --s-bg: var(--bg-2, #0F141B);
  --s-panel: var(--panel, #121820);
  --s-panel-2: var(--panel-2, #1A222C);
  --s-line: var(--line, #243040);
  --s-line-2: var(--line-2, #3A4757);
  --s-text: var(--text, #E8ECF1);
  --s-muted: var(--muted, #AEB8C4);
  --s-faint: var(--faint, #7F8B99);
  --s-accent: var(--accent, #2A66D6);
  --s-focus: var(--signal, #64D2FF);
  --s-ok: var(--ok, #7FD19E);
  --s-mono: var(--mono, ui-monospace, Menlo, Consolas, monospace);
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--s-text);
  font-family: var(--body, system-ui, sans-serif);
  -webkit-tap-highlight-color: transparent;
}
.lbsim button { font: inherit; color: inherit; }
.lbsim :focus-visible { outline: 2px solid var(--s-focus); outline-offset: 2px; }

.lbsim-main { display: flex; align-items: center; justify-content: center; gap: 18px; }
.lbsim-stage { flex: 0 1 auto; min-width: 0; display: flex; justify-content: center; }
.lbsim-scaler { position: relative; flex: none; }
.lbsim-device { position: absolute; top: 0; left: 0; transform-origin: 0 0; }

/* Ulefone Armor 27T Pro+ in landscape: rugged body, drawn to scale around the 820 x 360 screen. */
.lbsim-phone {
  position: relative;
  box-sizing: border-box;
  border-radius: 58px;
  background: linear-gradient(160deg, #2b2f34 0%, #17191c 42%, #101113 100%);
  box-shadow: inset 0 0 0 2px #3a3f45, inset 0 0 0 9px #141619, 0 24px 60px rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lbsim-bump { position: absolute; width: 118px; height: 118px; border: 20px solid #2c3036; box-sizing: border-box; pointer-events: none; }
.lbsim-bump--tl { top: -6px; left: -6px; border-right: 0; border-bottom: 0; border-top-left-radius: 66px; }
.lbsim-bump--tr { top: -6px; right: -6px; border-left: 0; border-bottom: 0; border-top-right-radius: 66px; }
.lbsim-bump--bl { bottom: -6px; left: -6px; border-right: 0; border-top: 0; border-bottom-left-radius: 66px; }
.lbsim-bump--br { bottom: -6px; right: -6px; border-left: 0; border-top: 0; border-bottom-right-radius: 66px; }
/* side keys: the portrait right edge (power, volume) and left edge (custom key) are the top and bottom edges in landscape */
.lbsim-key { position: absolute; height: 10px; border-radius: 4px; background: linear-gradient(#3a3f46, #22262b); pointer-events: none; }
.lbsim-key--power { top: -8px; left: 520px; width: 64px; }
.lbsim-key--vol { top: -8px; left: 620px; width: 128px; }
.lbsim-key--custom { bottom: -8px; left: 560px; width: 70px; background: linear-gradient(#e0662a, #a8441a); }
.lbsim-glass {
  position: relative;
  flex: none;
  border-radius: 22px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 0 5px #000, 0 0 0 6px #25282c;
}
.lbsim-screen { display: block; width: 820px; height: 360px; border: 0; background: #0D1219; }
/* punch-hole front camera, left of the screen in landscape */
.lbsim-camera { position: absolute; left: 14px; top: 50%; width: 15px; height: 15px; margin-top: -7.5px; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #1d2733 0 25%, #050607 45%); box-shadow: 0 0 0 2px #000; pointer-events: none; }
.lbsim[data-power="off"] .lbsim-glass, .lbsim[data-power="rebooting"] .lbsim-glass { box-shadow: 0 0 0 5px #000, 0 0 0 6px #25282c; }

/* Chrome for Android's JavaScript dialog (dark theme), in phone pixels */
.lbsim-jsdialog { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.32); font-family: Roboto, 'Segoe UI', system-ui, sans-serif; }
.lbsim-jsdialog__card { width: 312px; max-width: 80%; box-sizing: border-box; padding: 24px 24px 12px; border-radius: 28px; background: #2b2d31; color: #e3e3e3; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); }
.lbsim-jsdialog__title { margin: 0 0 12px; font-size: 16px; font-weight: 500; }
.lbsim-jsdialog__text { margin: 0; font-size: 14px; line-height: 20px; color: #c4c7c5; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 150px; overflow: auto; }
.lbsim-jsdialog__row { display: flex; justify-content: flex-end; margin-top: 12px; }
.lbsim-jsdialog__ok { min-height: 40px; padding: 0 16px; border: 0; border-radius: 20px; background: transparent; color: #a8c7fa; font: 500 14px Roboto, 'Segoe UI', system-ui, sans-serif; cursor: pointer; }
.lbsim-jsdialog__ok:hover { background: rgba(168, 199, 250, 0.08); }

/* Liberandum hardware */
.lbsim-hw { flex: none; display: flex; flex-direction: column; gap: 10px; width: 150px; }
.lbsim-trigger {
  display: flex; align-items: center; gap: 12px; min-height: 76px; padding: 12px 14px;
  border: 1px solid var(--s-line-2); border-radius: 14px; background: linear-gradient(180deg, #232b36, #161c24);
  text-align: left; cursor: pointer; user-select: none; touch-action: none;
}
.lbsim-trigger strong { display: block; font-size: 15px; font-weight: 600; }
.lbsim-trigger small { display: block; font-size: 12px; color: var(--s-muted); }
.lbsim-trigger__dot { flex: none; width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #7fb0ff, var(--s-accent) 60%, #123a86); box-shadow: 0 3px 0 #0e2a63, 0 0 0 3px #0b0e12; transition: transform 0.06s ease, box-shadow 0.06s ease; }
.lbsim-trigger.is-down { border-color: var(--s-focus); }
.lbsim-trigger.is-down .lbsim-trigger__dot { transform: translateY(3px); box-shadow: 0 0 0 #0e2a63, 0 0 0 3px #0b0e12, 0 0 14px rgba(100, 210, 255, 0.7); }
.lbsim[data-power="off"] .lbsim-trigger, .lbsim[data-power="rebooting"] .lbsim-trigger { opacity: 0.55; }

.lbsim-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 14px;
  border: 1px solid var(--s-line-2); border-radius: 8px; background: var(--s-panel-2); cursor: pointer; font-size: 14px; font-weight: 500;
}
.lbsim-btn:hover { border-color: var(--s-muted); }
.lbsim-btn[disabled] { opacity: 0.5; cursor: default; }
.lbsim-btn--quiet { background: transparent; }
.lbsim-btn[aria-pressed="true"] { background: var(--s-text); color: #0A0E13; border-color: var(--s-text); }
.lbsim-power::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--s-faint); }
.lbsim[data-power="on"] .lbsim-power::before { background: var(--s-ok); box-shadow: 0 0 8px var(--s-ok); }
.lbsim[data-power="rebooting"] .lbsim-power::before { background: #E8B865; }

.lbsim-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.lbsim-seg { display: inline-flex; }
.lbsim-seg .lbsim-btn { border-radius: 0; }
.lbsim-seg .lbsim-btn:first-child { border-radius: 8px 0 0 8px; }
.lbsim-seg .lbsim-btn:last-child { border-radius: 0 8px 8px 0; border-left: 0; }
.lbsim-reset { margin-left: auto; }
.lbsim-note { margin: 0; font-size: 13px; color: var(--s-muted); }

/* Field panel */
.lbsim-field { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 14px; padding: 14px; border: 1px solid var(--s-line); border-radius: 12px; background: var(--s-bg); }
.lbsim-field__map { position: relative; min-width: 0; min-height: 260px; }
.lbsim-zoom { position: absolute; top: 8px; left: 8px; display: flex; flex-direction: column; gap: 4px; }
.lbsim-zoom__btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--s-line-2); border-radius: 7px; background: rgba(18, 24, 32, 0.88); font-size: 19px; line-height: 1; cursor: pointer; }
.lbsim-zoom__btn:hover { background: var(--s-panel-2); }
.lbsim-zoom__btn:disabled { opacity: 0.35; cursor: default; }
/* The map fills its box (as tall as the controls beside it) without adding to its height. */
.lbsim-map { position: absolute; inset: 0; display: block; width: 100%; height: 100%; border-radius: 8px; cursor: crosshair; touch-action: manipulation; }
.lbsim-field__side { display: flex; flex-direction: column; gap: 12px; }
.lbsim-field__head { display: flex; align-items: baseline; justify-content: space-between; }
.lbsim-label { font-family: var(--s-mono); font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--s-muted); }
.lbsim-heading { font-family: var(--s-mono); font-size: 24px; font-variant-numeric: tabular-nums; }
.lbsim-field__row { display: flex; flex-wrap: wrap; gap: 8px; }
.lbsim-pad { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 48px); gap: 6px; }
.lbsim-pad__btn { display: flex; align-items: center; justify-content: center; border: 1px solid var(--s-line-2); border-radius: 8px; background: var(--s-panel-2); cursor: pointer; touch-action: none; user-select: none; }
.lbsim-pad__btn:active { background: var(--s-line-2); }
.lbsim-pad__btn:nth-child(1) { grid-column: 1; grid-row: 1 / span 2; }
.lbsim-pad__btn:nth-child(2) { grid-column: 2; grid-row: 1; }
.lbsim-pad__btn:nth-child(3) { grid-column: 3; grid-row: 1 / span 2; }
.lbsim-pad__btn:nth-child(4) { grid-column: 2; grid-row: 2; }
.lbsim-pad--turn { grid-template-columns: repeat(2, 1fr); grid-template-rows: 56px; }
.lbsim-pad--turn .lbsim-pad__btn:nth-child(n) { grid-column: auto; grid-row: auto; }
.lbsim-field__status { color: #FFD60A; }

/* Too narrow for the Liberandum's buttons beside a real-size phone: they go under it. */
.lbsim--stack .lbsim-main { flex-direction: column; align-items: stretch; }
.lbsim--stack .lbsim-hw { flex-direction: row; width: auto; }
.lbsim--stack .lbsim-hw > * { flex: 1; }

/* Real-size calibration */
.lbsim-dialog { max-width: min(560px, calc(100vw - 32px)); padding: 22px; border: 1px solid var(--s-line-2); border-radius: 12px; background: var(--s-panel); color: var(--s-text); }
.lbsim-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.lbsim-dialog h3 { margin: 0 0 8px; font-size: 18px; }
.lbsim-dialog p { margin: 0 0 16px; color: var(--s-muted); }
.lbsim-dialog input[type="range"] { width: 100%; margin: 16px 0; }
.lbsim-card { border: 2px dashed var(--s-text); border-radius: 3.2mm; }

@media (max-width: 760px) {
  .lbsim-main { flex-direction: column; align-items: stretch; }
  .lbsim-hw { flex-direction: row; width: auto; }
  .lbsim-hw > * { flex: 1; }
  .lbsim-field { grid-template-columns: 1fr; }
}
