/* ===== Colours ===== */
:root {
  --night: #020a1f;
  --deep: #06204a;
  --electric: #1f7bff;
  --sky: #6ec6ff;
  --light: #cfeaff;
  --cyan: #38e8ff;
  --gold: #e8c56a;
  --gold-light: #fff0bd;
  --white: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  background: var(--night);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100svh; /* fits iPhone Safari with its toolbars */
  color: var(--white);
  font-family: "Noto Sans Sinhala", "Sinhala Sangam MN", sans-serif;
  text-align: center;
}

/* ===== Background ===== */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(180deg, var(--night) 0%, var(--deep) 62%, #0a3f7c 100%);
}

.glow {
  position: absolute;
  width: 120vmax;
  height: 120vmax;
  border-radius: 50%;
  animation: drift 14s ease-in-out infinite alternate;
}
.glow-cyan {
  top: -70vmax;
  left: -50vmax;
  background: radial-gradient(circle, rgba(56, 232, 255, .22), transparent 62%);
}
.glow-blue {
  right: -65vmax;
  bottom: -65vmax;
  background: radial-gradient(circle, rgba(31, 123, 255, .38), transparent 62%);
  animation-delay: -7s;
}

.stars {
  position: absolute;
  inset: 0;
  animation: twinkle 4s ease-in-out infinite alternate;
}
.stars-small {
  background-image:
    radial-gradient(1px 1px at 20px 30px, var(--white), transparent),
    radial-gradient(1px 1px at 90px 120px, var(--light), transparent),
    radial-gradient(1px 1px at 150px 60px, var(--white), transparent),
    radial-gradient(1px 1px at 60px 180px, var(--sky), transparent);
  background-size: 190px 210px;
}
.stars-large {
  background-image:
    radial-gradient(2px 2px at 40px 90px, var(--gold-light), transparent),
    radial-gradient(1.5px 1.5px at 210px 40px, var(--cyan), transparent),
    radial-gradient(2px 2px at 160px 230px, var(--white), transparent);
  background-size: 280px 310px;
  animation-delay: -2s;
}

.horizon {
  position: absolute;
  left: -50%;
  bottom: -62vw;
  width: 200%;
  height: 75vw;
  border-radius: 50%;
  border-top: 1px solid rgba(110, 198, 255, .55);
  box-shadow: 0 -12px 50px rgba(56, 232, 255, .25);
}

/* ===== Welcome screen ===== */
.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding:
    calc(24px + env(safe-area-inset-top))
    calc(20px + env(safe-area-inset-right))
    calc(24px + env(safe-area-inset-bottom))
    calc(20px + env(safe-area-inset-left));
}

.emblem {
  position: relative;
  width: 92px;
  height: 92px;
  margin-bottom: 22px;
}
.ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid transparent;
}
.ring-outer {
  inset: 0;
  border-top-color: var(--gold);
  border-bottom-color: var(--cyan);
  animation: spin 12s linear infinite;
}
.ring-inner {
  inset: 14px;
  border-left-color: var(--gold-light);
  border-right-color: var(--sky);
  animation: spin 8s linear infinite reverse;
}
/* four-point golden light */
.spark {
  position: absolute;
  inset: 27px;
  background: radial-gradient(circle, var(--white) 8%, var(--gold-light) 30%, var(--gold) 70%);
  clip-path: polygon(50% 0, 59% 41%, 100% 50%, 59% 59%, 50% 100%, 41% 59%, 0 50%, 41% 41%);
  animation: pulse 3s ease-in-out infinite;
}

.intro {
  color: var(--light);
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.8;
}

/* Never split Sinhala letters or add letter spacing: it breaks the script */
.name {
  margin: 10px 0 4px;
  font-family: "Noto Serif Sinhala", "Sinhala Sangam MN", serif;
  font-size: clamp(2.2rem, 11vw, 4.2rem);
  font-weight: 700;
  line-height: 1.5;
  filter: drop-shadow(0 0 18px rgba(232, 197, 106, .35));
}
.name span {
  display: block;
  padding: 0 .1em;
  color: var(--gold-light);
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .name span {
    background: linear-gradient(100deg, var(--gold) 20%, var(--gold-light) 40%, var(--white) 50%, var(--gold-light) 60%, var(--gold) 80%);
    background-size: 250% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 6s ease-in-out infinite alternate;
  }
}

.divider {
  display: flex;
  justify-content: center;
  align-items: center;
  width: min(240px, 70%);
  height: 1px;
  margin: 14px 0 20px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.divider i {
  width: 7px;
  height: 7px;
  background: var(--gold-light);
  transform: rotate(45deg);
  box-shadow: 0 0 12px var(--gold);
}

.hint {
  max-width: 21rem;
  text-wrap: balance;
  color: var(--light);
  font-size: .9rem;
  line-height: 1.9;
}

/* ===== Button ===== */
.start {
  min-height: 56px;
  width: min(100%, 320px);
  margin-top: 28px;
  padding: 16px 24px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: linear-gradient(135deg, #0b57d0, var(--electric) 55%, #0a8fc4);
  color: var(--white);
  font-family: "Cinzel", Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .08em;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  box-shadow: 0 0 22px rgba(56, 232, 255, .45), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.start:active { filter: brightness(1.15); }
.start:focus-visible { outline: 3px solid var(--cyan); outline-offset: 4px; }

.message {
  min-height: 2em;
  margin-top: 14px;
  color: var(--gold-light);
  line-height: 1.8;
}

/* ===== Animations ===== */
.reveal { animation: rise 1.1s ease-out both; }
.r1 { animation-delay: .1s; }
.r2 { animation-delay: .5s; }
.r3 { animation-delay: .9s; }
.r4 { animation-delay: 1.5s; }
.r5 { animation-delay: 2s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes pulse   { 50% { transform: scale(1.18); opacity: .8; } }
@keyframes twinkle { from { opacity: .35; } to { opacity: .95; } }
@keyframes drift   { to { transform: translate3d(6vmax, 4vmax, 0); } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* Short screens, for example a phone turned sideways */
@media (max-height: 620px) {
  .emblem { display: none; }
  .name { font-size: 2.2rem; }
  .start { margin-top: 18px; }
}

/* Respect the phone's "Reduce Motion" setting */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}
