/* Additive display: pure black = transparent. Keep backgrounds black, UI bright and high contrast. */
* { box-sizing: border-box; }
html, body {
  margin: 0; width: 600px; height: 600px; overflow: hidden;
  background: #000; color: #f2f2f2;
  font: 22px/1.25 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.hidden { display: none !important; }
#app { width: 600px; height: 600px; }
.screen { width: 600px; height: 600px; padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 10px; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 40px; flex-shrink: 0; }
.logo { font-size: 26px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dim { color: #9ab; font-size: 18px; }
.sub { color: #9ab; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label { color: #9ab; font-size: 17px; text-transform: uppercase; letter-spacing: .06em; margin: 6px 2px 0; }
.row { display: flex; gap: 10px; align-items: stretch; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.note { color: #9ab; font-size: 18px; margin: 0; }

.focusable { transition: border-color 120ms, box-shadow 120ms, background 120ms; border: 3px solid #333; }
.focusable:focus, .focusable.focused { outline: none; border-color: #00d4ff; box-shadow: 0 0 18px rgba(0, 212, 255, .6); }

.btn {
  min-height: 72px; padding: 0 14px; border-radius: 14px; background: #0b1a22; color: #fff;
  font: inherit; font-size: 22px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
}
.btn:focus { background: #06303d; }
.btn.small { min-height: 60px; font-size: 20px; }
.btn.icon { min-width: 72px; padding: 0 8px; font-size: 26px; }
.btn.on { color: #ffd166; }
.btn.active { border-color: #2d7d46; background: #0d2a17; }
.btn.active:focus { border-color: #00d4ff; }
.btn.danger { color: #ff8a8a; }
.btn.primary { background: #073a4b; }
.btn .i { font-size: 26px; line-height: 1; }
.btn .l { font-size: 18px; }
.btn.stack { flex-direction: column; gap: 2px; }

.scroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; padding: 4px; margin: -4px; display: flex; flex-direction: column; gap: 10px; }
.scroll::-webkit-scrollbar { display: none; }

/* Device card: [ main (opens detail) ][ quick action ] */
.card { display: flex; gap: 10px; flex-shrink: 0; }
.card .main {
  flex: 1; min-width: 0; min-height: 80px; border-radius: 14px; background: #0a0a0a; color: #fff; font: inherit; text-align: left;
  display: flex; align-items: center; gap: 12px; padding: 6px 12px; cursor: pointer;
}
.card .main:focus { background: #06303d; }
.card .ico { font-size: 30px; width: 40px; text-align: center; flex-shrink: 0; }
.card .meta { min-width: 0; display: flex; flex-direction: column; }
.card .t { font-size: 21px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .s { font-size: 18px; color: #9ab; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .s.on { color: #ffd166; }
.card .s.alert { color: #ff8a8a; }
.card .act { width: 120px; flex-shrink: 0; min-height: 80px; }

.tile {
  min-height: 84px; border-radius: 14px; background: #0a0a0a; color: #fff; font: inherit; cursor: pointer; padding: 6px 12px;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start; text-align: left;
}
.tile:focus { background: #06303d; }
.tile .t { font-size: 21px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tile .s { font-size: 17px; color: #9ab; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tile.scene .t::before { content: "▶ "; color: #00d4ff; }

.panel { border: 2px solid #22414d; border-radius: 16px; padding: 16px; background: #050b0e; }
.panel h2 { margin: 0 0 8px; font-size: 26px; }
.panel p { margin: 0 0 10px; font-size: 20px; line-height: 1.35; }
.panel .url { color: #7fe3ff; font-weight: 700; word-break: break-all; }
.empty { color: #8a99a6; font-size: 19px; padding: 8px 4px; }

/* PIN pad */
.pin-top { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dots { display: flex; gap: 14px; height: 30px; align-items: center; }
.dot { width: 20px; height: 20px; border-radius: 50%; border: 3px solid #5a6b75; }
.dot.f { background: #00d4ff; border-color: #00d4ff; }
.pin-msg { min-height: 26px; font-size: 19px; color: #9ab; text-align: center; }
.pin-msg.err { color: #ff8a8a; }
.pad { display: grid; grid-template-columns: repeat(3, 150px); gap: 10px; justify-content: center; }
.pad .btn { min-height: 84px; font-size: 32px; }

/* Device detail */
.big-state { font-size: 34px; font-weight: 700; display: flex; align-items: center; gap: 12px; }
.big-state.on { color: #ffd166; }
.big-state.alert { color: #ff8a8a; }
.readouts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; font-size: 20px; }
.readouts .k { color: #9ab; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper .val { flex: 1; text-align: center; font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stepper .name { width: 130px; color: #9ab; font-size: 19px; }
.stepper .btn { width: 96px; font-size: 30px; }
.swatch { width: 22px; height: 22px; border-radius: 50%; display: inline-block; border: 2px solid #fff3; }

/* TV remote */
.tv-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tv-grid .btn { min-height: 92px; }
.budget { font-size: 17px; color: #9ab; text-align: right; }
.budget.low { color: #ffb36b; }
.dpad-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; outline: none; }
.dpad { position: relative; width: 300px; height: 300px; }
.dpad .k { position: absolute; width: 100px; height: 100px; border: 3px solid #2a4a56; border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 40px; color: #cfe; }
.dpad .k.up { left: 100px; top: 0; } .dpad .k.down { left: 100px; top: 200px; }
.dpad .k.left { left: 0; top: 100px; } .dpad .k.right { left: 200px; top: 100px; }
.dpad .k.ok { left: 100px; top: 100px; border-radius: 50%; font-size: 26px; font-weight: 700; }
.dpad .k.hit { border-color: #00d4ff; background: #06303d; box-shadow: 0 0 22px rgba(0, 212, 255, .7); color: #fff; }
.hint { font-size: 18px; color: #9ab; text-align: center; line-height: 1.4; }

.confirm { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.confirm h2 { margin: 0; font-size: 32px; text-align: center; }
.confirm p { margin: 0; font-size: 21px; text-align: center; color: #cfe; }

.toast {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); max-width: 568px; width: max-content;
  background: #102a35; color: #fff; border: 2px solid #00d4ff; border-radius: 12px; padding: 10px 16px; font-size: 19px; z-index: 10; text-align: center;
}
.toast.warn { border-color: #ffb36b; background: #2a1d0b; }
.spinner { color: #9ab; font-size: 20px; padding: 20px; text-align: center; }
