/* ============================================================
   Y17x SENSI — style.css
   Black background, red accents, gaming-style UI.
   Theme colors live in :root so they are easy to change.
   ============================================================ */

/* ---------- 1. Theme tokens ---------- */
:root {
  --bg: #000;
  --panel: #0b0b0d;
  --panel-2: #140406;
  --card: #050506;
  --red: #e10f1f;
  --red-dark: #8f0a14;
  --red-glow: rgba(225, 15, 31, 0.45);
  --text: #fff;
  --muted: #b9b9bd;
  --line: #3a0d12;

  --font-display: "Orbitron", "Arial Black", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Arial, sans-serif;

  --radius: 14px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ---------- 2. Base reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  -webkit-text-size-adjust: 100%; /* stop iOS from resizing text */
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden; /* no horizontal scroll on phones */
}

/* Keep elements with the hidden attribute hidden, even if a class sets display */
[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

h1:focus,
h2:focus {
  outline: none; /* headings receive focus for screen readers only */
}

/* ---------- 3. Animated background ---------- */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(225, 15, 31, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(225, 15, 31, 0.09) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 78%);
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 78%);
}

.bg-glow {
  position: fixed;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 0%, rgba(225, 15, 31, 0.28), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(143, 10, 20, 0.25), transparent 50%);
  animation: glowShift 12s ease-in-out infinite alternate;
}

@keyframes glowShift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-3%, 2%, 0) scale(1.06); }
}

/* ---------- 4. App layout (safe-area aware for iPhone) ---------- */
.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh; /* correct height on iOS Safari toolbars */
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding:
    calc(env(safe-area-inset-top, 0px) + 20px)
    calc(env(safe-area-inset-right, 0px) + 16px)
    calc(env(safe-area-inset-bottom, 0px) + 24px)
    calc(env(safe-area-inset-left, 0px) + 16px);
}

/* Only the active screen is shown */
.screen {
  display: none;
  width: 100%;
}

