/* Sprout & Bolt — playful rounded geometric sans, teal + coral on warm cream */
@font-face { font-family: 'Fredoka'; src: url('../assets/fonts/fredoka-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Fredoka'; src: url('../assets/fonts/fredoka-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Fredoka'; src: url('../assets/fonts/fredoka-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Fredoka'; src: url('../assets/fonts/fredoka-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --cream: #FBF3E2;
  --cream-2: #F3E7CE;
  --ink: #3E2F23;
  --teal: #12948A;
  --teal-dark: #0C6B64;
  --coral: #F0725C;
  --coral-dark: #C24B37;
  --shadow: 0 6px 0 rgba(62, 47, 35, .16);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Fredoka', ui-rounded, 'SF Pro Rounded', 'Segoe UI', system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
  -webkit-user-select: none; user-select: none;
}

#app { display: flex; flex-direction: column; height: 100%; }

/* ---------- top banner ---------- */
#banner {
  height: 64px; flex: 0 0 64px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 0 16px;
  background: var(--cream);
  border-bottom: 3px solid var(--ink);
  z-index: 20; position: relative;
}
.banner-side { display: flex; align-items: center; gap: 12px; min-width: 0; }
.banner-side.right { justify-content: flex-end; }
#levelName { font-weight: 700; font-size: 18px; white-space: nowrap; }
#objective {
  font-size: 14px; font-weight: 500; color: #6d5b44;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34vw;
}
.banner-mid { display: flex; align-items: center; gap: 10px; }
.trinket-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 600; font-size: 15px;
  padding: 4px 12px; border-radius: 999px;
  border: 2px solid var(--ink); background: #fff;
}
.trinket-pill::before { content: ''; width: 10px; height: 10px; border-radius: 50%; }
.trinket-pill.p1::before { background: var(--teal); }
.trinket-pill.p2::before { background: var(--coral); }
.solo-badge {
  font-size: 12px; font-weight: 700; letter-spacing: .06em;
  padding: 4px 10px; border-radius: 999px;
  background: var(--ink); color: var(--cream);
}
#timer { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 16px; }
.mini-btn {
  font-family: inherit; font-weight: 700; font-size: 14px;
  width: 34px; height: 34px; border-radius: 10px;
  border: 2px solid var(--ink); background: #fff; color: var(--ink);
  cursor: pointer; box-shadow: 0 3px 0 rgba(62,47,35,.2);
}
.mini-btn:active { transform: translateY(2px); box-shadow: none; }

/* ---------- stage ---------- */
#stageWrap { position: relative; flex: 1 1 auto; min-height: 0; background: #222; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#divider {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 4px; margin-left: -2px;
  background: var(--ink); opacity: .85; pointer-events: none; z-index: 5;
}
.viewport-tag {
  position: absolute; top: 10px; z-index: 6; pointer-events: none;
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  padding: 4px 10px; border-radius: 999px; color: #fff;
}
.tag-p1 { left: 12px; background: var(--teal); }
.tag-p2 { right: 12px; background: var(--coral); }

.toast {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 8; pointer-events: none;
  background: var(--ink); color: var(--cream);
  font-weight: 600; font-size: 15px;
  padding: 8px 18px; border-radius: 999px;
  box-shadow: var(--shadow);
  transition: opacity .25s ease;
}

