/* Eden Rooms on the TV — a 10-foot interface for the PS5 browser, after homebrew.page's TV mode.
   Sized in rem from the viewport width (24px at 1920x1080), kept inside a title-safe margin, and
   driven by the D-pad: the focused element carries .is-focused, so no browser focus ring is
   needed. Only transform and opacity animate, which the console's browser composites cheaply. */

@font-face { font-family: "Inter"; src: url("../fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("../fonts/montserrat.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #0e0f24;
  --surface: #171926;
  --surface-2: #20213a;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f4efe6;
  --muted: #a9a59f;
  --gold: #ffd166;
  --green: #8fdab2;
  --red: #ff8a8a;
  --r1: #ffd166;
  --r2: #4fd1c5;
  --r3: #a78bfa;
  --r4: #f472b6;
  --display: "Montserrat", "Inter", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --safe-x: 3.6vw;
  --safe-y: 4.2vh;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: calc(100vw / 80); }
@media (max-aspect-ratio: 4/3) { html { font-size: calc(100vh / 45); } }

body.tv {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: var(--safe-y) var(--safe-x);
  cursor: default;
}
body.tv.uses-mouse { cursor: auto; }
:focus { outline: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.tv-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60vmax 45vmax at 78% -8%, rgba(66, 53, 143, 0.55), transparent 62%),
    radial-gradient(55vmax 45vmax at 4% 104%, rgba(36, 74, 184, 0.28), transparent 60%),
    radial-gradient(40vmax 34vmax at 100% 30%, rgba(255, 209, 102, 0.07), transparent 60%),
    var(--bg);
}

/* Top bar */

.tv-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.4rem; }
.tv-logo { display: flex; align-items: center; gap: 0.7rem; }
.tv-logo__mark { position: relative; width: 1.5rem; height: 1.5rem; margin: 0 0.3rem; border-radius: 23%; background: var(--gold); transform: rotate(45deg); }
.tv-logo__mark::after { content: ""; position: absolute; top: 27%; right: 27%; bottom: 27%; left: 27%; border-radius: 20%; background: var(--bg); }
.tv-logo__word { font: 500 1.1rem/1 var(--display); letter-spacing: 0.12em; text-transform: uppercase; }
.tv-logo__word em { display: block; margin-top: 0.3rem; font: 500 0.62rem/1 var(--body); font-style: normal; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); }
.tv-top__status { margin: 0; font-size: 1rem; color: var(--muted); }
.tv-top__status b { color: var(--text); font-weight: 600; }

/* Rooms */

