/* Test sender (sender-test.php). Plain developer tool layout: controls on the left, QR on the right. */

:root {
  --bg: #eef0f5;
  --panel: #ffffff;
  --text: #1c1f26;
  --muted: #5b6270;
  --line: #d5d9e2;
  --accent: #c8102e;
  --ok: #0b7a3e;
  --warn: #a15c00;
  --err: #b00020;
}

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

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.top {
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.top h1 {
  margin: 0;
  font-size: 16px;
}

.note {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.note a {
  color: var(--accent);
}

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

/* ---------- controls ---------- */

.panel {
  overflow-y: auto;
  padding: 12px 16px 16px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.field {
  margin: 0 0 12px;
}

.field > label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

.field small,
.panel > small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: inherit;
  font: inherit;
}

input[type="file"] {
  max-width: 100%;
  font: inherit;
}

input[type="range"] {
  width: 100%;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row input[type="range"] {
  flex: 1;
  min-width: 0;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.info {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 10px;
  margin: 0 0 14px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f7f8fb;
}

.info dt {
  color: var(--muted);
}

.info dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.hash {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.3;
}

progress {
  display: block;
  width: 100%;
  margin: -6px 0 12px;
}

.hint {
  margin: -6px 0 14px;
  padding: 6px 10px;
  border-left: 3px solid var(--warn);
  background: #fff6e8;
  color: var(--warn);
  font-size: 13px;
}

.mono {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.buttons {
  display: flex;
  gap: 8px;
}

button {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

button.primary {
  flex: 1;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

button.primary.running {
  border-color: var(--text);
  background: var(--text);
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

.status {
  min-height: 1.4em;
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.status.error {
  color: var(--err);
  font-weight: 600;
}

.status.warn {
  color: var(--warn);
}

/* ---------- QR stage ---------- */

.stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #fff;
}

.qr-box {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fff;
}

.qr-box.manual {
  overflow: auto;
  /* "safe" keeps a QR bigger than the box scrollable from its top-left corner */
  align-items: safe center;
  justify-content: safe center;
}

#qr {
  display: block;
  flex: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.placeholder {
  position: absolute;
  margin: 0;
  color: var(--muted);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 18px;
  padding: 6px 12px 8px;
  border-top: 1px solid var(--line);
  background: #fff;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
}

#st-frame {
  font-weight: 700;
}

.dim {
  color: var(--muted);
  font-size: 13px;
}

.stage:fullscreen {
  padding: 0;
}

/* ---------- phones ---------- */

@media (max-width: 720px) {
  body {
    height: auto;
    min-height: 100vh;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  .panel {
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .qr-box {
    flex: none;
    aspect-ratio: 1 / 1;
  }

  .stage:fullscreen .qr-box {
    flex: 1;
    aspect-ratio: auto;
  }
}
