/* ANTI-FOUC */
html {
  visibility: hidden;
}
html.loaded {
  visibility: visible !important;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #000;
  color: #f0f0f0;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  overflow-x: hidden;
  line-height: 1.5;
}

/* SLIM TOP BAR — LOGO ONLY */
#slim-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(15, 15, 15, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid #333;
  display: flex;
  align-items: center;
  padding-left: 16px;
  z-index: 1200;
  padding-top: env(safe-area-inset-top);
}

#top-logo-img {
  height: 32px;
  width: auto;
}

/* v2 BOTTOM TAB BAR — PERFECT */
#bottom-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 84px;
  background: rgba(15, 15, 15, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid #333;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1300;
  padding-bottom: env(safe-area-inset-bottom);
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: #888;
  font-size: 10.5px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: color 0.2s;
}

.tab-btn svg {
  width: 26px;
  height: 26px;
}

.tab-btn.active {
  color: #0a84ff;
}

.tab-btn:active {
  background: rgba(255, 255, 255, 0.08);
}

/* Content spacing */
.page {
  padding-top: 76px !important;
  padding-bottom: 140px !important;
}

/* Hide old nav/footer */
#nav-bar,
#attribution {
  display: none !important;
}

/* PAGES */
.page {
  display: none;
}
.page.active {
  display: block;
}
.page-title {
  text-align: center;
  margin: 0 0 16px;
  font-size: 22px;
  color: #fff;
  font-weight: 700;
}
.subheader {
  text-align: center;
  font-size: 15px;
  color: #aaa;
  font-style: italic;
  margin-bottom: 24px;
  line-height: 1.4;
}

/* HOME MENU */
#menu-list {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  padding: 0 10px;
}
.menu-card {
  background: #1c1c1e;
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s, box-shadow 0.25s;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  aspect-ratio: 1 / 1;
  max-width: 300px;
  margin: 0 auto;
}
.menu-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.5);
}
.menu-card img {
  width: 100%;
  height: 70%;
  object-fit: contain;
  background: #111;
  border-radius: 18px 18px 0 0;
}
.menu-card p {
  padding: 12px 8px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  background: #1c1c1e;
  margin: 0;
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
}

/* SUBMENU & GALLERY */
#submenu-list {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.submenu-card {
  background: #1c1c1e;
  border-radius: 16px;
  padding: 16px 12px;
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.submenu-card:hover {
  background: #2a2a2c;
  transform: translateY(-3px);
}

#image-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}
.img-thumb {
  width: 100%;
  height: 130px;
  object-fit: cover;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.25s;
}
.img-thumb:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}
.img-caption {
  text-align: center;
  font-size: 13px;
  color: #aaa;
  margin-top: 6px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === YOUTUBE PRACTICE BUTTONS — FINAL & GORGEOUS === */
#youtube-practice-container {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin: 36px 20px 120px;
}

.youtube-btn {
  flex: 0 1 320px;
  min-width: 280px;
  max-width: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(135deg, #ff0000, #cc0000);
  color: white !important;
  font-weight: 700;
  font-size: 17px;
  padding: 18px 28px;
  border-radius: 18px;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(255, 0, 0, 0.4);
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.youtube-btn:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 16px 32px rgba(255, 0, 0, 0.5);
  background: linear-gradient(135deg, #ff3333, #ff0000);
}

/* Mobile — beautiful vertical stack */
@media (max-width: 500px) {
  #youtube-practice-container {
    flex-direction: column;
    align-items: center;
    gap: 18px;
  }
  .youtube-btn {
    width: 92%;
    max-width: 360px;
    min-width: auto;
  }
}

/* FULLSCREEN */
#fullscreen {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}
#fullscreen.hidden {
  display: none;
}

#fs-image {
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
}

#fs-overlay-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  display: flex;
  flex-direction: column;
  padding: 20px;
  box-sizing: border-box;
  color: white;
}
#fs-overlay-controls.active {
  opacity: 1;
  pointer-events: all;
}

#close-fs {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 40px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
}

#fs-counter {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 14px;
}

#fs-caption {
  background: rgba(0, 0, 0, 0.6);
  padding: 10px 16px;
  border-radius: 8px;
  max-width: 90%;
  margin: 0 auto auto auto;
  font-size: 16px;
  backdrop-filter: blur(4px);
}

#fs-nav-bottom {
  display: flex;
  justify-content: center;
  gap: 100px;
  margin-top: auto;
  padding-bottom: 30px;
}
#fs-nav-bottom button {
  font-size: 56px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: white;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

/* INSTALL BUTTON */
#install-instructions-container {
  text-align: center;
  margin: 25px 0;
  display: none;
}
#home.active #install-instructions-container {
  display: block;
}
.install-btn {
  background: #0a84ff;
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(10, 132, 255, 0.3);
}

/* INSTALL LIGHTBOX */
#install-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.96);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#install-lightbox.active {
  display: flex;
}
#install-lightbox img {
  max-width: 100%;
  max-height: 100vh;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

/* COMING SOON NOTICE */
#coming-soon-notice {
  position: fixed;
  top: 64px;
  left: 8px;
  right: 8px;
  background: linear-gradient(135deg, #1e3c72, #2a5298);
  color: #fff;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 6px 16px rgba(30, 87, 153, 0.4);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 999;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.notice-text {
  flex: 1;
  text-align: center;
  line-height: 1.4;
}
.notice-dismiss {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.notice-dismiss:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.1);
}
#coming-soon-notice.hidden {
  display: none !important;
}

/* VISUALLY HIDDEN */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* RESPONSIVE */
@media (max-width: 380px) {
  #menu-list,
  #submenu-list {
    grid-template-columns: 1fr 1fr;
  }
  .img-thumb {
    height: 110px;
  }
}

/* BACK BUTTON — TOP RIGHT, ONLY WHEN NEEDED */
#back-btn-top {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 1201;
}

#back-btn-top.visible {
  opacity: 1;
  pointer-events: all;
}

#back-btn-top:active {
  background: rgba(255, 255, 255, 0.1);
}
