/* The landing page. The real branch drifts by on the game canvas behind it
   (src/titlescene.js); everything here sits on top as dark glass, paper and
   marigold, so the bank shows through. */

.title-screen {
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: max(28px, var(--safe-top)) max(28px, var(--safe-right)) max(20px, var(--safe-bottom)) max(28px, var(--safe-left));
  overflow-y: auto;
  background: transparent;
}

/* Dips to black at each camera cut. */
.title-fade {
  position: fixed;
  inset: 0;
  background: #05060a;
  opacity: 1;
  pointer-events: none;
}

/* Darkens the left, where the words are, and the edges. */
.title-shade {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(5, 8, 18, 0.92) 0%, rgba(5, 8, 18, 0.78) 34%, rgba(5, 8, 18, 0.25) 62%, rgba(5, 8, 18, 0.55) 100%),
    linear-gradient(0deg, rgba(5, 8, 18, 0.85) 0%, transparent 30%),
    radial-gradient(ellipse at 30% 40%, rgba(242, 182, 50, 0.08), transparent 60%);
}

.title-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 580px) minmax(0, 360px);
  justify-content: space-between;
  align-items: center;
  gap: 40px;
  width: min(1180px, 100%);
  margin: 0 auto;
}

/* ------------------------------------------------------------------ hero */

.title-hero {
  display: grid;
  gap: 16px;
}

.title-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(244, 240, 232, 0.72);
}

.title-logo {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
  margin: 0;
  line-height: 0.95;
}

.title-logo-words {
  display: grid;
}

.title-emblem {
  width: clamp(72px, 9vw, 112px);
  height: auto;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 30px rgba(242, 182, 50, 0.25));
  transform: rotate(-4deg);
  animation: emblem-in 800ms 150ms cubic-bezier(0.2, 1.5, 0.4, 1) both;
}

@keyframes emblem-in {
  from { transform: rotate(-30deg) scale(0.4); opacity: 0; }
}

.title-fullscreen {
  position: absolute;
  top: max(16px, var(--safe-top));
  right: max(16px, var(--safe-right));
  z-index: 2;
}

.title-logo-hi {
  font-size: clamp(22px, 3.4vw, 34px);
  font-weight: 700;
  color: var(--marigold);
  letter-spacing: 0.04em;
  text-shadow: 0 2px 14px rgba(242, 182, 50, 0.35);
}

.title-logo-en {
  position: relative;
  justify-self: start;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  font-size: clamp(48px, 8.4vw, 96px);
  color: #fff4d6;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.7), 0 0 40px rgba(242, 182, 50, 0.25);
  padding-bottom: 10px;
}

/* A marigold brushstroke under the name. */
.title-logo-en::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 18%;
  bottom: 0;
  height: 7px;
  border-radius: 999px 40% 999px 30%;
  background: linear-gradient(90deg, #f2b632, #e8742a 70%, rgba(232, 116, 42, 0));
  transform: rotate(-1deg);
}

.title-tagline {
  margin: -4px 0 0;
  font-family: Georgia, serif;
  font-style: italic;
  font-size: clamp(17px, 2vw, 21px);
  color: rgba(255, 244, 214, 0.86);
}

/* Your resignation, with Sir's opinion stamped on it. */
.title-letter {
  position: relative;
  justify-self: start;
  max-width: 440px;
  margin: 6px 0 2px;
}

.title-letter-paper {
  padding: 14px 18px 12px;
  border-radius: 3px;
  background:
    repeating-linear-gradient(180deg, transparent 0 21px, rgba(40, 60, 120, 0.08) 21px 22px),
    #fbf8ef;
  color: #1c2a55;
  font-family: Georgia, serif;
  font-size: 13.5px;
  line-height: 1.45;
  transform: rotate(-1.6deg);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55), 0 2px 0 rgba(0, 0, 0, 0.15);
}

.title-letter-paper p {
  margin: 0 0 6px;
}

.title-letter-sub {
  font-size: 13px;
}

.title-letter-sign {
  font-family: "Brush Script MT", "Segoe Script", cursive;
  font-size: 19px;
  text-align: right;
  margin: 26px 0 0 !important;
}

.title-stamp {
  position: absolute;
  left: 22px;
  bottom: 8px;
  padding: 6px 12px;
  border: 3px solid rgba(200, 32, 26, 0.85);
  border-radius: 6px;
  color: rgba(200, 32, 26, 0.9);
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 15px;
  line-height: 1.05;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
  transform: rotate(-7deg);
  background: rgba(251, 248, 239, 0.15);
  mix-blend-mode: multiply;
  animation: stamp-in 700ms 500ms cubic-bezier(0.2, 1.8, 0.4, 1) both;
}

@keyframes stamp-in {
  from { transform: rotate(-7deg) scale(2.4); opacity: 0; }
}

.title-story {
  margin: 0;
  max-width: 520px;
  font-size: 15px;
  line-height: 1.6;
  color: rgba(244, 240, 232, 0.82);
}

.title-story b {
  color: #fff4d6;
}

.title-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 4px;
}

