/* ============================================================
   POWER WASH — style.css  (v2: bright sunny-street theme)
   Crisp UI rule: no transform/filter/blur on text or buttons;
   press effects use position shifts (top).
   ============================================================ */
:root {
  --ink: #0d2b45;
  --ink2: #3c6283;
  --aqua: #12b5f0;
  --aqua-d: #0b7fb8;
  --sun: #ffc62e;
  --lime: #7ed957;
  --coral: #ff5e52;
  --card: #ffffff;
  --line: #bfe3f6;
  --sky1: #58c6f8;
  --sky2: #d3f2ff;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  height: 100%;
  overflow: hidden;
}
#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}
body {
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  background: #58c6f8;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
img {
  -webkit-user-drag: none;
}
.hidden {
  display: none !important;
}
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.screen.active {
  display: flex;
}
.screen.sub {
  background: linear-gradient(180deg, var(--sky1) 0%, var(--sky2) 62%, #a9e38a 62.1%, #86cf5e 100%);
}
#screen-game {
  background: transparent;
}

/* ---------- buttons ---------- */
.btn3d {
  position: relative;
  top: 0;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow:
    0 6px 0 rgba(0, 0, 0, 0.28),
    inset 0 2px 0 rgba(255, 255, 255, 0.5);
  transition:
    top 0.06s,
    box-shadow 0.06s;
  overflow: hidden;
}
.btn3d::after {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  top: 5%;
  height: 40%;
  background: linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.06));
  border-radius: 12px 12px 40% 40%/14px 14px 100% 100%;
  pointer-events: none;
}
.btn3d:active {
  top: 5px;
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.28),
    inset 0 2px 0 rgba(255, 255, 255, 0.4);
}
.btn3d > * {
  position: relative;
  z-index: 1;
}
.btn3d img {
  width: 1.35em;
  height: 1.35em;
}
.btn3d.l {
  font-size: clamp(14px, 1.8vw, 18px);
  padding: 14px 22px;
  width: 100%;
}
.btn3d.s {
  font-size: 13px;
  padding: 12px 16px;
}
.btn3d.xs {
  font-size: 13px;
  padding: 10px 14px;
}
.btn3d.blue {
  background: linear-gradient(#4fc0ff, #1e96e8 55%, #1478c4);
  box-shadow:
    0 6px 0 #0d5a94,
    inset 0 2px 0 rgba(255, 255, 255, 0.5);
}
.btn3d.green {
  background: linear-gradient(#8be35f, #4cb944 55%, #3a9936);
  box-shadow:
    0 6px 0 #2a722a,
    inset 0 2px 0 rgba(255, 255, 255, 0.5);
}
.btn3d.silver {
  background: linear-gradient(#a7b6c6, #7a8ca0 55%, #62758a);
  box-shadow:
    0 6px 0 #455566,
    inset 0 2px 0 rgba(255, 255, 255, 0.5);
}
.btn3d.red {
  background: linear-gradient(#ff8378, #f0463c 55%, #cc3029);
  box-shadow:
    0 6px 0 #8c1f1b,
    inset 0 2px 0 rgba(255, 255, 255, 0.5);
}
.btn3d:active.blue {
  box-shadow: 0 1px 0 #0d5a94;
}
.btn3d:active.green {
  box-shadow: 0 1px 0 #2a722a;
}
.btn3d:active.silver {
  box-shadow: 0 1px 0 #455566;
}
.btn3d:active.red {
  box-shadow: 0 1px 0 #8c1f1b;
}

/* ---------- loading ---------- */
#screen-loading {
  z-index: 60;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--sky1) 0%, var(--sky2) 60%, #a9e38a 60.1%, #86cf5e 100%);
  padding: 16px;
}
.load-card {
  text-align: center;
  padding: clamp(18px, 4vh, 36px) clamp(22px, 5vw, 46px);
  background: #fff;
  border: 4px solid #12b5f0;
  border-radius: 26px;
  box-shadow: 0 10px 0 rgba(8, 70, 110, 0.25);
  width: min(440px, 92vw);
}
.load-drop {
  width: clamp(52px, 12vh, 84px);
  height: auto;
}
.load-logo {
  margin-top: 4px;
  font-size: clamp(34px, 8vw, 52px);
  font-weight: 900;
  font-style: italic;
  line-height: 1;
}
.load-logo .p,
.m-sign .p {
  color: #fff;
}
.load-logo .w,
.m-sign .w {
  color: #ffc62e;
}
.load-logo span,
.m-sign h1 span {
  -webkit-text-stroke: 7px #0b6fb0;
  paint-order: stroke fill;
  text-shadow: 0 4px 0 #0b6fb0;
}
.load-sub {
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 0.26em;
  color: var(--ink2);
  font-weight: 800;
}
.tank {
  margin: 20px auto 0;
  height: 22px;
  width: 100%;
  background: #e3f4fc;
  border: 3px solid #0b6fb0;
  border-radius: 12px;
  overflow: hidden;
}
.tank i {
  display: block;
  height: 100%;
  width: 0%;
  background: repeating-linear-gradient(115deg, #4fc0ff 0 14px, #2aa4f2 14px 28px);
  transition: width 0.18s ease-out;
}
.load-pct {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 900;
  color: #0b7fb8;
}
.load-tip {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink2);
  min-height: 17px;
}

/* ---------- chips / top bars ---------- */
.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) clamp(12px, 3vw, 26px) 10px;
  background: #fff;
  border-bottom: 4px solid #12b5f0;
  flex: none;
}
.ttl {
  font-size: clamp(18px, 3vw, 24px);
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 2.5px solid #bfe3f6;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink2);
  font-weight: 800;
  box-shadow: 0 3px 0 rgba(8, 70, 110, 0.15);
  white-space: nowrap;
}
.chip b {
  color: var(--ink);
  font-size: 14px;
  letter-spacing: 0;
}
.chip.gold {
  border-color: #ffc62e;
}
.chip img {
  width: 17px;
  height: 17px;
}
.chip.ghost {
  visibility: hidden;
  min-width: 70px;
}

