:root{
  /* LIGHT MODE */
  --bg: #ffffff;
  --panel: rgba(0,0,0,.04);
  --stroke: rgba(0,0,0,.14);
  --text: rgba(0,0,0,.92);
  --muted: rgba(0,0,0,.68);
  --shadow: 0 18px 55px rgba(0,0,0,.18);

  --major: #3fa9f5;
  --minor: #fe7aab;
  --good: #7ac943;
  --bad:  #ff1d25;
  --orange: #fe921d;
}

*{ box-sizing:border-box; }

html,body{
  height:100%;
  margin:0;
  overflow:hidden;
  touch-action: manipulation;
  -ms-touch-action: manipulation;

  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Fullscreen black-backdrop fix (important when using translucent panels) */
.app{ background: #ffffff; }
#appRoot:fullscreen,
#appRoot:-webkit-full-screen{
  background: #ffffff;
}
:fullscreen{ background:#ffffff; }

.app{
  height: calc(var(--vh, 1vh) * 100);
  width:100%;
  display:grid;
  grid-template-rows: 1fr auto auto;
  gap: 10px;

  padding: 10px;
  padding-top: calc(10px + env(safe-area-inset-top));
  padding-bottom: calc(10px + env(safe-area-inset-bottom));

  overflow:auto;
  -webkit-overflow-scrolling: touch;
}
.app::-webkit-scrollbar{ width:0; height:0; }

/* Staff area */
.staffArea{
  position: relative;
  border: 2px solid rgba(0,0,0,.80);
  background: #ffffff;
  box-shadow: var(--shadow);
  overflow:hidden;
  border-radius: 16px;
  display:flex;
  flex-direction:column;
}

.staffTop{
  padding: 10px 12px 6px;
  border-bottom: 1px solid rgba(0,0,0,.10);
  background: rgba(0,0,0,.03);
}

.banner{
  font-weight: 1000;
  font-size: 24px;
  text-align:center;
  letter-spacing: .2px;
  color: rgba(0,0,0,.92);
}
.subBanner{
  min-height: 26px;
  text-align:center;
  font-weight: 900;
  font-size: 18px;
  color: rgba(0,0,0,.74);
  margin-top: 6px;
}

.staffMount{
  flex:1;
  width:100%;
}

/* BIG listen overlay */
.listenOverlay{
  position:absolute;
  inset: 0;
  display:flex;
  align-items:center;
  justify-content:center;
  pointer-events:none;

  opacity: 0;
  visibility: hidden;
  transform: scale(0.985);
  transition: opacity .12s ease, transform .12s ease, visibility .12s ease;
}
.listenOverlay.show{
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}
.listenCard{
  background: rgba(255,255,255,.94);
  border: 2px solid rgba(254,146,29,.65);
  box-shadow: 0 20px 70px rgba(0,0,0,.25);
  border-radius: 22px;
  padding: 18px 22px;
  text-align:center;
  backdrop-filter: blur(6px);
}
.listenText{
  font-size: 44px;
  font-weight: 1000;
  letter-spacing: .2px;
  color: rgba(0,0,0,.92);
  text-shadow: 0 10px 26px rgba(0,0,0,.10);
}
.listenEmoji{
  margin-top: 6px;
  font-size: 40px;
  filter: drop-shadow(0 10px 22px rgba(0,0,0,.15));
}

/* HUD */
.hud{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 10px;
}
.hudLeft, .hudRight{
  display:flex;
  gap: 10px;
  align-items:center;
  flex-wrap: wrap;
}
.pillRow{
  display:flex;
  gap: 10px;
  align-items:center;
  flex-wrap: wrap;
}
.hidden{ display:none !important; }

.pill{
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 10px 12px;
  display:flex;
  gap: 10px;
  align-items:baseline;
  box-shadow: 0 10px 28px rgba(0,0,0,.12);
}
.pill .label{ color: var(--muted); font-weight: 900; font-size: 12px; }
.pill .value{ font-weight: 1000; font-size: 18px; color: rgba(0,0,0,.92); }

/* Mode chips */
.modeSwitch{
  display:flex;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.04);
  border: 1px solid rgba(0,0,0,.14);
  box-shadow: 0 12px 30px rgba(0,0,0,.12);
}
.chip{
  border-radius: 999px;
  border: 2px solid rgba(0,0,0,.16);
  background: rgba(0,0,0,.04);
  color: rgba(0,0,0,.92);
  font-weight: 1000;
  font-size: 14px;
  padding: 10px 14px;
  cursor:pointer;
  touch-action: manipulation;
  user-select:none;
}
.chip.active{
  outline: 6px solid rgba(0,0,0,.18);
  outline-offset: 1px;
  background: rgba(63,169,245,.18);
  border-color: rgba(63,169,245,.40);
}

/* Buttons */
.btn{
  border-radius: 16px;
  border: 2px solid rgba(0,0,0,.16);
  background: rgba(0,0,0,.05);
  color: rgba(0,0,0,.92);
  font-weight: 1000;
  font-size: 18px;
  padding: 14px 16px;
  cursor:pointer;
  user-select:none;
  -webkit-user-select:none;
  touch-action: manipulation;
  box-shadow: 0 12px 30px rgba(0,0,0,.12);
}
.btn:active{ transform: scale(.99); }
.btn.primary{
  background: rgba(63,169,245,.18);
  border-color: rgba(63,169,245,.42);
}
.btn.ghost{ background: rgba(0,0,0,.04); }

/* Replay button pulse (orange) */
@keyframes orangePulse {
  0%   { box-shadow: 0 12px 30px rgba(0,0,0,.12), 0 0 0 0 rgba(254,146,29,.0); transform: translateZ(0) scale(1); }
  45%  { box-shadow: 0 14px 34px rgba(0,0,0,.16), 0 0 0 12px rgba(254,146,29,.18); transform: translateZ(0) scale(1.01); }
  100% { box-shadow: 0 12px 30px rgba(0,0,0,.12), 0 0 0 0 rgba(254,146,29,.0); transform: translateZ(0) scale(1); }
}
.pulseOrange{
  border-color: rgba(254,146,29,.80) !important;
  background: rgba(254,146,29,.16) !important;
  animation: orangePulse 1.15s ease-in-out infinite;
}

/* Answer buttons */
.answerArea{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.bigBtn{
  height: 110px;
  border-radius: 18px;
  border: 2px solid rgba(0,0,0,.16);
  background: rgba(0,0,0,.05);
  color: white;
  font-weight: 1000;
  font-size: 36px;
  letter-spacing: .6px;
  cursor:pointer;
  user-select:none;
  touch-action: manipulation;
  box-shadow: 0 18px 45px rgba(0,0,0,.18);
  text-shadow: 0 8px 16px rgba(0,0,0,.22);
}
.bigBtn:active{ transform: scale(.99); }
.bigBtn.major{
  background: rgba(63,169,245,.85);
  border-color: rgba(63,169,245,.95);
}
.bigBtn.minor{
  background: rgba(254,122,171,.85);
  border-color: rgba(254,122,171,.95);
}

/* Universal disabled look */
button:disabled,
input:disabled{
  opacity: .45 !important;
  pointer-events:none !important;
  filter: saturate(.85);
}

/* Overlays */
.overlay{
  position: fixed;
  inset: 0;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(0,0,0,.35);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition: opacity .16s ease;
  z-index: 50000;
}
.overlay.show{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 60000;
}
.overlayCard{
  width: min(760px, 92%);
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,.18);
  background: rgba(255,255,255,.98);
  box-shadow: 0 22px 70px rgba(0,0,0,.22);
  padding: 16px;
  text-align:center;
  pointer-events:auto;
}
.overlayCard.wide{ width: min(1120px, 94%); }
.overlayTitle{ font-size: 34px; font-weight: 1000; margin-bottom: 6px; color: rgba(0,0,0,.92); }
.overlayText{ font-size: 18px; color: rgba(0,0,0,.80); margin-bottom: 12px; }
.overlaySmall{ margin-top: 10px; color: rgba(0,0,0,.62); font-size: 13px; line-height: 1.35; }
.overlayButtons{
  display:flex;
  gap:10px;
  justify-content:center;
  flex-wrap:wrap;
  margin-top: 10px;
}

/* Team setup */
.teamGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
  text-align:left;
}
.teamField{
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.14);
  background: rgba(0,0,0,.03);
  padding: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,.10);
}
.teamLabel{
  display:block;
  font-weight: 1000;
  font-size: 13px;
  color: rgba(0,0,0,.78);
  margin-bottom: 6px;
}
.teamInput{
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.18);
  background: rgba(255,255,255,.98);
  padding: 12px 12px;
  font-size: 16px;
  font-weight: 900;
  color: rgba(0,0,0,.92);
  outline: none;
}
.teamInput:focus{
  box-shadow: 0 0 0 4px rgba(0,135,255,.18);
  border-color: rgba(0,135,255,.40);
}

