/* Meta screens (ui/meta.js, ui/events-ui.js): starter hero, difficulty and
   mode picker, Grove Market, profile, knowledge, awards, daily gift, powers,
   events, leaderboards and the challenge editor. Colours come from the theme
   tokens in style.css; game-art pieces (medals, coins) keep their own. */

.sheet.is-update { animation: none; }
.m-sheet { text-align: left; }
.m-sheet .title { text-align: left; }
.m-sheet > .eyebrow, .m-sheet .m-head .eyebrow { margin: 0; }
.m-sheet.m-starter, .m-sheet.m-daily { text-align: center; }
.m-sheet.m-starter .title, .m-sheet.m-daily .title { text-align: center; }
.sheet.m-sheet.wide { width: min(940px, 100%); }
.sheet.m-modes, .sheet.m-event-sheet { width: min(900px, 100%); }

.m-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 10px; padding-right: 44px; margin-bottom: 12px; }
.m-head > span:first-child { min-width: 0; }
.m-wallet { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex: none; }
.m-cur {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 12px 0 5px; border-radius: 999px; font-variant-numeric: tabular-nums;
  background: linear-gradient(#ffe08a, #e9b43e); color: #3a2a08; box-shadow: 0 3px 0 #9a6c12, inset 0 1px 0 rgba(255,255,255,.55); white-space: nowrap;
}
.m-cur svg { width: 22px; height: 22px; }
.m-cur b { font-size: 15px; }
.m-cur.tro { background: linear-gradient(#d9e8f5, #9cb8d0); box-shadow: 0 3px 0 #5a7690, inset 0 1px 0 rgba(255,255,255,.55); color: #1d2c3a; }

.m-fine { margin: 2px 0 10px; font-size: 12.5px; line-height: 1.35; color: var(--sheet-soft); }
.m-fine svg, .m-note svg { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; }
.m-note { margin: 0 0 10px; font-size: 13px; color: var(--sheet-soft); }
.m-empty { margin: 8px 0 14px; padding: 14px; border-radius: 14px; background: var(--sheet-2); color: var(--sheet-soft); text-align: center; font-size: 14px; }
.m-empty svg { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.m-sub { margin: 12px 0 6px; font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--sheet-soft); display: flex; align-items: center; gap: 6px; }
.m-sub small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.m-sub svg { width: 16px; height: 16px; }
.m-status { min-height: 0; margin: 0; font-size: 13.5px; font-weight: 700; color: var(--good-text); text-align: center; }
.m-status:not(:empty) { margin: 0 0 8px; }
.m-status.bad { color: var(--bad-text); }
.m-status.pop { animation: m-pop .35s var(--spring); }
@keyframes m-pop { from { transform: scale(.9); opacity: .4; } }

/* Tabs */
.m-tabs { display: flex; gap: 6px; margin: 4px 0 10px; padding: 2px 2px 5px; overflow-x: auto; scrollbar-width: thin; }
.m-tab {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 38px; padding: 0 14px; border: 0; border-radius: 12px; cursor: pointer; font: inherit; font-size: 14.5px; font-weight: 700;
  color: var(--sheet-soft); background: var(--sheet-2); box-shadow: 0 3px 0 var(--sheet-drop); transition: transform .18s var(--spring);
}
.m-tab.on { color: #fff; background: linear-gradient(var(--go-a), var(--go-b)); box-shadow: 0 3px 0 var(--go-deep); text-shadow: 0 1px 0 rgba(0,0,0,.3); }
.m-tab:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--sheet-drop); }

/* Chips and small rows */
.m-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px 0 6px; border: 0; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13.5px;
  color: var(--sheet-text); background: var(--sheet-2); box-shadow: 0 3px 0 var(--sheet-drop);
}
.m-chip.static { cursor: default; padding-left: 10px; }
.m-chip svg { width: 20px; height: 20px; }
.m-chip-pic { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; display: grid; place-items: end center; background: radial-gradient(circle at 50% 30%, #d6efb6, #6aa64e); }
.m-chip-pic img { width: 130%; height: 130%; object-fit: contain; margin-bottom: -26%; }
.m-foot-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.m-foot-row .sbtn { flex: 1 1 140px; }

/* ---- Starter hero ---- */
.m-hero-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 6px 0 10px; }
.m-hero {
  position: relative; display: grid; justify-items: center; gap: 1px; padding: 0 4px 8px; border: 0; border-radius: 16px; cursor: pointer; font: inherit; color: var(--card-text);
  background: linear-gradient(var(--card-a), var(--card-b)); box-shadow: 0 4px 0 var(--card-drop), inset 0 0 0 2px var(--card-line); transition: transform .2s var(--spring);
}
.m-hero.on { box-shadow: 0 4px 0 var(--card-drop), inset 0 0 0 3px var(--gold); transform: translateY(-3px); }
.m-hero-pic { width: 100%; aspect-ratio: 1; display: grid; place-items: end center; overflow: hidden; border-radius: 14px 14px 0 0; }
.m-hero-pic img { width: 110%; height: 110%; object-fit: contain; margin-bottom: -6%; }
.m-hero b { font-size: 15px; }
.m-hero small { font-size: 11.5px; color: var(--card-soft); line-height: 1.2; }
.m-free { position: absolute; top: 6px; right: 6px; font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; color: #fff; background: linear-gradient(var(--go-a), var(--go-b)); box-shadow: 0 2px 0 var(--go-deep); }
.m-free s { opacity: .7; margin-right: 3px; font-weight: 500; }
.m-hero-info { display: grid; gap: 2px; margin: 0 0 12px; font-size: 14px; color: var(--sheet-soft); }
.m-hero-info b { color: var(--sheet-text); font-size: 16px; }
.m-starter .sbtn.big { width: 100%; }

/* ---- Difficulty + mode ---- */
.m-modes-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; padding-right: 44px; }
.m-modes-head .title { margin: 0; }
.m-thumb { flex: none; width: 96px; height: 60px; border-radius: 12px; overflow: hidden; background: var(--sheet-3); box-shadow: 0 3px 0 var(--sheet-drop); display: grid; place-items: center; }
.m-thumb img { width: 100%; height: 100%; object-fit: cover; }
.m-thumb.boss, .m-thumb.ico { background: radial-gradient(circle at 50% 35%, #f0d2a6, #a2683a 65%, #5d3416); }
.m-thumb.boss svg { width: 76%; height: 76%; transform: rotate(-12deg); }
.m-thumb.ico { background: radial-gradient(circle at 50% 35%, #cdeaff, #4a8fc4 65%, #24507a); color: #fff; }
.m-thumb.ico svg { width: 44%; height: 44%; }
.m-medal-count { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--sheet-soft); }
.m-medal-count svg { width: 16px; height: 16px; }
.m-diffs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: start; }
.m-diff { display: grid; gap: 6px; padding: 8px; border-radius: 16px; background: var(--sheet-2); box-shadow: 0 3px 0 var(--sheet-drop); }
.m-diff h3 { margin: 0 0 2px; display: grid; line-height: 1.1; }
.m-diff h3 b { font-size: 20px; }
.m-diff h3 small { font-size: 11.5px; font-weight: 500; color: var(--sheet-soft); }
.m-diff.d-easy h3 b { color: #426a37; }
.m-diff.d-normal h3 b { color: #806026; }
.m-diff.d-hard h3 b { color: #a24f2d; }
.m-diff.d-elder h3 b { color: #6a3d9a; }
/* Elder sits under the other three, across the whole row. */
.m-diff.d-elder { grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: stretch; box-shadow: 0 3px 0 var(--sheet-drop), inset 0 0 0 2px #8a5ac8; }
.m-diff.d-elder h3 { grid-column: 1 / -1; }
.m-diff.d-elder.gated { opacity: .92; }
.m-mode {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 7px; min-height: 44px; padding: 4px 8px 4px 5px; border: 0; border-radius: 12px; cursor: pointer;
  font: inherit; text-align: left; color: var(--card-text); background: linear-gradient(var(--card-a), var(--card-b)); box-shadow: 0 3px 0 var(--card-drop), inset 0 0 0 1px var(--card-line);
  transition: transform .18s var(--spring), filter .15s;
}
.m-mode.std { min-height: 52px; box-shadow: 0 3px 0 var(--card-drop), inset 0 0 0 2px var(--moss); }
.m-mode:active { transform: translateY(2px) scale(.98); }
.m-mode.locked { background: linear-gradient(var(--card-off-a), var(--card-off-b)); color: var(--card-off-text); box-shadow: 0 3px 0 var(--card-off-drop); }
.m-mode-t { min-width: 0; display: grid; }
.m-mode-t b { font-size: 14px; line-height: 1.15; }
.m-mode-t small { font-size: 11px; line-height: 1.2; color: var(--card-soft); display: block; white-space: normal; overflow-wrap: anywhere; }
.m-mode-r { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.m-mode-r svg { width: 16px; height: 16px; }
.m-mode-r i { font-style: normal; font-size: 10px; margin-left: 2px; padding: 0 4px; border-radius: 999px; color: #fff; background: #d4643a; }
.m-medal { display: grid; place-items: center; width: 30px; height: 30px; color: var(--card-off-text); }
.m-medal svg { width: 100%; height: 100%; filter: grayscale(1) opacity(.35); }
.m-medal.got svg { filter: none; }
.m-medal.got.t-easy svg circle { fill: #b8d6a0; }
.m-medal.got.t-normal svg circle { fill: #9fd2e6; }
.m-medal.got.t-elder svg circle { fill: #8a5ac8; stroke: #f2c14e; }
.m-medal.got.t-purist svg circle { fill: #3a3346; stroke: #f2c14e; }
.m-medal.got.t-purist svg path:last-child { fill: #f2c14e; }
.m-mode.locked .m-medal svg { width: 18px; height: 18px; filter: none; }
.m-modes-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---- Market cards ---- */
.m-body { min-height: 0; }
.m-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.m-grid.looks { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
.m-card {
  position: relative; display: grid; align-content: start; justify-items: center; gap: 3px; padding: 0 10px 10px; border-radius: 16px; text-align: center; color: var(--card-text);
  background: linear-gradient(var(--card-a), var(--card-b)); box-shadow: 0 4px 0 var(--card-drop), inset 0 0 0 1px var(--card-line);
}
.m-card.own { box-shadow: 0 4px 0 var(--card-drop), inset 0 0 0 2px var(--moss); }
.m-card.look { padding-top: 10px; }
.m-card-pic { position: relative; width: 100%; height: 104px; display: grid; place-items: end center; overflow: hidden; }
.m-card-pic img { height: 118%; object-fit: contain; margin-bottom: -10%; }
.m-card-pic.ico { height: 70px; place-items: center; }
.m-card-pic.ico svg { width: 52px; height: 52px; }
.m-card-pic em { position: absolute; top: 8px; right: 0; font-style: normal; font-weight: 700; font-size: 13px; padding: 1px 8px; border-radius: 999px; background: var(--sheet-3); color: var(--sheet-text); }
.m-card b { font-size: 15.5px; line-height: 1.15; }
.m-card small { font-size: 11.5px; color: var(--card-soft); }
.m-card small i { font-style: normal; font-weight: 700; }
.m-card p { margin: 2px 0 6px; font-size: 12px; line-height: 1.3; color: var(--card-soft); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.m-lv { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; color: var(--gold-text); margin-bottom: 4px; }
.m-lv svg { width: 13px; height: 13px; }
.m-card .m-lv { color: #f9d891; }
.m-buy {
  justify-self: stretch; display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 38px; border: 0; border-radius: 12px; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 700; color: #3a2a08; background: linear-gradient(#ffe08a, #e9b43e); box-shadow: 0 3px 0 #9a6c12;
  transition: transform .18s var(--spring), filter .15s; margin-top: auto;
}
.m-buy svg { width: 18px; height: 18px; }
.m-buy .m-cur { height: auto; padding: 0; background: none; box-shadow: none; }
.m-buy .m-cur svg { width: 18px; height: 18px; }
.m-buy.poor { filter: saturate(.4); opacity: .8; }
.m-buy.armed { color: #fff; background: linear-gradient(var(--go-a), var(--go-b)); box-shadow: 0 3px 0 var(--go-deep); animation: m-armed .9s ease-in-out infinite; }
@keyframes m-armed { 50% { filter: brightness(1.15); } }
.m-buy.own { color: var(--sheet-text); background: var(--sheet-3); box-shadow: 0 3px 0 var(--sheet-drop); }
.m-buy:disabled { cursor: default; opacity: .85; }
.m-buy:active:not(:disabled) { transform: translateY(2px); }
.m-buy-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; width: 100%; margin-top: auto; }
.m-title-tag { display: inline-block; margin: 6px 0; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; color: #3a2a08; background: linear-gradient(#ffe08a, #e9b43e); }
.m-banner { display: block; width: 100%; height: 44px; border-radius: 10px; background: linear-gradient(135deg, var(--ba), var(--bb)); box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); margin-bottom: 4px; }
.m-grant { font-size: 11px !important; font-style: italic; margin-top: auto; }
.m-bag { display: flex; flex-wrap: wrap; gap: 8px; }
.m-bag-item {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 6px; padding: 6px 30px 6px 8px; border: 0; border-radius: 12px;
  font: inherit; text-align: left; color: var(--card-text); background: linear-gradient(var(--card-a), var(--card-b)); box-shadow: 0 3px 0 var(--card-drop);
}
button.m-bag-item { cursor: pointer; }
.m-bag-item > svg { width: 28px; height: 28px; grid-row: span 2; }
.m-bag-item b { font-size: 13.5px; }
.m-bag-item small { grid-column: 2; font-size: 11px; color: var(--card-soft); }
.m-bag-item em { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-style: normal; font-weight: 700; font-size: 13px; }
.m-bag-pic { width: 40px; height: 40px; grid-row: span 2; border-radius: 10px; overflow: hidden; display: grid; place-items: end center; background: radial-gradient(circle at 50% 30%, #d6efb6, #6aa64e); }
.m-bag-pic img { width: 125%; height: 125%; object-fit: contain; margin-bottom: -22%; }

/* Avatars with frames */
.m-ava {
  --s: 44px; position: relative; flex: none; width: var(--s); height: var(--s); border-radius: 30%; overflow: hidden; display: grid; place-items: end center;
  background: radial-gradient(circle at 50% 28%, #d6efb6, #7cb85c 60%, #417d30); box-shadow: 0 0 0 2px var(--sheet-edge), 0 3px 0 2px var(--sheet-drop);
}
.m-ava img { width: 128%; height: 128%; max-width: none; object-fit: contain; margin-bottom: -30%; }
.m-ava.framed { box-shadow: 0 0 0 3px var(--fb), 0 0 0 6px var(--fa), 0 4px 0 6px rgba(0,0,0,.3); }

/* ---- Profile ---- */
.m-card-banner {
  position: relative; display: flex; align-items: center; gap: 14px; margin: -4px 40px 10px -4px; padding: 12px 14px; border-radius: 18px; color: #fff;
  background: linear-gradient(135deg, var(--ba, #4f7a3a), var(--bb, #1f3a18)); box-shadow: 0 4px 0 rgba(0,0,0,.25), inset 0 0 0 2px rgba(255,255,255,.18);
}
.m-card-banner .m-ava { --s: 76px; }
.m-id { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
.m-id small { font-size: 13px; color: rgba(255,255,255,.85); text-shadow: 0 1px 2px rgba(0,0,0,.4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-name { display: flex; align-items: center; gap: 6px; max-width: 320px; cursor: text; }
.m-name input {
  min-width: 0; flex: 1; height: 36px; padding: 0 10px; border-radius: 10px; border: 2px solid rgba(255,255,255,.35); background: rgba(0,0,0,.18);
  color: #fff; font: inherit; font-size: 20px; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.m-name input:focus { outline: none; border-color: #f2c14e; background: rgba(0,0,0,.3); }
.m-name svg { width: 18px; height: 18px; color: rgba(255,255,255,.8); flex: none; }
.m-name.big { max-width: none; margin: 4px 40px 10px 0; }
.m-name.big input { color: var(--sheet-text); background: var(--sheet-2); border-color: var(--sheet-3); text-shadow: none; font-size: 22px; height: 44px; }
.m-name.big svg { color: var(--sheet-soft); }
.m-lvbar { position: relative; display: block; height: 22px; max-width: 360px; border-radius: 999px; overflow: hidden; background: rgba(0,0,0,.35); box-shadow: inset 0 2px 3px rgba(0,0,0,.4); }
.m-lvbar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(#c3cc85, #728c4e); box-shadow: inset 0 2px 0 rgba(255,255,255,.35); transition: width .6s var(--ease-out); }
.m-lvbar em { position: relative; display: block; text-align: center; font-style: normal; font-weight: 700; font-size: 12.5px; line-height: 22px; text-shadow: 0 1px 2px rgba(0,0,0,.75); white-space: nowrap; }
.m-card-banner .m-wallet { flex-direction: column; align-self: flex-start; }
.m-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 0; }
.m-stats div { padding: 7px 12px; border-radius: 12px; background: var(--sheet-2); }
.m-stats dt { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--sheet-soft); }
.m-stats dd { margin: 0; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.m-medal-grid { display: grid; gap: 6px; }
.m-medal-trail { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 12px; background: var(--sheet-2); }
.m-medal-trail b { width: 150px; flex: none; font-size: 13.5px; }
.m-medal-trail span { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.m-medal-trail s { width: 8px; }
.m-medal.sm { width: 24px; height: 24px; }
.m-avatars { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; margin-bottom: 12px; }
.m-avatar-pick { aspect-ratio: 1; border: 0; padding: 0; border-radius: 30%; cursor: pointer; overflow: hidden; display: grid; place-items: end center;
  background: radial-gradient(circle at 50% 28%, #d6efb6, #7cb85c 60%, #417d30); box-shadow: 0 3px 0 var(--sheet-drop); }
.m-avatar-pick img { width: 128%; height: 128%; object-fit: contain; margin-bottom: -30%; }
.m-avatar-pick.on { box-shadow: 0 0 0 3px var(--gold), 0 3px 0 3px var(--sheet-drop); }
.m-online { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 14px; background: var(--sheet-2); margin-bottom: 10px; }
.m-online b { display: block; font-size: 16px; }
.m-online small { display: block; font-size: 13px; color: var(--sheet-soft); line-height: 1.35; }
.m-dot { flex: none; width: 14px; height: 14px; margin-top: 4px; border-radius: 50%; background: #9c947a; box-shadow: 0 0 0 3px rgba(156,148,122,.25); }
.m-online.on .m-dot { background: #58bf3c; box-shadow: 0 0 0 3px rgba(88,191,60,.3), 0 0 10px #58bf3c; }
.m-online-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.m-online-acts .sbtn { flex: 1 1 160px; }
.m-online-pill { display: inline-flex; align-items: center; gap: 6px; flex: none; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--sheet-2); color: var(--sheet-soft); }
.m-online-pill i { width: 9px; height: 9px; border-radius: 50%; background: #9c947a; }
.m-online-pill.on { color: var(--good-text); }
.m-online-pill.on i { background: #58bf3c; box-shadow: 0 0 8px #58bf3c; }

/* ---- Knowledge ---- */
.m-points { display: grid; justify-items: center; flex: none; padding: 4px 14px; border-radius: 14px; background: linear-gradient(#dce4bd, #a4b47c); color: #30452f; box-shadow: 0 3px 0 #718352; }
.m-points b { font-size: 26px; line-height: 1; }
.m-points small { font-size: 11px; font-weight: 700; }
.m-branches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.m-branch { padding: 8px; border-radius: 16px; background: var(--sheet-2); box-shadow: 0 3px 0 var(--sheet-drop), inset 0 3px 0 var(--bc); }
.m-branch h3 { margin: 2px 2px 6px; display: grid; line-height: 1.1; }
.m-branch h3 b { font-size: 17px; color: color-mix(in srgb, var(--bc) 75%, #253b2b); }
.m-branch h3 small { font-size: 11px; font-weight: 500; color: var(--sheet-soft); }
.m-branch ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; position: relative; }
.m-branch li { position: relative; }
.m-branch li + li::before { content: ''; position: absolute; left: 50%; top: -10px; width: 4px; height: 10px; margin-left: -2px; background: var(--sheet-3); }
.m-perk {
  position: relative; width: 100%; display: grid; gap: 1px; padding: 7px 34px 7px 9px; border: 0; border-radius: 12px; cursor: pointer; font: inherit; text-align: left;
  color: var(--card-off-text); background: linear-gradient(var(--card-off-a), var(--card-off-b)); box-shadow: 0 3px 0 var(--card-off-drop);
}
.m-perk b { font-size: 13.5px; line-height: 1.15; }
.m-perk small { font-size: 11px; line-height: 1.25; opacity: .9; }
.m-perk i { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); font-style: normal; display: grid; place-items: center; }
.m-perk i svg { width: 18px; height: 18px; }
.m-perk.s-learned { color: #fff; background: linear-gradient(color-mix(in srgb, var(--bc) 85%, #fff), var(--bc)); box-shadow: 0 3px 0 color-mix(in srgb, var(--bc) 60%, #000); text-shadow: 0 1px 0 rgba(0,0,0,.3); }
.m-perk.s-ready { color: var(--card-text); background: linear-gradient(var(--card-a), var(--card-b)); box-shadow: 0 3px 0 var(--card-drop), inset 0 0 0 2px var(--bc); }
.m-perk.s-ready i.go { right: 6px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; color: #fff; background: var(--bc); }
.m-perk.armed { animation: m-armed .9s ease-in-out infinite; }
.m-perk.armed i.go { background: var(--go-b); }

/* ---- Awards ---- */
.m-award-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: 8px; }
.m-award { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 14px; background: var(--sheet-2); box-shadow: 0 3px 0 var(--sheet-drop); }
.m-award-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--sheet-3); }
.m-award-ico svg { width: 80%; height: 80%; }
.m-award.s-progress .m-award-ico svg { filter: grayscale(.8) opacity(.55); }
.m-award.s-ready { box-shadow: 0 3px 0 var(--sheet-drop), inset 0 0 0 2px var(--gold); }
.m-award.s-claimed { opacity: .72; }
.m-award b { display: block; font-size: 14.5px; line-height: 1.15; }
.m-award small { display: block; font-size: 12px; color: var(--sheet-soft); }
.m-award .sbtn { height: 38px; font-size: 14px; }
.m-done { color: var(--good-text); }
.m-done svg { width: 24px; height: 24px; }
.m-prize { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.m-prize span { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px 1px 4px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--tag); color: var(--tag-text); }
.m-prize span svg { width: 15px; height: 15px; }
.m-prize .done { color: var(--good-text); background: var(--tag-good); }
.m-prize.center { justify-content: center; align-items: center; font-size: 13px; color: var(--sheet-soft); }

/* ---- Daily gift ---- */
.m-days { list-style: none; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin: 8px 0 12px; padding: 0; }
.m-day { position: relative; min-width: 0; display: grid; justify-items: center; gap: 2px; padding: 6px 1px 8px; border-radius: 12px; background: var(--sheet-2); box-shadow: 0 3px 0 var(--sheet-drop); }
.m-day small { font-size: 11px; color: var(--sheet-soft); font-weight: 700; }
.m-day span { display: inline-flex; flex-direction: column; align-items: center; gap: 0; max-width: 100%; font-size: 11.5px; font-weight: 700; white-space: nowrap; line-height: 1.1; }
.m-day span svg { width: 20px; height: 20px; }
.m-day.big span svg { width: 30px; height: 30px; }
.m-day.today { background: linear-gradient(#fff3c8, #f6d77c); color: #3a2a08; box-shadow: 0 3px 0 #b8862a, 0 0 0 3px #f2c14e; transform: translateY(-3px); }
.m-day.today small { color: #6a5220; }
.m-day.done { opacity: .6; }
.m-day i { position: absolute; top: -6px; right: -4px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--go-b); }
.m-day i svg { width: 13px; height: 13px; }
.m-gift-box { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 12px; margin-bottom: 12px; border-radius: 16px; background: var(--sheet-2); }
.m-gift-box.ready { background: radial-gradient(circle at 50% 0, rgba(242,193,78,.35), transparent 70%), var(--sheet-2); box-shadow: inset 0 0 0 2px var(--gold); }
.m-gift-box span { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
.m-gift-box svg { width: 28px; height: 28px; }
.m-gift-pic { width: 40px; height: 40px; border-radius: 10px; overflow: hidden; display: grid; place-items: end center; background: radial-gradient(circle at 50% 30%, #d6efb6, #6aa64e); }
.m-gift-pic img { width: 125%; height: 125%; object-fit: contain; margin-bottom: -22%; }

/* ---- Powers (in match) ---- */
.m-power-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.m-power {
  display: grid; grid-template-columns: 46px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 7px 10px 7px 7px; border: 0; border-radius: 14px;
  cursor: pointer; font: inherit; text-align: left; color: var(--card-text); background: linear-gradient(var(--card-a), var(--card-b)); box-shadow: 0 3px 0 var(--card-drop), inset 0 0 0 2px var(--gold);
}
.m-power.off { box-shadow: 0 3px 0 var(--card-drop); filter: saturate(.5); opacity: .8; }
.m-power-ico { position: relative; grid-row: span 2; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--sheet-3); }
.m-power-ico svg { width: 30px; height: 30px; }
.m-power-ico em { position: absolute; right: -5px; bottom: -5px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px; font-style: normal; font-size: 12px; font-weight: 700; display: grid; place-items: center; color: #fff; background: #c8402a; box-shadow: 0 0 0 2px var(--sheet); }
.m-power b { font-size: 15px; }
.m-power small { font-size: 11.5px; color: var(--card-soft); line-height: 1.25; }

/* ---- Events ---- */
.m-events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(268px, 100%), 1fr)); gap: 10px; }
.m-event { min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 16px; background: var(--sheet-2); box-shadow: 0 3px 0 var(--sheet-drop); }
.m-event.race { box-shadow: 0 3px 0 var(--sheet-drop), inset 0 3px 0 #3d8fd1; }
.m-event.boss { box-shadow: 0 3px 0 var(--sheet-drop), inset 0 3px 0 #c8402a; }
.m-event.daily { box-shadow: 0 3px 0 var(--sheet-drop), inset 0 3px 0 #58bf3c; }
.m-event.advanced { box-shadow: 0 3px 0 var(--sheet-drop), inset 0 3px 0 #8a5ac8; }
.m-event.custom { box-shadow: 0 3px 0 var(--sheet-drop), inset 0 3px 0 #f2c14e; }
.m-event header { display: flex; gap: 10px; align-items: center; }
.m-event header .m-thumb { width: 72px; height: 48px; }
.m-event header > span { min-width: 0; display: grid; line-height: 1.15; }
.m-event header > span:last-child { flex: 1; }
.m-event header small { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--accent); }
.m-event header small svg { width: 12px; height: 12px; }
.m-event header b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-event header em { font-style: normal; font-size: 12px; color: var(--sheet-soft); }
.m-event p { margin: 0; font-size: 12.5px; line-height: 1.3; color: var(--sheet-soft); }
.m-event footer { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; align-items: center; }
.m-event footer .sbtn { height: 38px; font-size: 14px; flex: 1 1 auto; padding: 0 8px; }
.m-event footer .sbtn svg { width: 16px; height: 16px; }
.m-event footer .m-prize { flex: 1 0 auto; margin: 0; }
.m-rules { display: flex; flex-wrap: wrap; gap: 4px; }
.m-rules span { padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--tag); color: var(--tag-text); }
.m-rules.big { margin: 4px 0 10px; }
.m-rules.big span { font-size: 13px; padding: 4px 10px; }
.m-best { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12.5px; color: var(--sheet-soft); }
.m-best span { display: inline-flex; align-items: center; gap: 4px; }
.m-best svg { width: 15px; height: 15px; }
.m-best b { color: var(--sheet-text); font-variant-numeric: tabular-nums; }
.m-best.center { justify-content: center; }
.m-code { display: flex; gap: 6px; }
.m-code input { flex: 1; min-width: 0; height: 38px; padding: 0 10px; border-radius: 10px; border: 2px solid var(--sheet-3); background: var(--sheet); color: var(--sheet-text); font: inherit; font-size: 13px; }
.m-code input:focus { outline: none; border-color: var(--focus); }
.m-code .sbtn { height: 38px; font-size: 14px; }
.m-prize-table { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: 10px; }
.m-prize-table span { display: inline-flex; align-items: center; gap: 3px; padding: 3px 10px; border-radius: 999px; font-size: 12px; background: var(--sheet-2); }
.m-prize-table b { margin-right: 4px; }
.m-prize-table svg { width: 14px; height: 14px; }
.m-community { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.m-community li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px; border-radius: 14px; background: var(--sheet-2); }
.m-community .m-thumb { width: 72px; height: 46px; }
.m-community b { font-size: 15px; }
.m-community small { display: block; font-size: 12px; color: var(--sheet-soft); margin-bottom: 3px; }

/* ---- Leaderboards ---- */
.m-board { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 5px; }
.m-board li { display: grid; grid-template-columns: 30px auto minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 5px 12px 5px 8px; border-radius: 12px; background: var(--sheet-2); }
.m-board li.me { box-shadow: inset 0 0 0 2px var(--moss); background: color-mix(in srgb, var(--moss) 18%, var(--sheet-2)); }
.m-board li.gap { display: block; text-align: center; background: none; padding: 0; color: var(--sheet-soft); }
.m-board em { font-style: normal; font-weight: 700; font-size: 16px; text-align: center; font-variant-numeric: tabular-nums; }
.m-board li.top1 em { color: #d9a21a; } .m-board li.top2 em { color: #8c9aa6; } .m-board li.top3 em { color: #b0703a; }
.m-board span { min-width: 0; display: grid; }
.m-board span b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-board span small { font-size: 11.5px; color: var(--sheet-soft); }
.m-board strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.m-board .m-ava { --s: 34px; }
.m-board .m-pair { display: inline-flex; align-items: center; }
.m-board-wrap { min-height: 80px; }

/* ---- Editor ---- */
.m-ed-maps { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; }
.m-ed-map { flex: none; display: grid; gap: 3px; justify-items: center; padding: 5px 5px 6px; border: 0; border-radius: 12px; cursor: pointer; font: inherit; color: var(--sheet-text); background: var(--sheet-2); box-shadow: 0 3px 0 var(--sheet-drop); }
.m-ed-map b { font-size: 12px; }
.m-ed-map .m-thumb { width: 92px; height: 54px; }
.m-ed-map.on { box-shadow: 0 3px 0 var(--sheet-drop), inset 0 0 0 3px var(--gold); }
.m-ed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 6px 12px; }
.m-ed-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 4px 6px 4px 10px; border-radius: 12px; background: var(--sheet-2); }
.m-ed-row > span { display: grid; min-width: 0; }
.m-ed-row b { font-size: 14px; }
.m-ed-row small { font-size: 11px; color: var(--sheet-soft); }
.m-seg { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 3px; }
.m-seg button { min-width: 36px; height: 32px; padding: 0 9px; border: 0; border-radius: 9px; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--sheet-soft); background: var(--sheet-3); }
.m-seg button.on { color: #fff; background: linear-gradient(var(--go-a), var(--go-b)); }
.m-step { display: flex; align-items: center; gap: 6px; }
.m-step button { width: 34px; height: 34px; border: 0; border-radius: 10px; cursor: pointer; font: inherit; font-size: 20px; font-weight: 700; color: var(--sheet-text); background: var(--sheet-3); }
.m-step button:disabled { opacity: .4; cursor: default; }
.m-step b { min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }
.m-toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.m-toggle { --tc: var(--moss); display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 12px; border: 0; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 700; color: var(--sheet-soft); background: var(--sheet-2); box-shadow: 0 2px 0 var(--sheet-drop); }
.m-toggle svg { width: 15px; height: 15px; }
.m-toggle.on { color: #fff; background: var(--tc); box-shadow: 0 2px 0 rgba(0,0,0,.35); text-shadow: 0 1px 0 rgba(0,0,0,.3); }
.m-ed-animals { display: flex; flex-wrap: wrap; gap: 5px; }
.m-ed-animal { width: 46px; height: 46px; padding: 3px; border: 0; border-radius: 12px; cursor: pointer; background: var(--sheet-2); box-shadow: 0 2px 0 var(--sheet-drop); opacity: .55; }
.m-ed-animal svg { width: 100%; height: 100%; }
.m-ed-animal.on { opacity: 1; box-shadow: 0 2px 0 var(--sheet-drop), inset 0 0 0 3px var(--gold); }

/* Co-op lobby: player level tag. Quests: acorn prizes. */
.coop-lv { display: inline-block; margin-right: 5px; padding: 0 6px; border-radius: 999px; font-weight: 700; font-size: .92em; color: #3a2a08; background: linear-gradient(#ffe08a, #e9b43e); }
.quest-prize.acorns svg { width: 16px; height: 16px; }
.quest-claim { min-width: 46px; }

/* Precise pointers */
@media (hover: hover) and (pointer: fine) {
  .m-mode:hover:not(.locked), .m-hero:hover, .m-perk:hover, .m-power:hover, .m-buy:hover, .m-tab:hover, .m-chip:hover { filter: brightness(1.05); }
}

/* ---- Phones in landscape ---- */
@media (max-height: 560px) {
  .m-cur { height: 28px; padding: 0 10px 0 4px; }
  .m-cur svg { width: 19px; height: 19px; }
  .m-cur b { font-size: 13.5px; }
  .m-tabs { margin-bottom: 8px; }
  .m-tab { height: 34px; font-size: 13.5px; padding: 0 11px; }
  .m-fine { font-size: 11.5px; margin-bottom: 8px; }
  .m-thumb { width: 74px; height: 46px; }
  .m-modes-head { margin-bottom: 8px; gap: 10px; }
  .m-diffs { gap: 7px; }
  .m-diff { padding: 6px; gap: 5px; }
  .m-diff h3 b { font-size: 17px; }
  .m-mode { min-height: 38px; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 5px; padding: 3px 6px 3px 4px; }
  .m-mode.std { min-height: 44px; }
  .m-medal { width: 24px; height: 24px; }
  .m-mode-t b { font-size: 13px; }
  .m-mode-t small { -webkit-line-clamp: 1; font-size: 10.5px; }
  .m-modes-foot { margin-top: 8px; }
  .m-chip { height: 34px; font-size: 12.5px; }
  .m-hero-row { gap: 6px; }
  .m-hero b { font-size: 13.5px; }
  .m-hero small { display: none; }
  .m-hero-pic { aspect-ratio: 1.15; }
  .m-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .m-card-pic { height: 78px; }
  .m-card p { -webkit-line-clamp: 2; font-size: 11.5px; }
  .m-card-banner { padding: 8px 10px; gap: 10px; }
  .m-card-banner .m-ava { --s: 58px; }
  .m-name input { font-size: 17px; height: 32px; }
  .m-stats { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
  .m-stats dd { font-size: 16px; }
  .m-branches { gap: 6px; }
  .m-branch { padding: 6px; }
  .m-branch ol { gap: 8px; }
  .m-perk { padding: 5px 30px 5px 7px; min-height: 38px; }
  .m-perk small { display: none; }
  .m-perk.s-ready small, .m-perk.armed small { display: block; }
  .m-award-list { grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 6px; }
  .m-award { padding: 6px 8px; grid-template-columns: 36px minmax(0, 1fr) auto; }
  .m-award-ico { width: 36px; height: 36px; }
  .m-days { gap: 4px; margin: 4px 0 8px; }
  .m-gift-box { padding: 8px; margin-bottom: 8px; }
  .m-events-grid { grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 8px; }
  .m-event { padding: 8px; gap: 5px; }
  .m-event p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .m-event footer .sbtn { height: 36px; font-size: 13px; }
  .m-ed-row { min-height: 40px; }
  .m-seg button { height: 34px; padding: 0 7px; font-size: 12px; }
}
@media (max-width: 760px) {
  .m-diffs { grid-template-columns: 1fr; }
  .m-branches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .m-hero-row { grid-template-columns: repeat(5, minmax(84px, 1fr)); overflow-x: auto; }
  .m-ed-grid { grid-template-columns: 1fr; }
  .m-medal-trail { flex-wrap: wrap; }
}
@media (max-width: 520px) {
  .m-card-banner { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; }
  .m-card-banner .m-ava { width: 64px; height: 64px; }
  .m-card-banner .m-wallet { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; }
}
@media (max-height: 560px) and (min-width: 700px) {
  /* Wide phones: keep the three difficulties side by side. */
  .m-diffs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .m-branches { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
