/* Wildfire styles. Big, round, friendly buttons sized for small fingers. */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #7fc1e0; font-family: -apple-system, "Avenir Next", "Trebuchet MS", "Segoe UI", Roboto, sans-serif; color: #1f2a1f; }
#app { position: fixed; left: 0; top: 0; right: 0; bottom: 0; overflow: hidden; }
#view { position: absolute; left: 0; top: 0; touch-action: none; display: block; }
.hidden { display: none !important; }
svg { display: block; }

.btn { border: 0; font: inherit; font-weight: 800; cursor: pointer; color: #1f2a1f; box-shadow: 0 3px 0 rgba(0,0,0,0.22), 0 4px 10px rgba(0,0,0,0.15); outline: none; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.22); }
.btn.round { width: 52px; height: 52px; border-radius: 26px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 18px; flex: none; }
.btn.round svg { width: 30px; height: 30px; }
.btn.pill { border-radius: 30px; padding: 12px 22px; font-size: 18px; min-height: 52px; }
.btn.big { font-size: 22px; padding: 14px 30px; min-height: 60px; }
.red { background: #ff5a4e; color: #fff; } .green { background: #4cc35a; color: #fff; } .blue { background: #3d9bff; color: #fff; }
.orange { background: #ff9a1f; color: #fff; } .white { background: #fff; } .yellow { background: #ffd23f; }

/* ---- HUD ---- */
#hud { position: absolute; left: 0; top: 0; right: 0; bottom: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
#topbar { position: absolute; left: 0; right: 0; top: 0; padding: 8px; padding-top: calc(8px + env(safe-area-inset-top)); padding-left: calc(8px + env(safe-area-inset-left)); padding-right: calc(8px + env(safe-area-inset-right));
  display: flex; flex-wrap: wrap; align-items: center; pointer-events: none; }
#topbar > * { pointer-events: auto; }
.chip { background: rgba(255,255,255,0.92); border-radius: 22px; height: 44px; padding: 0 14px; display: flex; align-items: center; font-weight: 800; font-size: 17px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); white-space: nowrap; }
.chip svg { width: 24px; height: 24px; flex: none; }
.chip .sep { width: 8px; }
#money { color: #1b7a2b; }
#windBox { margin-left: auto; }
#windArrow { display: inline-block; width: 30px; height: 30px; }
#windArrow svg { width: 30px; height: 30px; }

#toast { position: absolute; left: 50%; top: calc(70px + env(safe-area-inset-top)); transform: translateX(-50%); background: rgba(30,30,30,0.85); color: #fff; padding: 10px 18px; border-radius: 18px; font-weight: 700; font-size: 17px; max-width: 90%; text-align: center; pointer-events: none; }
#tip { position: absolute; left: 50%; top: calc(118px + env(safe-area-inset-top)); transform: translateX(-50%); width: 440px; max-width: 94%; background: #fffbe6; border: 4px solid #ffb627; border-radius: 22px; padding: 14px 16px; font-size: 18px; font-weight: 700; line-height: 1.35; box-shadow: 0 8px 24px rgba(0,0,0,0.25); display: flex; flex-direction: column; pointer-events: none !important; }
#tip .btn { align-self: flex-end; pointer-events: auto; }

#mini { position: absolute; right: calc(10px + env(safe-area-inset-right)); bottom: calc(112px + env(safe-area-inset-bottom)); width: 170px; height: 85px; background: rgba(20,60,30,0.35); border-radius: 14px; border: 3px solid rgba(255,255,255,0.8); touch-action: none; }
#btnStart { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(118px + env(safe-area-inset-bottom)); white-space: nowrap; display: flex; align-items: center; }
#btnStart svg { width: 32px; height: 32px; }
#sideBtns { position: absolute; left: calc(10px + env(safe-area-inset-left)); bottom: calc(118px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
#sideBtns .btn { display: flex; align-items: center; }
#sideBtns svg { width: 28px; height: 28px; }

#toolbar { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0.25)); }
#toolbar::-webkit-scrollbar { display: none; }
.tool { flex: none; width: 88px; height: 92px; border-radius: 20px; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px 2px; }
.tool svg { width: 44px; height: 44px; }
.tool .lbl { font-size: 14px; line-height: 1.1; }
.tool .cost { font-size: 12px; color: #1b7a2b; font-weight: 800; }
.tool.on { background: #ffd23f; box-shadow: 0 0 0 4px #fff, 0 3px 0 rgba(0,0,0,0.22); }
.tool.no { opacity: 0.45; }

.panel { position: absolute; left: calc(10px + env(safe-area-inset-left)); bottom: calc(180px + env(safe-area-inset-bottom)); width: 300px; max-width: 92%; background: #fff; border-radius: 20px; padding: 14px; box-shadow: 0 8px 24px rgba(0,0,0,0.25); font-weight: 700; }
.ptitle { font-size: 20px; font-weight: 900; margin-bottom: 6px; }
.prow { display: flex; flex-direction: column; margin: 8px 0; }
.prow2 { display: flex; justify-content: space-between; margin-top: 8px; }
.prow input[type=range] { width: 100%; height: 36px; }
#compass { display: grid; grid-template-columns: repeat(4, 1fr); grid-gap: 6px; }
#compass button { height: 40px; border-radius: 12px; border: 0; background: #e8f1ff; font: inherit; font-weight: 800; }
#compass button.on { background: #3d9bff; color: #fff; }

/* ---- title ---- */
.screen { position: absolute; left: 0; top: 0; right: 0; bottom: 0; background: linear-gradient(#bfe8ff, #a6dc7a); }
.tscroll { position: absolute; left: 0; right: 0; top: 0; bottom: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px; padding-top: calc(16px + env(safe-area-inset-top)); padding-bottom: calc(30px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; }
.tscroll > * { flex: none; }
.logo { display: flex; align-items: center; }
.logo svg { width: 76px; height: 76px; }
.logo h1 { margin: 0; font-size: 56px; font-weight: 900; color: #e8541b; text-shadow: 0 3px 0 #fff, 0 6px 12px rgba(0,0,0,0.15); letter-spacing: 1px; }
.tag { margin: 4px 0 10px; font-size: 18px; font-weight: 700; text-align: center; color: #2c4a2c; }
h2 { font-size: 21px; margin: 16px 0 8px; color: #24412a; }
.seg { display: flex; flex-wrap: wrap; justify-content: center; max-width: 760px; }
.seg button { flex: 1 1 160px; min-height: 70px; border-radius: 20px; border: 4px solid transparent; background: #fff; font: inherit; padding: 10px 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 3px 0 rgba(0,0,0,0.15); color: #1f2a1f; }
.seg button b { font-size: 20px; }
.seg button small { font-size: 14px; font-weight: 600; color: #4a5a4a; text-align: center; }
.seg button.on { border-color: #ff9a1f; background: #fff6e6; }
#mapPick { display: flex; flex-wrap: wrap; justify-content: center; max-width: 800px; }
.mapcard { width: 180px; border-radius: 20px; background: #fff; border: 4px solid transparent; padding: 8px; display: flex; flex-direction: column; align-items: center; box-shadow: 0 3px 0 rgba(0,0,0,0.15); font: inherit; color: #1f2a1f; }
.mapcard canvas { width: 160px; height: 80px; }
.mapcard b { font-size: 18px; }
.mapcard small { font-size: 13px; font-weight: 600; color: #4a5a4a; text-align: center; min-height: 34px; }
.mapcard .lvl { display: flex; align-items: center; font-size: 12px; font-weight: 800; color: #b55a00; }
.mapcard .lvl svg { width: 16px; height: 16px; }
.mapcard.on { border-color: #ff9a1f; background: #fff6e6; }
#btnPlay { margin-top: 20px; min-width: 220px; }
#btnResume { margin: 4px 0 6px; max-width: 94%; }
.foot { margin-top: 14px; font-size: 14px; color: #3a5a3a; font-weight: 600; }

/* ---- modals ---- */
.modal { position: absolute; left: 0; top: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.35); display: flex; align-items: center; justify-content: center; padding: 16px; }
.card { background: #fff; border-radius: 26px; padding: 20px; width: 420px; max-width: 100%; max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; align-items: stretch; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.ctitle { font-size: 30px; font-weight: 900; text-align: center; color: #e8541b; }
.small { font-size: 14px; color: #555; text-align: center; font-weight: 600; }
#rStars { display: flex; justify-content: center; }
#rStars svg { width: 64px; height: 64px; }
.rrow { display: flex; justify-content: space-between; align-items: center; font-size: 18px; font-weight: 700; padding: 6px 4px; border-bottom: 2px dashed #eee; }
.rrow b { font-size: 20px; white-space: nowrap; }
.rnote { font-size: 16px; font-weight: 600; text-align: center; color: #3a4a3a; padding-top: 4px; }
.rbtns { display: flex; flex-direction: column; margin-top: 6px; }

/* ---- small phones ---- */
@media (max-width: 600px) {
  .chip { height: 38px; font-size: 15px; padding: 0 10px; }
  .chip svg { width: 20px; height: 20px; }
  .btn.round { width: 46px; height: 46px; }
  #stats { order: 5; }
  #windBox { order: 6; margin-left: 0; }
  .tool { width: 68px; height: 80px; border-radius: 18px; }
  #toolbar { padding-left: 6px; padding-right: 6px; }
  .tool svg { width: 38px; height: 38px; }
  .tool .lbl { font-size: 12px; }
  .tool .cost { font-size: 11px; }
  #mini { width: 130px; height: 65px; bottom: calc(100px + env(safe-area-inset-bottom)); }
  #btnStart { bottom: calc(176px + env(safe-area-inset-bottom)); font-size: 19px; padding: 12px 20px; }
  #sideBtns { bottom: calc(100px + env(safe-area-inset-bottom)); }
  #toast { top: calc(104px + env(safe-area-inset-top)); font-size: 15px; }
  #tip { font-size: 15px; padding: 10px 12px; border-width: 3px; border-radius: 18px; }
  #tip .btn.pill { min-height: 40px; padding: 8px 16px; font-size: 16px; }
  .logo h1 { font-size: 44px; }
  .logo svg { width: 60px; height: 60px; }
  .mapcard { width: 46%; min-width: 136px; }
  .mapcard canvas { width: 120px; height: 60px; }
  .panel { bottom: calc(160px + env(safe-area-inset-bottom)); }
}
@media (max-width: 340px) {
  .chip { font-size: 14px; padding: 0 8px; }
  .chip .sep { width: 3px; }
  #windBox .unit { display: none; }
  #windArrow, #windArrow svg { width: 24px; height: 24px; }
  #phase { display: none; }
  .tool { width: 64px; height: 76px; }
}

/* Spacing with margins (older iPads don't support "gap" in flex boxes) */
#topbar { padding: 4px; padding-top: calc(4px + env(safe-area-inset-top)); padding-left: calc(4px + env(safe-area-inset-left)); padding-right: calc(4px + env(safe-area-inset-right)); }
#topbar > * { margin: 4px; }
.chip svg { margin-right: 5px; }
#windArrow { margin-right: 6px; }
#tip .btn { margin-top: 10px; }
#btnStart svg, #sideBtns svg { margin-right: 10px; }
#toolbar > * + * { margin-left: 8px; }
.prow > * + * { margin-top: 4px; }
.prow2 > * + * { margin-left: 8px; }
.logo svg { margin-right: 12px; }
.seg button { margin: 5px; }
.seg button > * + * { margin-top: 4px; }
.mapcard { margin: 6px; }
.mapcard > * + * { margin-top: 4px; }
.lvl svg { margin-right: 2px; }
.card > * + * { margin-top: 10px; }
#rStars svg { margin: 0 4px; }
.rrow svg { margin-right: 6px; }
.rbtns > * + * { margin-top: 8px; }
@media (max-width: 600px) { #toolbar > * + * { margin-left: 6px; } #tip .btn { margin-top: 6px; } .mapcard { width: 44%; } }
@media (max-width: 340px) { .chip svg { margin-right: 3px; } }
