/* TV frame and remote guide around the prototype. Add ?bare to the URL for just the 1920x1080 app filling the window. */
#room {
  position: fixed; inset: 0; direction: ltr;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px 40px; padding: 22px 40px 14px;
  background: radial-gradient(120% 95% at 38% 38%, #1e2333 0%, #0c0f16 55%, #050608 100%);
  color: #e9ecf2; font: 400 15px/1.45 'Noto Sans', system-ui, sans-serif;
  -webkit-user-select: none; user-select: none;
}
[dir=rtl] #screen { direction: rtl; }   /* the app follows the content language; the frame stays left-to-right */

#about { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
#about h1 { margin: 0; display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
#about .tag { padding: 3px 10px; border-radius: 999px; background: rgba(138,180,255,.15); color: #8ab4ff; font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
#about p { margin: 4px 0 0; max-width: 72ch; color: #a7afbe; }
#fs { display: inline-flex; align-items: center; gap: 8px; flex: none; padding: 9px 18px 9px 14px; border-radius: 999px; background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); font-size: 14px; font-weight: 600; white-space: nowrap; }
#fs:hover { background: rgba(255,255,255,.13); }
#fs .ms { font-size: 20px; }

/* The TV: bezel 10px each side and a 26px stand, so its width fits (height - 46) * 16/9 + 20. */
#tvwrap { min-width: 0; min-height: 0; container-type: size; display: grid; place-items: center; }
#tv { width: min(100cqw, calc((100cqh - 46px) * 16 / 9 + 20px)); }
#tv .bezel {
  padding: 10px; border-radius: 14px;
  background: linear-gradient(#1c1d22, #0a0a0c);
  box-shadow: 0 0 0 1px #2b2d34, inset 0 1px 0 rgba(255,255,255,.07), 0 34px 90px rgba(0,0,0,.6);
}
#screen { position: relative; aspect-ratio: 16 / 9; overflow: clip; background: #000; border-radius: 3px; }
#screen:fullscreen { border-radius: 0; }
#tv .stand { position: relative; height: 26px; }
#tv .stand::before { content: ''; position: absolute; left: 50%; top: 0; width: 7%; height: 19px; transform: translateX(-50%); background: linear-gradient(#18191d, #0d0e11); }
#tv .stand::after { content: ''; position: absolute; left: 50%; bottom: 0; width: 30%; height: 8px; transform: translateX(-50%); border-radius: 5px 5px 2px 2px; background: linear-gradient(#2a2b31, #131417); box-shadow: 0 10px 22px rgba(0,0,0,.55); }

/* Remote and key list; tv.js scales .gi down when the space is short. */
#guide { position: relative; width: 300px; min-height: 0; }
#guide .gi { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 300px; display: flex; flex-direction: column; align-items: center; gap: 26px; transform-origin: center; }
#guide .touch { display: none; margin: 0; max-width: 200px; color: #c2c8d3; font-size: 14px; }

#remote {
  width: 172px; padding: 30px 0 26px; border-radius: 86px / 70px;
  display: flex; flex-direction: column; align-items: center; gap: 24px;
  background: linear-gradient(165deg, #2c2f38, #16181d);
  box-shadow: 0 0 0 1px #363a44, inset 0 1px 0 rgba(255,255,255,.09), 0 20px 44px rgba(0,0,0,.5);
}
#remote button { color: #cfd4de; touch-action: manipulation; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
#remote .ms { font-size: 30px; }
.dpad { position: relative; width: 136px; height: 136px; border-radius: 50%; background: radial-gradient(circle, #15161b 40%, #0e0f13); box-shadow: inset 0 0 0 1px #3b3f49; }
.dpad button { position: absolute; display: grid; place-items: center; border-radius: 50%; }
.dpad .up    { left: 38px; top: 0;     width: 60px; height: 40px; }
.dpad .down  { left: 38px; bottom: 0;  width: 60px; height: 40px; }
.dpad .left  { left: 0;    top: 38px;  width: 40px; height: 60px; }
.dpad .right { right: 0;   top: 38px;  width: 40px; height: 60px; }
.dpad .ok {
  left: 41px; top: 41px; width: 54px; height: 54px;
  background: linear-gradient(#3b3f4a, #262931); box-shadow: 0 0 0 1px #4b505c, 0 2px 6px rgba(0,0,0,.4);
  color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .04em;
}
#remote .row { display: flex; gap: 26px; }
#remote .row > div { display: flex; flex-direction: column; align-items: center; gap: 6px; }
#remote .round { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(#323642, #1c1e25); box-shadow: 0 0 0 1px #40444f, 0 2px 6px rgba(0,0,0,.35); }
#remote .round .ms { font-size: 24px; }
#remote .cap { font-size: 11px; color: #8f97a6; white-space: nowrap; }
#remote button:hover { color: #fff; }
.dpad button.lit:not(.ok) { color: #8ab4ff; background: radial-gradient(circle, rgba(138,180,255,.32), transparent 70%); }
.dpad .ok.lit, #remote .round.lit { background: #8ab4ff; color: #0b1020; box-shadow: 0 0 0 1px #8ab4ff, 0 0 18px rgba(138,180,255,.55); }

#keys { margin: 0; width: 100%; display: grid; gap: 2px; }
#keys > div { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 12px; padding: 6px 10px; border-radius: 10px; transition: background .15s; }
#keys > div.lit { background: rgba(138,180,255,.16); }
#keys dt { display: flex; flex-wrap: wrap; gap: 4px; }
#keys dd { margin: 0; color: #c2c8d3; font-size: 13.5px; line-height: 1.35; }
kbd {
  display: inline-grid; place-items: center; min-width: 25px; height: 25px; padding: 0 7px; border-radius: 6px;
  background: linear-gradient(#30343e, #23262e); box-shadow: inset 0 -2px 0 rgba(0,0,0,.35), 0 0 0 1px #41454f;
  color: #eef1f6; font: 600 12px/1 'Noto Sans', system-ui, sans-serif;
}

#note { grid-column: 1 / -1; text-align: center; color: #7b8394; font-size: 12.5px; }

/* Portrait (tablets, phones): TV on top, remote and keys side by side under it. */
@media (max-aspect-ratio: 5/4) {
  #room { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 14px; padding: 16px 16px 10px; }
  #tvwrap { container-type: normal; }
  #tv { width: 100%; }
  #guide { width: auto; }
  #guide .gi { width: max-content; flex-direction: row; align-items: center; gap: 20px; }
  #keys { width: 320px; }
  #keys > div { grid-template-columns: 120px 1fr; gap: 8px; padding: 5px 6px; }
  #about h1 { font-size: 19px; }
  #about p { font-size: 13.5px; }
}
@media (max-width: 600px) { #fs { display: none; } }
/* Touch screens have no keyboard: the remote alone, with a tip for holding OK. */
@media (hover: none) and (pointer: coarse) { #keys { display: none; } #guide .touch { display: block; } }
@media (max-height: 560px) and (min-aspect-ratio: 5/4) { #about p { display: none; } #room { padding-top: 12px; gap: 10px 28px; } }

/* ?bare: the app alone, as before the frame existed */
.bare #about, .bare #guide, .bare #note, .bare #tv .stand { display: none; }
.bare #room { display: block; padding: 0; background: #000; }
.bare #tvwrap { container-type: normal; }
.bare #screen { position: fixed; inset: 0; aspect-ratio: auto; border-radius: 0; }
