:root{
  --blue:#00ffff;
  --pink:#ff00ff;
  --vh:1vh;
}

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

html,body{
  margin:0;
  padding:0;
  height:100%;
  background:#111;
  color:var(--blue);
  font-family:'Orbitron',system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  overflow:hidden;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  text-rendering:optimizeLegibility;
}

/* BACKGROUND TEXT */
#background-text{
  position:fixed;
  inset:0;
  display:flex;
  flex-wrap:wrap;
  pointer-events:none;
  z-index:0;
  opacity:.68;

  font-family:'Share Tech Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-weight:700;
  line-height:1.05;
  letter-spacing:.02em;
  color:var(--blue);
  text-shadow:
    0 0 1px rgba(0,0,0,.95),
    0 0 10px rgba(0,255,255,.65),
    0 0 26px rgba(0,255,255,.30);
}
#background-text span{ flex:0 0 auto; width:1ch; height:1em; opacity:0; }
@keyframes charFade{ to{ opacity:1; } }

/* BUTTON BASE */
button,
.modal-button,
#backHomeBtn{
  font-family:inherit;
  font-weight:800;
  letter-spacing:.04em;
  background:rgba(0,0,0,.15);
  color:#fff;
  border:2px solid rgba(255,255,255,.18);
  border-radius:6px;
  cursor:pointer;
  text-shadow:0 0 10px rgba(0,255,255,.25);
  -webkit-text-stroke:.35px rgba(0,0,0,.45);
  transition:background .15s ease, border-color .15s ease, transform .15s ease;
  touch-action:manipulation;
}
button:hover,
.modal-button:hover,
#backHomeBtn:hover{
  background:rgba(255,255,255,.08);
  border-color:rgba(0,255,255,.55);
}

/* ANIMATIONS (restored) */
@media (prefers-reduced-motion: no-preference){
  @keyframes neonPulse{
    0%{ box-shadow:0 0 10px rgba(0,255,255,.22), inset 0 0 10px rgba(255,0,255,.10); }
    100%{ box-shadow:0 0 22px rgba(0,255,255,.55), inset 0 0 18px rgba(255,0,255,.18); }
  }
  @keyframes gradientShift{
    0%{ background-position:0% 50%; }
    100%{ background-position:100% 50%; }
  }

  /* Home CTA buttons pulse a bit */
  #home button{ animation:neonPulse 2.2s ease-in-out infinite alternate; }

  /* Animated gradient on download */
  .download-button{ animation:gradientShift 2.8s linear infinite; }
}

/* TOP NAV */
#loginBtn,#registerBtn,#logoutBtn{
  position:fixed;
  top:16px;
  width:160px;
  padding:8px 0;
  font-size:18px;
  z-index:1000;
}
#loginBtn{ left:14px; }
#registerBtn{ right:14px; }
#logoutBtn{
  left:50%;
  transform:translateX(-50%);
  border-color:rgba(255,0,255,.7);
  text-shadow:0 0 10px rgba(255,0,255,.35);
}
@media (max-width:420px){
  #loginBtn,#registerBtn,#logoutBtn{
    top:10px;width:124px;padding:7px 0;font-size:15px;
  }
  #loginBtn{ left:10px; }
  #registerBtn{ right:10px; }
}
@media (max-width:340px){
  #loginBtn,#registerBtn{
    left:50%; right:auto; transform:translateX(-50%);
    width:156px;
  }
  #loginBtn{ top:8px; }
  #registerBtn{ top:54px; }
}

/* HOME */
#home{
  position:relative;
  z-index:2;
  height:calc(var(--vh) * 100);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:26px;
}
#liveBtn,#reviewBtn{
  width:min(86vw, 420px);
  padding:18px 20px;
  font-size:28px;
  border:2px solid rgba(0,255,255,.85);
  background:rgba(0,0,0,.55);
  box-shadow:0 0 20px rgba(0,255,255,.25), inset 0 0 14px rgba(255,0,255,.10);
}
#reviewBtn{
  border-color:rgba(255,0,255,.75);
}

/* RECORDER */
#recorder{
  position:fixed;
  inset:0;
  height:calc(var(--vh) * 100);
  background:#000;
  padding:0;

  border:2px solid var(--blue);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:1000;

  overflow:hidden; /* prevents any edge bleed */
  box-shadow:0 0 14px rgba(0,255,255,.25) inset;
}

/* VIDEO PREVIEW (seam-safe) */
#preview{
  position:absolute;
  inset:0;

  width:100%;
  height:100%;
  object-fit:cover;
  background:#000;

  /* remove rounded corners to avoid edge artifacts */
  border-radius:0;

  /* ensure no border/shadow causes lines */
  border:0;
  box-shadow:none;

  /* GPU seam fixes */
  transform:translateZ(0);
  -webkit-transform:translateZ(0);
  backface-visibility:hidden;
  -webkit-backface-visibility:hidden;
  outline:1px solid transparent; /* hides 1px edge artifacts */
  will-change:transform;
}