.screen.is-active {
  display: block;
  animation: screenIn 0.45s var(--ease) both;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

/* Children of the active screen fade up one after another */
.screen.is-active .panel > * {
  animation: fadeUp 0.5s var(--ease) both;
}
.screen.is-active .panel > *:nth-child(2) { animation-delay: 0.05s; }
.screen.is-active .panel > *:nth-child(3) { animation-delay: 0.1s; }
.screen.is-active .panel > *:nth-child(4) { animation-delay: 0.15s; }
.screen.is-active .panel > *:nth-child(5) { animation-delay: 0.2s; }
.screen.is-active .panel > *:nth-child(6) { animation-delay: 0.25s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 5. Panels and typography ---------- */
.panel {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px 18px;
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Red scanning line across the top of each panel */
.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  animation: scanline 3.5s linear infinite;
}

@keyframes scanline {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

.center {
  text-align: center;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--red);
  text-transform: uppercase;
  margin: 0 0 8px;
}

.logo {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(32px, 10vw, 46px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 4px 0 20px;
  text-shadow: 0 0 18px var(--red-glow);
}

.title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 6px;
}

.sub {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 18px;
}

.note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.note strong {
  color: var(--red);
}

.error {
  color: #ff5a64;
  font-size: 13px;
  margin: 8px 0 0;
}

/* Glitch effect on the main title (CSS only). Text comes from data-text. */
.glitch {
  position: relative;
  display: inline-block;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  overflow: hidden;
  pointer-events: none;
}

.glitch::before {
  color: var(--red);
  transform: translate(-2px, 0);
  animation: glitchTop 3.4s infinite steps(1);
}

.glitch::after {
  color: #fff;
  transform: translate(2px, 0);
  animation: glitchBottom 3.4s infinite steps(1);
}

@keyframes glitchTop {
  0%, 88%, 100% { clip-path: inset(0 0 100% 0); }
  90%           { clip-path: inset(8% 0 62% 0); }
  94%           { clip-path: inset(40% 0 30% 0); }
}

@keyframes glitchBottom {
  0%, 88%, 100% { clip-path: inset(100% 0 0 0); }
  92%           { clip-path: inset(60% 0 12% 0); }
  96%           { clip-path: inset(25% 0 50% 0); }
}

/* ---------- 6. Inputs ---------- */
.input {
  width: 100%;
  background: #000;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px 16px;
  font-family: var(--font-display);
  font-size: 16px; /* 16px prevents iOS auto-zoom when focusing */
  font-weight: 500;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.input::placeholder {
  color: #6d6d72;
  letter-spacing: 0.12em;
}

.input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(225, 15, 31, 0.25), 0 0 22px rgba(225, 15, 31, 0.25);
}

.input.shake {
  animation: shake 0.4s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* ---------- 7. Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;            /* comfortable touch target (44px+) */
  padding: 14px 20px;
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
  background: #120305;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform 0.15s var(--ease), box-shadow 0.2s, opacity 0.2s, background 0.2s;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:focus-visible,
.back:focus-visible,
.menu-btn:focus-visible,
.option:focus-visible,
.game-card:focus-visible,
.social-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-red {
  background: linear-gradient(110deg, var(--red), var(--red-dark));
  box-shadow: 0 10px 26px var(--red-glow);
}

.btn-red:hover:not(:disabled) {
  box-shadow: 0 12px 34px rgba(225, 15, 31, 0.65);
  transform: translateY(-1px);
}

/* Light sweep across red buttons on hover */
.btn-red::after {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s var(--ease);
}

.btn-red:hover::after {
  left: 125%;
}

.btn-ghost {
  background: transparent;
  border: 1px solid #fff;
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
}

.btn-block {
  width: 100%;
}

.btn-xl {
  min-height: 64px;
  font-size: 18px;
  margin-top: 4px;
}

.next-btn {
  margin-top: 16px;
}

.back {
  background: none;
  border: 0;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.12em;
  padding: 10px 4px;
  min-height: 44px;
  cursor: pointer;
}

.back:hover {
  color: var(--red);
}

/* ---------- 8. Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand b {
  color: var(--red);
}

.status-pill {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: #fff;
  border: 1px solid var(--red);
  border-radius: 999px;
  padding: 5px 10px;
  box-shadow: 0 0 14px var(--red-glow);
  white-space: nowrap;
}

/* ---------- 9. App icons (TikTok, Discord, Free Fire, Free Fire MAX) ---------- */
.app-icon {
  position: relative;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #000;
  border: 1px solid #2a2a2e;
}

.app-icon svg {
  width: 30px;
  height: 30px;
}

.app-icon.discord {
  background: #5865f2;
  border-color: #5865f2;
}

.app-icon.ff {
  background: linear-gradient(160deg, #2a0d00, #000);
  border-color: #ff7a00;
  box-shadow: 0 0 16px rgba(255, 122, 0, 0.35);
}

.app-icon.ff.max {
  border-color: var(--red);
  box-shadow: 0 0 16px var(--red-glow);
}

/* "MAX" badge on the Free Fire MAX icon */
.max-badge {
  position: absolute;
  right: -6px;
  bottom: -6px;
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: #fff;
  background: var(--red);
  border-radius: 6px;
  padding: 2px 4px;
  line-height: 1;
}

/* ---------- 10. Social buttons ---------- */
.social-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  text-align: left;
  text-decoration: none;
  color: #fff;
  background: #0a0a0c;
  border: 1px solid var(--line);
  border-radius: 16px;
  transition: border-color 0.2s, transform 0.15s var(--ease), box-shadow 0.2s;
}

.social-btn:hover {
  border-color: var(--red);
  box-shadow: 0 0 22px rgba(225, 15, 31, 0.3);
  transform: translateY(-2px);
}

.social-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.social-text strong {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.1em;
}

.social-text small {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

/* ---------- 11. Dashboard menu ---------- */
.menu-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.menu-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 18px 18px 18px 20px;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.12em;
  text-align: left;
  background: linear-gradient(90deg, #120305, #050506);
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.2s var(--ease), border-color 0.2s, box-shadow 0.2s;
}

.menu-btn small {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
}

.menu-btn:hover,
.menu-btn:active {
  transform: translateX(4px);
  border-color: var(--red);
  box-shadow: 0 0 22px rgba(225, 15, 31, 0.25);
}

/* ---------- 12. Optimization options and progress ---------- */
.options {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  color: #fff;
  font: inherit;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.option:hover:not(:disabled) {
  border-color: #6a1a22;
}

.option:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.option .check {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 2px solid #555;
  border-radius: 7px;
  display: grid;
  place-items: center;
  transition: background 0.2s, border-color 0.2s;
}

.option .check::after {
  content: "";
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.2s var(--ease);
  margin-top: -3px;
}

.option-text strong {
  display: block;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.option-text small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.option[aria-pressed="true"] {
  border-color: var(--red);
  background: rgba(225, 15, 31, 0.1);
  box-shadow: 0 0 18px rgba(225, 15, 31, 0.2);
}

.option[aria-pressed="true"] .check {
  background: var(--red);
  border-color: var(--red);
}

.option[aria-pressed="true"] .check::after {
  transform: rotate(45deg) scale(1);
}

.progress-wrap {
  margin-top: 18px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 8px;
}

.progress {
  height: 12px;
  background: #1a0406;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, var(--red-dark), var(--red), #fff);
  box-shadow: 0 0 16px var(--red-glow);
  border-radius: 999px;
}

.success {
  margin: 16px 0 0;
  padding: 14px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.5;
  color: #fff;
  background: rgba(225, 15, 31, 0.12);
  border: 1px solid var(--red);
  border-radius: 12px;
  box-shadow: 0 0 24px var(--red-glow);
  animation: fadeUp 0.5s var(--ease) both;
}

.success small {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
}

/* ---------- 13. Game selection ---------- */
.game-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.game-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 10px;
  color: #fff;
  font: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.2s var(--ease), border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.game-card:hover {
  transform: translateY(-3px);
  border-color: #6a1a22;
}

.game-card strong {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-align: center;
}

.game-card small {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.game-card[aria-pressed="true"] {
  border-color: var(--red);
  background: rgba(225, 15, 31, 0.1);
  box-shadow: 0 0 0 1px var(--red), 0 0 24px var(--red-glow);
}

/* ---------- 14. About list ---------- */
.about-list {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  padding-left: 18px;
  margin: 0 0 20px;
}

.about-list li {
  margin-bottom: 10px;
}

.about-list strong {
  color: #fff;
}

/* ---------- 15. Demo confirmation modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.75);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  width: 100%;
  max-width: 360px;
  padding: 22px;
  background: #0b0b0d;
  border: 1px solid var(--red);
  border-radius: 18px;
  box-shadow: 0 0 40px var(--red-glow);
  text-align: center;
  transform: scale(0.92);
  transition: transform 0.3s var(--ease);
}

.modal.is-open .modal-box {
  transform: scale(1);
}

.modal-box h3 {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.1em;
  margin: 0 0 12px;
  color: var(--red);
}

.modal-box p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  margin: 0 0 20px;
}

/* ---------- 16. Responsive tweaks ---------- */
@media (min-width: 600px) {
  .app {
    max-width: 520px;
  }
  .panel {
    padding: 28px 26px;
  }
}

/* Very small iPhones (e.g. SE) */
@media (max-width: 360px) {
  .menu-btn {
    font-size: 15px;
  }
  .game-card strong {
    font-size: 12px;
  }
  .logo {
    font-size: 30px;
  }
}

/* Respect "reduce motion" accessibility setting */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
