﻿/* Large screens & TV - stable layout, no jank, reliable taps.
 Only clip horizontal overflow on body - locking html+body together
 breaks Windows laptop trackpad / precision-wheel scrolling. */
html {
 scroll-behavior: auto;
 overflow-x: hidden;
 overflow-y: auto;
}

body {
 overflow-x: hidden;
 overflow-y: visible;
}

#app-main {
 overflow-x: hidden;
 overflow-y: visible;
}

@media (min-width: 1200px) {
 #app-main {
 max-width: min(1400px, 100vw);
 margin-left: auto;
 margin-right: auto;
 }
}

@media (min-width: 1920px) {
 #app-main {
 max-width: 1520px;
 }
 .ielts-root,
 .ama-pre-studio,
 .foundation-campus--premium {
 max-width: 1200px;
 margin-left: auto;
 margin-right: auto;
 }
}

/* Do not use contain on views - breaks clicks on many TV browsers */
.view {
 contain: none;
}

/* TV / classroom display */
html[data-ama-tv="1"] .bg-mesh,
html[data-ama-tv="1"] .bg-orb,
html[data-ama-tv="1"] .bg-grid {
 display: none !important;
}

html[data-ama-tv="1"] *,
html[data-ama-tv="1"] *::before,
html[data-ama-tv="1"] *::after {
 animation-duration: 0.01ms !important;
 animation-iteration-count: 1 !important;
 transition-duration: 0.01ms !important;
}

html[data-ama-tv="1"] .ama-pre-tile,
html[data-ama-tv="1"] .unit-card-pro,
html[data-ama-tv="1"] .level-card-pro,
html[data-ama-tv="1"] .pathway-card,
html[data-ama-tv="1"] .topnav button,
html[data-ama-tv="1"] .ama-nav-pill {
 min-height: 52px;
 cursor: pointer;
}

html[data-ama-tv="1"] .unit-hub {
 display: grid;
 grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
 gap: 14px;
}

html[data-ama-tv="1"] #app-main {
 padding-bottom: 24px !important;
}

html[data-ama-tv="1"] .quick-nav-controls {
 z-index: 9500;
}

@media (pointer: coarse), (min-width: 1600px) {
 .topnav button,
 .ama-nav-pill,
 .ama-pre-tile {
 min-height: 44px;
 }
}