#switchBtn,#stopBtn{
  position:absolute;
  top:16px;
  padding:10px;
  background:rgba(0,0,0,.35);
  border:2px solid var(--blue);
  border-radius:4px;
  color:var(--blue);
  font-size:16px;
  z-index:5; /* stays above the video */
}
#switchBtn{ left:16px; }
#stopBtn{ right:16px; }

/* REVIEW PANEL (stable scroll) */
#reviewPanel{
  position:fixed;
  inset:0;
  height:calc(var(--vh) * 100);
  background:#111;
  z-index:1000;
  overflow:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;

  padding-top: calc(20px + env(safe-area-inset-top));
  padding-left:  calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
  padding-bottom: max(140px, calc(140px + env(safe-area-inset-bottom)));
}

#backHomeBtn{
  display:block;
  margin:0 auto 16px;
  padding:10px 20px;
  font-size:16px;
  background:rgba(0,0,0,.85);
  border:2px solid var(--blue);
  color:var(--blue);
}

/* GRID */
#sessionList{
  list-style:none;
  margin:0;
  padding:0;

  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  gap:24px;

  justify-content:center;
  align-content:start;
  align-items:start;
}
@media (max-width:360px){
  #sessionList{
    grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr));
    gap:18px;
  }
}

/* TILE (no infinite animations / no 3D tearing) */
.tile{
  display:flex;
  flex-direction:column;
  gap:12px;

  background:rgba(10,10,10,.86);
  border:2px solid rgba(0,255,255,.90);
  border-radius:10px;
  padding:20px;
  min-height:280px;
  text-align:center;
}

/* Hover effect only on desktop (safe) */
@media (hover:hover) and (pointer:fine){
  .tile:hover{
    transform:translateZ(0) translateY(-2px);
    box-shadow:
      0 0 26px rgba(0,255,255,.60),
      inset 0 0 18px rgba(0,255,255,.18);
  }
}

.timestamp{
  margin:0;
  font-size:.85em;
  color:var(--blue);
  background:rgba(0,0,0,.55);
  padding:6px 10px;
  border-radius:6px;
  text-shadow:0 0 8px rgba(0,255,255,.55);
  border:1px solid rgba(0,255,255,.20);
}

.tile button{ width:100%; }

/* ACTION buttons */
.download-button{
  padding:10px 18px;
  background:linear-gradient(120deg,var(--blue),var(--pink),var(--blue));
  background-size:200% 200%;
  color:#111;
  font-weight:900;
  border:none;
  border-radius:6px;
}
.trailer-button{
  padding:8px 14px;
  background:rgba(0,0,0,.72);
  border:2px solid rgba(0,255,255,.85);
  border-radius:6px;
  color:var(--blue);
  font-size:.9em;
  text-shadow:0 0 8px rgba(0,255,255,.55);
}

/* Bottom action row (delete never disappears) */
.tile-actions{
  margin-top:auto;
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  justify-content:center;
}
.tile-actions .delete-button{
  flex:1 1 160px;
  min-width:160px;
  padding:10px 14px;
  background:rgba(0,0,0,.80);
  border:2px solid rgba(255,0,255,.85);
  color:var(--pink);
  text-shadow:0 0 10px rgba(255,0,255,.35);
}

/* MODALS (fast show) */
.modal{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,0.86);
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transition:opacity .12s ease;
  z-index:99999;
}
.modal.show{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
}
.modal-content{
  position:relative;
  background:#111;
  padding:20px;
  border-radius:10px;
  border:2px solid rgba(0,255,255,0.85);
  box-shadow:0 0 22px rgba(0,255,255,0.55);
  text-align:center;
  width:min(92vw, 360px);
}
.modal-close{
  position:absolute;
  top:8px;
  right:10px;
  background:none;
  border:none;
  color:var(--pink);
  font-size:1.8em;
  cursor:pointer;
  line-height:1;
  text-shadow:0 0 12px rgba(255,0,255,0.7);
}
.modal-content h2{
  color:#fff;
  font-size:1.15em;
  margin:0 0 16px;
  font-weight:900;
}
.modal-buttons{
  display:flex;
  gap:12px;
  justify-content:center;
}
.modal-button{
  padding:10px 16px;
  border-radius:8px;
  border:2px solid rgba(255,255,255,.2);
}
.modal-button.blue{ border-color:rgba(0,255,255,.75); }
.modal-button.pink{ border-color:rgba(255,0,255,.75); }
/* ────────────────────────────────────────────────────────────────
   POLISH (no animation reductions)
   - Fixes mobile tap highlight / focus visibility
   - Improves iOS safe-area handling + autofill legibility
──────────────────────────────────────────────────────────────── */

:focus-visible{
  outline:2px solid var(--blue);
  outline-offset:3px;
}

/* iOS notch safe-area padding (keeps your layout centered) */
body{
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* Better tap feel on mobile without changing your animations */
button, a{
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Chrome/Safari autofill: keep neon theme readable */
input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill{
  -webkit-text-fill-color:#fff !important;
  transition: background-color 9999s ease-out 0s;
  box-shadow: 0 0 0px 1000px rgba(0,0,0,0.35) inset !important;
}