/* ---------- menu (full-bleed living scene) ---------- */
#screen-menu {
  background: transparent;
}
.m-wrap {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) clamp(12px, 3vw, 28px) max(14px, env(safe-area-inset-bottom));
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
}
.m-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.m-top .roundbtn {
  margin-left: auto;
}
.roundbtn {
  position: relative;
  top: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid #12b5f0;
  background: #fff;
  padding: 7px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(8, 70, 110, 0.3);
  transition:
    top 0.06s,
    box-shadow 0.06s;
  flex: none;
}
.roundbtn:active {
  top: 3px;
  box-shadow: 0 1px 0 rgba(8, 70, 110, 0.3);
}
.roundbtn img {
  width: 100%;
  height: 100%;
}
.m-sign {
  text-align: center;
}
.m-sign h1 {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 0.2em;
  font-size: clamp(40px, 12.5vw, 76px);
  line-height: 1;
  font-style: italic;
  font-weight: 900;
}
.m-sign p {
  margin-top: 10px;
  display: inline-block;
  background: #fff;
  border: 3px solid #12b5f0;
  border-radius: 999px;
  padding: 5px 16px;
  font-size: clamp(10px, 2.9vw, 13px);
  letter-spacing: 0.26em;
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 3px 0 rgba(8, 70, 110, 0.25);
}
.m-stage {
  min-height: 0;
}
.m-play {
  position: relative;
  top: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 10px 22px 10px 12px;
  border: 0;
  border-radius: 24px;
  cursor: pointer;
  font-family: inherit;
  color: #fff;
  text-align: left;
  background: linear-gradient(#8be35f, #4cb944 55%, #3a9936);
  box-shadow:
    0 8px 0 #2a722a,
    inset 0 3px 0 rgba(255, 255, 255, 0.55);
  transition:
    top 0.06s,
    box-shadow 0.06s;
}
.m-play:active {
  top: 7px;
  box-shadow:
    0 1px 0 #2a722a,
    inset 0 3px 0 rgba(255, 255, 255, 0.5);
}
.m-play-head {
  flex: none;
  width: clamp(54px, 15vw, 74px);
  height: clamp(54px, 15vw, 74px);
  border-radius: 50%;
  background: #fff;
  border: 4px solid #12b5f0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}
.m-play-head img {
  width: 82%;
  height: 82%;
}
.m-play-txt {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.m-play-txt b {
  font-size: clamp(32px, 9vw, 48px);
  line-height: 1;
  font-style: italic;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
}
.m-play-txt small {
  margin-top: 3px;
  font-size: clamp(10px, 2.8vw, 13px);
  letter-spacing: 0.14em;
  font-weight: 800;
  color: #f0ffe6;
}
.m-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.m-tile {
  position: relative;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 4px 10px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.08em;
  font-size: clamp(10px, 2.9vw, 13px);
  box-shadow:
    0 5px 0 rgba(0, 0, 0, 0.28),
    inset 0 2px 0 rgba(255, 255, 255, 0.45);
  transition:
    top 0.06s,
    box-shadow 0.06s;
}
.m-tile:active {
  top: 4px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.28);
}
.m-tile img {
  width: 30px;
  height: 30px;
}
.m-tile.blue {
  background: linear-gradient(#4fc0ff, #1e96e8 55%, #1478c4);
}
.m-tile.green {
  background: linear-gradient(#8be35f, #4cb944 55%, #3a9936);
}
.m-tile.silver {
  background: linear-gradient(#a7b6c6, #7a8ca0 55%, #62758a);
}
.m-tile.green {
  background: linear-gradient(#ffd75e, #f5b400 55%, #d89400);
}

/* ---------- levels ---------- */
.lv-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 12px clamp(12px, 3vw, 26px) 0;
  flex: none;
}
.lv-tab {
  flex: 1;
  max-width: 120px;
  position: relative;
  top: 0;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 900;
  font-size: 14px;
  color: var(--ink2);
  padding: 10px 4px 9px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 0 rgba(8, 70, 110, 0.3);
  transition: top 0.06s;
}
.lv-tab.on {
  background: linear-gradient(#ffd75e, #f5b400);
  color: #3a2a00;
  box-shadow: 0 4px 0 #a66f00;
}
.lv-tab:active {
  top: 3px;
}
.lv-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(0, 1fr));
  padding: clamp(12px, 2.5vw, 24px);
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}
.lv-cell {
  position: relative;
  top: 0;
  min-height: 0;
  max-height: 110px;
  align-self: center;
  width: 100%;
  height: 100%;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  border-radius: 16px;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(#4fc0ff, #1e96e8 55%, #1478c4);
  box-shadow:
    0 5px 0 #0d5a94,
    inset 0 2px 0 rgba(255, 255, 255, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: top 0.07s;
}
.lv-cell:active {
  top: 4px;
  box-shadow: 0 1px 0 #0d5a94;
}
.lv-cell .num {
  font-size: clamp(22px, 6vw, 30px);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}
.lv-cell .st {
  display: flex;
  gap: 2px;
}
.lv-cell .st img {
  width: clamp(14px, 4vw, 20px);
  height: clamp(14px, 4vw, 20px);
}
.lv-cell .st img.off {
  opacity: 0.3;
}
.lv-cell.locked {
  background: linear-gradient(#b7c6d4, #8fa2b4);
  box-shadow: 0 5px 0 #61758a;
  color: #eaf2f8;
  cursor: default;
}
.lv-cell.locked .lk {
  width: clamp(18px, 5vw, 26px);
  height: auto;
}
.lv-cell.current {
  outline: 4px solid #ffc62e;
  outline-offset: 2px;
}

/* ---------- how to ---------- */
.how-wrap {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 12px;
  align-content: center;
  grid-template-columns: minmax(0, 1fr);
  padding: clamp(12px, 3vw, 28px);
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
}
.how-card {
  display: flex;
  gap: 14px;
  align-items: center;
  background: #fff;
  border: 3px solid #bfe3f6;
  border-radius: 18px;
  padding: 12px 16px;
  box-shadow: 0 4px 0 rgba(8, 70, 110, 0.2);
}
.how-card i {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(#ffd75e, #f5b400);
  color: #3a2a00;
  font:
    900 20px/40px "Segoe UI",
    Arial,
    sans-serif;
  font-style: normal;
  text-align: center;
  box-shadow: 0 3px 0 #a66f00;
}
.how-card h3 {
  color: var(--aqua-d);
  font-size: 14px;
  letter-spacing: 0.16em;
  margin-bottom: 3px;
  font-style: italic;
}
.how-card p {
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.45;
}
.how-ok {
  margin: 0 auto max(18px, env(safe-area-inset-bottom));
  width: min(320px, 80%);
  flex: none;
}

/* ---------- settings ---------- */
.set-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: clamp(14px, 3vw, 30px);
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}
.panel {
  background: #fff;
  border: 3px solid #bfe3f6;
  border-radius: 18px;
  box-shadow: 0 4px 0 rgba(8, 70, 110, 0.2);
}
.setrow.panel {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.setrow label {
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--ink2);
  font-weight: 900;
}
.setrow.danger-row {
  border-color: #ffb3ac;
}
.seg {
  display: flex;
  background: #e3f4fc;
  border: 2.5px solid #bfe3f6;
  border-radius: 14px;
  padding: 4px;
  gap: 4px;
}
.seg button {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 900;
  letter-spacing: 0.08em;
  background: transparent;
  color: var(--ink2);
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13px;
}
.seg button.on {
  background: linear-gradient(#4fc0ff, #1e96e8);
  color: #fff;
  box-shadow: 0 3px 0 #0d5a94;
}

/* ---------- game HUD ---------- */
.gbar {
  padding-bottom: 8px;
}
.hud-chips {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex: 1;
}
.hchip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fff;
  border: 2.5px solid #bfe3f6;
  border-radius: 999px;
  font-size: clamp(10px, 2.8vw, 12px);
  letter-spacing: 0.1em;
  font-weight: 900;
  color: var(--ink2);
  padding: 7px 14px;
  white-space: nowrap;
}
.hchip b {
  color: var(--ink);
  font-size: clamp(13px, 3.4vw, 15px);
  letter-spacing: 0;
}
.hchip img {
  width: 16px;
  height: 16px;
}
.iconbtn {
  position: relative;
  top: 0;
  width: clamp(40px, 6vw, 50px);
  height: clamp(40px, 6vw, 50px);
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  flex: none;
  transition: top 0.07s;
}
.iconbtn:active {
  top: 3px;
}
.iconbtn img {
  width: 100%;
  height: 100%;
}
.meters {
  display: flex;
  gap: 10px;
  padding: 8px clamp(12px, 3vw, 26px);
  background: #fff;
  flex: none;
  border-bottom: 4px solid #12b5f0;
  position: relative;
  z-index: 2;
}
.meter {
  position: relative;
  flex: 1;
  height: 26px;
  border-radius: 13px;
  background: #e3f4fc;
  border: 2.5px solid #0b6fb0;
  overflow: hidden;
}
.meter i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  transition: width 0.18s;
}
.meter.clean i {
  background: linear-gradient(#9ceb6e, #4cb944);
}
.meter.water i {
  width: 100%;
  background: linear-gradient(#6fd0ff, #1e96e8);
}
.meter span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--ink);
}
.meter span b {
  font-size: 12px;
  letter-spacing: 0;
}
.meter.water.warn {
  border-color: #e23c3c;
}
.meter.water.warn i {
  background: linear-gradient(#ff8378, #e23c3c);
}
#field {
  flex: 1;
  min-height: 0;
  display: block;
  width: 100%;
  touch-action: none;
  cursor: pointer;
}
.hint {
  position: absolute;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: max-content;
  max-width: 90vw;
  bottom: 150px;
  z-index: 5;
  pointer-events: none;
  background: #fff;
  border: 3px solid #12b5f0;
  border-radius: 999px;
  padding: 9px 18px;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(8, 70, 110, 0.3);
}
.pop {
  position: absolute;
  left: 0;
  right: 0;
  top: 28%;
  text-align: center;
  z-index: 6;
  pointer-events: none;
  font-size: clamp(30px, 8vw, 54px);
  font-weight: 900;
  font-style: italic;
  color: #fff;
  -webkit-text-stroke: 7px #0b6fb0;
  paint-order: stroke fill;
  text-shadow: 0 4px 0 #0b6fb0;
  opacity: 0;
}
.pop.go {
  animation: popgo 1.1s ease-out;
}
@keyframes popgo {
  0% {
    opacity: 0;
    top: 34%;
  }
  15% {
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    top: 24%;
  }
}

/* ---------- overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(8, 40, 70, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.ov-card {
  background: #fff;
  border: 4px solid #12b5f0;
  border-radius: 24px;
  box-shadow: 0 10px 0 rgba(8, 70, 110, 0.35);
  padding: clamp(18px, 3.5vw, 30px);
  width: min(390px, 92vw);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}
.ov-card h2 {
  font-style: italic;
  font-size: clamp(24px, 4vw, 30px);
  color: var(--aqua-d);
  margin-bottom: 4px;
}
.ov-card.result {
  border-color: #7ed957;
}
.ov-card.fail {
  border-color: #ff5e52;
}
.ov-card .two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.trophy {
  width: clamp(56px, 11vw, 76px);
  margin: 0 auto;
}
.fail-drop {
  width: 64px;
  margin: 0 auto;
  opacity: 0.6;
}
.res-title {
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #3a9936;
  font-size: clamp(17px, 2.8vw, 22px);
}
.res-title.red {
  color: #e23c3c;
}
.stars {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.stars img {
  width: clamp(38px, 7vw, 48px);
}
.stars img.off {
  opacity: 0.25;
}
.res-stats {
  color: var(--ink2);
  font-size: 13.5px;
  line-height: 1.6;
}
.res-stats b {
  color: var(--ink);
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  top: 70px;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: max-content;
  max-width: 92vw;
  text-align: center;
  background: #fff;
  border: 3px solid #12b5f0;
  color: var(--ink);
  font-weight: 900;
  letter-spacing: 0.1em;
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 999px;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.22s,
    top 0.22s;
}
.toast.on {
  opacity: 1;
  top: 84px;
}

/* ---------- wide menu ---------- */
@media (min-aspect-ratio: 23/20) and (min-width: 700px) {
  .m-wrap {
    grid-template-columns: minmax(330px, 520px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto auto auto auto minmax(0, 1fr);
    gap: 14px 30px;
  }
  .m-top {
    grid-column: 1;
    grid-row: 2;
  }
  .m-sign {
    grid-column: 1;
    grid-row: 3;
  }
  .m-play {
    grid-column: 1;
    grid-row: 4;
  }
  .m-tiles {
    grid-column: 1;
    grid-row: 5;
  }
  .m-stage {
    grid-column: 2;
    grid-row: 1 / 7;
  }
  .m-sign h1 {
    font-size: clamp(44px, 5.4vw, 86px);
  }
  .m-play-txt b {
    font-size: clamp(32px, 3.6vw, 54px);
  }
  .m-play-head {
    width: clamp(58px, 6vw, 86px);
    height: clamp(58px, 6vw, 86px);
  }
  .m-tile {
    padding: 16px 4px 14px;
    font-size: clamp(11px, 1.2vw, 15px);
  }
  .m-tile img {
    width: clamp(30px, 3vw, 42px);
    height: clamp(30px, 3vw, 42px);
  }
  .lv-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }
  .how-wrap {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* ---------- small / short screens ---------- */
@media (max-height: 640px) {
  .m-wrap {
    gap: 8px;
  }
  .m-sign p {
    margin-top: 5px;
    padding: 3px 12px;
  }
  .m-tile {
    flex-direction: row;
    gap: 8px;
    padding: 10px 4px;
  }
  .m-tile img {
    width: 22px;
    height: 22px;
  }
  .m-play {
    padding: 6px 18px 6px 8px;
  }
  .m-play-head {
    width: 46px;
    height: 46px;
  }
  .m-play-txt b {
    font-size: 28px;
  }
  .m-sign h1 {
    font-size: clamp(32px, 9vw, 52px);
  }
  .how-card {
    padding: 8px 12px;
  }
  .how-card p {
    font-size: 12px;
  }
  .lv-grid {
    gap: 8px;
  }
}
@media (max-height: 520px) {
  .ov-card {
    padding: 12px 16px;
    gap: 6px;
    width: min(440px, 94vw);
  }
  .ov-card h2 {
    font-size: 20px;
    margin: 0;
  }
  .trophy {
    width: 34px;
  }
  .stars img {
    width: 28px;
  }
  .res-stats {
    font-size: 12px;
    line-height: 1.35;
  }
  .btn3d.l {
    padding: 8px 14px;
    font-size: 13px;
  }
  .fail-drop {
    width: 34px;
  }
  .set-wrap {
    gap: 6px;
    padding: 8px 14px;
  }
  .setrow.panel {
    padding: 6px 14px;
  }
  .seg button {
    padding: 6px 14px;
  }
  .how-wrap {
    gap: 6px;
    padding: 8px 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .how-card i {
    width: 28px;
    height: 28px;
    font-size: 15px;
    line-height: 28px;
  }
  .how-card h3 {
    font-size: 11px;
  }
  .how-card p {
    font-size: 11px;
    line-height: 1.3;
  }
  .how-ok {
    margin-bottom: 8px;
    padding: 8px;
    width: 200px;
  }
  .topbar {
    padding: 6px 12px;
  }
  .iconbtn {
    width: 36px;
    height: 36px;
  }
  .meters {
    padding: 4px 12px;
  }
  .meter {
    height: 20px;
  }
  .lv-tabs {
    padding-top: 6px;
  }
  .lv-tab {
    padding: 6px 4px;
    font-size: 12px;
  }
  .lv-grid {
    gap: 6px;
    padding: 6px 14px;
  }
  .lv-cell .st img {
    width: 12px;
    height: 12px;
  }
  .lv-cell .num {
    font-size: 18px;
  }
  .toast {
    top: 54px;
  }
  .toast.on {
    top: 62px;
  }
}
@media (max-height: 520px) and (min-width: 700px) {
  .m-wrap {
    grid-template-columns: minmax(250px, 340px) minmax(0, 1fr);
    gap: 8px 16px;
    padding: 8px 14px;
  }
  .m-sign h1 {
    font-size: 34px;
  }
  .m-sign p {
    display: none;
  }
  .m-tile img {
    display: none;
  }
  .m-tile span {
    font-size: 10px;
  }
}
@media (max-width: 359px) {
  .hchip {
    padding: 7px 10px;
  }
  .m-tile {
    letter-spacing: 0.04em;
    font-size: 9.5px;
  }
  .meter span {
    font-size: 10px;
    letter-spacing: 0.06em;
  }
}
.lv-cell .st {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  padding: 3px 6px;
}
.lv-cell .st img.off {
  opacity: 0.35;
}

.hchip em {
  font-style: normal;
  font-size: 0.72em;
  letter-spacing: 0.5px;
  white-space: nowrap;
  margin-left: 2px;
}
.lv-cell {
  background: linear-gradient(
    color-mix(in srgb, var(--bc, #4fc0ff) 70%, #fff),
    var(--bc, #1e96e8) 55%,
    color-mix(in srgb, var(--bc, #1478c4) 80%, #000)
  );
  box-shadow:
    0 5px 0 color-mix(in srgb, var(--bc, #0d5a94) 55%, #000),
    inset 0 2px 0 rgba(255, 255, 255, 0.45);
}
.lv-cell:active {
  box-shadow: 0 1px 0 color-mix(in srgb, var(--bc, #0d5a94) 55%, #000);
}
.lv-cell.locked {
  background: linear-gradient(#b7c6d4, #8fa2b4);
  box-shadow: 0 5px 0 #61758a;
}
@media (max-width: 379px) {
  .hchip em {
    display: none;
  }
}

/* ---- world map ---- */
.lv-grid {
  gap: clamp(6px, 1.6vw, 14px);
}
.wc {
  position: relative;
  container-type: inline-size;
  min-height: 0;
  border-radius: 16px;
  background-size: cover;
  background-position: center;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px 7px 7px;
  box-shadow:
    0 5px 0 color-mix(in srgb, var(--bc) 60%, #000),
    0 0 0 3px #fff inset;
}
.wc::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(10, 30, 50, 0.62), rgba(10, 30, 50, 0) 42%, rgba(10, 30, 50, 0.6));
  pointer-events: none;
}
.wc.now {
  outline: 4px solid #ffc62e;
  outline-offset: 2px;
}
.wc-top,
.wc-lv {
  position: relative;
  z-index: 1;
}
.wc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  font-weight: 900;
}
.wc-top b {
  font-size: clamp(10px, 3.4vw, 15px);
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wc-top span {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 999px;
  padding: 1px 6px;
  flex: none;
}
.wc-top span img {
  width: 11px;
  height: 11px;
}
.wc-lv {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.wl {
  position: relative;
  top: 0;
  border: 0;
  padding: 2px 0 3px;
  cursor: pointer;
  font-family: inherit;
  color: #fff;
  border-radius: 9px;
  background: linear-gradient(color-mix(in srgb, var(--bc) 70%, #fff), var(--bc));
  box-shadow:
    0 3px 0 color-mix(in srgb, var(--bc) 55%, #000),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: top 0.06s;
}
.wl:active {
  top: 2px;
  box-shadow: 0 1px 0 color-mix(in srgb, var(--bc) 55%, #000);
}
.wl i {
  font-style: normal;
  font-weight: 900;
  font-size: clamp(11px, 3.4vw, 16px);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
  line-height: 1.2;
}
.wl u {
  display: flex;
  gap: 2px;
  text-decoration: none;
}
.wl s {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.28);
}
.wl s.on {
  background: #ffe04d;
  box-shadow: 0 0 0 1px #a66f00;
}
.wl.off {
  background: linear-gradient(#c4d0db, #9aaaba);
  box-shadow: 0 3px 0 #61758a;
  color: #eaf2f8;
  cursor: default;
}
.wl.cur {
  outline: 3px solid #ffc62e;
  outline-offset: 1px;
}
.wc.locked {
  filter: saturate(0.55);
}
.wc-lock {
  position: absolute;
  z-index: 2;
  right: 8px;
  top: 40%;
  width: clamp(18px, 5vw, 26px);
}
@container (max-width: 150px) {
  .wc-lv {
    grid-template-columns: repeat(3, 1fr);
  }
}
@container (max-width: 200px) {
  .wc-top span {
    display: none;
  }
}

/* ---- feel & polish ---- */
#screen-game::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(ellipse at 50% 46%, rgba(0, 0, 0, 0) 58%, rgba(10, 30, 60, 0.28) 100%);
}
.combo {
  position: absolute;
  right: 12px;
  top: 38%;
  z-index: 6;
  pointer-events: none;
  font-weight: 900;
  font-style: italic;
  font-size: clamp(20px, 5.4vw, 32px);
  color: #ffe04d;
  -webkit-text-stroke: 5px #7a3a00;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 #7a3a00;
  opacity: 0;
  transition: opacity 0.25s;
}
.combo.on {
  opacity: 1;
}
.combo.bump {
  animation: cbump 0.3s ease-out;
}
@keyframes cbump {
  0% {
    right: 0;
  }
  100% {
    right: 12px;
  }
}
@media (orientation: landscape) and (max-height: 480px) {
  .lv-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }
  .wc {
    padding: 4px 5px 5px;
  }
  .wc-top b {
    font-size: 10px;
  }
  .wl {
    padding: 1px 0 2px;
  }
  .wl i {
    font-size: 12px;
  }
}

/* ---------- v3.3: menu version, world-map fixes, illustrated how-to ---------- */
.m-ver {
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.12em;
  font-weight: 800;
  color: rgba(20, 60, 90, 0.55);
  margin-top: 8px;
}
@media (max-height: 520px) and (orientation: landscape) {
  .m-ver {
    display: none;
  }
}
.wc-top b {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.05;
}
.wc-lock {
  right: auto;
  left: 50%;
  top: 28%;
  transform: translateX(-50%);
}
.how-wrap {
  overflow-y: auto;
  align-content: start;
}
.how-foot {
  flex: none;
  padding: 10px 16px max(16px, env(safe-area-inset-bottom));
}
.how-foot .how-ok {
  display: block;
  margin: 0 auto;
  width: min(320px, 90%);
}
.how-card {
  gap: 16px;
}
.how-art {
  position: relative;
  flex: none;
  width: clamp(92px, 24vw, 128px);
  height: clamp(74px, 19vw, 96px);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(#bfe8ff, #8fd0f5);
  box-shadow: inset 0 3px 8px rgba(8, 70, 110, 0.25);
}
.how-art > b {
  position: absolute;
  left: 6px;
  top: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(#ffd75e, #f5b400);
  color: #3a2a00;
  font:
    900 13px/24px "Segoe UI",
    Arial,
    sans-serif;
  text-align: center;
  box-shadow: 0 2px 0 #a66f00;
}
.how-art .ob {
  width: 78%;
  filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.3));
}
.how-art .nz {
  position: absolute;
  height: 92%;
  right: 8%;
  bottom: -6%;
  transform: rotate(-14deg);
}
.how-art .dr {
  position: absolute;
  width: 14px;
  left: 28%;
  animation: hwDrop 1.4s ease-in infinite;
}
.how-art .dr.d2 {
  left: 40%;
  animation-delay: -0.7s;
}
.how-art .dirt {
  position: absolute;
  inset: 20% 12% 22% 40%;
  border-radius: 40%;
  background: rgba(150, 110, 60, 0.8);
  animation: hwWipe 2.6s ease-in-out infinite;
}
.how-art .sp {
  position: absolute;
  width: 26px;
  left: 22%;
  top: 14%;
  animation: hwTwinkle 1.3s ease-in-out infinite;
}
.how-art .aim {
  position: absolute;
  width: 34px;
  height: 34px;
  border: 3px solid #e2453c;
  border-radius: 50%;
  animation: hwAim 2.4s ease-in-out infinite;
}
.how-art .aim::before,
.how-art .aim::after {
  content: "";
  position: absolute;
  background: #e2453c;
  left: 50%;
  top: 50%;
}
.how-art .aim::before {
  width: 3px;
  height: 46px;
  margin: -23px 0 0 -1.5px;
}
.how-art .aim::after {
  height: 3px;
  width: 46px;
  margin: -1.5px 0 0 -23px;
}
.how-art .wbar {
  position: absolute;
  left: 14%;
  right: 14%;
  top: 24%;
  height: 14px;
  border-radius: 8px;
  background: #fff;
  border: 2px solid #1f7fc4;
  overflow: hidden;
}
.how-art .wbar i {
  display: block;
  height: 100%;
  width: 70%;
  background: linear-gradient(#59c0ff, #1f8fe0);
  animation: hwWater 3s ease-in-out infinite;
}
.how-art .stars {
  position: absolute;
  bottom: 14%;
  display: flex;
  gap: 4px;
}
.how-art .stars img {
  width: 22px;
}
.how-txt small {
  display: block;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: #6c8ba0;
  margin-bottom: 2px;
}
.how-card h3 {
  font-size: clamp(13px, 3.4vw, 15px);
}
@keyframes hwDrop {
  0% {
    transform: translate(0, 10px);
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  100% {
    transform: translate(-6px, 56px);
    opacity: 0;
  }
}
@keyframes hwWipe {
  0%,
  20% {
    opacity: 1;
    transform: scaleX(1);
    transform-origin: right;
  }
  70%,
  100% {
    opacity: 0;
    transform: scaleX(0.2);
    transform-origin: right;
  }
}
@keyframes hwTwinkle {
  0%,
  100% {
    transform: scale(0.5) rotate(0);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.1) rotate(40deg);
    opacity: 1;
  }
}
@keyframes hwAim {
  0%,
  100% {
    transform: translate(-16px, 4px);
  }
  50% {
    transform: translate(16px, -4px);
  }
}
@keyframes hwWater {
  0%,
  100% {
    width: 70%;
  }
  50% {
    width: 30%;
  }
}
@media (min-width: 960px) and (min-height: 600px) {
  .how-wrap {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  .how-wrap {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 8px 12px;
  }
  .how-card {
    flex-direction: column;
    text-align: center;
    gap: 6px;
    padding: 8px;
  }
  .how-art {
    width: 100%;
    height: 54px;
  }
  .how-card p,
  .how-txt small {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .how-art * {
    animation: none !important;
  }
}
