* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1d6b2f; color: #fff; font-family: "Trebuchet MS", "Arial Rounded MT Bold", Arial, sans-serif; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; border: 0; color: inherit; }

#top { position: fixed; top: max(8px, env(safe-area-inset-top)); left: 8px; right: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; z-index: 5; pointer-events: none; }
#top > * { pointer-events: auto; }
.topBtns { display: flex; gap: 6px; }
.round { width: 46px; height: 46px; border-radius: 50%; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff; text-decoration: none; flex: 0 0 auto; }
.round.off { opacity: .45; }
#top .spacer { flex: 1; }
.meter { background: rgba(0,0,0,.45); padding: 6px 12px; border-radius: 16px; }
.meter { display: flex; flex-direction: column; gap: 2px; font-size: 12px; font-weight: bold; }
.bar { width: min(170px, 22vw); height: 14px; background: rgba(255,255,255,.2); border-radius: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffe14d, #ff8a1f); transition: width .4s; }
.keeper .bar i { background: linear-gradient(90deg, #7fdbff, #3a86ff); }
#qLabel { font-size: 14px; font-weight: bold; color: #1f7a3a; margin-bottom: 4px; }

#banner { position: fixed; left: 50%; top: 22%; transform: translate(-50%, -50%) scale(.6); font-size: clamp(26px, 5vw, 46px); font-weight: bold; color: #ffe14d; text-shadow: 0 4px 0 #a84d00, 0 8px 18px rgba(0,0,0,.6); pointer-events: none; opacity: 0; transition: opacity .25s, transform .25s; z-index: 6; white-space: nowrap; }
#banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* setup + result cards */
.modal { position: fixed; inset: 0; background: rgba(0, 30, 10, .45); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 14px; overflow-y: auto; }
.card { background: linear-gradient(#1f7a3a, #145a29); border: 4px solid #fff; border-radius: 26px; padding: 18px 22px; text-align: center; width: min(520px, 100%); box-shadow: 0 12px 40px rgba(0,0,0,.4); animation: popIn .3s; }
@keyframes popIn { from { transform: scale(.7); opacity: 0; } }
.card h1 { margin: 4px 0; font-size: 34px; text-shadow: 0 3px 0 #0b3d1a; }
.sub { margin: 4px 0 12px; font-size: 17px; }
.small { font-size: 14px; opacity: .85; margin: 10px 0 0; }
.field { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: bold; margin: 8px 0; }
.field input { font: inherit; font-size: 20px; padding: 8px 12px; border-radius: 12px; border: 0; width: 200px; text-align: center; color: #123; }
.formRow { display: flex; gap: 16px; justify-content: center; align-items: center; flex-wrap: wrap; }
.field #numIn { width: 74px; font-size: 26px; font-weight: bold; }
#hairIn { width: 54px; height: 44px; padding: 0; border: 3px solid #fff; border-radius: 12px; background: none; cursor: pointer; }
.pickLabel { font-weight: bold; margin: 8px 0 4px; }
#teams { display: grid; grid-template-columns: repeat(4, 1fr); max-height: 250px !important; gap: 6px; max-height: 210px; overflow-y: auto; padding: 2px; }
#teams button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border-radius: 12px; background: rgba(255,255,255,.1); font-size: 12px; font-weight: bold; border: 3px solid transparent; }
#teams button .badge { position: relative; width: 54px; height: 60px; display: flex; align-items: center; justify-content: center; clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%); box-shadow: inset 0 0 0 3px var(--acc); }
#teams button .badge b { font-size: 32px; line-height: 1; margin-top: -6px; }
#teams button .badge small { position: absolute; right: 4px; bottom: 15px; font-size: 15px; }
#teams button.on { border-color: #ffe14d; background: rgba(255,225,77,.2); }
.pickRow { display: flex; align-items: center; gap: 10px; margin: 8px 0; justify-content: center; }
.pickRow > span { width: 64px; text-align: right; font-weight: bold; }
.swatches, .chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.swatches button { width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgba(255,255,255,.4); }
.swatches button.on { border-color: #fff; box-shadow: 0 0 0 3px #ffe14d; }
.chips button { min-width: 44px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.15); font-weight: bold; font-size: 18px; }
.chips button.on { background: #ffe14d; color: #222; }
.go { background: linear-gradient(#ffe14d, #ffb703); color: #222; font-weight: bold; font-size: 24px; padding: 14px 30px; border-radius: 18px; box-shadow: 0 5px 0 #a86f00; margin-top: 10px; }
.go:active { transform: translateY(3px); box-shadow: 0 2px 0 #a86f00; }
.soft { background: rgba(255,255,255,.18); padding: 10px 18px; border-radius: 14px; font-weight: bold; margin-top: 10px; }
.bigEmoji { font-size: 70px; line-height: 1; }
#rStars { font-size: 34px; letter-spacing: 4px; }
#rText { font-size: 19px; }

/* question card */
#quiz { position: fixed; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(820px, calc(100% - 16px)); background: rgba(255,255,255,.96); color: #123; border-radius: 24px; padding: 12px 14px; z-index: 5; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.qrow { display: flex; align-items: center; gap: 12px; }
#qEmoji { font-size: 46px; line-height: 1; flex: 0 0 auto; }
#qText { flex: 1; font-size: clamp(19px, 2.6vw, 26px); font-weight: bold; line-height: 1.2; }
#readBtn { background: #1f7a3a; }
#answers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
#answers button { background: #e8f4ff; border: 3px solid #b9d9f5; border-radius: 18px; padding: 14px 8px; font-size: clamp(17px, 2.2vw, 22px); font-weight: bold; color: #123; min-height: 70px; }
#answers button:active { transform: scale(.97); }
#answers button.right { background: #7be05a; border-color: #3aa52a; color: #0b3d1a; animation: bounce .4s; }
#answers button.wrong { background: #ff8a8a; border-color: #e63946; animation: shake .35s; }
#answers button.dim { opacity: .45; }
@keyframes bounce { 50% { transform: scale(1.08); } }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
#feedback { min-height: 26px; text-align: center; font-weight: bold; font-size: 20px; margin-top: 8px; }

#shootHint { pointer-events: none; position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: rgba(0,0,0,.6); padding: 12px 22px; border-radius: 18px; font-size: clamp(18px, 3vw, 26px); font-weight: bold; z-index: 5; animation: hop 1s infinite alternate; white-space: nowrap; }
@keyframes hop { to { transform: translate(-50%, -8px); } }

@media (max-width: 600px) {
  #answers { grid-template-columns: 1fr; gap: 6px; }
  #answers button { min-height: 50px; padding: 8px; }
  .bar { width: 80px; }
  #teams { grid-template-columns: repeat(3, 1fr); }
  .meter span { font-size: 10px; }
  #qEmoji { font-size: 34px; }
}
