/* PadLink Go: prepared boards on the iPad or iPhone. */
:root {
  --bg: #eef1f7; --card: #ffffff; --ink: #1d2433; --ink2: #3a4256; --muted: #5b6478; --line: rgba(29, 36, 51, 0.1);
  --blue: #2f6bff; --blue-soft: #eef3ff; --good: #157f3c; --good-soft: #e7f6ec; --warn: #b45309; --warn-soft: #fff4e5; --bad: #b42318;
  --shadow: 0 1px 2px rgba(29, 36, 51, 0.06), 0 8px 24px rgba(29, 36, 51, 0.08);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font: 16px/1.4 -apple-system, "Segoe UI", system-ui, sans-serif; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }

.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: max(12px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 12px max(20px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, 0.94); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.logo { width: auto; height: 46px; }
h1 .wordmark { display: block; height: 26px; width: auto; margin: 2px 0 4px; }
.title { flex: 1; min-width: 160px; }
.title h1 { margin: 0; font-size: 21px; line-height: 1.2; }
.title p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { min-height: 44px; padding: 0 18px; border-radius: 12px; background: #e9edf5; color: var(--ink); font-weight: 650; font-size: 15px; }
.btn.primary { background: var(--blue); color: #fff; box-shadow: 0 6px 16px rgba(47, 107, 255, 0.25); }
.btn:active { transform: scale(0.98); }
.link { color: var(--blue); font-weight: 700; text-decoration: underline; padding: 0 4px; }

.banner { margin: 14px max(20px, env(safe-area-inset-left)) 0; padding: 12px 16px; border-radius: 14px; background: var(--warn-soft); color: #7a3d06; font-size: 15px; }
.banner.blue { background: var(--blue-soft); color: #1e4fc2; }

main { padding: 18px max(20px, env(safe-area-inset-right)) 24px max(20px, env(safe-area-inset-left)); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.card { position: relative; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; text-align: left; }
.card .thumb { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #f7f8fb; border-bottom: 1px solid var(--line); }
.card .info { position: relative; padding: 10px 12px 12px; }
.card .name { font-weight: 700; font-size: 16px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; padding-right: 34px; }
.card .meta { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.card .badge { display: inline-block; margin-top: 8px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--warn-soft); color: var(--warn); }
.card .badge.sent { background: var(--good-soft); color: var(--good); }
.card .open { position: absolute; inset: 0; z-index: 1; }
.card .more { position: absolute; z-index: 2; right: 4px; top: 4px; width: 40px; height: 40px; border-radius: 12px; font-size: 22px; line-height: 1; color: var(--ink2); }
.card .more:hover, .card .more:focus-visible { background: rgba(29, 36, 51, 0.06); }

.empty { max-width: 440px; margin: 12vh auto 0; text-align: center; }
.empty-art { width: 120px; height: 80px; margin: 0 auto 14px; border-radius: 12px; background: #fff; border: 2px dashed #c9d1e0; }
.empty h2 { margin: 0 0 6px; font-size: 21px; }
.empty p { margin: 0; color: var(--muted); }
.storage { padding: 4px max(20px, env(safe-area-inset-left)) max(18px, env(safe-area-inset-bottom)); color: var(--muted); font-size: 13px; text-align: center; }


.dialog { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: rgba(29, 36, 51, 0.45); }
.dialog-card { width: min(420px, 100%); padding: 22px; border-radius: 18px; background: #fff; box-shadow: 0 24px 64px rgba(29, 36, 51, 0.3); }
.dialog-card h2 { margin: 0 0 6px; font-size: 19px; }
.dialog-card p { margin: 0 0 14px; color: var(--ink2); }
.dialog-card p:empty { display: none; }
.dialog-card input { width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid #c9d1e0; border-radius: 12px; font: inherit; margin-bottom: 16px; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 10px; }
.dialog-buttons .danger { background: var(--bad); color: #fff; box-shadow: none; }

.menu { position: fixed; z-index: 25; min-width: 220px; padding: 6px; border-radius: 14px; background: #fff; box-shadow: 0 12px 40px rgba(29, 36, 51, 0.22); }
.menu button { display: block; width: 100%; min-height: 44px; padding: 0 14px; border-radius: 10px; text-align: left; font-size: 16px; }
.menu button:hover, .menu button:focus-visible { background: var(--blue-soft); }
.menu .danger { color: var(--bad); }

.toast { position: fixed; z-index: 40; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px; background: #1d2433; color: #fff; font-size: 15px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); }

/* Control the PC (stage 8) */
.btn.control { background: #1d2433; color: #fff; }

/* The PC's boards (stage 8e) */
.pc-text { margin: 0 0 10px; color: var(--ink2); }
.pc-list { display: flex; flex-direction: column; gap: 6px; min-height: 80px; }
.pc-list button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; border-radius: 12px; text-align: left; }
.pc-list button:active, .pc-list button:hover { background: var(--blue-soft); }
.pc-list img { flex: none; width: 96px; height: 54px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.pc-list b { display: block; }
.pc-list small { display: block; color: var(--muted); font-size: 13px; }
.pc-list .empty { color: var(--muted); padding: 8px; }

/* Help */
.btn.round { width: 44px; padding: 0; font-size: 19px; font-weight: 800; }
.help-card-go { max-height: min(720px, calc(100vh - 40px)); display: flex; flex-direction: column; }
.help-scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px 14px; padding: 0 4px; }
.help-scroll h3 { margin: 16px 0 4px; font-size: 16px; }
.help-scroll h3:first-child { margin-top: 4px; }
.help-scroll p { margin: 0 0 8px; color: var(--ink2); font-size: 15px; line-height: 1.5; }

/* Connecting: scanning the PC's QR code (stage 9) */
.scan-btn { width: 100%; min-height: 52px; font-size: 17px; margin-bottom: 12px; }
.scan-box { margin: 0 0 12px; text-align: center; }
.scan-box video { width: 100%; max-height: 46vh; object-fit: cover; border-radius: 14px; background: #000; }
.scan-box p { margin: 8px 0 0; color: var(--ink2); }
.pair-other { margin: 4px 0 12px; color: var(--ink2); }
.pair-other summary { cursor: pointer; min-height: 32px; }
.pair-other .pair-paste { margin-top: 8px; }
.pair-saved { margin: 14px 0 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.pair-saved h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.pair-saved-list { display: flex; flex-direction: column; gap: 6px; }
.pair-saved-list button { width: 100%; min-height: 46px; text-align: left; }
.pair-saved-list button b, .pair-saved-list button small { display: block; }
.pair-saved-list button small { margin-top: 2px; color: var(--muted); }

/* Pairing and sending */
.title p .link { font-size: 14px; padding: 0 2px; }
.dialog-card.wide { width: min(520px, 100%); }
.pair-steps { margin: 4px 0 16px; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; color: var(--ink2); }
.pair-paste { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.pair-paste input { flex: 1; min-width: 180px; min-height: 44px; margin: 0; }
.pin { margin: 6px 0 16px; text-align: center; font: 800 52px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.2em; color: var(--blue); }
.pair-msg { margin: 0 0 14px; padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); color: #7a3d06; font-size: 15px; }
.pair-msg.good { background: var(--good-soft); color: var(--good); }
.btn.danger-text { color: var(--bad); }
.btn:disabled { opacity: 0.5; }
.card .badge.sending { background: var(--blue-soft); color: #1e4fc2; }
.pair-page .pair-main { max-width: 560px; margin: 0 auto; padding: 24px 20px; font-size: 17px; }
.pair-page .pair-steps { font-size: 18px; gap: 16px; }
.pair-page .pair-steps .btn { margin-left: 8px; vertical-align: middle; }
.pair-page .ok { color: var(--good); font-weight: 700; margin-left: 8px; }
.pair-page .pair-alt, .pair-page .pair-small { color: var(--muted); font-size: 15px; }
.pair-page .pair-lead { font-size: 17px; color: var(--ink2); }
.pair-page .pair-other summary { font-size: 15px; }

.phone-only { display: none; }
@media (max-width: 600px) {
  .phone-only { display: block; }
  .actions .wide-only, .actions #helpOpen { display: none !important; }
  .actions { width: 100%; }
  .actions .btn { flex: 1; }
  .actions .btn.round { flex: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}

.auto-row { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0 4px; font-size: 15px; line-height: 1.35; cursor: pointer; }
.auto-row[hidden] { display: none; }
.auto-row input { flex: none; width: 20px; height: 20px; margin-top: 1px; }
