/* The launcher's own parts; the rest is tvpipe's look (/_tvpipe/ui.css). */

body { min-height: 100vh; display: flex; flex-direction: column; }
.top, main, .foot { width: 100%; }
main { flex: 1; }

/* One column (no label column: the list needs the width), the status
   beside the title, the picture and the buttons in a bar that sticks to
   the bottom of the window however many TVs there are. */
main.pick { padding-top: 36px; padding-bottom: 0; display: flex; flex-direction: column; }
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; }
.head h1 { margin: 0; }
.head .state { font-size: 14px; }
.lead { color: var(--ink-2); font-size: 16px; margin: 8px 0 22px; }

/* The TVs: rows between rules. */
.devices { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.device { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; column-gap: 16px; align-items: center;
          padding: 11px 4px; border-bottom: 1px solid var(--rule); cursor: pointer; line-height: 1.5; }
.device:hover { background: var(--panel); }
.device input { appearance: none; display: grid; place-items: center; align-self: start; width: 16px; height: 16px; margin: 3px 0 0;
                border: 1.5px solid var(--ink-3); border-radius: 2px; background: var(--bg); cursor: pointer; }
.device input:checked { background: var(--accent); border-color: var(--accent); }
.device input:checked::after { content: ""; width: 4px; height: 8px; margin-top: -2px; border: solid var(--bg); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.device .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device .meta { font-size: 13.5px; color: var(--ink-2); }
.device .meta:empty { display: none; }
.device .pairing { font-size: 13.5px; color: var(--ink-2); }
.device .pairing.done { color: var(--accent); }
.device .pairing.bad { color: var(--bad); }
.device .end { display: flex; align-items: center; gap: 14px; }
.tag { font: 400 8.5px/1 var(--title); letter-spacing: .12em; text-transform: uppercase; white-space: nowrap;
       color: var(--ink-2); padding: 5px 7px 4px; border: 1px solid var(--rule); border-radius: 2px; }

.searching { margin: 14px 0 0; font-size: 13.5px; color: var(--ink-3); }

/* Web mode (tvpipe.party): one of this device's screens, a radio each. */
.device.radio input { border-radius: 50%; }
.device.radio input:checked::after { width: 6px; height: 6px; margin: 0; border: 0; border-radius: 50%; background: var(--bg); transform: none; }
.device.selected .name { color: var(--ink); }
.device.radio .name { white-space: normal; }
.device .steps { margin: 8px 0 2px; padding-left: 20px; font-size: 14px; color: var(--ink); }
.device .steps li { margin: 2px 0; }
/* The tvpipe app's row picked: its commands instead of Start. */
.device.open .end { align-self: start; }
.app-way { margin: 12px 0 4px; font-size: 14px; color: var(--ink-2); cursor: auto; scroll-margin-bottom: 110px; }
.app-way p { margin: 0; }
.app-intro { margin-bottom: 10px !important; color: var(--ink); }
.app-way .cmd { display: flex; align-items: center; gap: 14px; margin: 0 0 8px; padding: 8px 8px 8px 16px; background: var(--panel); border-radius: 3px; }
.app-way .cmd .lbl { flex: none; min-width: 96px; white-space: nowrap; }
.app-way .cmd code { flex: 1; min-width: 0; font-size: 14px; color: var(--ink); overflow-wrap: anywhere; user-select: all; }
.app-note { margin-top: 10px !important; max-width: 46em; }

/* The game picked on /games/, above the question. */
.web-game { margin: 0 0 30px; }
.web-game .back { display: inline-block; margin: 0 0 18px; font-size: 14px; color: var(--ink-2); text-decoration: none; }
.web-game .back:hover { color: var(--accent); }
.web-game-row { display: flex; align-items: center; gap: 20px; }
.web-game img { flex: none; width: 152px; height: auto; border-radius: 4px; box-shadow: 0 0 0 1px var(--rule); background: var(--panel); }
.web-title { font: 400 24px/1.2 var(--title); letter-spacing: -.01em; color: var(--ink); }
.web-facts { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }
.more { margin: 18px 0 0; font-size: 14px; color: var(--ink-2); }
.more .howto { margin: 10px 0 0; padding: 12px 16px; border-left: 2px solid var(--rule); }
.more .howto b { display: block; font-weight: 500; color: var(--ink); margin-bottom: 4px; }
.more .howto ol { margin: 0; padding-left: 20px; }
.more .howto p { margin: 0; }

/* The bar: the picture left, the buttons right. */
/* The gap above it: at least 24 px, the rest of the window when the list is short. */
.pick > .gap { flex: 1 0 24px; }
.bar { position: sticky; bottom: 0; z-index: 1; padding: 16px 0 20px; background: var(--bg); border-top: 1px solid var(--rule); }
.bar-row { display: flex; align-items: center; justify-content: space-between; gap: 14px 24px; flex-wrap: wrap; }
.bar .buttons { margin-left: auto; }
.error { margin: 0 0 14px; font-size: 14.5px; }

/* The resolution: one of a few. */
.res { display: grid; grid-template-columns: auto auto; align-items: center; column-gap: 14px; }
.res .seg { justify-self: start; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 3px; overflow: hidden; }
.seg button { font: 500 14px/1 var(--sans, inherit); padding: 9px 16px; border: 0; border-right: 1px solid var(--rule);
              background: var(--bg); color: var(--ink-2); cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--panel); }
.seg button[aria-checked="true"] { background: var(--accent); color: var(--bg); }
.res-note { grid-column: 2; margin: 6px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--ink-3); }
.res-note:empty { display: none; }