/* -- TV Fit controller (laptop -> classroom TV) -- */
#ama-tv-world {
  min-height: 100%;
  will-change: transform;
  transition: transform .18s ease;
}
#ama-tv-fit {
  position: fixed;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 2147483646;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  pointer-events: none;
}
#ama-tv-fit > * { pointer-events: auto; }
.ama-tv-fit__fab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 16px;
  border: 0;
  border-radius: 999px;
  background: #0b1f4d;
  color: #fff;
  font: 800 .92rem/1 system-ui, sans-serif;
  box-shadow: 0 10px 28px rgba(0,0,0,.35), 0 0 0 2px rgba(245,197,66,.55);
  cursor: pointer;
}
.ama-tv-fit__fab i { color: #f5c542; }
#ama-tv-fit.is-active .ama-tv-fit__fab {
  background: linear-gradient(145deg, #f7d77a, #c9952a);
  color: #241800;
  box-shadow: 0 10px 28px rgba(0,0,0,.35);
}
#ama-tv-fit.is-active .ama-tv-fit__fab i { color: #241800; }
#ama-tv-fit.is-open .ama-tv-fit__fab { display: none; }
.ama-tv-fit__pad {
  width: min(300px, calc(100vw - 28px));
  padding: 14px;
  border-radius: 18px;
  background: rgba(7,18,46,.96);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 16px 40px rgba(0,0,0,.45);
  color: #fff;
}
.ama-tv-fit__head {
  position: relative;
  margin-bottom: 12px;
  padding-right: 36px;
}
.ama-tv-fit__head strong {
  display: block;
  font: 800 1.05rem/1.2 system-ui, sans-serif;
  color: #f5c542;
}
.ama-tv-fit__head small {
  display: block;
  margin-top: 4px;
  color: #cfd8ee;
  font-size: .78rem;
}
.ama-tv-fit__x {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: rgba(255,255,255,.1);
  color: #fff;
  cursor: pointer;
}
.ama-tv-fit__grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-areas:
    ". up ."
    "left reset right"
    ". down .";
  gap: 8px;
  margin-bottom: 12px;
}
.ama-tv-fit__up { grid-area: up; }
.ama-tv-fit__down { grid-area: down; }
.ama-tv-fit__left { grid-area: left; }
.ama-tv-fit__right { grid-area: right; }
.ama-tv-fit__reset { grid-area: reset; }
.ama-tv-fit__btn {
  display: grid;
  place-items: center;
  gap: 2px;
  min-height: 56px;
  padding: 8px;
  border: 0;
  border-radius: 14px;
  background: rgba(255,255,255,.1);
  color: #fff;
  font: 800 .85rem/1 system-ui, sans-serif;
  cursor: pointer;
}
.ama-tv-fit__btn:hover { background: rgba(255,255,255,.18); }
.ama-tv-fit__btn i { font-size: 1.25rem; color: #f5c542; }
.ama-tv-fit__up, .ama-tv-fit__down { min-height: 64px; }
.ama-tv-fit__reset {
  background: linear-gradient(145deg, #f7d77a, #c9952a);
  color: #241800;
}
.ama-tv-fit__reset:hover { filter: brightness(1.05); }
.ama-tv-fit__zoom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255,255,255,.06);
}
.ama-tv-fit__zoom button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
}
.ama-tv-fit__zoom span { font: 700 .9rem/1 system-ui, sans-serif; color: #cfd8ee; }
.ama-tv-fit__zoom b { color: #f5c542; }
.ama-tv-fit__readout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 10px;
}
.ama-tv-fit__readout div {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,.06);
  text-align: center;
}
.ama-tv-fit__readout dt {
  margin: 0;
  color: #9eb0d0;
  font: 700 .68rem/1 system-ui, sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.ama-tv-fit__readout dd {
  margin: 4px 0 0;
  color: #fff;
  font: 800 1.15rem/1 system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
.ama-tv-fit__tip {
  margin: 0;
  color: #9eb0d0;
  font: 600 .72rem/1.4 system-ui, sans-serif;
}
.ama-tv-fit__tip kbd, .ama-tv-fit__tip b { color: #f5c542; }
@media (max-width: 720px) {
  #ama-tv-fit { right: 10px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .ama-tv-fit__fab span { display: none; }
  .ama-tv-fit__fab { width: 48px; height: 48px; justify-content: center; padding: 0; border-radius: 50%; }
}

/* ── TV Fit panel (does not wrap the page; laptop scroll stays normal) ── */
#ama-tv-fit {
  position: fixed;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 2147483646;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  pointer-events: none;
}
#ama-tv-fit > * { pointer-events: auto; }
.ama-tv-fit__fab {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 10px 16px; border: 0; border-radius: 999px;
  background: #0b1f4d; color: #fff; font: 800 .92rem/1 system-ui, sans-serif;
  box-shadow: 0 10px 28px rgba(0,0,0,.35), 0 0 0 2px rgba(245,197,66,.55); cursor: pointer;
}
.ama-tv-fit__fab i { color: #f5c542; }
#ama-tv-fit.is-active .ama-tv-fit__fab,
#ama-tv-fit.is-armed .ama-tv-fit__fab {
  background: linear-gradient(145deg, #f7d77a, #c9952a); color: #241800;
}
#ama-tv-fit.is-active .ama-tv-fit__fab i,
#ama-tv-fit.is-armed .ama-tv-fit__fab i { color: #241800; }
#ama-tv-fit.is-open .ama-tv-fit__fab { display: none; }
.ama-tv-fit__pad {
  width: min(300px, calc(100vw - 28px)); padding: 14px; border-radius: 18px;
  background: rgba(7,18,46,.96); border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 16px 40px rgba(0,0,0,.45); color: #fff;
}
.ama-tv-fit__head { position: relative; margin-bottom: 10px; padding-right: 36px; }
.ama-tv-fit__head strong { display: block; font: 800 1.05rem/1.2 system-ui, sans-serif; color: #f5c542; }
.ama-tv-fit__head small { display: block; margin-top: 4px; color: #cfd8ee; font-size: .78rem; }
.ama-tv-fit__x {
  position: absolute; top: -4px; right: -4px; width: 36px; height: 36px;
  border: 0; border-radius: 10px; background: rgba(255,255,255,.1); color: #fff; cursor: pointer;
}
.ama-tv-fit__mode {
  margin: 0 0 10px; padding: 8px 10px; border-radius: 10px;
  background: rgba(255,255,255,.08); color: #f5c542; font: 800 .8rem/1 system-ui, sans-serif;
  text-align: center; letter-spacing: .04em; text-transform: uppercase;
}
.ama-tv-fit__grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  grid-template-areas: ". up ." "left reset right" ". down .";
  gap: 8px; margin-bottom: 12px;
}
.ama-tv-fit__up { grid-area: up; } .ama-tv-fit__down { grid-area: down; }
.ama-tv-fit__left { grid-area: left; } .ama-tv-fit__right { grid-area: right; }
.ama-tv-fit__reset { grid-area: reset; }
.ama-tv-fit__btn {
  display: grid; place-items: center; gap: 2px; min-height: 56px; padding: 8px;
  border: 0; border-radius: 14px; background: rgba(255,255,255,.1); color: #fff;
  font: 800 .85rem/1 system-ui, sans-serif; cursor: pointer;
}
.ama-tv-fit__btn:hover { background: rgba(255,255,255,.18); }
.ama-tv-fit__btn i { font-size: 1.25rem; color: #f5c542; }
.ama-tv-fit__up, .ama-tv-fit__down { min-height: 64px; }
.ama-tv-fit__reset { background: linear-gradient(145deg, #f7d77a, #c9952a); color: #241800; }
.ama-tv-fit__zoom {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 10px; padding: 8px; border-radius: 12px; background: rgba(255,255,255,.06);
}
.ama-tv-fit__zoom button {
  width: 44px; height: 44px; border: 0; border-radius: 12px;
  background: rgba(255,255,255,.12); color: #fff; font-size: 1.1rem; cursor: pointer;
}
.ama-tv-fit__zoom span { font: 700 .9rem/1 system-ui, sans-serif; color: #cfd8ee; }
.ama-tv-fit__zoom b { color: #f5c542; }
.ama-tv-fit__readout { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 10px; }
.ama-tv-fit__readout div { padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.06); text-align: center; }
.ama-tv-fit__readout dt { margin: 0; color: #9eb0d0; font: 700 .68rem/1 system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; }
.ama-tv-fit__readout dd { margin: 4px 0 0; color: #fff; font: 800 1.15rem/1 system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.ama-tv-fit__tip { margin: 0; color: #9eb0d0; font: 600 .72rem/1.4 system-ui, sans-serif; }
.ama-tv-fit__tip b { color: #f5c542; }
@media (max-width: 720px) {
  #ama-tv-fit { right: 10px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .ama-tv-fit__fab span { display: none; }
  .ama-tv-fit__fab { width: 48px; height: 48px; justify-content: center; padding: 0; border-radius: 50%; }
}
