.tij-title-screen-shell {
  --tij-frame-blue: #1b3150;
  --tij-frame-blue-dark: #0d1c31;
  --tij-gold: #d3a34c;
  --tij-gold-dark: #6e481d;
  --tij-gold-light: #f4d68e;
  --tij-menu-bg: #1d3353;
  --tij-menu-bg-dark: #11233d;
  --tij-screen-bg: #061225;
  --tij-text-cream: #f7e7c2;
  width: 100%;
  margin: 0 auto;
}

.tij-title-screen-shell,
.tij-title-screen-shell * {
  box-sizing: border-box;
}

.tij-title-screen-frame {
  width: min(100vw - 20px, calc(100dvh * 0.5625));
  height: min(100dvh - 20px, calc((100vw - 20px) * 1.7778));
  max-width: 540px;
  max-height: 960px;
  min-width: 300px;
  min-height: 533px;
  margin: 0 auto;
  position: relative;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.tij-title-screen-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 10px;
  border: 4px solid #273d5a;
  box-shadow: 0 14px 40px rgba(0,0,0,.5);
  background: linear-gradient(180deg, #0c1830, #08111f);
  isolation: isolate;
}

.tij-title-screen-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tij-layer-bg {
  background-image: url('../images/bg_denim.png');
  background-repeat: repeat;
  background-size: 180px auto;
  background-position: 0 0;
  transform: scale(1.08);
  animation: tijDenimDrift 26s linear infinite;
  filter: saturate(1.06) contrast(1.04) brightness(.96);
}

.tij-layer-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 20%, rgba(255,255,255,.08), transparent 22%),
    radial-gradient(circle at 50% 60%, transparent 22%, rgba(0,0,0,.16) 100%);
  mix-blend-mode: screen;
  opacity: .55;
}

.tij-layer-logo-wrap {
  left: 50%;
  top: -5%;
  width: 100%;
  height: 29.6%;
  transform: translateX(-50%);
  overflow: hidden;
}

.tij-layer-logo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,.45)) brightness(1);
  animation: tijLogoPulse 4.8s ease-in-out infinite;
}

.tij-logo-shine {
  display: none;
}

.tij-layer-cards {
  top: 27%;
  bottom: 17%;
}

.tij-card {
  position: absolute;
  width: 49%;
  max-width: 270px;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 10px 0 rgba(0,0,0,.12)) drop-shadow(0 18px 24px rgba(0,0,0,.26));
}

.tij-card-back {
  left: 52%;
  top: 17%;
  transform: translateX(-7%) rotate(10deg);
  animation: tijCardBackFloat 4.1s ease-in-out infinite;
}

.tij-card-front {
  left: 48%;
  top: 17%;
  transform: translateX(-84%) rotate(-8deg);
  animation: tijCardFrontFloat 3.4s ease-in-out infinite;
}

.tij-card-glow {
  position: absolute;
  left: 19%;
  top: 19%;
  width: 62%;
  height: 58%;
  background: radial-gradient(circle at 50% 45%, rgba(255,229,154,.12), rgba(255,229,154,0));
  filter: blur(12px);
  opacity: .75;
}

.tij-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tij-spark {
  position: absolute;
  width: 7px;
  height: 7px;
  background: #f3d88d;
  box-shadow: 0 0 0 2px #6e481d;
  clip-path: polygon(50% 0%, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0% 50%, 38% 38%);
  opacity: 0;
}

.tij-spark-1 { left: 16%; top: 24%; animation: tijTwinkle 2.7s steps(2) infinite .25s; }
.tij-spark-2 { right: 15%; top: 22%; animation: tijTwinkle 2.7s steps(2) infinite 1.15s; }
.tij-spark-3 { left: 28%; top: 54%; animation: tijTwinkle 2.7s steps(2) infinite 1.75s; }
.tij-spark-4 { right: 24%; top: 56%; animation: tijTwinkle 2.7s steps(2) infinite .7s; }

.tij-title-screen-menu {
  position: absolute;
  left: 50%;
  bottom: 5.2%;
  transform: translateX(-50%);
  z-index: 15;
  width: min(72%, 270px);
  text-align: center;
}

.tij-start-button {
  width: 100%;
  background: linear-gradient(180deg, var(--tij-menu-bg), var(--tij-menu-bg-dark));
  border: 3px solid var(--tij-gold);
  box-shadow: 0 0 0 3px rgba(49,31,15,.85), 0 8px 0 rgba(0,0,0,.2);
  border-radius: 6px;
  padding: 10px 14px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.tij-start-button:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 3px rgba(49,31,15,.85), 0 6px 0 rgba(0,0,0,.15);
}

.tij-start-button:focus-visible,
.tij-title-screen-stage:focus-visible {
  outline: 2px solid #f4d68e;
  outline-offset: 4px;
}

.tij-start-cursor {
  display: none;
}

.tij-start-text {
  color: var(--tij-gold-light);
  text-shadow: -1px 0 var(--tij-gold-dark), 1px 0 var(--tij-gold-dark), 0 -1px var(--tij-gold-dark), 0 1px var(--tij-gold-dark);
  text-transform: none;
  letter-spacing: 1px;
  font-size: clamp(20px, 3.9vw, 30px);
  line-height: 1;
  font-family: 'IM Fell English', Georgia, serif;
}

.tij-start-hint {
  margin-top: 10px;
  color: rgba(255,245,220,.82);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: .8;
}

.tij-fade-overlay {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 600ms steps(12);
  z-index: 30;
}

.tij-fade-overlay.is-active {
  opacity: 1;
}

@keyframes tijDenimDrift {
  from { background-position: 0 0; }
  to { background-position: -36px 20px; }
}

@keyframes tijLogoPulse {
  0%, 100% {
    filter: drop-shadow(0 3px 0 rgba(0,0,0,.45)) brightness(1);
  }
  50% {
    filter: drop-shadow(0 3px 0 rgba(0,0,0,.45)) brightness(1.12);
  }
}

@keyframes tijCardFrontFloat {
  0%, 100% { transform: translateX(-84%) translateY(0) rotate(-8deg); }
  50% { transform: translateX(-84%) translateY(-5px) rotate(-7deg); }
}

@keyframes tijCardBackFloat {
  0%, 100% { transform: translateX(-7%) translateY(0) rotate(10deg); }
  50% { transform: translateX(-7%) translateY(-4px) rotate(11deg); }
}

@keyframes tijTwinkle {
  0%, 74%, 100% { opacity: 0; transform: scale(1); }
  78%, 86% { opacity: 1; transform: scale(1.2); }
  82% { opacity: .6; transform: scale(.8); }
}

@keyframes tijBlink {
  0%, 45% { opacity: 1; }
  50%, 100% { opacity: .15; }
}

@media (max-width: 390px) {
  .tij-layer-logo-wrap {
    left: 50%;
    top: -5%;
    width: 100%;
    height: 29.6%;
  }

  .tij-layer-cards {
    top: 28%;
    bottom: 18%;
  }

  .tij-card {
    width: 51%;
  }

  .tij-card-back {
    left: 52.5%;
    top: 18%;
  }

  .tij-card-front {
    left: 47.5%;
    top: 18%;
  }

  .tij-title-screen-menu {
    bottom: 4.8%;
    width: 76%;
  }

  .tij-start-button {
    min-height: 44px;
    padding: 8px 12px;
  }

  .tij-start-text {
    font-size: 21px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tij-title-screen-shell *,
  .tij-title-screen-shell *::before,
  .tij-title-screen-shell *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition: none !important;
  }
}