/* Tutorial layout */
.tutorialGrid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  text-align:left;
  margin-top: 10px;
}
.tutorialPanel{
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.14);
  background: rgba(0,0,0,.03);
  padding: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,.12);
}
.tutorialHeading{
  font-weight: 1000;
  font-size: 18px;
  margin-bottom: 6px;
  color: rgba(0,0,0,.92);
}
.tutorialList{
  margin: 0;
  padding-left: 18px;
  color: rgba(0,0,0,.82);
  font-weight: 800;
  line-height: 1.35;
  font-size: 16px;
}
.tutorialList li{ margin: 6px 0; }

/* Leaderboard list */
.boardList{
  display:flex;
  flex-direction:column;
  gap: 10px;
  margin-top: 10px;
  text-align:left;
}
.boardRow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.14);
  background: rgba(0,0,0,.03);
  box-shadow: 0 12px 30px rgba(0,0,0,.10);
}
.boardName{
  font-weight: 1000;
  color: rgba(0,0,0,.92);
}
.boardScore{
  font-weight: 1000;
  font-size: 22px;
  color: rgba(0,0,0,.92);
}

/* Shared staff mounts */
.journeyStaffMount{
  width: 100%;
  height: 320px;
}

/* WRONG popup additions */
.wrongBig{
  font-size: 28px;
  font-weight: 1000;
  line-height: 1.2;
  padding: 8px 0 10px;
  color: rgba(0,0,0,.92);
}
.wrongBig .bad{ color: rgba(255,29,37,.95); }
.wrongBig .maj{ color: rgba(63,169,245,.95); }
.wrongBig .min{ color: rgba(254,122,171,.95); }

