/*
 * Hand-written subset of the Tailwind classes used in src/views and public/js.
 * Replaces the Tailwind Play CDN, which needs modern JS and CSS variables.
 * Target floor: Samsung Tizen 3.0 TV browser (Chrome 47): no CSS variables, no grid,
 * no flex `gap`, no max()/min(). Grid and gap are enabled only under @supports;
 * older browsers get the flex + margin fallback below.
 * Adding a class to a view? Add its rule here too.
 */

/* ---------- reset (preflight subset) ---------- */
*, *::before, *::after { box-sizing: border-box; border: 0 solid #1e293b; }
html { -webkit-text-size-adjust: 100%; line-height: 1.5;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
html, body { margin: 0; background: #0b1220; color: #e2e8f0; }
h1, h2, p, pre, ul { margin: 0; padding: 0; }
h1, h2 { font-size: inherit; font-weight: inherit; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; margin: 0; }
button { background: transparent; cursor: pointer; padding: 0; }
input, select { background: transparent; padding: 0; }
input::-webkit-input-placeholder { color: #94a3b8; }
input::placeholder { color: #94a3b8; }
table { border-collapse: collapse; }
th { font-weight: inherit; }
pre { font-family: ui-monospace, Menlo, Consolas, monospace; }
summary { display: list-item; }
[hidden], .hidden { display: none !important; }
.mono { -webkit-font-feature-settings: "tnum" 1, "lnum" 1; font-feature-settings: "tnum" 1, "lnum" 1; font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.block { display: block; }
.flex { display: -webkit-flex; display: flex; }
.flex-wrap { -webkit-flex-wrap: wrap; flex-wrap: wrap; }
.flex-1 { -webkit-flex: 1 1 0%; flex: 1 1 0%; }
.shrink-0 { -webkit-flex-shrink: 0; flex-shrink: 0; }
.items-center { -webkit-align-items: center; align-items: center; }
.items-start { -webkit-align-items: flex-start; align-items: flex-start; }
.items-end { -webkit-align-items: flex-end; align-items: flex-end; }
.justify-between { -webkit-justify-content: space-between; justify-content: space-between; }
.justify-center { -webkit-justify-content: center; justify-content: center; }
.min-w-0 { min-width: 0; }
.min-h-screen { min-height: 100vh; }
.w-full { width: 100%; }
.w-5 { width: 1.25rem; } .h-5 { height: 1.25rem; }
.w-12 { width: 3rem; } .w-20 { width: 5rem; } .w-24 { width: 6rem; } .w-32 { width: 8rem; }
.max-w-md { max-width: 28rem; } .max-w-3xl { max-width: 48rem; } .max-w-5xl { max-width: 64rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.ml-auto { margin-left: auto; }
.mt-1 { margin-top: .25rem; } .mt-2 { margin-top: .5rem; } .mt-4 { margin-top: 1rem; } .mb-2 { margin-bottom: .5rem; }
.p-2 { padding: .5rem; } .p-3 { padding: .75rem; } .p-4 { padding: 1rem; } .p-6 { padding: 1.5rem; }
.px-1 { padding-left: .25rem; padding-right: .25rem; } .px-2 { padding-left: .5rem; padding-right: .5rem; }
.px-3 { padding-left: .75rem; padding-right: .75rem; } .px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-0\.5 { padding-top: .125rem; padding-bottom: .125rem; } .py-1 { padding-top: .25rem; padding-bottom: .25rem; }
.py-2 { padding-top: .5rem; padding-bottom: .5rem; } .py-3 { padding-top: .75rem; padding-bottom: .75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; } .py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
.pt-4 { padding-top: 1rem; } .pb-1 { padding-bottom: .25rem; }
.space-y-2 > * + * { margin-top: .5rem; } .space-y-3 > * + * { margin-top: .75rem; }
.space-y-4 > * + * { margin-top: 1rem; } .space-y-6 > * + * { margin-top: 1.5rem; }
.relative { position: relative; } .absolute { position: absolute; } .fixed { position: fixed; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-2 { top: .5rem; } .left-1\/2 { left: 50%; }
.-translate-x-1\/2 { -webkit-transform: translateX(-50%); transform: translateX(-50%); }
.z-0 { z-index: 0; } .z-10 { z-index: 10; } .z-50 { z-index: 50; }
.overflow-hidden { overflow: hidden; } .overflow-x-auto { overflow-x: auto; }
.pointer-events-none { pointer-events: none; }
.cursor-pointer { cursor: pointer; }
.select-none { -webkit-user-select: none; user-select: none; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border-width: 0; }

/* ---------- grid + gap: flex/margin fallback (old browsers) ---------- */
/* side margins only, so a parent's space-y margin-top still applies */
.grid { display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; margin-left: -.25rem; margin-right: -.25rem; }
.grid > * { margin: 0 .25rem .5rem; width: calc(100% - .5rem); }
.grid-cols-2 > * { width: calc(50% - .5rem); }
.col-span-2 { width: calc(100% - .5rem) !important; }
.flex.gap-2 > * + * { margin-left: .5rem; }
.flex.gap-3 > * + * { margin-left: .75rem; }
.flex > .sr-only + * { margin-left: 0; }
.flex.flex-wrap { margin-bottom: -.5rem; }
.flex.flex-wrap > * { margin-bottom: .5rem; }

/* ---------- grid + gap: real implementation (modern browsers) ---------- */
@supports (display: grid) {
  .grid { display: grid; margin-left: 0; margin-right: 0; }
  .grid > * { margin: 0; width: auto; }
  .grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
  .grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-cols-2 > * { width: auto; }
  .col-span-2 { grid-column: span 2 / span 2; width: auto !important; }
  .gap-2 { gap: .5rem; } .gap-3 { gap: .75rem; } .gap-4 { gap: 1rem; }
  .flex.gap-2 > * + *, .flex.gap-3 > * + * { margin-left: 0; }
  .flex.flex-wrap, .flex.flex-wrap > * { margin-bottom: 0; }
}

/* ---------- typography ---------- */
.text-xs { font-size: .75rem; line-height: 1rem; }
.text-sm { font-size: .875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.text-7xl { font-size: 4.5rem; line-height: 1; }
.font-semibold { font-weight: 600; } .font-bold { font-weight: 700; } .font-black { font-weight: 900; }
.text-left { text-align: left; } .text-center { text-align: center; } .text-right { text-align: right; }
.uppercase { text-transform: uppercase; }
.tracking-widest { letter-spacing: .1em; }
.tracking-\[0\.4em\] { letter-spacing: .4em; } .tracking-\[0\.5em\] { letter-spacing: .5em; }

/* ---------- colors (literal rgba, no CSS variables) ---------- */
.text-slate-300 { color: #cbd5e1; } .text-slate-400 { color: #94a3b8; }
.text-slate-500 { color: #64748b; } .text-slate-600 { color: #475569; }
.text-amber-300 { color: #fcd34d; } .text-amber-400 { color: #fbbf24; }
.text-red-100 { color: #fee2e2; } .text-red-200 { color: #fecaca; } .text-red-400 { color: #f87171; }
.placeholder-slate-600::-webkit-input-placeholder { color: #475569; }
.placeholder-slate-600::placeholder { color: #475569; }

.bg-slate-700 { background-color: #334155; } .bg-slate-800 { background-color: #1e293b; }
.bg-slate-800\/50 { background-color: rgba(30,41,59,.5); }
.bg-slate-900\/60 { background-color: rgba(15,23,42,.6); }
.bg-slate-950\/60 { background-color: rgba(2,6,23,.6); }
.bg-emerald-600 { background-color: #059669; }
.bg-amber-600 { background-color: #d97706; } .bg-amber-600\/30 { background-color: rgba(217,119,6,.3); }
.bg-red-900 { background-color: #7f1d1d; }
.bg-red-900\/40 { background-color: rgba(127,29,29,.4); } .bg-red-900\/90 { background-color: rgba(127,29,29,.9); }
.bg-black\/55 { background-color: rgba(0,0,0,.55); }

.border { border-width: 1px; } .border-t { border-top-width: 1px; }
.border-slate-800 { border-color: #1e293b; } .border-red-700 { border-color: #b91c1c; }
.rounded { border-radius: .25rem; } .rounded-lg { border-radius: .5rem; }
.rounded-xl { border-radius: .75rem; } .rounded-2xl { border-radius: 1rem; }
.accent-emerald-500 { accent-color: #10b981; }

.hover\:bg-slate-600:hover { background-color: #475569; } .hover\:bg-slate-700:hover { background-color: #334155; }
.hover\:bg-emerald-500:hover { background-color: #10b981; } .hover\:bg-amber-500:hover { background-color: #f59e0b; }
.hover\:bg-red-800:hover { background-color: #991b1b; }
.hover\:text-red-300:hover { color: #fca5a5; } .hover\:text-slate-200:hover { color: #e2e8f0; }
.focus\:outline-none:focus { outline: 2px solid transparent; outline-offset: 2px; }
.focus\:ring-2:focus { box-shadow: 0 0 0 2px #10b981; }
/* TV remotes and keyboards: always show where focus is */
button:focus, a:focus, select:focus, summary:focus { outline: 2px solid #10b981; outline-offset: 2px; }

/* ---------- responsive (sm 640px, md 768px) ---------- */
@media (min-width: 640px) {
  .grid.sm\:grid-cols-2 > * { width: calc(50% - .5rem); }
  @supports (display: grid) {
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid.sm\:grid-cols-2 > * { width: auto; }
  }
}
@media (min-width: 768px) {
  .md\:p-6 { padding: 1.5rem; }
  .md\:w-64 { width: 16rem; }
  .md\:text-2xl { font-size: 1.5rem; line-height: 2rem; }
  .md\:text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
  .md\:text-5xl { font-size: 3rem; line-height: 1; }
  .md\:text-9xl { font-size: 8rem; line-height: 1; }
  .grid.md\:grid-cols-3 > * { width: calc(33.333% - .5rem); }
  .grid.md\:grid-cols-4 > * { width: calc(25% - .5rem); }
  .grid.md\:grid-cols-5 > * { width: calc(20% - .5rem); }
  .grid.md\:grid-cols-3 > .md\:col-span-2 { width: calc(66.666% - .5rem); }
  @supports (display: grid) {
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .md\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .grid.md\:grid-cols-3 > *, .grid.md\:grid-cols-4 > *, .grid.md\:grid-cols-5 > *,
    .grid.md\:grid-cols-3 > .md\:col-span-2 { width: auto; }
    .md\:col-span-2 { grid-column: span 2 / span 2; }
  }
}