/* The cast picker (in a dialog over the host page): no header or footer,
   the dialog is the frame. */
[data-mode="change"] .top, [data-mode="change"] .foot { display: none; }
[data-mode="change"] main.pick { padding: 28px 28px 0; }

/* The AirPlay PIN. */
dialog { width: min(440px, calc(100vw - 40px)); padding: 28px 32px 30px; border: 1px solid var(--rule); border-radius: 4px;
         background: var(--bg); color: var(--ink); box-shadow: 0 18px 48px rgba(13, 24, 40, .18); }
dialog::backdrop { background: rgba(13, 24, 40, .45); }
dialog .lbl { display: block; margin-bottom: 12px; }
dialog h2 { overflow-wrap: anywhere; }
dialog p { margin: 0; color: var(--ink-2); }
dialog input { display: block; width: 100%; margin: 22px 0 0; padding: 12px 14px; text-align: center;
               font: 500 30px/1.2 var(--mono); letter-spacing: .35em; text-indent: .35em; font-variant-numeric: tabular-nums;
               color: var(--ink); background: var(--panel); border: 1px solid var(--rule); border-radius: 3px; }
dialog input::placeholder { color: var(--ink-3); opacity: .5; }
dialog input:focus { outline: none; border-color: var(--accent); }
dialog .error { margin-top: 12px; }
dialog .buttons { margin-top: 24px; }

/* TV sync: this screen's flashes, moved until they come with the TV's. */
dialog.sync { width: min(520px, calc(100vw - 40px)); }
.sync .pad { display: grid; place-items: center; height: 210px; margin: 22px 0 0;
             border: 1px solid var(--rule); border-radius: 4px; background: var(--panel); }
.sync .beat { display: grid; place-items: center; width: 140px; height: 140px; border-radius: 50%;
              border: 6px solid var(--rule); box-sizing: border-box; color: var(--ink-3);
              font-size: 64px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.sync .beat.flash { background: var(--ink); border-color: var(--ink); color: var(--panel); }
.sync .lag { display: flex; gap: 10px; align-items: center; margin-top: 18px; }
.sync .lag input { flex: 1; accent-color: var(--accent); }
.sync .value { margin: 8px 0 0; text-align: center; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sync .value b { color: var(--ink); }

@media (max-width: 720px) {
  main.pick, [data-mode="change"] main.pick { padding: 24px 20px 0; }
  .web-game img { width: 108px; }
  .app-way .cmd { flex-wrap: wrap; row-gap: 4px; }
  .app-way .cmd .lbl { width: 100%; }
  .res { grid-template-columns: auto; row-gap: 8px; }
  .res-note { grid-column: 1; margin: 0; }
  .device { grid-template-columns: 18px minmax(0, 1fr); }
  .device .end { grid-column: 2; justify-content: flex-start; margin-top: 8px; }
}
