/* Qemuro Journey Quest - game UI on the official Qemuro brand.
   Palette: Blu Notte -> Blu Primario -> Turchese. Font: Poppins. No emoji: SVG icons. */
:root {
  --sky1: #0A1A2F; --sky2: #0D47A1; --sea: #00BCD4;
  --ink: #0A1A2F; --white: #fff;
  --gold: #00BCD4; --gold-ink: #063a41;
  --red: #e5484d; --green: #1f9d57; --amber: #d99a2b;
  --line: #e4e8f0;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: 'Poppins', -apple-system, 'Segoe UI', system-ui, Roboto, sans-serif;
  font-size: 16px; line-height: 1.5;
  background: linear-gradient(180deg, var(--sky1) 0%, var(--sky2) 60%, var(--sea) 100%);
  background-attachment: fixed;
  color: var(--white); min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
#game { max-width: 640px; margin: 0 auto; padding: 16px 14px 40px; }
.loading { text-align: center; padding: 80px 0; opacity: .7; }

.ic { width: 1.1em; height: 1.1em; vertical-align: -0.18em; flex: none; }

.q-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.q-logo { display: flex; align-items: center; gap: 10px; }
.logo-chip { display: inline-flex; background: #fff; border-radius: 9px; padding: 5px 9px; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.qlogo-full { width: auto; display: block; }
.q-module { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #7fd3e6; }
.q-link { color: #bfe0f5; font-size: 12px; text-decoration: none; }

.qcard {
  background: rgba(255, 255, 255, .97); color: var(--ink);
  border-radius: 18px; padding: 18px; margin: 12px 0;
  box-shadow: 0 10px 30px rgba(5, 22, 42, .4);
}
h1 { font-size: 22px; margin: 8px 0; display: flex; align-items: center; gap: 10px; letter-spacing: -.01em; }
h1 .ic { color: var(--sea); }
h2 { font-size: 18px; margin: 6px 0; display: flex; align-items: center; gap: 8px; }
.muted { color: #5a6b80; font-size: 13.5px; }
.small { font-size: 12.5px; }

/* stats bar */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.stat {
  background: rgba(6, 28, 52, .6); border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px; padding: 9px 6px; text-align: center;
}
.stat .sic { color: #8fd8cd; }
.stat .sic .ic { width: 16px; height: 16px; }
.stat .val { font-weight: 800; font-size: 15px; margin-top: 1px; }
.stat .lbl { font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; opacity: .7; }
.bar { height: 4.5px; background: rgba(255,255,255,.18); border-radius: 4px; margin-top: 5px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: #34c3af; transition: width .4s; }
.bar i.warn { background: var(--gold); }
.bar i.bad { background: #e0705f; }

/* choices */
.choice {
  display: block; width: 100%; text-align: left; font: inherit; cursor: pointer;
  background: #f3f7fb; border: 2px solid var(--line); border-radius: 14px;
  padding: 13px 14px; margin: 9px 0; color: var(--ink); transition: transform .08s, border-color .15s;
}
.choice:hover { border-color: var(--sky2); transform: translateY(-1px); }
.choice b { display: block; font-size: 15px; }
.choice .fx { font-size: 12.5px; color: #5a6b80; margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.choice .fx span { display: inline-flex; align-items: center; gap: 3px; }
.choice .fx .ic { width: .95em; height: .95em; }
.choice .risk-tag { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; border-radius: 6px; padding: 2px 8px; margin-top: 6px; text-transform: uppercase; }
.risk-tag.basso { background: #e2f2e9; color: var(--green); }
.risk-tag.medio { background: #f9eed3; color: #8a6116; }
.risk-tag.alto { background: #f9e0dd; color: var(--red); }

.btn {
  font: inherit; font-weight: 750; cursor: pointer; border: 0; border-radius: 12px;
  padding: 13px 20px; display: inline-flex; gap: 9px; align-items: center; justify-content: center;
  text-decoration: none; letter-spacing: .01em;
}
.btn-go { background: linear-gradient(135deg, #0D47A1, #00BCD4); color: #fff; width: 100%; font-size: 16.5px; box-shadow: 0 6px 16px rgba(0,188,212,.35); }
.btn-go:hover { filter: brightness(1.06); }
.btn-sea { background: var(--sea); color: #fff; }
.btn-ghost { background: transparent; border: 2px solid var(--line); color: var(--ink); }
.btn-ghost.ondark { border-color: rgba(255,255,255,.4); color: #fff; }

/* mission select */
.mission {
  cursor: pointer; border: 2px solid var(--line); border-radius: 16px; padding: 14px; margin: 10px 0;
  display: flex; gap: 14px; align-items: center; background: #f7fafd; transition: border-color .15s, transform .08s;
}
.mission:hover { border-color: var(--sea); transform: translateY(-1px); }
.mission .m-ico {
  flex: none; width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(135deg, var(--sky2), var(--sea)); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.mission .m-ico .ic { width: 26px; height: 26px; }
.mission .m-tag { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--sky2); }

/* progress dots */
.dots { display: flex; gap: 6px; justify-content: center; margin: 8px 0; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.3); }
.dots i.done { background: var(--gold); }
.dots i.cur { background: #fff; transform: scale(1.25); }

/* outcome / event */
.event { border-left: 4px solid var(--sky2); background: #eef4fb; border-radius: 0 12px 12px 0; padding: 11px 13px; margin: 10px 0; font-size: 14px; }
.event.bad { border-color: var(--red); background: #fdefed; }
.event.good { border-color: var(--green); background: #ecf7f1; }
.event .ev-title { display: flex; align-items: center; gap: 7px; font-weight: 700; }
.event.bad .ev-title { color: var(--red); }
.event.good .ev-title { color: var(--green); }
.factors { margin: 8px 0 0; padding: 0; list-style: none; }
.factors li { font-size: 12.5px; color: #5a6b80; padding: 2px 0; }
.factors li b { color: var(--ink); }

/* minigame */
#mg-canvas { width: 100%; border-radius: 12px; background: #0a2440; display: block; touch-action: manipulation; }
.mg-tries { text-align: center; font-size: 13px; margin: 8px 0; color: #5a6b80; }

/* final */
.final-score { text-align: center; }
.final-score .cup { color: var(--gold); margin-top: 6px; }
.final-score .cup .ic { width: 46px; height: 46px; }
.final-score .big { font-size: 54px; font-weight: 900; color: var(--sky2); line-height: 1.1; letter-spacing: -.02em; }
.final-score .rank { font-size: 19px; font-weight: 800; margin: 6px 0; }
.scoreline { display: flex; justify-content: space-between; padding: 6.5px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.scoreline:last-child { border-bottom: 0; }

.resume-box { background: rgba(6,28,52,.65); border: 1px solid rgba(255,255,255,.22); border-radius: 14px; padding: 14px; margin: 12px 0; }
.resume-box .rb-title { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.resume-box .rb-title .ic { color: var(--gold); }

/* ---------- language switch in the header ---------- */
.q-head-right { display: flex; align-items: center; gap: 12px; }
.q-lang { display: inline-flex; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); border-radius: 8px; overflow: hidden; }
.q-lang button {
  background: transparent; border: 0; cursor: pointer; color: #cfe6f5;
  font-family: inherit; font-size: 11px; font-weight: 800; letter-spacing: .06em; padding: 0 9px; height: 26px;
}
.q-lang button.on { background: #fff; color: var(--sky2); }
@media (max-width: 420px) { .q-link { display: none; } }

/* ---------- instructions ---------- */
.howto h3 { margin: 18px 0 6px; font-size: 15px; }
.howto p { color: #33415c; }
.how-list { list-style: none; margin: 8px 0 0; padding: 0; }
.how-list li { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; color: #33415c; font-size: 14.5px; }
.how-list li .ic { color: var(--sky2); margin-top: 4px; }
.how-demo { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.how-demo .risk-tag { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; border-radius: 6px; padding: 3px 9px; text-transform: uppercase; }

/* ---------- per-mission record on the menu ---------- */
.m-record { font-size: 12px; color: #4a5876; margin-top: 5px; display: flex; align-items: center; gap: 5px; }
.m-record .ic { width: 13px; height: 13px; color: var(--green); }

/* ---------- achievements ---------- */
.badges { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; margin: 10px 0; }
.badge { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 12px; border: 1px solid var(--line); }
.badge .b-ico { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; }
.badge .b-ico .ic { width: 16px; height: 16px; }
.badge b { font-size: 13.5px; }
.badge .small { font-size: 11.5px; line-height: 1.35; }
.badge.on { background: #e3f7fa; border-color: #a9e4ee; }
.badge.on .b-ico { background: var(--sea); color: #fff; }
.badge.off { opacity: .62; }
.badge.off .b-ico { background: #eef1f6; color: #9aa6ba; }
.new-badges { border: 2px solid var(--sea); }

/* ---------- debrief ---------- */
.debrief { border-left: 3px solid var(--line); padding: 8px 0 8px 11px; margin: 10px 0; }
.debrief.ok { border-left-color: var(--green); }
.debrief.ko { border-left-color: var(--red); }
.d-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.d-head .d-n {
  width: 21px; height: 21px; border-radius: 50%; background: var(--sky2); color: #fff;
  display: grid; place-items: center; font-size: 11px; font-weight: 800; flex: none;
}
.d-head .risk-tag { display: inline-block; font-size: 10px; font-weight: 800; border-radius: 6px; padding: 2px 7px; text-transform: uppercase; }
.d-choice { display: flex; gap: 7px; align-items: flex-start; font-size: 13.5px; margin: 5px 0 3px; color: #22304a; }
.d-choice .ic { width: 14px; height: 14px; margin-top: 3px; }
.debrief.ok .d-choice .ic { color: var(--green); }
.debrief.ko .d-choice .ic { color: var(--red); }
.d-note { font-size: 12.5px; color: #5b6880; line-height: 1.45; }

/* ---------- closing call to action ---------- */
.cta { background: linear-gradient(135deg, #0D47A1 0%, #00BCD4 100%); color: #fff; }
.cta h2 { color: #fff; }
.cta p { color: #e4f6fb; font-size: 14.5px; }
.cta .btn-go { background: #fff; color: var(--sky2); text-decoration: none; display: flex; }
.q-inline { color: var(--sky2); font-weight: 600; }
