/* Live device preview (preview.html). Uses the tokens in styles.css. */
html, body.pv { height: 100%; }
body.pv { display: flex; flex-direction: column; overflow: hidden; background: #0a1430; }
.pv-bar { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 14px; padding: 10px 16px; background: var(--navy); border-bottom: 1px solid var(--line); min-height: 64px; position: relative; z-index: 5; }
.pv-left, .pv-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pv-right { justify-content: flex-end; }
.pv-home { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14.5px; padding: 8px 10px; border-radius: 8px; white-space: nowrap; min-height: 44px; }
.pv-home:hover { color: var(--white); background: var(--navy-2); }
.pv-home img { width: 18px; height: auto; }
.pv-switch { display: flex; align-items: center; gap: 4px; min-width: 0; }
.pv-iconbtn { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); cursor: pointer; }
.pv-iconbtn:hover { color: var(--white); border-color: var(--muted-2); }
.pv-iconbtn svg { width: 18px; height: 18px; }
.pv-select { position: relative; min-width: 0; }
.pv-select select { appearance: none; -webkit-appearance: none; font: 600 15px var(--display); color: var(--white); background: var(--navy-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 36px 9px 14px; min-height: 40px; max-width: 290px; width: 100%; text-overflow: ellipsis; cursor: pointer; }
.pv-select::after { content: ""; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--cyan-light); border-bottom: 2px solid var(--cyan-light); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.pv-select option, .pv-select optgroup { color: var(--ink); background: var(--white); }
.pv-devices { display: inline-flex; gap: 3px; background: #0a1430; border: 1px solid var(--line-2); border-radius: 12px; padding: 4px; }
.pv-devices button { display: inline-flex; align-items: center; gap: 8px; font: 600 14px var(--display); color: var(--muted); background: transparent; border: 0; border-radius: 9px; padding: 8px 13px; min-height: 40px; cursor: pointer; white-space: nowrap; }
.pv-devices button:hover { color: var(--white); }
.pv-devices button[aria-pressed="true"] { background: var(--white); color: var(--navy); }
.pv-devices svg { width: 18px; height: 18px; flex: none; }
.pv-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background:
  radial-gradient(60% 80% at 50% 0%, rgba(5, 158, 196, .12), transparent 70%),
  linear-gradient(rgba(92,198,226,.05) 1px, transparent 1px) 0 0 / 40px 40px,
  linear-gradient(90deg, rgba(92,198,226,.05) 1px, transparent 1px) 0 0 / 40px 40px, #0a1430; }
.pv-row { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: var(--pad, 24px); }
.pv-group { display: flex; align-items: flex-end; gap: var(--gap, 32px); }
body[data-view="all"] .pv-group { margin-bottom: 22px; }
.pv-dev { position: relative; flex: none; margin: 0; transition: opacity .3s; }
.pv-dev[hidden] { display: none; }
.pv-dev .pv-scale { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.pv-dev iframe { display: block; border: 0; background: #ffffff; }
.pv-label { position: absolute; left: 50%; bottom: -26px; transform: translateX(-50%); font: 500 11.5px var(--mono); color: var(--muted-2); white-space: nowrap; }
body:not([data-view="all"]) .pv-label { display: none; }

/* Desktop: a browser window */
.pv-dev--desktop .pv-scale { background: #e8edf5; border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 40px 80px -30px rgba(0, 0, 0, .8); }
.pv-chrome { height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 16px; background: #e8edf5; border-bottom: 1px solid #cfd8e8; }
.pv-chrome i { width: 12px; height: 12px; border-radius: 50%; background: #c3cde0; }
.pv-chrome i:nth-child(1) { background: #ef6a5e; } .pv-chrome i:nth-child(2) { background: #f4bf4f; } .pv-chrome i:nth-child(3) { background: #61c454; }
.pv-url { margin-left: 18px; flex: 1; max-width: 560px; display: flex; align-items: center; gap: 8px; height: 26px; background: #ffffff; border-radius: 7px; padding: 0 12px; font: 500 13px var(--mono); color: #46557a; white-space: nowrap; overflow: hidden; }
.pv-url svg { width: 12px; height: 12px; color: #2e7d32; flex: none; }
/* Tablet and phone: device bezels */
.pv-dev--tablet .pv-scale { background: #111827; border-radius: 40px; padding: 22px; box-shadow: inset 0 0 0 2px #2b3445, 0 40px 80px -30px rgba(0, 0, 0, .8); }
.pv-dev--tablet iframe { border-radius: 14px; }
.pv-dev--mobile .pv-scale { background: #111827; border-radius: 58px; padding: 14px; box-shadow: inset 0 0 0 2px #2b3445, 0 40px 80px -30px rgba(0, 0, 0, .8); }
.pv-dev--mobile iframe { border-radius: 44px; }
.pv-notch { position: absolute; left: 50%; top: 4px; width: 64px; height: 5px; margin-left: -32px; background: #2b3445; border-radius: 3px; pointer-events: none; }
/* Loading */
.pv-load { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(232, 237, 245, .9); color: var(--royal); font: 600 15px var(--display); z-index: 3; transition: opacity .3s; }
.pv-dev--desktop .pv-load { top: 40px; }
.pv-dev--tablet .pv-load { inset: 22px; border-radius: 14px; }
.pv-dev--mobile .pv-load { inset: 14px; border-radius: 44px; }
.pv-dev:not(.is-loading) .pv-load { opacity: 0; pointer-events: none; }
.pv-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #c9d4ea; border-top-color: var(--teal); animation: pv-spin .8s linear infinite; margin: 0 auto 10px; }
@keyframes pv-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pv-spin { animation-duration: 2.4s; } }

.pv-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 18px; background: var(--navy); border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); min-height: 48px; }
.pv-meta { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pv-meta .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; box-shadow: 0 0 0 1px rgba(255,255,255,.25); }
.pv-meta b { color: var(--white); font-weight: 600; white-space: nowrap; }
.pv-meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-tag { flex: none; font: 500 11.5px var(--mono); color: var(--cyan-light); border: 1px solid var(--line-2); border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.pv-foot a { white-space: nowrap; }
.pv-keys { font: 500 12px var(--mono); color: var(--muted-2); white-space: nowrap; }
.pv-keys kbd { font: inherit; border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 5px; color: var(--muted); }

@media (max-width: 1180px) {
  .pv-devices .txt { display: none; }
  .pv-keys { display: none; }
}
@media (max-width: 900px) {
  .pv-bar { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "left right" "dev dev"; row-gap: 8px; padding: 8px 10px; }
  .pv-left { grid-area: left; } .pv-right { grid-area: right; } .pv-devices { grid-area: dev; justify-self: center; }
  .pv-home .txt, .pv-right .btn-outline { display: none; }
  .pv-devices .txt { display: inline; }
  .pv-feature { display: none; }
}
.pv-right .btn-primary .short { display: none; }
@media (max-width: 700px) { .pv-label { display: none; } body[data-view="all"] .pv-group { margin-bottom: 0; } }
@media (max-width: 560px) {
  .pv-devices .txt { display: none; }
  .pv-devices button { padding: 8px 16px; }
  .pv-right .btn-primary .long, .pv-foot .long { display: none; }
  .pv-right .btn-primary .short { display: inline; }
  .pv-select select { max-width: 170px; font-size: 14px; }
  .pv-iconbtn { width: 36px; height: 36px; }
  .pv-foot .pv-meta span:not(.pv-tag) { display: none; }
}