.wrongGrid{
  display:grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 12px;
  align-items:stretch;
  margin-top: 8px;
}
.wrongStaffWrap{
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.14);
  background: rgba(0,0,0,.03);
  padding: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,.12);
}

.wrongHelp{
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.14);
  background: rgba(0,0,0,.03);
  padding: 12px;
  text-align:left;
  box-shadow: 0 12px 30px rgba(0,0,0,.12);
}
.helpTitle{
  font-size: 20px;
  font-weight: 1000;
  margin-bottom: 6px;
  color: rgba(0,0,0,.92);
}
.helpText{
  color: rgba(0,0,0,.82);
  font-weight: 900;
  line-height: 1.3;
  margin-bottom: 10px;
}
.bigHelpText{ font-size: 18px; }

.helpButtons{
  display:flex;
  flex-direction:column;
  gap: 10px;
}

@media (max-width: 980px){
  .tutorialGrid{ grid-template-columns: 1fr; }
  .wrongGrid{ grid-template-columns: 1fr; }
  .journeyStaffMount{ height: 260px; }
  .listenText{ font-size: 36px; }
  .listenEmoji{ font-size: 34px; }
  .teamGrid{ grid-template-columns: 1fr; }
}

@media (max-width: 820px){
  .bigBtn{ height: 96px; font-size: 32px; }
  .overlayTitle{ font-size: 30px; }
  .wrongBig{ font-size: 24px; }
  .listenText{ font-size: 30px; }
  .listenEmoji{ font-size: 28px; }
}