.title-start {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 28px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f7c451, #e89b24);
  color: #1b1405;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 34px rgba(242, 182, 50, 0.35), inset 0 -2px 0 rgba(0, 0, 0, 0.15);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.title-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 40px rgba(242, 182, 50, 0.5), inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}

.title-start:focus-visible {
  outline: 3px solid #fff4d6;
  outline-offset: 3px;
}

.title-best {
  margin: 0;
  font-size: 13px;
  color: rgba(244, 240, 232, 0.7);
}

/* ------------------------------------------------------------------ side */

.title-side {
  display: grid;
  gap: 14px;
}

.title-kit,
.title-rules {
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(8, 10, 16, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.title-section-label {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--marigold);
}

.title-kit-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.title-kit-item {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 6px 4px 5px;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 38%, rgba(255, 246, 225, 0.3), rgba(255, 246, 225, 0.06) 70%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 10px;
  line-height: 1.15;
  text-align: center;
  color: rgba(244, 240, 232, 0.78);
  transition: transform 150ms ease, background 150ms ease;
}

.title-kit-item:hover {
  transform: translateY(-2px) rotate(-2deg);
  background: rgba(242, 182, 50, 0.12);
}

.title-kit-item img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.6));
}

.title-kit-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: rgba(244, 240, 232, 0.6);
}

.title-rules {
  margin: 0;
  list-style: none;
  display: grid;
  gap: 9px;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(244, 240, 232, 0.78);
}

.title-rules li {
  position: relative;
  padding-left: 18px;
}

.title-rules li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 7px;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--marigold);
  transform: rotate(45deg);
}

.title-rules b {
  color: #fff4d6;
}

.title-keys {
  position: relative;
  margin: 0 auto;
  font-size: 12px;
  color: rgba(244, 240, 232, 0.5);
  text-align: center;
}

@media (hover: none) {
  .title-keys {
    display: none;
  }
}

/* --------------------------------------------------------------- narrow */

@media (max-width: 900px) {
  .title-screen {
    justify-content: flex-start;
  }

  .title-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
  }

  .title-shade {
    background:
      linear-gradient(180deg, rgba(5, 8, 18, 0.55) 0%, rgba(5, 8, 18, 0.85) 45%, rgba(5, 8, 18, 0.95) 100%);
  }

}

@media (max-width: 480px) {
  .title-kicker {
    padding-right: 56px;
  }

  .title-screen {
    padding: max(20px, var(--safe-top)) 16px max(16px, var(--safe-bottom));
  }

  .title-letter-paper {
    font-size: 12.5px;
  }

  .title-kit-item img {
    width: 42px;
    height: 42px;
  }

  .title-start {
    width: 100%;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .title-emblem,
  .title-stamp {
    animation: none;
  }
}

/* ------------------------------------------------ phones held sideways */

/* The only way the game is played on a phone: two columns, everything
   smaller, the page scrolls if it has to. */
@media (max-height: 500px) and (orientation: landscape) {
  .title-screen {
    justify-content: flex-start;
    padding: max(14px, var(--safe-top)) max(62px, var(--safe-right)) max(12px, var(--safe-bottom)) max(20px, var(--safe-left));
  }

  .title-layout {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    align-items: start;
    gap: 20px;
  }

  .title-shade {
    background:
      linear-gradient(90deg, rgba(5, 8, 18, 0.9) 0%, rgba(5, 8, 18, 0.75) 55%, rgba(5, 8, 18, 0.6) 100%);
  }

  .title-hero {
    gap: 9px;
  }

  .title-kicker {
    font-size: 9px;
    padding-right: 0;
  }

  .title-emblem {
    width: 54px;
  }

  .title-logo {
    gap: 12px;
  }

  .title-logo-hi {
    font-size: 17px;
  }

  .title-logo-en {
    font-size: 38px;
    padding-bottom: 6px;
  }

  .title-logo-en::after {
    height: 5px;
  }

  .title-tagline {
    font-size: 14px;
  }

  .title-letter-paper {
    padding: 9px 12px 8px;
    font-size: 11px;
  }

  .title-letter-sign {
    font-size: 15px;
    margin-top: 16px !important;
  }

  .title-stamp {
    font-size: 11px;
    padding: 4px 8px;
    bottom: 5px;
  }

  .title-story {
    font-size: 12px;
    line-height: 1.45;
  }

  .title-start {
    width: auto;
    padding: 11px 22px;
    font-size: 15px;
  }

  .title-side {
    gap: 10px;
  }

  .title-kit,
  .title-rules {
    padding: 10px 12px;
    border-radius: 12px;
  }

  .title-kit-grid {
    gap: 5px;
  }

  .title-kit-item {
    font-size: 8.5px;
    padding: 4px 2px;
  }

  .title-kit-item img {
    width: 30px;
    height: 30px;
  }

  .title-kit-note {
    display: none;
  }

  .title-rules {
    gap: 5px;
    font-size: 11px;
    line-height: 1.35;
  }

  .title-fullscreen {
    width: 40px;
    height: 40px;
  }
}
