/* TVN Share3D — giao diện viewer. Luôn tối (nền tối giúp nhìn rõ tủ), không theo chế độ sáng/tối của máy. */
:root {
  --tv-top: #1c2128;
  --tv-bot: #2c3138;
  --tv-chrome: rgba(20, 22, 26, .9);
  --tv-line: rgba(255, 255, 255, .11);
  --tv-fg: #f2f3f5;
  --tv-muted: #9aa3ad;
  --tv-led: #ffcf7a;
  --tv-led-ink: #2a1b00;
  --tv-hl: #ffb05c;
  --tv-warn: #ff9b7a;
  --tv-shadow: 0 8px 26px rgba(0, 0, 0, .42);
  --tv-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tv-num: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
html, body { height: 100%; margin: 0; background: var(--tv-top); overflow: hidden; overscroll-behavior: none; }
[hidden] { display: none !important; }
#tvn3d { position: fixed; inset: 0; font: 14px/1.4 var(--tv-font); color: var(--tv-fg);
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#tvn3d *, #tvn3d *::before, #tvn3d *::after { box-sizing: border-box; }
/* :where() = độ ưu tiên 0 → .tv-btn[aria-pressed] đổi được màu chữ */
:where(#tvn3d) button { font: inherit; color: inherit; cursor: pointer; }
:where(#tvn3d) button:focus-visible { outline: 2px solid var(--tv-hl); outline-offset: 2px; }
:where(#tvn3d) svg { display: block; flex: 0 0 auto; }

.tv-vp { position: absolute; inset: 0; touch-action: none;
  background: linear-gradient(180deg, var(--tv-top) 0%, var(--tv-bot) 62%, #1a1d22 100%); }
.tv-vp canvas { display: block; width: 100%; height: 100%; touch-action: none; }

.tv-ui { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; gap: 10px; pointer-events: none;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
           max(12px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.tv-ui > * { pointer-events: auto; }
.tv-top { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; pointer-events: none; }
.tv-top > * { pointer-events: auto; }
.tv-mid { flex: 1 1 auto; min-height: 0; position: relative; pointer-events: none; }

.tv-proj { max-width: min(70vw, 300px); padding: 5px 10px 6px; border-radius: 10px; background: var(--tv-chrome);
  border: 1px solid var(--tv-line); box-shadow: var(--tv-shadow); }
.tv-proj small { display: block; font-size: 10px; font-weight: 600; letter-spacing: .04em; color: var(--tv-muted); text-transform: uppercase; }
.tv-proj b { display: block; font-size: 13px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }

.tv-crumb { display: flex; align-items: center; gap: 8px; max-width: 100%; height: 40px; padding: 0 14px 0 10px; border-radius: 12px;
  border: 1px solid var(--tv-line); background: var(--tv-chrome); box-shadow: var(--tv-shadow); font-weight: 600; }
.tv-crumb svg { width: 20px; height: 20px; }
.tv-crumb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-crumb span i { font-style: normal; color: var(--tv-muted); font-weight: 500; }

.tv-toast { position: absolute; left: 50%; top: 0; transform: translate(-50%, -6px); width: max-content; max-width: min(100%, 420px);
  padding: 8px 13px; border-radius: 11px; background: rgba(242, 243, 245, .95); color: #15181c; font-size: 13px; line-height: 1.45;
  text-align: center; box-shadow: var(--tv-shadow); opacity: 0; transition: opacity .2s, transform .2s; }
.tv-toast.show { opacity: 1; transform: translate(-50%, 0); }

.tv-info { width: 100%; max-width: 380px; padding: 10px 12px 11px; border-radius: 14px; background: var(--tv-chrome);
  border: 1px solid var(--tv-line); box-shadow: var(--tv-shadow); }
.tv-info-head { display: flex; align-items: flex-start; gap: 10px; }
.tv-info-title { min-width: 0; flex: 1 1 auto; }
.tv-info-title b { display: block; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.tv-info-title span { display: block; margin-top: 1px; font-size: 12px; color: var(--tv-muted); overflow-wrap: anywhere; }
.tv-x { flex: 0 0 auto; width: 32px; height: 32px; margin: -4px -4px 0 0; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .08);
  display: flex; align-items: center; justify-content: center; padding: 0; }
.tv-x svg { width: 16px; height: 16px; }
.tv-dims { margin-top: 7px; font: 600 14px/1.3 var(--tv-num); font-variant-numeric: tabular-nums; }
.tv-dims small { margin-left: 6px; font: 400 11px var(--tv-font); color: var(--tv-muted); }
.tv-rows { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; margin: 6px 0 0; font-size: 12.5px; }
.tv-rows dt { color: var(--tv-muted); }
.tv-rows dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.tv-hint { margin: 7px 0 0; font-size: 12px; color: var(--tv-hl); }

.tv-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tv-btn { display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; min-width: 44px; padding: 0 14px;
  border-radius: 12px; border: 1px solid var(--tv-line); background: var(--tv-chrome); box-shadow: var(--tv-shadow);
  font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap; transition: background .15s, color .15s; }
.tv-btn svg { width: 20px; height: 20px; }
.tv-btn[aria-pressed="true"] { background: #f4f5f7; border-color: #f4f5f7; color: #15181c; }
.tv-btn.tv-led[aria-pressed="true"] { background: var(--tv-led); border-color: var(--tv-led); color: var(--tv-led-ink); }

.tv-cover { position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background: var(--tv-top); text-align: center; }
.tv-cover .tv-box { max-width: 360px; line-height: 1.55; }
.tv-cover b { display: block; font-size: 17px; margin-bottom: 6px; }
.tv-cover p { margin: 0; color: var(--tv-muted); font-size: 14px; }
.tv-cover .tv-btn { margin: 16px auto 0; }
.tv-spin { width: 34px; height: 34px; margin: 0 auto 14px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .14);
  border-top-color: var(--tv-hl); animation: tv-sp .9s linear infinite; }
@keyframes tv-sp { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .tv-toast, .tv-btn { transition: none; } .tv-spin { animation: none; } }
