@import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;600;700;800&display=swap");

body {
  margin: 0;
  overflow: hidden;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 2em;
  color: white;
  background: #9fc4d8;
}
body::before {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  content: "";
  background: linear-gradient(180deg, rgba(2, 12, 17, 0.35), transparent 48%, rgba(2, 12, 16, 0.3));
  mix-blend-mode: multiply;
  opacity: 1;
  transition: opacity 300ms ease;
}
body.started::before {
  opacity: 0;
}
#home-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  color: #f4f0e4;
  background: rgba(2, 12, 17, 0.52);
  transition: opacity 480ms ease, visibility 480ms ease;
}
#home-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.storm-rain {
  position: absolute;
  inset: -20%;
  opacity: 0.28;
  transform: rotate(15deg);
  background-image: repeating-linear-gradient(105deg, transparent 0 58px, rgba(202, 221, 224, 0.33) 59px, transparent 60px 118px);
  animation: rain-drift 1.8s linear infinite;
}
@keyframes rain-drift { to { transform: rotate(15deg) translate(-70px, 100px); } }
.eyebrow, .stat-label, .stat-unit, .stat-row, .start-panel small, .threat-meter {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.eyebrow { color: #f6b900; font-size: 11px; font-weight: 700; }
.brand-lockup, .run-stats, .start-panel, .top-actions, .threat-meter { position: absolute; }
.brand-lockup { top: 38px; left: 38px; padding-left: 13px; border-left: 3px solid #f6b900; }
.brand-lockup h1 { margin: 5px 0 0; font-family: inherit; font-weight: 800; font-size: clamp(28px, 3vw, 50px); line-height: 0.91; letter-spacing: 0; }
.run-stats { top: 176px; left: 38px; width: 166px; }
.run-stats strong { display: inline-block; margin-top: 2px; font-family: inherit; font-weight: 800; font-size: 60px; line-height: 0.95; letter-spacing: 0; }
.stat-unit { color: #f6b900; font-size: 10px; }
.stat-row { display: flex; justify-content: space-between; margin-top: 22px; padding-top: 10px; border-top: 1px solid rgba(246, 185, 0, 0.55); color: rgba(244, 240, 228, 0.55); font-size: 10px; }
.stat-row b { color: #f4f0e4; font-weight: 700; }
.start-panel { top: 50%; left: 50%; width: min(430px, 42vw); min-width: 300px; padding: 2px 0 22px 26px; border-left: 3px solid #f6b900; transform: translate(-12%, -44%); }
.start-panel h2 { margin: 13px 0 14px; font-family: inherit; font-weight: 800; font-size: clamp(60px, 6.2vw, 116px); line-height: 0.86; letter-spacing: 0; }
.start-panel p { margin: 0 0 24px; color: rgba(244, 240, 228, 0.7); font-size: 14px; }
#start-run { padding: 15px 21px; border: 1px solid #f6b900; border-radius: 4px; background: #f6b000; color: #111b1c; font-family: inherit; font-size: 16px; font-weight: 800; letter-spacing: 0.04em; box-shadow: 0 8px 26px rgba(246, 176, 0, 0.2); transition: transform 150ms ease, background 150ms ease; }
#start-run:hover { background: #ffd15a; transform: translateY(-2px); }
#start-run span { margin-right: 8px; }
.start-panel small { display: block; margin-top: 14px; color: rgba(244, 240, 228, 0.58); font-size: 9px; }
.top-actions { top: 38px; right: 38px; display: flex; gap: 8px; }
.top-actions button { width: 38px; height: 38px; border: 1px solid rgba(244, 240, 228, 0.35); border-radius: 4px; background: rgba(4, 18, 22, 0.6); color: #f4f0e4; font-size: 17px; }
.threat-meter { right: 38px; bottom: 34px; width: 250px; color: rgba(244, 240, 228, 0.68); font-size: 10px; }
.threat-meter b { float: right; color: #f4f0e4; }
.threat-meter i { display: block; height: 3px; margin-top: 9px; background: rgba(244, 240, 228, 0.28); }
.threat-meter em { display: block; width: 0; height: 100%; background: #e23e32; }
body.impact-flash::after {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  content: "";
  background: rgba(183, 42, 30, 0.28);
  animation: impact-flash 180ms ease-out forwards;
}
@keyframes impact-flash {
  from { opacity: 1; }
  to { opacity: 0; }
}
button {
  outline: none;
  cursor: pointer;
  border: none;
  -webkit-tap-highlight-color: transparent;
}
#counter {
  position: absolute;
  top: 24px;
  right: 28px;
  min-width: 72px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: rgba(20, 30, 34, 0.64);
  box-shadow: 0 10px 28px rgba(18, 27, 28, 0.2);
  font-family: inherit;
  font-size: 0.75em;
  text-align: center;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}
body.started #counter { opacity: 1; }
#end {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  background: rgba(2, 12, 17, 0.65);
  backdrop-filter: blur(4px);
  transition: opacity 300ms ease, visibility 300ms ease;
}
#end[style*="visible"], #end.visible {
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}
#end button {
  padding: 18px 48px;
  border-radius: 8px;
  background: #f6b000;
  color: #111b1c;
  font-family: inherit;
  font-size: 0.85em;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  border: 2px solid #ffffff;
  transition: transform 150ms ease, background 150ms ease;
  pointer-events: auto !important;
  position: relative;
  z-index: 10000;
}
#end button:hover {
  background: #ffd15a;
  transform: scale(1.06);
}
#controlls {
  position: absolute;
  min-width: 100%;
  min-height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}
body.started #controlls { opacity: 1; pointer-events: auto; }
#controlls div {
  display: grid;
  grid-template-columns: 50px 50px 50px;
  grid-template-rows: auto auto;
  grid-column-gap: 8px;
  grid-row-gap: 8px;
  margin-bottom: 24px;
}
#controlls button {
  width: 52px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 7px;
  background: rgba(20, 30, 34, 0.62);
  color: white;
  box-shadow: 0 8px 20px rgba(18, 27, 28, 0.2);
  transition: transform 120ms ease, background 120ms ease;
}
#controlls button:active {
  transform: translateY(2px) scale(0.96);
  background: rgba(217, 92, 58, 0.9);
}
#controlls svg {
  fill: currentColor;
  opacity: 0.9;
}
#controlls button:first-of-type {
  grid-column: 1/-1;
}
@media (max-width: 600px) {
  .brand-lockup { top: 22px; left: 20px; }
  .run-stats { top: 136px; left: 20px; transform: scale(0.8); transform-origin: top left; }
  .start-panel { top: 50%; left: 20px; width: calc(100% - 40px); min-width: 0; padding-left: 18px; transform: translateY(-42%); }
  .start-panel h2 { font-size: clamp(58px, 18vw, 88px); }
  .top-actions { top: 20px; right: 20px; }
  .threat-meter { right: 20px; bottom: 22px; width: 180px; }
  #counter {
    top: 14px;
    right: 14px;
    font-size: 0.58em;
  }
  #controlls div {
    margin-bottom: 14px;
  }
}