.tv-main { min-height: 0; display: flex; flex-direction: column; gap: 1.4rem; padding: 0.6rem; margin: -0.6rem; }
.tv-grid { flex: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.3rem; }
.tv-tile {
  --tone: var(--gold);
  position: relative;
  display: block;
  padding: 1.3rem 1.4rem 1.2rem;
  border-radius: 1.1rem;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
  transition: transform 0.16s ease;
}
.tv-tile::before { content: ""; position: absolute; top: 0; right: 0; left: 0; height: 0.24rem; background: var(--tone); }
.tv-tile:nth-child(1) { --tone: var(--r1); }
.tv-tile:nth-child(2) { --tone: var(--r2); }
.tv-tile:nth-child(3) { --tone: var(--r3); }
.tv-tile:nth-child(4) { --tone: var(--r4); }
.tv-tile__head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.tv-tile__name { margin: 0; font: 500 1.25rem/1.15 var(--display); letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-tile__state { flex: none; padding: 0.3rem 0.6rem; border-radius: 0.5rem; background: rgba(143, 218, 178, 0.14); color: var(--green); font: 700 0.6rem/1 var(--body); letter-spacing: 0.12em; text-transform: uppercase; }
.tv-tile.is-off .tv-tile__state { background: rgba(255, 138, 138, 0.14); color: var(--red); }
.tv-tile.is-off::before { background: var(--red); }
.tv-tile__count { display: flex; align-items: baseline; gap: 0.6rem; margin: 0.9rem 0 0.6rem; }
.tv-tile__count b { font: 500 3.6rem/0.95 var(--display); letter-spacing: -0.04em; }
.tv-tile__count span { font-size: 0.95rem; color: var(--muted); }
.tv-tile__bar { display: block; height: 0.32rem; border-radius: 1rem; overflow: hidden; background: rgba(255, 255, 255, 0.1); }
.tv-tile__bar i { display: block; width: 100%; height: 100%; border-radius: 1rem; background: var(--tone); transform-origin: left center; transform: scaleX(0); transition: transform 0.3s ease; }
.tv-tile__port { display: block; margin: 0.8rem 0 0; font-size: 0.9rem; color: var(--muted); }
.tv-tile__port b { font: 700 1rem/1 var(--mono); color: var(--tone); }
.tv-tile.is-focused { transform: scale(1.05); z-index: 2; box-shadow: 0 0 0 0.22rem var(--bg), 0 0 0 0.42rem #fff, 0 1.2rem 2.6rem rgba(0, 0, 0, 0.55), 0 0 2.4rem rgba(255, 209, 102, 0.3); }

/* Chart */

.tv-chart { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 1.2rem 1.4rem 1rem; border-radius: 1.1rem; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.tv-chart__head { flex: none; display: flex; align-items: center; gap: 1.4rem; }
.tv-heading { margin: 0; font: 500 1.4rem/1.1 var(--display); letter-spacing: -0.02em; }
.tv-chart__peak { flex: 1; margin: 0; font-size: 0.9rem; color: var(--muted); }
.tv-chart__peak b { color: var(--text); font-weight: 600; }
.tv-ranges { display: flex; gap: 0.3rem; padding: 0.25rem; border-radius: 2rem; background: rgba(9, 9, 22, 0.5); box-shadow: 0 0 0 1px var(--line); }
.tv-ranges button { padding: 0.4rem 0.9rem; border-radius: 2rem; font: 600 0.8rem/1 var(--body); color: var(--muted); }
.tv-ranges button.is-current { background: var(--gold); color: var(--bg); }
.tv-chart__plot { flex: 1; min-height: 0; margin-top: 0.8rem; overflow: hidden; }
.tv-legend { flex: none; display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem; margin: 0.6rem 0 0; padding: 0; list-style: none; font-size: 0.8rem; color: var(--muted); }
.tv-legend li { display: inline-flex; align-items: center; gap: 0.5rem; }
.tv-legend i { width: 1.1rem; height: 0.2rem; border-radius: 1rem; background: var(--text); }
.tv-legend li:nth-child(2) i { background: var(--r1); }
.tv-legend li:nth-child(3) i { background: var(--r2); }
.tv-legend li:nth-child(4) i { background: var(--r3); }
.tv-legend li:nth-child(5) i { background: var(--r4); }

/* Detail */

.tv-detail {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  align-content: center;
  padding: calc(var(--safe-y) + 1rem) calc(var(--safe-x) + 4rem) calc(var(--safe-y) + 2.8rem);
  background: rgba(11, 11, 20, 0.97);
  animation: tv-in 0.18s ease;
}
@keyframes tv-in { from { opacity: 0; transform: scale(0.985); } }
.tv-kicker { margin: 0 0 0.6rem; font: 700 0.75rem/1 var(--body); letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); }
.tv-detail__name { margin: 0; font: 500 3.4rem/1.05 var(--display); letter-spacing: -0.035em; }
.tv-detail__desc { margin: 0.8rem 0 0; max-width: 46rem; font-size: 1.2rem; line-height: 1.45; color: var(--muted); }
.tv-attrs { display: flex; flex-wrap: wrap; gap: 0.9rem; margin: 1.8rem 0 0; padding: 0; }
.tv-attrs div { padding: 0.9rem 1.3rem; border-radius: 0.9rem; background: var(--surface-2); box-shadow: 0 0 0 1px var(--line); }
.tv-attrs dt { font: 700 0.62rem/1 var(--body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.tv-attrs dd { margin: 0.5rem 0 0; font: 700 1.5rem/1.1 var(--mono); }
.tv-attrs div.is-key dd { color: var(--gold); }
.tv-section-title { margin: 2rem 0 0.7rem; font: 700 1rem/1 var(--display); }
.tv-steps { margin: 0; padding-left: 1.5rem; font-size: 1.1rem; max-width: 50rem; }
.tv-steps li + li { margin-top: 0.45rem; }
.tv-steps li::marker { color: var(--gold); font-weight: 700; }

/* Hints */

.tv-hints { display: flex; justify-content: flex-end; gap: 1.8rem; margin-top: 1.2rem; font-size: 0.85rem; color: var(--muted); position: relative; z-index: 11; }
.tv-hints span { display: inline-flex; align-items: center; gap: 0.5rem; }
.tv-credit { margin: 0 auto 0 0; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tv-hints b { font-weight: 400; }
body.in-detail .tv-hints [data-grid-only] { display: none; }
.tv-glyph { display: inline-grid; place-items: center; width: 1.45rem; height: 1.45rem; border-radius: 50%; font: 700 0.8rem/1 var(--body); font-style: normal; background: rgba(255, 255, 255, 0.1); }
.tv-glyph--cross { color: #7cb6ff; }
.tv-glyph--circle { color: #ff6f7d; }
.tv-glyph--triangle { color: #3fe0b0; }
.tv-glyph--square { color: #f59ad8; }
.tv-glyph--dpad { background: none; border-radius: 0.2rem; box-shadow: inset 0 0 0 0.42rem var(--bg), inset 0 0 0 1rem rgba(255, 255, 255, 0.35); transform: rotate(45deg) scale(0.72); }

.tv-noscript { font-size: 1.2rem; }
.tv-noscript a { text-decoration: underline; }
