/* TV Room — v0.6 | Core Stylesheet
 * Copyright (c) 2026 Stergios Koulouris. All rights reserved.
 */

:root {
  color-scheme: dark;
  --bg: #19232d;
  --bg-deep: #131c25;
  --panel: #25323d;
  --ink: #f3f0e9;
  --muted: #bbc5cc;
  --cream: #ddd6c5;
  --amber: #d8af59;
  --rental-blue: #304a65;
  --teal: #48696b;
  --cinema-red: #ac4246;
  --line: #455563;
  --font: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font: 15px/1.5 var(--font);
  background: radial-gradient(ellipse at 48% 0, #304354 0, transparent 58%), var(--bg);
  min-height: 100dvh;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  color: inherit;
  border: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.link-btn:focus-within {
  outline: 3px solid #f4c27a;
  outline-offset: 4px;
}

button:disabled {
  opacity: 0.35;
  cursor: default;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.hidden,
[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
header {
  background: var(--bg-deep);
  border-bottom: 1px solid #35434d;
}

.header-inner {
  height: 80px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #f0d7a2;
  font-family: var(--display);
  font-size: 26px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.7px;
  line-height: 1;
  white-space: nowrap;
}

.brand small {
  display: block;
  font-style: normal;
  font: 600 9px var(--font);
  letter-spacing: 1.5px;
  color: #bac5cd;
  margin-top: 7px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  flex: none;
  color: var(--amber);
}

.brand-screen {
  fill: var(--teal);
}

.demo {
  font-size: 10px;
  letter-spacing: 1.4px;
  color: #b0bfce;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.nav button {
  background: #23313f;
  border: 1px solid #50616e;
  color: #eef0ec;
  border-radius: 4px;
  padding: 10px 15px;
  transition: background-color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

@media (hover: hover) and (pointer: fine) {
  .nav button:hover {
    background: #2c3e4f;
    border-color: #7c93a3;
  }
}

.nav button[aria-current="page"] {
  background: var(--rental-blue);
  border-color: #8f9ea9;
  color: #fff;
}

.nav button.nav-accent {
  border-color: #8c7648;
  color: #f0d7a2;
}

@media (hover: hover) and (pointer: fine) {
  .nav button.nav-accent:hover {
    border-color: var(--amber);
    background: #2b353c;
  }
}

/* Page primitives */
.page {
  padding-top: 32px;
  padding-bottom: 38px;
}

.intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 1.15px;
  text-transform: uppercase;
  font-weight: 700;
  color: #e4bb6f;
  font-family: var(--font);
}

.demo-chip {
  font: 600 10px var(--font);
  letter-spacing: 1px;
  color: #b0bfce;
  border: 1px solid #4d5d6b;
  padding: 5px 8px;
  border-radius: 3px;
  text-transform: uppercase;
}

.demo-chip.is-personal {
  color: #f4dfb0;
  border-color: #9e8145;
  background: #252e31;
}

.primary {
  background: var(--amber);
  color: #18212b;
  font-weight: 800;
  border-radius: 4px;
  padding: 12px 19px;
  box-shadow: 0 3px 0 #9c7439;
  transition: background-color 0.2s;
}

@media (hover: hover) and (pointer: fine) {
  .primary:hover:not(:disabled) {
    background: #ebc57e;
  }
}

.ghost {
  padding: 9px 13px;
  background: #23313f;
  border: 1px solid #50616e;
  border-radius: 4px;
  color: #eef0ec;
  transition: background-color 0.2s, border-color 0.2s;
}

@media (hover: hover) and (pointer: fine) {
  .ghost:hover:not(:disabled) {
    background: #304152;
    border-color: #7c93a3;
  }
}

/* Home / Overview */
.home-hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid #64727a;
  border-radius: 5px;
  min-height: 330px;
  display: flex;
  align-items: center;
  padding: 38px;
  background: var(--bg);
}

.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, #19232d 4%, #19232df7 27%, #19232d88 52%, #19232d05 100%),
    linear-gradient(0deg, #121a2390, transparent 48%);
}

.hero-art {
  position: absolute;
  z-index: -2;
  right: 0;
  top: 0;
  width: 74%;
  height: 100%;
  object-fit: cover;
  object-position: 55% 52%;
}

.hero-text {
  max-width: 490px;
}

.hero-text h1 {
  font-family: var(--font);
  font-weight: 760;
  letter-spacing: -1px;
  color: #f4efe4;
  font-size: clamp(39px, 5.7vw, 68px);
  line-height: 1.02;
  margin: 12px 0;
}

.hero-text p {
  color: #d2d7d9;
  max-width: 440px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
}

.integration-note {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 16px 19px;
  margin-top: 17px;
  border-radius: 5px;
}

.note-mark {
  width: 25px;
  height: 25px;
  border: 1px solid #bca65f;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  font: italic 700 15px Georgia, serif;
  color: #f0c459;
}

.integration-note strong {
  color: #f1e7d4;
  font-size: 13px;
}

.integration-note p {
  color: #d2d7d9;
  font-size: 12px;
  line-height: 1.65;
  margin-top: 4px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  margin: 34px 0 15px;
  padding-bottom: 9px;
  color: #aab8c7;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  gap: 8px;
}

.feed {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.feed-item {
  background: none;
  text-align: left;
  padding: 0;
  min-width: 0;
}

.feed-item .poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 5px;
  border: 1px solid #5d6457;
  display: block;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}

.feed-item:focus-visible .poster {
  transform: translateY(-3px);
  border-color: var(--amber);
}

@media (hover: hover) and (pointer: fine) {
  .feed-item:hover .poster {
    transform: translateY(-3px);
    border-color: var(--amber);
  }
}

.feed-item .poster svg {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 4px;
}

.feed-item small {
  display: block;
  color: #aebbc4;
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stars {
  color: #d7ac70;
  letter-spacing: 1px;
}

/* Video Club Floor */
.room-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.room-top h1 {
  font-family: var(--font);
  font-weight: 760;
  letter-spacing: -1px;
  font-size: 38px;
  line-height: 1.15;
  color: #f4efe4;
}

.room-top p {
  color: var(--muted);
  margin-top: 5px;
}

.room-top-actions,
.shelf-top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.room-viewport {
  overflow: clip;
  overflow-clip-margin: 1px;
  border-radius: 6px;
}

.room-viewport:has(#roomScene[hidden]) {
  display: none;
}

.room-viewport:has(.approaching) {
  overflow: hidden;
}

.room {
  position: relative;
  isolation: isolate;
  aspect-ratio: 16 / 9;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #69737a;
  border-radius: 6px;
  background: #202d37;
  box-shadow: 0 18px 50px #0007;
}

.room:focus-within {
  overflow: hidden;
}

.room-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: -3;
  filter: saturate(0.89) contrast(1.02);
}

.scene-light {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(ellipse at 46% 54%, #ffe4a018 0, transparent 55%),
    radial-gradient(ellipse at 82% 36%, #60bdce1d 0, transparent 24%),
    radial-gradient(ellipse at 12% 70%, #fabb6d14, transparent 40%);
}

.room::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  box-shadow: inset 0 0 75px 5px #10182254;
  background: linear-gradient(0deg, #0b111c16, transparent 50%);
  border-radius: inherit;
}

.room.approaching {
  animation: approach 0.43s cubic-bezier(0.42, 0, 0.7, 1) forwards;
  transform-origin: var(--zoom-origin, 50% 50%);
  pointer-events: none;
}

.room-sign {
  position: absolute;
  top: 5%;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--display);
  font-size: clamp(17px, 2.7vw, 33px);
  font-weight: 900;
  font-style: italic;
  letter-spacing: 1px;
  background: #1a2229eb;
  border: 2px solid #ae6558;
  border-radius: 4px;
  padding: 7px 21px;
  color: #ffd9b6;
  text-shadow: 0 0 5px #ff8e64, 0 0 13px #d55d3b;
  box-shadow: 0 0 12px #c34a3b66, 0 4px 14px #000a;
  line-height: 1.1;
  white-space: nowrap;
  z-index: 1;
}

/* Interactive 2.5D Counters */
.counter {
  --accent: var(--cinema-red);
  --counter: #394b56;
  --counter-dark: #17252e;
  --sign-ink: #fff5e3;
  position: absolute;
  width: 25%;
  height: auto;
  padding: 0;
  background: none;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  filter: drop-shadow(7px 15px 9px #080c10b8);
  isolation: isolate;
  perspective: 850px;
  transform-style: preserve-3d;
  transform-origin: 50% 100%;
  transition: filter 0.25s, transform 0.28s;
  z-index: 2;
}

.counter::before {
  content: "";
  position: absolute;
  left: 2%;
  right: 2%;
  height: 22%;
  bottom: -10%;
  z-index: -1;
  transform: skewX(-11deg);
  background: radial-gradient(ellipse, #000c 0, transparent 72%);
  filter: blur(5px);
}

.counter:focus-visible {
  filter: drop-shadow(7px 15px 9px #080c10b8) brightness(1.15);
}

@media (hover: hover) and (pointer: fine) {
  .counter:hover {
    filter: drop-shadow(7px 15px 9px #080c10b8) brightness(1.15);
  }
}

.counter[data-shelf="watched"] {
  left: 12%;
  bottom: 13%;
  width: 25%;
  transform: rotateY(12deg) rotateZ(-1.5deg);
}

.counter[data-shelf="watchlist"] {
  --accent: var(--amber);
  --counter: var(--rental-blue);
  --counter-dark: #1b2b3a;
  --sign-ink: #202933;
  left: 39%;
  bottom: 25%;
  width: 23%;
  transform: rotateY(-4deg) scale(0.96);
  z-index: 1;
}

.counter[data-shelf="friends"] {
  --accent: var(--teal);
  --counter: #384e4d;
  --counter-dark: #1c3133;
  --sign-ink: #fff5e3;
  right: 9%;
  bottom: 10%;
  width: 25%;
  transform: rotateY(-10deg) rotateZ(1.2deg);
}

/* Counter hover and keyboard focus states */
.counter[data-shelf="watched"]:focus-visible {
  transform: rotateY(12deg) rotateZ(-1.5deg) translateY(-4px);
}

.counter[data-shelf="watchlist"]:focus-visible {
  transform: rotateY(-4deg) scale(0.96) translateY(-4px);
}

.counter[data-shelf="friends"]:focus-visible {
  transform: rotateY(-10deg) rotateZ(1.2deg) translateY(-4px);
}

@media (hover: hover) and (pointer: fine) {
  .counter[data-shelf="watched"]:hover {
    transform: rotateY(12deg) rotateZ(-1.5deg) translateY(-4px);
  }

  .counter[data-shelf="watchlist"]:hover {
    transform: rotateY(-4deg) scale(0.96) translateY(-4px);
  }

  .counter[data-shelf="friends"]:hover {
    transform: rotateY(-10deg) rotateZ(1.2deg) translateY(-4px);
  }
}

.counter-label {
  position: relative;
  z-index: 3;
  font-family: var(--display);
  font-size: clamp(10px, 1.42vw, 18px);
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.3px;
  line-height: 1.2;
  background: linear-gradient(115deg, #fff1, transparent 45%, #0002), var(--accent);
  color: var(--sign-ink);
  border: 1px solid #c6b28b;
  border-bottom: 3px solid #201b17;
  border-radius: 3px 3px 0 0;
  min-height: 33px;
  width: 94%;
  max-width: 94%;
  padding: 7px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: normal;
  box-shadow: inset 0 1px 3px #fff3, 0 2px 6px #0008;
  text-shadow: 0 1px 1px #0003;
}

.counter-cases {
  width: 93%;
  min-height: 0;
  aspect-ratio: 3.1 / 1;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 4px;
  background: linear-gradient(180deg, #16191b, #2c3234 72%, #15191b);
  border: 5px solid #606b6a;
  border-top: 0;
  border-bottom: 0;
  padding: 7px 5px 2px;
  box-shadow: inset 0 12px 22px #efc38418, inset 0 0 8px #000d;
  position: relative;
}

.counter-cases::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #fbd7a22e, transparent 42%, #0002);
  pointer-events: none;
}

.mini-case {
  display: block;
  width: 23%;
  aspect-ratio: 135 / 190;
  border: 2px solid #101416;
  border-left-width: 4px;
  box-shadow: 2px 3px 5px #000b;
  border-radius: 2px;
  transform: rotateX(-4deg);
  filter: saturate(0.98);
  background: #121619;
  overflow: hidden;
  position: relative;
}

.mini-case:nth-child(2) {
  transform: rotate(-1deg);
}

.mini-case:nth-child(4) {
  transform: rotate(1.2deg);
}

.mini-case svg {
  width: 100%;
  height: 100%;
  display: block;
}

.mini-case::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(130deg, #ffffff22, transparent 20%, transparent 75%, #ffffff0d);
  pointer-events: none;
}

.counter-edge {
  height: 11px;
  width: 99%;
  flex: none;
  background: linear-gradient(#c0b9a3 0, #a79c81 23%, #526060 34%, #82918a 60%, #374747 100%);
  border: 1px solid #253139;
  box-shadow: 0 3px 5px #0008;
}

.counter-base {
  width: 93%;
  height: clamp(29px, 4.7vw, 60px);
  min-height: 0;
  background:
    linear-gradient(180deg, #ffffff13, #0005),
    linear-gradient(90deg, var(--counter-dark), var(--counter) 12%, var(--counter) 84%, var(--counter-dark));
  border: 1px solid #556463;
  border-bottom: 5px solid #131f27;
  box-shadow: inset 0 4px 12px #0005, 4px 6px 6px #0009;
  position: relative;
}

.counter-base::after {
  content: attr(data-count);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font: 800 10px/1.2 var(--font);
  letter-spacing: 0.8px;
  color: #e8e4d9;
  white-space: nowrap;
}

.room-hint {
  position: absolute;
  bottom: 2.5%;
  left: 50%;
  transform: translateX(-50%);
  background: #172129d9;
  color: #f5eee2;
  border: 1px solid #7c8585;
  border-radius: 3px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15px;
  max-width: 90%;
  white-space: normal;
  text-align: center;
  box-shadow: 0 3px 9px #0005;
  z-index: 4;
}

/* Quick Access Bar */
.quick {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.quick button {
  background: var(--panel);
  border: 1px solid var(--line);
  text-align: left;
  padding: 14px 15px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  transition: border-color 0.2s, background-color 0.2s;
}

@media (hover: hover) and (pointer: fine) {
  .quick button:hover {
    border-color: var(--amber);
  }
}

.quick b {
  display: block;
  color: #f1e8d8;
  font-size: 14px;
  font-weight: 700;
}

.quick small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.quick .arrow {
  color: var(--amber);
  font-size: 20px;
}

/* Shelf Browser */
.shelf {
  background: linear-gradient(180deg, #283744, #1b252e);
  border: 1px solid #637277;
  border-radius: 8px;
  overflow: hidden;
  animation: shelf-arrive 0.36s ease-out;
}

.shelf-top {
  padding: 22px 26px;
  background: linear-gradient(115deg, #30404d, #202c35);
  border-bottom: 4px solid var(--cinema-red);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.shelf[data-shelf="watchlist"] .shelf-top {
  border-bottom-color: var(--amber);
}

.shelf[data-shelf="friends"] .shelf-top {
  border-bottom-color: var(--teal);
}

.shelf-top h2 {
  font-family: var(--font);
  font-weight: 760;
  letter-spacing: -1px;
  font-size: 32px;
  color: #f4efe4;
}

.shelf-top p {
  color: #c0cfdf;
  font-size: 13px;
  margin-top: 5px;
}

.controls {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
  padding: 16px 26px;
}

.controls input,
.controls select {
  background: #17232e;
  color: #f3f6fb;
  border: 1px solid #62727e;
  border-radius: 4px;
  padding: 9px 12px;
  min-width: 0;
}

.controls input {
  flex: 1;
  min-width: 150px;
}

.count {
  color: #c0cfdf;
  font-size: 12px;
}

.rack {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 22px 18px;
  padding: 18px 26px 28px;
  background:
    radial-gradient(ellipse at 50% 0, #f6ce8e13, transparent 65%),
    linear-gradient(180deg, #25343e, #17242e);
  perspective: 1000px;
}

.rack-more {
  padding: 0 26px 24px;
  text-align: center;
  background: #17242e;
}

.dvd-item {
  padding: 0;
  background: none;
  text-align: left;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.dvd {
  aspect-ratio: 135 / 190;
  position: relative;
  padding: 5px 4px 5px 9px;
  border-radius: 4px;
  background: linear-gradient(90deg, #0d1216, #495054 3%, #151a1e 7%, #171d20 95%, #555b5e 98%, #111 100%);
  box-shadow: 5px 7px 9px #000b, 9px 3px 0 -3px #101412;
  transform: rotateY(-3deg);
  transform-origin: bottom center;
  transition: transform 0.25s, box-shadow 0.25s;
}

.dvd-item:focus-visible .dvd {
  transform: translateY(-6px) rotateY(-7deg);
  box-shadow: 9px 11px 15px #0009;
}

@media (hover: hover) and (pointer: fine) {
  .dvd-item:hover .dvd {
    transform: translateY(-6px) rotateY(-7deg);
    box-shadow: 9px 11px 15px #0009;
  }
}

.dvd svg {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 1px;
}

.dvd::after {
  content: "";
  position: absolute;
  inset: 5px 4px 5px 9px;
  background: linear-gradient(120deg, #ffffff25, transparent 18%, transparent 76%, #ffffff13);
  border: 1px solid #ffffff0b;
  pointer-events: none;
}

.dvd-item .ledge {
  height: 12px;
  margin: 0 -6px 8px;
  background: linear-gradient(#b8b8ac 0, #a3a99e 24%, #586568 35%, #7b8986 80%, #343f44 100%);
  box-shadow: 0 5px 9px #0009;
}

.dvd-item b {
  font-size: 13px;
  color: #eaf1f8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dvd-item small {
  color: #b8c9da;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty {
  padding: 32px;
  text-align: center;
  color: #b8c9da;
  grid-column: 1 / -1;
}

.notice {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
}

/* Footer */
.footer {
  border-top: 1px solid var(--line);
  color: #b1bcc4;
  font-size: 11px;
  padding: 16px 0 calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* Dialogs & 3D DVD Case */
.dialog {
  width: min(830px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  border: 1px solid #6a7b83;
  border-radius: 10px;
  background: linear-gradient(135deg, #30404b, #18252e);
  color: #f2efe9;
  padding: 0;
  box-shadow: 0 25px 100px #000c;
}

.dialog::backdrop {
  background: #0b0d0dd9;
  backdrop-filter: blur(5px);
}

.dialog-head {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(135deg, #30404b, #23333e);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px 10px 20px;
  border-bottom: 1px solid var(--line);
}

.dialog-head button {
  font-size: 24px;
  line-height: 1;
  background: none;
  color: #d8e4ef;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  padding: 0;
}

.detail {
  display: grid;
  grid-template-columns: minmax(190px, 300px) 1fr;
  gap: 28px;
  padding: 24px;
}

.stage {
  perspective: 1000px;
  max-width: 252px;
  width: 100%;
  margin: 0 auto;
  container-type: inline-size;
}

.flip {
  --thickness: 15px;
  position: relative;
  aspect-ratio: 135 / 190;
  width: 100%;
  padding: 0;
  background: none;
  display: block;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transform: rotateY(-11deg) rotateX(2deg);
  transition: transform 0.75s cubic-bezier(0.35, 0.05, 0.22, 1);
}

.flip.turned {
  transform: rotateY(169deg) rotateX(-2deg);
}

.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 5px;
  overflow: hidden;
  background: #151a18;
  border: 5px solid #202523;
  border-left: 10px solid #202523;
  box-shadow: inset 0 0 0 1px #ffffff12, 0 12px 22px #0007;
  transform: translateZ(calc(var(--thickness) / 2));
}

.face svg {
  height: 100%;
  width: 100%;
  display: block;
}

.front {
  transform: rotateY(0deg) translateZ(calc(var(--thickness) / 2));
  -webkit-transform: rotateY(0deg) translateZ(calc(var(--thickness) / 2));
}

.front::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, #ffffff28, transparent 21%, transparent 77%, #ffffff10);
  pointer-events: none;
}

.back {
  transform: rotateY(180deg) translateZ(calc(var(--thickness) / 2));
  background: var(--cream);
  color: var(--bg);
  border-left-width: 5px;
  border-right-width: 10px;
  text-align: left;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.back h3 {
  font: 760 19px/1.1 var(--font);
  color: var(--bg);
}

.back p {
  font-size: 11px;
  line-height: 1.45;
  color: var(--bg);
}

.back .back-art {
  width: 100%;
  height: 26%;
  overflow: hidden;
  background: #514537;
}

.back .back-art svg {
  height: 190%;
  transform: translateY(-24%);
}

.back hr {
  border: 0;
  border-top: 1px solid #9a8e74;
  width: 100%;
  margin: 0;
}

.barcode {
  margin-top: auto;
  margin-left: auto;
  width: 54px;
  height: 22px;
  background: repeating-linear-gradient(90deg, #222 0 2px, #e6dcc1 2px 4px, #222 4px 5px, #e6dcc1 5px 8px);
}

.case-spine,
.case-opening {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 50%;
  width: var(--thickness);
  margin-left: calc(var(--thickness) / -2);
  background: linear-gradient(90deg, #0f1513, #39413c, #171c1a);
  border: 1px solid #454c46;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 2px;
}

.case-spine {
  transform: translateX(-50cqw) rotateY(-90deg);
  writing-mode: vertical-rl;
  font: 700 8px var(--font);
  color: #e1cba5;
  white-space: nowrap;
  overflow: hidden;
}

.case-opening {
  transform: translateX(50cqw) rotateY(90deg);
  background: linear-gradient(90deg, #252c28, #111715 45%, #485047 50%, #171d19 56%, #252c28);
}

.flip-hint {
  text-align: center;
  margin-top: 15px;
  color: #c1cedb;
  font-size: 12px;
}

.detail-info h2 {
  font-family: var(--font);
  font-weight: 800;
  letter-spacing: -1px;
  font-size: clamp(25px, 4vw, 36px);
  line-height: 1.12;
  margin: 8px 0 10px;
  color: #f4efe4;
}

.detail-info .meta {
  color: #c1cedb;
  font-size: 13px;
  margin-bottom: 14px;
}

.detail-info .summary {
  color: #d5cbb9;
  line-height: 1.65;
  font-size: 14px;
}

.activity {
  margin-top: 20px;
  padding: 12px 14px;
  background: #263b45;
  border-left: 2px solid var(--amber);
  font-size: 13px;
  color: #eaf1f8;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.modal-nav {
  display: flex;
  justify-content: space-between;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  gap: 12px;
  color: #c1cedb;
}

.modal-nav span {
  align-self: center;
  font-size: 12px;
}

/* CSV Import Modal */
.dialog-import {
  width: min(620px, calc(100% - 24px));
}

.import-body {
  padding: 22px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.import-body h2 {
  font-family: var(--font);
  font-weight: 760;
  letter-spacing: -0.6px;
  font-size: 26px;
  color: #f4efe4;
}

.import-lead {
  color: #d2d7d9;
  font-size: 14px;
}

.import-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.field select {
  background: #17232e;
  color: #f3f6fb;
  border: 1px solid #62727e;
  border-radius: 4px;
  padding: 9px 11px;
}

.dropzone {
  cursor: pointer;
  border: 1px dashed #7c8d99;
  border-radius: 6px;
  background: #17232eaa;
  padding: 22px 18px;
  text-align: center;
  transition: border-color 0.2s, background-color 0.2s;
}

.dropzone.is-dragover {
  border-color: var(--amber);
  background: #233340;
}

.dropzone small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.dropzone code {
  color: #f0d7a2;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.link-btn {
  color: var(--amber);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 700;
}

.import-feedback {
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 13px;
  background: #263b45;
  border-left: 3px solid var(--amber);
}

.import-feedback.is-error {
  background: #3b2328;
  border-left-color: var(--cinema-red);
  color: #ffd7d7;
}

.import-preview {
  background: #141e27;
  border: 1px solid #3c4d5a;
  border-radius: 5px;
  padding: 12px 14px;
  font-size: 12px;
  color: #d2d7d9;
}

.import-preview ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.import-preview li {
  margin: 3px 0;
}

.import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

/* Animations */
@keyframes approach {
  0% { transform: scale(1); opacity: 1; }
  75% { transform: scale(1.13); opacity: 0.7; }
  100% { transform: scale(1.17); opacity: 0; }
}

@keyframes shelf-arrive {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Tablet breakpoint */
@media (max-width: 850px) {
  .header-inner { gap: 10px; }
  .brand { font-size: 23px; }
  .rack { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .feed { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .room-sign { font-size: 24px; }
  .counter-label {
    min-height: 27px;
    font-size: clamp(10px, 1.5vw, 14px);
    padding: 5px 3px;
  }
  .counter-cases {
    gap: 2px;
    padding: 4px 3px 1px;
    border-width: 3px;
    border-top: 0;
    border-bottom: 0;
  }
  .counter-base { height: clamp(24px, 4.6vw, 42px); }
  .counter-base::after { font-size: 9px; }
  .room-hint { font-size: 10px; }
}

/* Prevent iOS Safari auto-zoom on form controls */
@media (max-width: 768px) {
  .controls input,
  .controls select,
  .field select {
    font-size: 16px;
  }
}

/* Mobile breakpoint */
@media (max-width: 550px) {
  .shell { padding-left: 14px; padding-right: 14px; }
  .header-inner {
    height: auto;
    min-height: 64px;
    padding-top: 10px;
    padding-bottom: 10px;
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .header-inner > .demo { display: none; }
  .brand { font-size: 18px; gap: 7px; letter-spacing: 0.2px; }
  .brand small { font-size: 7px; letter-spacing: 1px; }
  .brand-icon { width: 29px; height: 29px; }
  .nav { gap: 6px; flex-wrap: wrap; }
  .nav button { padding: 9px 10px; font-size: 11px; min-height: 36px; }
  .page { padding-top: 20px; }
  .demo-chip { font-size: 8px; letter-spacing: 0.4px; }
  .intro .eyebrow { font-size: 9px; letter-spacing: 1px; }
  .home-hero { padding: 24px; min-height: 318px; }
  .hero-art { width: 100%; opacity: 0.75; }
  .home-hero::before { background: linear-gradient(90deg, #19232de8, #19232d77); }
  .hero-text h1 { font-size: 43px; }
  .hero-text p { color: #f0eee7; }
  .integration-note { padding: 12px; gap: 10px; }
  .integration-note p { font-size: 11px; }
  .section-title { font-size: 10px; letter-spacing: 0.5px; }
  .feed { gap: 8px; }
  .room-top { align-items: flex-start; flex-wrap: wrap; }
  .room-top h1 { font-size: 30px; }
  .room-top p { font-size: 12px; }
  .room-top .ghost { font-size: 11px; white-space: nowrap; }
  .room { aspect-ratio: 4 / 5; }
  .room-bg { width: 100%; height: 100%; left: 0; object-fit: cover; object-position: 50% 50%; }
  .room-sign { top: 7%; font-size: 22px; padding: 5px 14px; }
  .counter[data-shelf="watchlist"] {
    left: 28%;
    bottom: 44%;
    width: 44%;
    transform: scale(0.94);
  }
  .counter[data-shelf="watched"] {
    left: 3%;
    bottom: 15%;
    width: 45%;
    transform: rotateY(7deg) rotateZ(-1deg);
  }
  .counter[data-shelf="friends"] {
    right: 3%;
    bottom: 15%;
    width: 45%;
    transform: rotateY(-7deg) rotateZ(1deg);
  }
  .counter[data-shelf="watchlist"]:focus-visible {
    transform: scale(0.94) translateY(-4px);
  }
  .counter[data-shelf="watched"]:focus-visible {
    transform: rotateY(7deg) rotateZ(-1deg) translateY(-4px);
  }
  .counter[data-shelf="friends"]:focus-visible {
    transform: rotateY(-7deg) rotateZ(1deg) translateY(-4px);
  }
  .counter-label {
    font-size: clamp(10px, 2.8vw, 13px);
    padding: 5px 2px;
    min-height: 28px;
    letter-spacing: 0;
  }
  .counter-base { height: 29px; }
  .counter-base::after { font-size: 8px; }
  .counter-edge { height: 8px; }
  .room-hint { bottom: 4%; font-size: 10px; }
  .quick { grid-template-columns: 1fr; gap: 6px; }
  .quick button { padding: 10px 12px; }
  .quick small { font-size: 11px; }
  .shelf-top { padding: 16px; align-items: flex-start; flex-wrap: wrap; }
  .shelf-top h2 { font-size: 25px; }
  .shelf-top p { font-size: 12px; }
  .shelf-top button { font-size: 11px; white-space: nowrap; }
  .controls { padding: 12px 13px; }
  .controls input { flex-basis: 100%; }
  .controls select { flex: 1; }
  .rack {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 12px 13px 20px;
    gap: 15px 10px;
  }
  .dvd { padding: 3px 3px 3px 6px; }
  .dvd::after { inset: 3px 3px 3px 6px; }
  .dvd-item b { font-size: 12px; }
  .dvd-item small { font-size: 10px; }
  .detail { grid-template-columns: 1fr; gap: 18px; padding: 17px; }
  .stage { max-width: min(215px, 62vw); }
  .flip { --thickness: 12px; }
  .face { border-width: 3px; border-left-width: 7px; }
  .back {
    border-left-width: 3px;
    border-right-width: 7px;
    padding: 10px;
    gap: 6px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .back h3 { font-size: 15px; }
  .back p { font-size: 10px; line-height: 1.4; }
  .barcode { height: 15px; flex: none; }
  .detail-actions button,
  .modal-nav button { min-height: 40px; }
  .modal-nav { padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .detail-info h2 { font-size: 26px; }
  .dialog-head { padding: 6px 10px 6px 15px; }
  .dialog-head .eyebrow { font-size: 10px; }
  .import-grid { grid-template-columns: 1fr; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