/* ---------- overlays / cards ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: rgba(62, 47, 35, .45);
  backdrop-filter: blur(3px);
  padding: 20px;
}
.hidden { display: none !important; }
.card {
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 34px 40px;
  max-width: 620px; width: 100%;
  text-align: center;
  max-height: 92vh; overflow-y: auto;
}
.card h1 { font-size: clamp(30px, 5vw, 46px); font-weight: 700; }
.card h1 em { color: var(--coral-dark); font-style: normal; }
.card h2 { font-size: clamp(24px, 4vw, 34px); font-weight: 700; margin-bottom: 10px; }
.title-duo { display: flex; align-items: center; justify-content: center; gap: 14px; }
.dot { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--ink); }
.dot.p1 { background: var(--teal); }
.dot.p2 { background: var(--coral); }
.tagline { margin: 10px 0 22px; font-weight: 500; color: #6d5b44; }
.kicker {
  display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: #fff; background: var(--teal);
  padding: 4px 14px; border-radius: 999px; margin-bottom: 14px;
}
.finale-card .kicker { background: var(--coral); }

.menu-buttons { display: flex; flex-direction: column; gap: 12px; margin: 8px 0; }
.big-btn {
  font-family: inherit; cursor: pointer;
  font-size: 19px; font-weight: 600; color: #fff;
  border: 3px solid var(--ink); border-radius: 18px;
  padding: 13px 22px; box-shadow: 0 5px 0 rgba(62,47,35,.28);
  transition: transform .08s ease, box-shadow .08s ease;
  display: flex; flex-direction: column; gap: 3px; align-items: center;
}
.big-btn small { font-size: 12.5px; font-weight: 500; opacity: .92; }
.big-btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 rgba(62,47,35,.28); }
.big-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(62,47,35,.28); }
.p1-btn { background: var(--teal); }
.p2-btn { background: var(--coral); }
.big-btn.ghost { background: #fff; color: var(--ink); }

.howto {
  margin-top: 20px; padding-top: 16px;
  border-top: 2px dashed rgba(62,47,35,.3);
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px;
  font-size: 13.5px; font-weight: 500; color: #6d5b44; text-align: left;
}
.howto b { color: var(--ink); margin-right: 6px; }
.howto i { opacity: .8; }

.vignette-card p, .finale-card p { font-size: 17px; font-weight: 500; line-height: 1.55; margin-bottom: 20px; color: #54432f; }
.stats {
  display: flex; justify-content: center; gap: 22px; flex-wrap: wrap;
  margin-bottom: 20px; font-weight: 600; font-size: 16px;
}
.stats span { background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 8px 16px; }

/* ---------- touch controls ---------- */
.touch-pad {
  position: absolute; bottom: 14px; z-index: 12;
  display: grid; grid-template-columns: repeat(4, 54px); gap: 8px;
}
.left-pad { left: 14px; }
.right-pad { right: 14px; }
.touch-pad button, .touch-swap {
  font-family: inherit; font-size: 19px; font-weight: 700; color: var(--ink);
  width: 54px; height: 54px; border-radius: 16px;
  border: 2px solid var(--ink);
  background: rgba(251, 243, 226, .82);
  touch-action: none;
}
.left-pad button { box-shadow: 0 3px 0 var(--teal-dark); }
.right-pad button { box-shadow: 0 3px 0 var(--coral-dark); }
.touch-pad button.jump { background: rgba(255,255,255,.92); }
.touch-pad button.active { transform: translateY(2px); box-shadow: none; }
.touch-swap {
  position: absolute; bottom: 14px; left: 50%; margin-left: -27px; z-index: 12;
}

/* ---------- narrow notice ---------- */
.narrow-note {
  position: fixed; inset: auto 0 0 0; z-index: 60;
  background: var(--ink); color: var(--cream);
  font-size: 13.5px; font-weight: 500; line-height: 1.45;
  padding: 12px 16px;
}
.narrow-note b { color: #ffd9a0; }
.narrow-note button {
  font-family: inherit; font-weight: 700; margin-left: 10px;
  border: 2px solid var(--cream); background: transparent; color: var(--cream);
  border-radius: 10px; padding: 3px 12px; cursor: pointer;
}

@media (max-width: 760px) {
  #objective { display: none; }
  #levelName { font-size: 15px; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; }
  .card { padding: 22px 18px; }
  .howto { grid-template-columns: 1fr; }
  .touch-pad { grid-template-columns: repeat(2, 50px); gap: 6px; }
  .touch-pad button { width: 50px; height: 50px; }
  .touch-swap { bottom: 118px; width: 48px; height: 48px; margin-left: -24px; }
}
