/* Woodburn - workshop UI. Wood surfaces come from the generated textures and
   are injected as CSS variables once the loader finishes. */

@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/fredoka-500.ttf') format('truetype');
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/fredoka-600.ttf') format('truetype');
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/fredoka-700.ttf') format('truetype');
}

#ov-rotate {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 80;
  margin: 0;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: #161e28;
  color: #eef4fa;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .08em;
  text-align: center;
  pointer-events: none;
}
#ov-rotate p { margin: 0; line-height: 1.2; }
#ov-rotate .rot-phone, #ov-rotate #rot-back { display: none; }
#ov-rotate[hidden] { display: none; }
/* On a phone the wrong way round, nothing else can be used: Rooms only
   sideways, everything else only upright. */
#ov-rotate.force {
  top: 0;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 24px;
  font-size: 22px;
  pointer-events: auto;
}
#ov-rotate.force[hidden] { display: none; }
#ov-rotate.force .rot-phone {
  display: block;
  width: 46px;
  height: 78px;
  border: 4px solid #eef4fa;
  border-radius: 10px;
  box-sizing: border-box;
  position: relative;
}
#ov-rotate.force .rot-phone::after {
  content: '';
  position: absolute;
  left: 50%; bottom: 5px;
  width: 10px; height: 3px;
  margin-left: -5px;
  border-radius: 2px;
  background: #eef4fa;
}
#ov-rotate.force.to-side .rot-phone { animation: rot-to-side 2.2s ease-in-out infinite; }
#ov-rotate.force.to-up .rot-phone { animation: rot-to-up 2.2s ease-in-out infinite; }
@keyframes rot-to-side { 0%, 25% { transform: none; } 60%, 100% { transform: rotate(-90deg); } }
@keyframes rot-to-up { 0%, 25% { transform: rotate(-90deg); } 60%, 100% { transform: none; } }
/* Rooms on an upright phone: a bar along the bottom, a small phone that
   tips over, and the words. The room above stays usable. */
#ov-rotate.hint { display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 16px; letter-spacing: .04em; }
#ov-rotate.hint[hidden] { display: none; }
#ov-rotate.hint .rot-phone {
  display: block; flex: 0 0 auto;
  width: 22px; height: 36px;
  border: 3px solid #eef4fa; border-radius: 6px; box-sizing: border-box;
  animation: rot-to-side 2.2s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { #ov-rotate.hint .rot-phone { animation: none; transform: rotate(-90deg); } }
#ov-rotate.hint.hint-up .rot-phone { animation-name: rot-to-up; }
/* a board held sideways: a small note in the empty lower-left corner, off
   the board and the buttons */
#ov-rotate.hint.hint-up {
  left: calc(10px + env(safe-area-inset-left, 0px)); right: auto;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  max-width: min(200px, 24vw);
  padding: 8px 12px; border-radius: 12px; gap: 10px;
  font-size: 14px; letter-spacing: .02em; text-align: left;
  background: rgba(22, 30, 40, .88);
}
@media (prefers-reduced-motion: reduce) { #ov-rotate.hint.hint-up .rot-phone { animation: none; transform: none; } }
#ov-rotate.force #rot-back:not([hidden]) { display: inline-flex; justify-content: center; width: auto; min-width: 160px; }
@media (prefers-reduced-motion: reduce) {
  #ov-rotate.force.to-side .rot-phone { animation: none; transform: rotate(-90deg); }
  #ov-rotate.force.to-up .rot-phone { animation: none; }
}

:root {
  --cream: #f6e6c8;
  --cream-dim: #d9c19a;
  --burn: #2e1c0d;
  --burn-soft: #4a2f16;
  --ember: #e39a3f;
  --shadow: rgba(18, 9, 3, 0.55);
  --wood-btn: linear-gradient(#f8e2a8, #e0a24a);
  --wood-panel: linear-gradient(#3d281a, #241609);
  /* Pine plaques for Play, Next Board, Start, See the boards, the path
     tabs, and the other buttons. */
  --btn-face: var(--wood-btn);
  --cta: linear-gradient(180deg, #ffe566 0%, #ffc107 52%, #f0a000 100%);
  --cta-ink: #2a1608;
  --cta-hot: #b42f23;
  --btn-edge: #a86b2e;
  --btn-ink: #3f2912;
  --btn-shine: transparent;
  --btn-lip: transparent;
  /* the panel face, so a board made of something else can restyle it. The wood
     texture is painted onto the html element at load, which was overriding the
     material themes and leaving every panel oak whatever the board was. */
  --panel-face: var(--wood-sign, var(--wood-panel));
  --ui: "Fredoka", "Trebuchet MS", "Segoe UI", sans-serif;
  --display: "Fredoka", "Trebuchet MS", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  height: -webkit-fill-available;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  /* no pinch-zoom on phones: one-finger panning only (lists still scroll) */
  touch-action: pan-x pan-y;
  /* CrazyGames ask for this on mobile: no selection or callout gestures */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  background: #161e28;
  color: #eef4fa;
  font-family: var(--ui);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  -webkit-touch-callout: none;
  padding-top: env(safe-area-inset-top, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
}
html[data-cg-app] #app {
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  padding-right: max(8px, env(safe-area-inset-right, 0px));
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  padding-left: max(8px, env(safe-area-inset-left, 0px));
}
/* follow the dynamic viewport so an iOS toolbar sliding in or out never hides
   the controls at the bottom of the board */
@supports (height: 100dvh) {
  #app { bottom: auto; height: 100dvh; }
}

#bg { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }
#s-title {
  background: transparent;
}
/* The board screen stays clear: the bench canvas under it is the material's
   own surface - planks for wood, tiles for porcelain, cloth for linen. */
#s-loading {
  background:
    radial-gradient(ellipse 100% 58% at 50% -12%, rgba(140, 170, 200, .34), transparent 64%),
    linear-gradient(180deg, transparent 0 34%, rgba(190, 210, 230, .4) 50%, transparent 66%),
    linear-gradient(180deg, #2a3848 0%, #161e28 100%);
}
/* Storm, page-picker 23. The loading screen and the lists. */
#s-levels {
  background:
    radial-gradient(ellipse 100% 58% at 50% -12%, rgba(140, 170, 200, .34), transparent 64%),
    linear-gradient(180deg, transparent 0 34%, rgba(190, 210, 230, .4) 50%, transparent 66%),
    linear-gradient(180deg, #2a3848 0%, #161e28 100%);
}
#ov-purse.shop-overlay {
  background: transparent;
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
  flex-direction: column;
  pointer-events: none;
  top: 58px;
}
.shop-hud, #shop-spots { pointer-events: auto; }
/* Just the room: the little corner button puts everything else away; a tap
   anywhere brings it back. */
.shop-view {
  position: absolute; right: 8px; bottom: 8px; z-index: 3;
  width: 40px; height: 40px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid rgba(226, 190, 140, .5);
  background: rgba(16, 24, 34, .72); color: #f6e6c8;
  font-size: 22px; line-height: 1; cursor: pointer; pointer-events: auto;
}
#app.room-view #path-dock, #app.room-view .shop-hud, #app.room-view #shop-spots, #app.room-view .shop-menu,
#app.room-view .shop-view, #app.room-view #ov-rotate { display: none !important; }
#app.room-view #ov-purse.shop-overlay { top: 0 !important; display: flex !important; }
#app.room-view #ov-purse.shop-overlay::before { display: none; }
#app.room-view #ov-purse #shop-stage { grid-column: 1 / -1; margin: 0 !important; pointer-events: auto; cursor: pointer; }
#app.shop-open .screen { visibility: hidden; }
#shop-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  z-index: 1;
}
.shop-rooms {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px;
  pointer-events: auto;
  flex: 1 1 100%;
  order: 5;
}
.shop-rooms::-webkit-scrollbar { display: none; }
.shop-room {
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #e7eef6;
  background: rgba(16, 24, 34, .78);
  border: 1px solid rgba(226, 190, 140, .35);
  border-radius: 16px;
  padding: 6px 12px;
  cursor: pointer;
  flex: 0 0 auto;
  white-space: nowrap;
}
.shop-room[data-room="workshop"] { box-shadow: inset 0 -3px 0 #e2a24a; }
.shop-room[data-room="kitchen"]  { box-shadow: inset 0 -3px 0 #d86a45; }
.shop-room[data-room="parlor"]   { box-shadow: inset 0 -3px 0 #7ea36a; }
.shop-room[data-room="garden"]   { box-shadow: inset 0 -3px 0 #3eae62; }
.shop-room[data-room="library"]  { box-shadow: inset 0 -3px 0 #d2b15c; }
.shop-room[data-room="hall"]     { box-shadow: inset 0 -3px 0 #6f93c4; }
.shop-room[data-room="dining"]   { box-shadow: inset 0 -3px 0 #c45b78; }
.shop-room.on, .shop-room:hover {
  color: #fff3d0;
  border-color: rgba(242, 196, 99, .8);
  background: rgba(48, 28, 12, .82);
}
.shop-room:active, .shop-room.is-press {
  transform: translateY(3px) scale(0.96);
  filter: brightness(0.8);
}
.shop-hud {
  position: relative;
  z-index: 3;
  background: #2a3848;
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 8px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  padding-left: calc(12px + env(safe-area-inset-left, 0px));
  padding-right: calc(12px + env(safe-area-inset-right, 0px));
}
#shop-spots { position: absolute; inset: 0; z-index: 2; overflow: hidden; }
.shop-spot {
  position: absolute;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  border-radius: 14px;
}
.shop-spot:not(.owned) {
  box-shadow: 0 0 0 2px rgba(242, 196, 99, .55), 0 0 18px rgba(255, 170, 60, .25);
  animation: shop-pulse 2.4s ease-in-out infinite;
}
/* The painting stays clear: no outlines, no price tags. The Furnish menu
   sells; its row under the finger lights its spot here (.lit). */
#shop-spots .shop-spot:not(.lit), #shop-spots .shop-spot.short:not(.lit) { box-shadow: none; animation: none; }
#shop-spots .shop-spot.shop-look:not(.lit) { visibility: hidden; }
#shop-spots .shop-tag, #shop-spots .shop-spot b { display: none !important; }
#shop-spots .shop-spot.lit { box-shadow: 0 0 0 3px rgba(255, 214, 120, .9), 0 0 22px rgba(255, 186, 80, .45); animation: shop-pulse 1.6s ease-in-out infinite; }

.btn.furnish {
  /* with the coins, at the right end of the bar */
  margin-left: auto;
  font-size: 15px; padding: 8px 16px; min-height: 40px; letter-spacing: .06em;
  border: 1px solid #4e7064; background: linear-gradient(180deg, #f6dc9c, #e2a24a); color: #2e1c0d;
  box-shadow: 0 4px 0 #8a5a1c, 0 6px 10px rgba(0, 0, 0, .22);
}
.shop-menu {
  position: absolute; z-index: 6; right: 10px; top: 10px;
  max-height: calc(100% - 20px);
  width: min(360px, calc(100% - 20px));
  display: flex; flex-direction: column;
  border-radius: 14px; overflow: hidden; pointer-events: auto;
  background: rgba(22, 32, 44, .97); border: 2px solid #e8b44a;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .6);
}
.shop-menu[hidden] { display: none; }
.shop-menu-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px 8px 14px; }
.shop-menu-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.shop-menu-coins { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; color: #f5d27a; }
.shop-menu-head b { font-family: var(--display); font-size: 17px; letter-spacing: .06em; text-transform: uppercase; color: #f6e6c8; }
.shop-menu-x {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(226, 190, 140, .45);
  background: rgba(255, 255, 255, .06); color: #f6e6c8; font-size: 24px; line-height: 1; cursor: pointer;
}
.shop-menu-list { list-style: none; margin: 0; padding: 0 10px 10px; overflow-y: auto; display: grid; gap: 6px; }
.shop-menu-item {
  width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'nm pr' 'bl pr';
  align-items: center; gap: 2px 10px; text-align: left;
  min-height: 48px; padding: 8px 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid rgba(242, 196, 99, .5); background: rgba(255, 236, 196, .08); color: #ffe7b0; font: inherit;
}
.shop-menu-item .nm { grid-area: nm; font-family: var(--display); font-size: 16px; letter-spacing: .03em; }
.shop-menu-item .bl { grid-area: bl; font-size: 13px; color: #d0c4ae; line-height: 1.25; }
.shop-menu-item .pr { grid-area: pr; display: inline-flex; align-items: center; gap: 5px; font-family: var(--display); font-size: 17px; color: #f5d27a; }
.shop-menu-item.short .pr { color: #c9a39b; }
.shop-menu-item.short .bl { color: #e0b0a6; }
.shop-menu-item.owned { cursor: default; opacity: .7; border-color: rgba(180, 208, 192, .45); }
.shop-menu-item.owned .pr { color: #b4d0c0; }
.shop-menu-item.focus { border-color: #ffd36a; background: rgba(255, 220, 140, .16); }
.shop-menu-item:not(:disabled):hover { background: rgba(255, 236, 196, .16); }
.shop-menu-item.nope { animation: menu-nope .3s; }
/* an upright phone: the bar is one line (the coin chips drop their word) */
@media (max-width: 480px) {
  #ov-purse .shop-hud .purse-chip i { display: none; }
  #ov-purse .btn.furnish { padding: 6px 12px; font-size: 14px; min-height: 40px; }
  #ov-purse .shop-hud { gap: 6px; padding-top: 8px; padding-bottom: 6px; }
}
@keyframes menu-nope { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.shop-spot.owned { cursor: default; box-shadow: none; animation: none; }
.shop-spot.short:not(.owned) { box-shadow: 0 0 0 2px rgba(242, 196, 99, .28); }
/* touch: a shared patch over things packed too close for a finger; their
   outlines stay drawn underneath, and a tap asks which one */
.shop-spot.shop-look { pointer-events: none; }
.shop-spot.shop-patch { box-shadow: none; animation: none; border-radius: 10px; }
.shop-pick {
  position: absolute; z-index: 5; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px;
  padding: 8px; min-width: 170px; border-radius: 12px; overflow-y: auto; box-sizing: border-box;
  background: rgba(22, 32, 44, .96); border: 2px solid #e8b44a;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .6);
}
.shop-pick-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; padding: 6px 12px; border-radius: 9px; cursor: pointer;
  border: 1px solid rgba(242, 196, 99, .5); background: rgba(255, 236, 196, .08);
  color: #ffe7b0; font-family: var(--display); font-size: 15px; letter-spacing: .04em;
}
.shop-pick-item .nm { font-style: normal; text-transform: uppercase; }
.shop-pick-item .pr { display: inline-flex; align-items: center; gap: 4px; color: #f5d27a; }
.shop-pick-item.owned { opacity: .75; }
.shop-pick-item.short .pr { color: #d9a8a0; }
@keyframes shop-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(242, 196, 99, .4), 0 0 10px rgba(255, 170, 60, .12); }
  50% { box-shadow: 0 0 0 3px rgba(255, 214, 120, .85), 0 0 22px rgba(255, 186, 80, .4); }
}
.shop-spot b {
  position: absolute;
  left: 50%;
  top: -1.4em;
  transform: translateX(-50%);
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #ffe7b0;
  text-shadow: 0 1px 6px rgba(0,0,0,.85);
  white-space: nowrap;
  pointer-events: none;
}
.shop-tag {
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translate(-50%, 70%);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 9px 5px;
  border-radius: 12px;
  background: #16202c;
  color: #f2c463;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,.55);
  white-space: nowrap;
}
.shop-tag .nm {
  font-style: normal;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #ffe7b0;
  line-height: 1.15;
}
.shop-tag .pr {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
/* placed beside its piece by placeShopTags() in ui.js */
.shop-tag { z-index: 1; }
@media (max-width: 700px), (max-height: 560px) {
  .shop-spot b { display: none; }
  .shop-tag { font-size: 14px; padding: 3px 7px 4px; gap: 0; }
  .shop-tag .nm { display: none; }
  .shop-tag .pr { font-size: 14px; }
}
.shop-line { display: none !important; }

/* ---------------------------------------------------------------- screens */
#path-dock {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 8px 8px;
  background: rgba(22, 30, 40, .55);
}
#path-dock[hidden] { display: none; }

#mat-dock {
  display: none !important;
  position: absolute;
  top: 58px; left: 0; right: 0;
  z-index: 49;
  display: flex;
  gap: 6px;
  padding: 0 8px 8px;
  background: rgba(22, 30, 40, .94);
}
#mat-dock[hidden] { display: none; }
#mat-dock button {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  padding: 5px 4px 6px;
  border-radius: 9px;
  border: 1px solid var(--btn-edge, rgba(90, 58, 28, .22));
  background: var(--btn-face);
  background-size: cover;
  color: var(--btn-ink);
  font: inherit;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(48, 24, 8, .42), 0 5px 8px rgba(0, 0, 0, .2);
}
#mat-dock button b {
  font-family: var(--display);
  font-size: clamp(12px, 2.8vw, 15px);
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
#mat-dock button.on {
  box-shadow: 0 0 0 2px #f2c463, 0 3px 0 rgba(48, 24, 8, .42);
  filter: brightness(1.08);
}
#mat-dock button.locked { opacity: .45; filter: grayscale(.35); }
#mat-dock button:active, #mat-dock button.is-press {
  transform: translateY(3px) scale(0.97);
  box-shadow: inset 0 4px 8px rgba(20, 8, 2, .45);
}

#s-levels.screen { padding-top: 58px; }
#s-game.screen { padding-top: 58px; }
#app[data-screen="title"] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 100% 58% at 50% -12%, rgba(140, 170, 200, .34), transparent 64%),
    linear-gradient(180deg, transparent 0 34%, rgba(190, 210, 230, .4) 50%, transparent 66%),
    linear-gradient(180deg, #2a3848 0%, #161e28 100%);
}
#app[data-screen="title"] #s-title.screen {
  position: relative;
  inset: auto;
  width: 100%;
  height: auto;
  padding: 0 12px;
  flex: 0 0 auto;
  order: 1;
}
/* The title is the sign, Play, and the coins. The tabs wait for the
   board lists and the boards. */
#app[data-screen="title"]:not(.shop-open):not(.achieve-open) #path-dock { display: none; }
#app[data-screen="title"] #path-dock {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  width: min(1040px, 98%);
  order: 2;
  margin: 14px auto 0;
  background: transparent;
}
/* Rooms opens over the title. The title rule pulls this bar into the
   flow, which parked it on the painting. Pin it back to the top. */
#app.shop-open[data-screen="title"] #path-dock,
#app.achieve-open[data-screen="title"] #path-dock {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: auto;
  order: 0;
  margin: 0;
  background: rgba(22, 30, 40, .5);
}
#app[data-screen="levels"] #path-dock {
  background: rgba(22, 30, 40, .5);
}
/* The tab pages hide the screen behind the dock. The strip stays Storm. */
#app.achieve-open {
  background:
    radial-gradient(ellipse 100% 58% at 50% -12%, rgba(140, 170, 200, .34), transparent 64%),
    linear-gradient(180deg, #2a3848 0%, #161e28 100%);
}
#app.shop-open { background: #2a3848; }
#app.shop-open #ov-rotate { background: #161e28; color: #eef4fa; }
#app.achieve-open .screen { visibility: hidden; }
#app.celebrate-open #path-dock,
#app.celebrate-open .screen { visibility: hidden; }
#app[data-screen="title"] #mat-dock { display: none !important; }
#app[data-screen="title"] #s-title .menu #btn-levels,
#app[data-screen="title"] #s-title .menu #btn-shop { display: none; }
/* one row of seven: Achievements is the longest word and gets the room
   to say it; the other six give a little */
#path-dock #path-achieve { flex-basis: 17%; }
#path-dock button {
  flex: 1 1 11%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  margin: 0;
  padding: 6px 4px 7px;
  border-radius: 10px;
  /* Celadon, gallery 35. A grey-green that sits with the indigo page
     and the green card. The same face on every material. Play and the
     board controls keep the material plaque. */
  border: 1px solid #4e7064;
  background: linear-gradient(180deg, #b4d0c0, #78a090);
  background-size: auto;
  color: #1c2824;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 4px 0 #304840, 0 6px 10px rgba(0, 0, 0, .22);
}
#path-dock button b {
  font-family: var(--display);
  font-size: clamp(12px, 1.5vw, 15px);
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  line-height: 1.1;
  color: #1c2824;
  max-width: 100%;
}
#path-dock button i {
  font-style: normal;
  font-size: 12px;
  letter-spacing: .04em;
  color: #1c2824;
  opacity: .7;
  line-height: 1.1;
}
#path-dock button.on {
  box-shadow: 0 4px 0 #304840, 0 6px 10px rgba(0, 0, 0, .22);
  filter: brightness(1.06);
}
#path-dock button.on i { opacity: .85; }
#path-dock button:active, #path-dock button.is-press {
  transform: translateY(4px) scale(0.97);
  box-shadow: inset 0 5px 10px rgba(20, 8, 2, .5);
}
#s-levels[data-wall="easy"] .card:not(.band-easy),
#s-levels[data-wall="medium"] .card:not(.band-medium),
#s-levels[data-wall="hard"] .card:not(.band-hard),
#s-levels[data-wall="locks"] .card:not(.band-locks) { display: none !important; }
#s-levels[data-wall="locks"] .chapter,
#s-levels[data-wall="locks"] .grid:not(.locks-shelf) { display: none !important; }
#s-levels:not([data-wall="locks"]) .grid.locks-shelf { display: none !important; }
/* the Daily tab shows the daily plate and its month, and nothing else */
#s-levels[data-wall="daily"] #level-list { display: none !important; }
#s-levels[data-wall="easy"] #lv-daily,
#s-levels[data-wall="medium"] #lv-daily,
#s-levels[data-wall="hard"] #lv-daily,
#s-levels[data-wall="locks"] #lv-daily { display: none !important; }
.card.band-train .no { display: none; }
.chapter { scroll-margin-top: 120px; }

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#s-levels.screen { padding-top: 72px; }
#s-game.screen { padding-top: 72px; }
.screen.show { display: flex; }
.screen.fade { animation: fade .28s ease backwards; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- loading */
.loader {
  margin: auto;
  text-align: center;
  padding: 24px;
  max-width: 420px;
}
.loader .mark {
  width: 74px; height: 74px; margin: 0 auto 18px;
  border-radius: 50%;
  border: 3px solid rgba(227, 154, 63, .5);
  border-top-color: var(--ember);
  animation: spin 1.1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.logo {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(38px, 9vw, 66px);
  letter-spacing: .10em;
  margin: 0;
  color: #f3dfb8;
  text-shadow: 0 2px 0 #2a1708, 0 6px 18px rgba(0,0,0,.6);
}
.logo-sub {
  font-family: var(--display);
  font-size: clamp(13px, 3.2vw, 19px);
  letter-spacing: .44em;
  text-transform: uppercase;
  margin: 2px 0 0;
  color: var(--cream-dim);
  text-indent: .44em;
}

.bar {
  margin: 26px auto 10px;
  width: min(260px, 70vw);
  height: 9px;
  border-radius: 6px;
  background: rgba(0,0,0,.45);
  box-shadow: inset 0 2px 5px rgba(0,0,0,.7);
  overflow: hidden;
}
.bar i {
  display: block; height: 100%; width: 0%;
  border-radius: 6px;
  background: linear-gradient(90deg, #b8762f, var(--ember));
  transition: width .18s ease;
}
.load-note { color: var(--cream-dim); font-size: 15px; letter-spacing: .08em; margin: 0; }
.return-note {
  margin: 14px auto 0;
  max-width: 420px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(22, 32, 44, .92);
  border: 1px solid rgba(168, 196, 220, .45);
  color: #eef4fa;
  /* The sign-in line's plain system face: Fredoka this small and heavy
     smeared on Windows. Whole-pixel lines keep the rows under it on whole
     pixels too. */
  font-family: "Segoe UI", system-ui, Arial, sans-serif;
  font-weight: 600;
  font-size: 15px;
  line-height: 22px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .28);
}
.return-note[hidden] { display: none; }

/* ---------------------------------------------------------------- title */
.title-stack { margin: auto; text-align: center; padding: 20px; width: 100%; max-width: 460px; }
.sign {
  position: relative;
  padding: 22px 26px 26px;
  border-radius: 14px;
  background: var(--panel-face);
  background-size: cover;
  box-shadow: 0 14px 34px var(--shadow), inset 0 1px 0 rgba(255,225,180,.22),
              inset 0 -3px 10px rgba(0,0,0,.5);
  border: 1px solid rgba(30,16,6,.7);
}
.sign-art { display: block; width: 100%; height: auto; border-radius: 10px; }
.sign.sign--art {
  padding: 0; background: none; border: 0;
  box-shadow: 0 18px 40px var(--shadow);
  border-radius: 12px;
}
.sign.sign--art .logo, .sign.sign--art .logo-sub {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.menu { display: flex; flex-direction: column; gap: 12px; margin-top: 26px; }
.tally { color: var(--cream-dim); font-size: 14px; letter-spacing: .1em; margin-top: 18px; white-space: nowrap; }
#levels-tally { margin-top: 0; }
.account {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  margin: 18px auto 0;
  padding: 9px 18px;
  border: 2px solid #ffc107;
  border-radius: 22px;
  background: rgba(22, 32, 44, .92);
  color: #eef4fa;
  font-size: 14px;
  cursor: pointer;
}
.account:hover { background: rgba(36, 52, 70, .96); border-color: #ffe566; }
.account img { width: 26px; height: 26px; border-radius: 50%; }
.account[hidden] { display: none; }

.title-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 14px; margin-top: 20px; max-width: 100%; }
/* The row wraps on a narrow phone. Sound goes last there, so the two chips
   share the first line and neither tip has to climb over the other. Wider,
   it sits between them (index.html) so each chip's tip has room at its end. */
@media (max-width: 480px) { .title-foot #t-sound { order: 1; } }
.purse-chip {
  position: relative;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px 7px 11px;
  border: 2px solid #ffc107; border-radius: 22px;
  background: rgba(16, 24, 34, .82);
  box-shadow: inset 0 1px 0 rgba(210, 226, 240, .16), 0 2px 8px rgba(0,0,0,.35);
  color: #f2c463; font-family: var(--display); font-size: 19px; font-weight: 700;
  cursor: pointer;
}
.purse-chip.flat { cursor: default; font-size: 16px; padding: 6px 12px 6px 9px; }
.purse-chip i { font-style: normal; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: #d5e2ee; }
.purse-chip:hover { background: rgba(28, 42, 58, .88); }

/* the standing watch-an-ad offer, dressed like the purse so they read as a
   pair: coins you have, coins on offer */
.purse-chip.adchip { color: #163028; background: linear-gradient(#f3faf6, #c5dfd2); border: 2px solid #246b56; }
.purse-chip.adchip[hidden] { display: none !important; }
.purse-chip.adchip:disabled { opacity: .55; cursor: default; }
.purse-chip.adchip .tv {
  display: inline-block; vertical-align: -3px;
  width: 28px; height: 22px;
  border: 2.5px solid #245544; border-radius: 4px;
  position: relative;
  background: rgba(0,0,0,.18);
}
.purse-chip.adchip .tv::after {
  content: ''; position: absolute; left: 8px; top: 3px;
  border: 7px solid transparent; border-left-color: #245544; border-right: 0;
}
.purse-chip.adchip i { color: #245544; }
.shop { list-style: none; margin: 4px 0 16px; padding: 0; text-align: left; }
.shop li {
  display: grid; grid-template-columns: 52px 1fr; align-items: baseline; gap: 8px;
  padding: 9px 4px; border-top: 1px solid rgba(226,190,140,.16);
  cursor: pointer;
}
.shop b { color: #f2c463; font-family: var(--display); font-size: 18px; }
.shop i { font-style: normal; font-weight: 700; color: #f0dcb6; font-size: 15px; }
.shop em { grid-column: 2; font-style: normal; color: var(--cream-dim); font-size: 14px; line-height: 1.4; }
.shop li.owned { cursor: default; opacity: .8; }
.shop li.owned b { color: #9ecf88; font-size: 14px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; margin: 0;
}

.tally b { color: var(--ember); }

/* ---------------------------------------------------------------- buttons */
.btn {
  position: relative;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--btn-ink);
  padding: 13px 22px;
  border: 1px solid var(--btn-edge, rgba(90, 58, 28, .22));
  border-radius: 10px;
  background: var(--btn-face);
  background-size: cover;
  cursor: pointer;
  text-shadow: none;
  box-shadow: 0 5px 0 rgba(48, 24, 8, .42), 0 8px 12px rgba(0, 0, 0, .22);
  filter: none;
  transition: transform .07s ease, box-shadow .07s ease, filter .07s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.btn:hover { filter: brightness(1.04); }
.btn:active, .btn.held, .btn.is-press {
  transform: translateY(5px) scale(0.96);
  filter: brightness(0.78);
  box-shadow: inset 0 6px 12px rgba(20, 8, 2, .5), 0 0 0 rgba(0, 0, 0, 0);
}
.btn:focus-visible { outline: 3px solid var(--ember); outline-offset: 3px; }
.btn-lg { font-size: 22px; padding: 16px 26px; }
/* Play stays the large control on the title. Its face is the same pine plaque
   as the path tabs; size is what marks it. */
#btn-play {
  font-size: 28px;
  letter-spacing: .2em;
  padding: 18px 26px;
}
#btn-play::before {
  content: '';
  display: inline-block;
  width: 0; height: 0;
  margin-right: 12px;
  vertical-align: 2px;
  border-style: solid;
  border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent currentColor;
}
.btn-sm { font-size: 19px; padding: 10px 26px; min-height: 54px; letter-spacing: .09em; }
/* every button says what it does underneath its name */
.btn b { font-weight: inherit; display: inline; }
.btn small {
  display: block;
  font-family: var(--ui);
  font-size: 13px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: #2f7a3a; text-shadow: none;
  margin-top: 3px;
}
.btn .price { color: #7a4a10; font-weight: 700; }
/* CrazyGames require the non-ad alternative to be equally prominent: same
   size, weight and colour as the ad button. */
.btn.choice { font-size: 17px; padding: 14px 20px; width: 100%; }
.btn.choice .tv {
  display: inline-block; vertical-align: -3px;
  width: 26px; height: 20px; margin-right: 9px;
  border: 2.5px solid #2a1404; border-radius: 4px;
  position: relative;
}
.btn.choice .tv::after {
  content: ''; position: absolute; left: 7px; top: 3px;
  border: 6px solid transparent; border-left-color: #2a1404; border-right: 0;
}
#ov-buy .panel, #ov-fail .panel { width: min(430px, 100%); }
#ov-fail .win-shout { color: #b4451c; font-size: clamp(24px, 6vw, 34px); }
#ov-fail .panel, #ov-buy .panel {
  background: linear-gradient(#fff0d0, #f3c982 62%, #e5ac5c);
  border: 1px solid #b8813a;
}
#ov-fail .panel h2, #ov-buy .panel h2 { color: #163028; }
#ov-fail .remark, #ov-buy .remark { color: #163028; }
#ov-fail .panel-actions, #ov-buy .panel-actions { gap: 9px; }
#g-peek.costs b::after { content: ''; }
#g-peek.costs { box-shadow: 0 5px 0 #4b2d13, 0 10px 20px var(--shadow), inset 0 1px 0 rgba(255,232,190,.5), 0 0 0 2px rgba(242,196,99,.45); }

/* the coach: one bright panel that explains a control the first time you meet
   it, and again whenever you hover it */
#coach {
  position: absolute;
  z-index: 60;
  max-width: min(360px, 78vw);
  padding: 13px 17px;
  border-radius: 12px;
  background: linear-gradient(#ffdd96, #efb44e);
  color: #2b1806;
  font-size: 16.5px;
  line-height: 1.35;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .6);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
#coach.show { opacity: 1; transform: none; }
/* A short side column cannot hold the full sentence. Slim keeps it in the
   open gap beside the plate. */
#coach.slim {
  padding: 8px 12px;
  font-size: 15px;
  line-height: 1.25;
}
#coach::after {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border: 9px solid transparent;
}
#coach.below::after {
  top: -18px;
  bottom: auto;
  left: var(--arrow, 50%);
  right: auto;
  margin-left: -9px;
  border-bottom-color: #ffdd96;
}
#coach.above::after {
  bottom: -18px;
  top: auto;
  left: var(--arrow, 50%);
  right: auto;
  margin-left: -9px;
  border-top-color: #efb44e;
}
/* The bubble is beside the plate. The point stays on that near edge. */
#coach.side-left::after {
  top: var(--arrow, 50%);
  bottom: auto;
  right: -18px;
  left: auto;
  margin-top: -9px;
  margin-left: 0;
  border-left-color: #f3c56a;
}
#coach.side-right::after {
  top: var(--arrow, 50%);
  bottom: auto;
  left: -18px;
  right: auto;
  margin-top: -9px;
  margin-left: 0;
  border-right-color: #ffdd96;
}
/* On a crowded phone screen the nearest clear spot can be a little way off.
   The point then sits at the end of a leader line, so the sentence still
   plainly belongs to its control. */
#coach.stem::before {
  content: '';
  position: absolute;
  background: #efb44e;
  border-radius: 2px;
}
#coach.stem.above::before { top: 100%; left: var(--arrow); width: 3px; margin-left: -1.5px; height: var(--stem); }
#coach.stem.below::before { bottom: 100%; left: var(--arrow); width: 3px; margin-left: -1.5px; height: var(--stem); }
#coach.stem.side-left::before { left: 100%; top: var(--arrow); height: 3px; margin-top: -1.5px; width: var(--stem); }
#coach.stem.side-right::before { right: 100%; top: var(--arrow); height: 3px; margin-top: -1.5px; width: var(--stem); }
#coach.stem.above::after { bottom: calc(-18px - var(--stem)); }
#coach.stem.below::after { top: calc(-18px - var(--stem)); }
#coach.stem.side-left::after { right: calc(-18px - var(--stem)); }
#coach.stem.side-right::after { left: calc(-18px - var(--stem)); }
.btn[disabled] { opacity: .42; cursor: default; box-shadow: none; }
.btn[disabled]:hover { filter: none; }

/* pine plaque with scorched marks, same as the title sign */
.icon {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  width: 46px; height: 46px;
  flex: 0 0 auto;
  border: 1px solid var(--btn-edge, rgba(90, 58, 28, .22));
  border-radius: 11px;
  background: var(--btn-face);
  background-size: cover;
  color: var(--btn-ink);
  font-size: 25px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(48, 24, 8, .4), 0 6px 10px rgba(0, 0, 0, .2);
  text-shadow: none;
  filter: none;
  transition: transform .07s ease, box-shadow .07s ease, filter .07s ease;
}
.icon.wide {
  width: auto;
  padding: 0 15px 0 10px;
  font-family: var(--display);
  font-size: 16px;
  letter-spacing: .08em;
}
.icon .arrow { font-size: 25px; line-height: 1; margin-top: -3px; }
.icon:hover { background: var(--btn-face); background-size: cover; filter: brightness(1.04); }
.icon:active, .icon.is-press { transform: translateY(4px) scale(0.94); filter: brightness(0.78); box-shadow: inset 0 5px 10px rgba(20, 8, 2, .5), 0 0 0 rgba(0, 0, 0, 0); }
.icon:focus-visible { outline: 3px solid var(--ember); outline-offset: 2px; }
.icon.off { color: #6a4a2c; }
.sound-btn { position: relative; }
.sound-btn.off { color: var(--btn-ink); }
.sound-btn.off::before {
  content: '';
  position: absolute;
  width: 30px;
  height: 30px;
  border: 2.5px solid currentColor;
  border-radius: 50%;
  pointer-events: none;
  box-sizing: border-box;
}
.sound-btn.off::after {
  content: '';
  position: absolute;
  width: 2.6px;
  height: 34px;
  background: currentColor;
  border-radius: 1px;
  transform: rotate(-42deg);
  pointer-events: none;
}


/* ---------------------------------------------------------------- topbar */
/* Three columns with equal outer tracks, so the title and meters sit on the
   centre line of the screen - and therefore of the board - however wide the
   button groups either side happen to be. */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  flex: 0 0 auto;
}
.topbar > :first-child { justify-self: start; }
.topbar > :last-child { justify-self: end; }
.topbar h2 {
  font-family: var(--display);
  font-size: clamp(16px, 4.2vw, 23px);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin: 0;
  text-align: center;
  color: #f0dcb6;
  text-shadow: 0 2px 6px rgba(0,0,0,.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hud-mid { min-width: 0; text-align: center; }
.hud-title {
  min-width: 0;
  text-align: center;
  background: linear-gradient(#fff8ef, #f3d7a6);
  border: 2px solid #e2b56a;
  border-radius: 14px;
  padding: 4px 16px 6px;
  box-shadow: 0 3px 0 #c9a06a;
}
.hud-title h2 {
  color: #5c3a24;
  text-shadow: none;
}
.hud-right { display: flex; gap: 6px; flex: 0 0 auto; }
/* On a narrow board list the coin, ad, and sound controls sit under the heading. Back stays on the row with the title. */
@media (max-width: 600px) {
  #s-levels .topbar {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "back title" "hud hud";
    justify-items: center;
    gap: 8px;
  }
  #s-levels .topbar > :first-child {
    display: inline-flex;
    grid-area: back;
    justify-self: start;
  }
  #s-levels .topbar h2 {
    grid-area: title;
    justify-self: center;
    max-width: 100%;
  }
  #s-levels .topbar .hud-right {
    grid-area: hud;
    justify-self: center;
    justify-content: center;
  }
}
/* Hidden with visibility so the phone rule that forces display:inline-flex
   cannot bring the button back, and the title stays in its column. */
#lv-back.is-off,
#purse-close.is-off,
#achieve-close.is-off {
  visibility: hidden;
  pointer-events: none;
}

/* its own centred row, so it lines up with the board no matter how wide the
   button groups in the bar above happen to be */
.stats {
  display: flex; justify-content: center; align-items: center;
  gap: 8px; flex: 0 0 auto;
  padding: 0 12px 4px;
}
.chip {
  display: flex; flex-direction: column; align-items: center;
  flex: 0 0 auto;
  min-width: 0;
  max-width: 28vw;
  padding: 1px 8px 2px;
  border-radius: 14px;
  background: linear-gradient(#fff8ef, #f6e2c4);
  border: 2px solid #e2b56a;
  box-shadow: 0 3px 0 #c9a06a;
  line-height: 1.05;
  cursor: default;
  color: #5c3a24;
}
.chip i {
  font-style: normal; font-size: 12px; font-weight: 700;
  letter-spacing: .06em; text-indent: 0; opacity: 1;
  white-space: normal;
  text-align: center;
  max-width: 100%;
  line-height: 1.15;
  color: #8a5a32;
}
.chip b { font-family: var(--display); font-size: 24px; font-weight: 600; color: #5c3a24; }
.chip.moves,
.chip.target,
.chip.time { background: linear-gradient(#fff8ef, #f6e2c4); border-color: #e2b56a; box-shadow: 0 3px 0 #c9a06a; }
.chip.moves i, .chip.target i, .chip.time i { color: #8a5a32; }
.chip.moves b, .chip.target b, .chip.time b { color: #5c3a24; }
.chip.purse {
  font: inherit;
  color: inherit;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin: 0;
}
.chip.purse:hover { filter: brightness(1.12); }
.chip.purse { background: linear-gradient(#fff8ef, #f6e2c4); border-color: #e2b56a; box-shadow: 0 3px 0 #c9a06a; }
.chip.purse i {
  color: #8a5a32;
  font-size: 12px;
  letter-spacing: .06em;
  line-height: 1.1;
  margin: 0;
  align-self: center;
}
.chip.purse b {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
  text-shadow: none;
}
.chip.purse .coin-sm { width: 22px; height: 22px; flex: 0 0 auto; }
.chip.purse b { color: #9a4e24; }
#ad-game {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 1px 8px 2px;
  border-radius: 9px;
  gap: 0;
  line-height: 1.05;
  box-shadow: inset 0 1px 0 rgba(255, 226, 180, .12), 0 2px 8px rgba(0, 0, 0, .45);
}
#ad-game .tv { display: none; }
#ad-game i {
  font-size: 13px;
  letter-spacing: .12em;
  text-indent: .12em;
  text-transform: uppercase;
}
#ad-game .ad-pay {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
#ad-game .coin-sm {
  display: inline-block;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}
#ad-game b {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
}
.chip b.over { color: #ff7a45; text-shadow: 0 0 14px rgba(255,110,50,.55); }
.chip[hidden] { display: none; }

/* ---------------------------------------------------------------- board */
.board-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 10px 20px;
  overflow: visible;
  transition: transform .45s cubic-bezier(.2, .9, .3, 1);
}
.board-rating {
  /* in the counters row, where the move count was */
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  max-width: 100%;
  text-align: center;
  pointer-events: none;
  box-sizing: border-box;
}
.board-wrap.has-rating .combo-shout { top: 36px; }
.board-rating b {
  display: inline-block;
  max-width: 100%;
  box-sizing: border-box;
  padding: 4px 12px 5px;
  border-radius: 12px;
  background: linear-gradient(#f3faf6, #c5dfd2);
  border: 2px solid #246b56;
  font-family: var(--display);
  font-size: clamp(13px, 3.4vw, 20px);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #163028;
}
/* in the counters row it stands as tall as the counters beside it, and a
   long word wraps rather than being cut */
.stats .board-rating { align-self: stretch; display: flex; }
.stats .board-rating b {
  display: flex; align-items: center; justify-content: center;
  white-space: normal; text-align: center; overflow-wrap: anywhere;
}
.board-rating.slam b {
  animation: rating-slam .72s cubic-bezier(.15, 1.5, .35, 1) backwards;
}
@keyframes rating-slam {
  0% { transform: scale(1.25) rotate(-6deg); opacity: 0; }
  40% { transform: scale(1.06) rotate(2deg); opacity: 1; }
  62% { transform: scale(0.96) rotate(-1deg); }
  100% { transform: none; opacity: 1; }
}
.board-wrap.board-out { animation: board-out .52s ease-in forwards; }
.board-wrap.board-in { animation: board-in .9s cubic-bezier(.2, .8, .2, 1) backwards; }
@keyframes board-out {
  0% { transform: none; }
  18% { transform: scale(1.05) rotate(-1.2deg); }
  38% { transform: scale(0.7); }
  100% { transform: scale(0.7) translateX(-130vw); }
}
@keyframes board-in {
  0% { transform: scale(0.7) translateX(130vw); }
  48% { transform: scale(0.7) translateX(0); }
  72% { transform: scale(1.07); }
  86% { transform: scale(0.97) rotate(1deg); }
  100% { transform: none; }
}
/* while the win panel is up, the board eases back so the finished picture
   stays fully visible above it */
#s-game.celebrate .board-wrap { transform: translateY(-6%) scale(.80); }
#s-game.celebrate .hud-right,
#s-game.celebrate .controls { opacity: 0; pointer-events: none; }
.controls { transition: opacity .25s ease; }
.controls.done { opacity: .3; pointer-events: none; }
/* the layout pass sizes this exactly, and a max-width/max-height cap here would
   squash the tray out of square instead */
#board {
  display: block;
  touch-action: none;
  cursor: pointer;
  border-radius: 12px;
  /* lifts the tray off the bench whatever the two woods are doing */
  filter: drop-shadow(0 14px 26px rgba(0, 0, 0, .62));
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
/* the board takes focus on every tap for the arrow keys; no ring round it */
#board:focus, #board:focus-visible { outline: none; }

.controls {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 10px;
  padding: 16px 12px calc(14px + env(safe-area-inset-bottom));
  width: min(640px, calc(100% - 24px));
  margin: 8px auto 0;
}
.controls .btn-sm {
  font-size: 16px;
  padding: 10px 12px;
  flex: 1 1 calc(33.33% - 8px);
  max-width: calc(33.33% - 8px);
  min-width: 0;
  box-sizing: border-box;
}



.board-wrap.has-rating { padding-top: 38px; }
.board-wrap.has-combo { padding-top: 48px; }
.board-wrap.has-rating.has-combo { padding-top: 78px; }
.combo-shout {
  position: absolute;
  top: 4px;
  left: 8px;
  right: 8px;
  z-index: 5;
  margin: 0;
  text-align: center;
  pointer-events: auto;
  cursor: help;
}
.combo-shout b {
  display: inline-block;
  max-width: 100%;
  box-sizing: border-box;
  padding: 5px 14px 6px;
  border-radius: 14px;
  background: linear-gradient(#f3faf6, #c5dfd2);
  border: 2px solid #246b56;
  font-family: var(--display);
  font-size: clamp(16px, 4.2vw, 32px);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #163028;
  text-shadow: none;
  transform-origin: center;
}
/* each tier warms up: gold, then orange, then a hot magenta, with a glow */
.combo-shout[data-tier="pay"] b {
  color: #3a2200; border-color: #c8861a;
  background: linear-gradient(#fff6d8, #ffd56a);
  box-shadow: 0 0 0 2px rgba(255, 213, 106, .35), 0 0 16px rgba(255, 190, 60, .7);
}
.combo-shout[data-tier="hot"] b {
  color: #3d1200; border-color: #d4561a;
  background: linear-gradient(#ffe6cc, #ff9d4d);
  box-shadow: 0 0 0 2px rgba(255, 140, 60, .4), 0 0 20px rgba(255, 110, 30, .8);
}
.combo-shout[data-tier="max"] b {
  color: #fff; border-color: #7a1a8c;
  background: linear-gradient(#e05cd0, #9b2fc0);
  text-shadow: 0 1px 2px rgba(40, 0, 50, .6);
  box-shadow: 0 0 0 3px rgba(224, 92, 208, .45), 0 0 26px rgba(200, 70, 255, .9);
}
/* every helpful slide slams the banner in and swivels it; between slides it
   keeps swaying, so a running combo never sits still */
.combo-shout.pop b { animation: combo-slam .45s cubic-bezier(.12, 1.6, .32, 1) backwards, combo-wiggle .8s ease-in-out .25s, combo-sway 1.6s ease-in-out 1.05s 3; }
.combo-shout[data-tier="max"].pop b { animation: combo-slam .45s cubic-bezier(.12, 1.6, .32, 1) backwards, combo-wiggle .55s ease-in-out .25s 2, combo-sway 1.1s ease-in-out 1.35s 4; }
/* the board is done: the banner holds still */
.combo-shout.still b, .combo-shout.still.pop b { animation: none; }
@keyframes combo-slam {
  0% { transform: scale(1.6) rotate(-8deg); opacity: 0; }
  50% { transform: scale(1.1) rotate(3deg); opacity: 1; }
  100% { transform: none; opacity: 1; }
}
@keyframes combo-wiggle {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-7deg) scale(1.08); }
  45% { transform: rotate(6deg) scale(1.08); }
  70% { transform: rotate(-4deg) scale(1.04); }
  88% { transform: rotate(2deg); }
}
@keyframes combo-sway {
  0%, 100% { transform: none; }
  25% { transform: rotate(-1.5deg); }
  75% { transform: rotate(1.5deg) scale(1.02); }
}
@media (prefers-reduced-motion: reduce) {
  .combo-shout.pop b, .combo-shout[data-tier="max"].pop b { animation: none; }
}
.btn.teach-glow, .icon.teach-glow, #path-dock button.teach-glow {
  box-shadow: 0 0 0 3px #e8b44a, 0 0 18px rgba(255, 176, 48, .85);
  animation: teach-blink 1.05s ease-in-out infinite;
  z-index: 5;
}
/* a coach mark: the sentence sits clear of a packed row, with no point,
   and the control it explains glows instead */
#coach.free::before, #coach.free::after { display: none; }
[data-tip].coach-mark {
  box-shadow: 0 0 0 3px #e8b44a, 0 0 18px rgba(255, 176, 48, .85) !important;
  animation: teach-blink 1.05s ease-in-out infinite !important;
}
@keyframes teach-blink {
  0%, 100% { box-shadow: 0 0 0 3px #e8b44a, 0 0 10px rgba(255, 176, 48, .55); }
  50% { box-shadow: 0 0 0 6px #ffd56a, 0 0 22px rgba(255, 196, 64, .95); }
}
.card .medals {
  display: block;
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: .04em;
  color: #f0d48a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gallery-wall .plate .medals {
  display: block;
  margin-top: 4px;
  font-style: normal;
  font-size: 13px;
  line-height: 1.3;
  letter-spacing: .03em;
  color: #e2c48a;
  white-space: pre-line;
}

.gallery-note { text-align: center; color: var(--cream-dim); margin: 8px 16px 0; max-width: 36em; margin-left: auto; margin-right: auto; }
.gallery-daily {
  display: flex; justify-content: center; padding: 10px 14px 0;
}
.gallery-daily[hidden] { display: none; }
.gallery-daily .plate {
  width: 168px;
  background: linear-gradient(180deg, rgba(58, 76, 96, .75), rgba(16, 24, 34, .6));
  border: 2px solid #e2b45a;
  box-shadow: 0 0 0 3px rgba(226, 180, 90, .25), 0 10px 24px rgba(0,0,0,.4);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.gallery-daily .plate canvas { width: 148px; height: 128px; display: block; border-radius: 4px; }
.gallery-daily .plate b { display: block; margin-top: 6px; font-size: 16px; font-weight: 700; color: #ffe7a8; }
.gallery-daily .kicker { margin: 0 0 6px; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: #e2b45a; }
.gallery-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, 140px);
  justify-content: center;
  gap: 16px;
  padding: 12px 14px 40px;
}
.gallery-wall .plate {
  width: 140px;
  background: rgba(16, 24, 34, .55);
  border: 1px solid rgba(168, 196, 220, .28);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
}
.gallery-wall .plate canvas { width: 124px; height: 108px; display: block; border-radius: 4px; }
.gallery-wall .plate b { display: block; margin-top: 6px; font-size: 15px; font-weight: 600; }
.gallery-wall .empty { opacity: .35; }

#ov-chapter .linky { display: block; margin: 12px auto 0; font-size: 17px; }

/* ---------------------------------------------------------------- levels */
.scroll {
  flex: 1 1 auto;
  overflow-y: auto; overflow-x: hidden;
  padding: 4px 14px 26px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 18px);
}
.chapter { margin: 18px 0 10px; display: flex; align-items: center; justify-content: center; gap: 12px; }
.chapter h3 {
  font-family: var(--display); font-size: 15px; letter-spacing: .26em;
  text-transform: uppercase; margin: 0; color: #eef4fa; white-space: nowrap;
}
.chapter hr { flex: 1 1 0; margin: 0; max-width: 22vw; border: 0; border-top: 1px solid rgba(190, 210, 230, .55); }
.chapter-ad {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(150, 220, 120, .5);
  border-radius: 14px;
  background: rgba(18, 48, 16, .78);
  cursor: pointer;
}
.chapter-ad[hidden] { display: none !important; }
/* a locked first board that an ad can open */
.card.locked.ad-lock { cursor: pointer; filter: none; }
.card.locked.ad-lock:hover { transform: translateY(-2px); }
.card-ad {
  position: absolute;
  left: 50%; top: 38%;
  transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px 5px 7px;
  border: 1px solid rgba(150, 220, 120, .6);
  border-radius: 16px;
  background: rgba(18, 48, 16, .9);
  color: #eef4fa;
  font-family: var(--display);
  font-size: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .35);
  pointer-events: none;
}
.card-ad[hidden] { display: none; }
.card-ad .tv {
  display: inline-block;
  width: 22px; height: 17px;
  border: 2px solid #9fd88a; border-radius: 4px;
  position: relative;
}
.card-ad .tv::after {
  content: ''; position: absolute; left: 6px; top: 2.5px;
  border: 5px solid transparent; border-left-color: #9fd88a; border-right: 0;
}
.chapter-ad:disabled { opacity: .55; cursor: default; }
.chapter-ad .tv {
  display: inline-block;
  width: 26px; height: 20px;
  border: 2.5px solid #245544; border-radius: 4px;
  position: relative;
  background: rgba(0,0,0,.25);
}
.chapter-ad .tv::after {
  content: ''; position: absolute; left: 7px; top: 3px;
  border: 6px solid transparent; border-left-color: #245544; border-right: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 14px;
  width: 100%;
  margin-inline: auto;
}
/* Twelve locks, two rows of six. The name wraps so a narrow column still
   holds "The Compass Lock" inside the card. */
.grid.locks-shelf {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  max-width: 1140px;
  gap: 8px;
}
.locks-shelf .card { aspect-ratio: 1 / 1.35; }
.locks-shelf .card .meta { height: 46%; padding: 3px 3px 4px; }
.locks-shelf .card .meta b {
  white-space: normal;
  overflow: hidden;
  text-overflow: clip;
  font-size: 12px;
  letter-spacing: .01em;
  line-height: 1.08;
}
.locks-shelf .card .meta i { display: none; }
.locks-shelf .card .meta .grade { font-size: 12px; letter-spacing: .02em; }
.card {
  position: relative;
  min-width: 0;
  width: 100%;
  border: 0;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #1c2836;
  cursor: pointer;
  box-shadow: 0 6px 16px var(--shadow), inset 0 0 0 2px rgba(168, 196, 220, .4);
  transition: transform .12s ease, box-shadow .12s ease;
  display: block;
  aspect-ratio: 1 / 1.15;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 12px 22px var(--shadow), inset 0 0 0 2px rgba(190, 214, 232, .7); }
.card:focus-visible { outline: 3px solid var(--ember); outline-offset: 2px; }
/* an absolutely positioned replaced element with auto width falls back to its
   intrinsic size, so the box has to be stated outright */
.card canvas {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 74%;
  object-fit: contain;
}
.card .meta {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 34%;
  padding: 4px 6px 5px;
  display: flex; flex-direction: column; justify-content: center;
  gap: 1px;
  background: rgba(16, 24, 34, .92);
  border-top: 1px solid rgba(168, 196, 220, .35);
  text-align: center;
  overflow: hidden;
}
.card .meta b {
  display: block; font-family: var(--display); font-size: 13px; line-height: 1.15;
  letter-spacing: .04em; text-transform: uppercase; color: #eef4fa;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card .meta i {
  font-style: normal; font-size: 13px; line-height: 1.2; color: #c5d4e4;
  letter-spacing: .04em;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
/* On a wall the heading already says Easy, Medium, or Hard, and the third
   line pushed the name off a phone-sized card. The name may take two lines. */
#s-levels .grid .card:not(.band-train):not(.bonus) .meta i { display: none; }
#s-levels .grid .card .meta { height: auto; min-height: 34%; }
#s-levels .grid .card .meta b {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding-block: 1px;
}
.card .meta .grade {
  font-style: normal;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
  color: #f2c463;
  letter-spacing: .04em;
}
.card .no {
  position: absolute; top: 5px; left: 5px;
  min-width: 24px; padding: 2px 6px;
  font-size: 15px; font-weight: 700; letter-spacing: .06em;
  color: #eef4fa; background: rgba(16, 24, 34, .78); border-radius: 6px;
}
.card .earned {
  position: absolute; top: 5px; right: 6px;
  display: flex; align-items: center; gap: 4px;
  padding: 2px 7px 2px 5px;
  border-radius: 9px;
  background: rgba(16, 24, 34, .78);
  font-size: 15px; font-weight: 700; color: #f2c463;
}
.card.locked { cursor: not-allowed; filter: saturate(.5) brightness(.62); }
.card.locked:hover { transform: none; }
.card.done { box-shadow: 0 6px 16px var(--shadow), inset 0 0 0 2px rgba(198,140,60,.85); }
/* set aside with "Try another board" (Coolmath build): unsolved, waiting */
.card.aside { box-shadow: 0 6px 16px var(--shadow), inset 0 0 0 2px rgba(120,170,220,.85); }
.card .aside-tag {
  position: absolute; top: 5px; right: 6px;
  padding: 2px 7px; border-radius: 9px;
  background: rgba(16, 24, 34, .82); color: #cfe3f7;
  font-size: 13px; font-weight: 700; letter-spacing: .03em;
}
.card.today {
  box-shadow: 0 6px 16px var(--shadow), inset 0 0 0 2px #e2b45a,
              0 0 0 3px rgba(226, 180, 90, .28);
}
.card.bonus .no { letter-spacing: .04em; }
.card.mat-linen { background: #21161a; }
.card.mat-ceramic { background: #12182a; }
.card.mat-marble { background: #101814; }
.card.inlay {
  background: #161c24;
  box-shadow: 0 6px 16px var(--shadow), inset 0 0 0 2px rgba(168, 196, 220, .4);
}
.card.inlay .meta {
  background: rgba(12, 16, 22, .92);
  border-top-color: rgba(168, 196, 220, .35);
}
.card.inlay .meta i { color: #c5d4e4; }
.card.inlay.done { box-shadow: 0 6px 16px var(--shadow), inset 0 0 0 2px rgba(198,140,60,.85); }

/* ---------------------------------------------------------------- overlays */
.overlay {
  position: absolute; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(10, 16, 24, .78);
  z-index: 20;
}
/* the win panel sits along the bottom edge with only a soft wash behind it, so
   the board the player just finished stays on screen */
#ov-win {
  z-index: 65;
  align-items: flex-end;
  padding: 12px;
  background: linear-gradient(to bottom,
              rgba(10,16,24,0) 0%, rgba(10,16,24,.18) 34%, rgba(10,16,24,.66) 72%, rgba(10,16,24,.86) 100%);
}
#ov-win .panel {
  position: relative;
  overflow: visible;
  width: min(420px, 100%);
  padding: 20px 22px 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, #244438 0%, #163028 100%);
  border: 3px solid #c9b48a;
  color: #f4f0d8;
  box-shadow:
    inset 0 0 0 2px rgba(244, 240, 216, .18),
    0 8px 0 #0c1612,
    0 18px 36px rgba(12, 22, 18, .45);
  animation: win-pop .45s cubic-bezier(.2, 1.2, .4, 1) backwards;
}
#ov-win .panel.win-hot,
#ov-win .panel.again {
  background: linear-gradient(180deg, #244438 0%, #163028 100%);
  border-color: #c9b48a;
}
@keyframes win-pop {
  0% { transform: translateY(36px) scale(.84); opacity: 0; }
  58% { transform: translateY(-10px) scale(1.05); opacity: 1; }
  100% { transform: none; opacity: 1; }
}
#teach-pin {
  position: fixed;
  pointer-events: none;
  z-index: 16;
}

/* the win card wears the board's material, not a standing orange poster */
#ov-win[data-mat="linen"] {
  background: linear-gradient(to bottom,
              rgba(34,12,14,0) 0%, rgba(34,12,14,.16) 34%, rgba(34,12,14,.62) 72%, rgba(28,10,12,.88) 100%);
}
#ov-win[data-mat="linen"] .panel,
#ov-win[data-mat="linen"] .panel.win-hot,
#ov-win[data-mat="linen"] .panel.again {
  background: linear-gradient(#5a1c1e, #2a1012);
  border-color: #c4a056;
}
#ov-win[data-mat="linen"] .win-shout,
#ov-win[data-mat="linen"] #win-tier { color: #f2c463; text-shadow: none; }
#ov-win[data-mat="linen"] .haul b { color: #ffe08a; text-shadow: none; }
#ov-win[data-mat="linen"] .linky { color: #b42f23; }
#ov-win[data-mat="linen"] .linky:hover { color: #7a1c14; }

#ov-win[data-mat="ceramic"] {
  background: linear-gradient(to bottom,
              rgba(10,16,36,0) 0%, rgba(10,16,36,.16) 34%, rgba(12,20,48,.62) 72%, rgba(8,14,36,.88) 100%);
}
#ov-win[data-mat="ceramic"] .panel,
#ov-win[data-mat="ceramic"] .panel.win-hot,
#ov-win[data-mat="ceramic"] .panel.again {
  background: linear-gradient(#2a3a58, #161e30);
  border-color: #c4a056;
}
#ov-win[data-mat="ceramic"] .win-shout,
#ov-win[data-mat="ceramic"] #win-tier { color: #f2c463; text-shadow: none; }
#ov-win[data-mat="ceramic"] .haul b { color: #ffe08a; }
#ov-win[data-mat="ceramic"] .linky { color: #b42f23; }

#ov-win[data-mat="marble"] {
  background: linear-gradient(to bottom,
              rgba(8,16,12,0) 0%, rgba(8,16,12,.16) 34%, rgba(10,22,16,.62) 72%, rgba(6,14,10,.88) 100%);
}
#ov-win[data-mat="marble"] .panel,
#ov-win[data-mat="marble"] .panel.win-hot,
#ov-win[data-mat="marble"] .panel.again {
  background: linear-gradient(#24352c, #121a16);
  border-color: #c4a056;
}
#ov-win[data-mat="marble"] .win-shout,
#ov-win[data-mat="marble"] #win-tier { color: #f2c463; text-shadow: none; }
#ov-win[data-mat="marble"] .haul b { color: #ffe08a; }
#ov-win[data-mat="marble"] .linky { color: #b42f23; }

#ov-win[data-mat="iron"] {
  background: linear-gradient(to bottom,
              rgba(8,10,14,0) 0%, rgba(8,10,14,.16) 34%, rgba(10,12,18,.62) 72%, rgba(6,8,12,.88) 100%);
}
#ov-win[data-mat="iron"] .panel,
#ov-win[data-mat="iron"] .panel.win-hot,
#ov-win[data-mat="iron"] .panel.again {
  background: linear-gradient(#3a3834, #1a1814);
  border-color: #c4a056;
}
#ov-win[data-mat="iron"] .win-shout,
#ov-win[data-mat="iron"] #win-tier { color: #f2c463; text-shadow: none; }
#ov-win[data-mat="iron"] .haul b { color: #ffe08a; }
#ov-win[data-mat="iron"] .linky { color: #b42f23; }
#ov-win .haul[hidden], #ov-win .win-break[hidden], #ov-win .win-streak[hidden],
#ov-win .win-again[hidden], #ov-win .win-medals[hidden] {
  display: none !important;
}
.win-break {
  list-style: none; margin: 0 auto 12px; padding: 0;
  max-width: 360px; color: #5c3a24; font-weight: 700;
  font-size: clamp(18px, 4.6vw, 26px);
  line-height: 1.2;
  width: 100%;
}
.win-break li {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px;
  margin: 5px 0;
  padding: 7px 14px;
  border-radius: 14px;
  background: rgba(244, 240, 216, .08);
  border: 2px solid #e0a24a;
  letter-spacing: .02em;
  color: #e4dcb8;
}
.win-break b {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #5c3a24;
  font-family: var(--display);
  font-size: 1.08em;
  letter-spacing: .02em;
  flex: 0 0 auto;
}
.win-break .coin-sm {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}
.win-break li.minus b { color: #9a4030; }
.win-break li.plus b { color: #5c3a24; }
#ov-win[data-mat] .win-break { color: #5c3a24; }
#ov-win[data-mat] .win-break b { color: #5c3a24; }
#ov-win[data-mat] .win-break li.minus b { color: #9a4030; }
#ov-win .win-medals,
#ov-win[data-mat] .win-medals {
  color: #e4dcb8;
  background: rgba(244, 240, 216, .08);
  border: 1px solid #e0a24a;
}
.win-medals {
  margin: 0 auto 8px;
  padding: 8px 14px;
  width: fit-content;
  border-radius: 999px;
  background: #fff8ef;
  border: 1px solid #e2b56a;
  color: #5c3a24;
  font-size: 15px;
  font-weight: 600;
}
.win-streak {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: clamp(18px, 5vw, 26px);
  font-weight: 700;
  letter-spacing: .08em;
  color: #f4f0d8;
  text-shadow: none;
}
#ov-win .panel h2 { color: #f4f0d8; text-shadow: none; }
#ov-win .remark { color: #e4dcb8; }
#ov-win .teach { color: #f2c463; }
#ov-win .score dt { color: #e4dcb8; }
#ov-win .score dd { color: #f4f0d8; }
.win-shout {
  position: relative;
  z-index: 1;
  margin: 4px 0 8px;
  font-family: var(--display);
  font-size: clamp(34px, 9vw, 52px);
  font-weight: 700;
  letter-spacing: .04em;
  color: #f2c463;
  text-shadow: none;
}
/* the payout */
.purse {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 6px 0 8px;
}
/* the whole reward, in two things you can read across the room */
.haul {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin: 4px 0 14px;
}
.haul .coin { width: 56px; height: 56px; min-width: 56px; min-height: 56px; flex: 0 0 auto; }
.haul b {
  font-family: var(--display);
  font-size: clamp(44px, 12vw, 64px);
  font-weight: 700;
  line-height: .9;
  color: #7a4e16;
  text-shadow: none;
  transform-origin: left center;
  transition: transform .18s ease;
}
#ov-intro .panel { width: min(400px, 100%); padding: 28px 24px 24px; }
#ov-unlock {
  z-index: 70;
  background: rgba(10, 16, 24, .72);
}
#ov-unlock .panel {
  width: min(420px, 100%);
  padding: 28px 24px 24px;
  border-radius: 22px;
  background: linear-gradient(180deg, #244438 0%, #163028 100%);
  border: 3px solid #c9b48a;
  color: #f4f0d8;
  box-shadow:
    inset 0 0 0 2px rgba(244, 240, 216, .18),
    0 8px 0 #0c1612,
    0 18px 36px rgba(12, 22, 18, .45);
}
#ov-unlock .win-shout {
  color: #f2c463;
  text-shadow: none;
  font-size: clamp(28px, 7vw, 42px);
}
#ov-unlock .intro-line { color: #f4f0d8; font-size: 18px; }
#ov-unlock .btn { margin-top: 6px; }
#ov-intro .panel.speed,
#ov-intro .panel.clever {
  background: linear-gradient(180deg, #fff8ef 0%, #f6e2c4 100%);
  border: 3px solid #b42f23;
}
#ov-intro .panel.linen { background: linear-gradient(#f2ede4, #d4a49a 62%, #963d3a); border-color: #6e1e1e; }
#ov-intro .panel.marble { background: linear-gradient(#eceae4, #c8c4ba 62%, #9a968c); border-color: #6e6a62; }
#ov-intro .panel.porcelain { background: linear-gradient(#e8eef8, #9ab0d4 62%, #5a78b0); border-color: #3d5a8a; }
#ov-intro .panel.wood { background: linear-gradient(#f0d7a8, #c99658 62%, #8a5520); border-color: #6a3c14; }
#ov-intro .panel.lock { background: linear-gradient(#d8d4cc, #8a8680 62%, #3a3834); border-color: #2a2824; }
#ov-intro .panel.lock .win-shout { color: #1a1814; text-shadow: none; }
#ov-intro .panel.lock .intro-line { color: #222018; }
#ov-intro .win-shout { color: #4a2205; font-size: clamp(30px, 8.5vw, 46px); text-shadow: none; }
#ov-intro .panel.marble .win-shout,
#ov-intro .panel.porcelain .win-shout,
#ov-intro .panel.linen .win-shout { color: #1e2430; text-shadow: none; }
#ov-intro .panel.marble .intro-line,
#ov-intro .panel.porcelain .intro-line,
#ov-intro .panel.linen .intro-line { color: #2a3140; }
.intro-line { margin: 2px 0 18px; font-size: 16.5px; color: #5c300d; font-weight: 600; }
.intro-badge {
  display: flex; align-items: baseline; justify-content: center; gap: 9px;
  margin: 0 auto 22px; padding: 10px 22px;
  width: fit-content;
  border-radius: 14px;
  background: rgba(16, 24, 34, .82);
}
.intro-badge[hidden] { display: none; }
.intro-badge b { font-family: var(--display); font-size: 42px; font-weight: 700; color: #ffd98a; line-height: 1; }
.intro-badge i { font-style: normal; font-size: 14px; letter-spacing: .14em; text-transform: uppercase; color: #d3ab6f; }

#win-fork { margin: 2px 0 8px; }
#win-fork-note {
  margin: 0 0 12px;
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.35;
  color: #e4dcb8;
}
#win-fork .btn { width: 100%; margin-top: 8px; }
/* Start, See the boards, Next Board, and the easy/hard choices share the
   pine plaque. Size stays large; the face comes from .btn. */
#ov-win .btn-lg,
#intro-go,
#chapter-go,
#app[data-material] #ov-win .btn-lg,
#app[data-material] #intro-go,
#app[data-material] #chapter-go {
  margin-top: 2px;
  min-width: 220px;
  color: var(--btn-ink);
  background: var(--btn-face);
  background-size: cover;
  border-color: var(--btn-edge, rgba(90, 58, 28, .22));
  text-shadow: none;
  box-shadow: 0 5px 0 rgba(48, 24, 8, .42), 0 8px 12px rgba(0, 0, 0, .22);
}
#ov-win .btn-lg:hover,
#intro-go:hover,
#chapter-go:hover {
  color: var(--btn-ink);
  background: var(--btn-face);
  background-size: cover;
  filter: brightness(1.04);
}
#ov-win .btn-lg:active,
#intro-go:active,
#chapter-go:active {
  color: var(--btn-ink);
  background: var(--btn-face);
  background-size: cover;
  filter: brightness(0.78);
}
.win-more { display: flex; justify-content: center; gap: 22px; margin-top: 14px; }
.linky {
  border: 0; background: none; cursor: pointer;
  font: 600 16px var(--ui);
  color: #f3dfb8;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 6px 4px;
}
.linky:hover { color: #fff6e4; }
.purse b {
  font-family: var(--display); font-size: 48px; font-weight: 700; color: #7a4a10;
  text-shadow: none;
}
.purse i { font-style: normal; font-size: 14px; letter-spacing: .14em; text-transform: uppercase; color: #96703c; align-self: flex-end; margin-bottom: 10px; }
.coin, .coin-sm, .fly-coin, .btn .coin-in {
  position: relative;
  display: inline-block;
  border-radius: 50%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cdefs%3E%3CradialGradient id='g' cx='34%25' cy='30%25' r='72%25'%3E%3Cstop offset='0%25' stop-color='%23fff6d2'/%3E%3Cstop offset='40%25' stop-color='%23f0c14b'/%3E%3Cstop offset='100%25' stop-color='%23b86b18'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='32' cy='32' r='31' fill='%236e4510'/%3E%3Ccircle cx='32' cy='32' r='27.5' fill='url(%23g)' stroke='%237a4a12' stroke-width='1.4'/%3E%3Ccircle cx='32' cy='32' r='23' fill='none' stroke='%236e4510' stroke-width='3' stroke-dasharray='1.6 2.4'/%3E%3Ccircle cx='32' cy='32' r='12' fill='none' stroke='%236e4510' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
  box-shadow: 0 1px 2px rgba(0,0,0,.28);
}
.coin::before, .coin-sm::before, .fly-coin::before, .btn .coin-in::before,
.coin::after, .coin-sm::after, .fly-coin::after, .btn .coin-in::after {
  content: none;
}
.coin { width: 48px; height: 48px; }
.coin-sm { width: 17px; height: 17px; }

#coin-fx {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 80;
  overflow: hidden;
}
.fly-coin {
  position: absolute;
  left: 0; top: 0;
  width: 38px; height: 38px;
  margin: -19px 0 0 -19px;
  will-change: transform;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.4));
}
.fly-coin .wake { display: none; }
.coin-got {
  position: absolute;
  left: 50%;
  top: -8px;
  transform: translate(-50%, -100%);
  font-family: var(--display);
  font-size: 22px;
  font-weight: 800;
  color: #ffe08a;
  text-shadow: 0 2px 0 #5a2a08, 0 0 12px rgba(0,0,0,.55);
  pointer-events: none;
  animation: got-float 1.35s ease-out both;
  z-index: 5;
  white-space: nowrap;
}
@keyframes got-float {
  0% { opacity: 0; transform: translate(-50%, -40%); }
  18% { opacity: 1; transform: translate(-50%, -100%); }
  70% { opacity: 1; transform: translate(-50%, -140%); }
  100% { opacity: 0; transform: translate(-50%, -170%); }
}
.chip.purse.coin-pop { animation: coin-pop .22s ease; }
@keyframes coin-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.16); }
  100% { transform: scale(1); }
}

/* a coin sitting inside a button label, so a price never reads as a bare
   number - "PEEK 10" tells a ten-year-old nothing about what the 10 is */
.btn .coin-in {
  vertical-align: -2px; margin: 0 3px 0 5px;
  width: 16px; height: 16px;
  /* A gold coin on a pale button is gold on pale, so it needs an edge to sit
     against. Dark ring first for light buttons, a pale halo outside that for
     dark ones - between them it reads on every material's furniture. */
  box-shadow:
    inset 0 0 0 1px rgba(70, 38, 6, .7),
    inset 0 0 0 2px rgba(255, 226, 150, .5),
    inset 0 -2px 3px rgba(70, 38, 6, .45),
    0 0 0 1.6px rgba(58,34,6,.85),
    0 0 0 2.8px rgba(255,248,224,.45);
}
.breakdown {
  list-style: none; margin: 0 0 12px; padding: 0;
  font-size: 13.5px; color: #e4dcb8;
}
.breakdown li { display: flex; justify-content: space-between; max-width: 260px; margin: 0 auto; padding: 2px 0; }
.breakdown li b { color: #f2c463; font-weight: 700; }
#ov-win .panel h2 { margin: 2px 0 8px; font-size: clamp(19px, 5vw, 25px); }
#ov-win .score { gap: 20px; margin-bottom: 14px; flex-wrap: wrap; }
#ov-win .score dd { font-size: 18px; }
#ov-win .panel-actions .btn-lg { font-size: 18px; padding: 13px 22px; order: 0; }
#ov-win .panel-actions .btn-sm { order: 1; }
.overlay.show { display: flex; animation: fade .22s ease backwards; }
/* intro / win / fail sit over the board, not over Boards, Rooms, or Peek */
#ov-intro, #ov-win, #ov-fail, #ov-chapter {
  pointer-events: none;
}
#ov-intro .panel, #ov-win .panel, #ov-fail .panel, #ov-chapter .panel {
  pointer-events: auto;
}
/* nothing in the game is clickable from the moment an ad is asked for
   until it is over (panels set their own pointer-events, hence the reach
   and the !important) */
body.ad-playing #app, body.ad-playing #app *,
body.ad-pending #app, body.ad-pending #app * { pointer-events: none !important; }
.panel {
  width: min(400px, 100%);
  max-height: 100%;
  overflow-y: auto;
  text-align: center;
  padding: 24px 24px 22px;
  border-radius: 16px;
  background: linear-gradient(180deg, #244438 0%, #163028 100%);
  background-size: cover;
  border: 3px solid #c9b48a;
  color: #f4f0d8;
  box-shadow:
    inset 0 0 0 2px rgba(244, 240, 216, .18),
    0 8px 0 #0c1612,
    0 18px 36px rgba(12, 22, 18, .45);
  animation: pop .3s cubic-bezier(.2,1.2,.4,1) backwards;
}
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.panel h2 {
  font-family: var(--display); margin: 4px 0 12px;
  font-size: clamp(22px, 6vw, 30px); letter-spacing: .1em; text-transform: uppercase;
  color: #f4f0d8; text-shadow: none;
}
.kicker { margin: 0; font-size: 14px; letter-spacing: .22em; text-transform: uppercase; color: var(--ember); }
#win-tier {
  font-family: var(--display);
  letter-spacing: .04em;
  text-indent: 0;
  font-size: clamp(40px, 10vw, 64px);
}
#ov-win #win-tier[data-rank="0"],
#ov-win #win-tier[data-rank="1"],
#ov-win #win-tier[data-rank="2"],
#ov-win #win-tier[data-rank="3"],
#ov-win #win-tier[data-rank="again"] { color: #5c3a24; text-shadow: none; }
.teach {
  margin: -6px 0 12px;
  font-size: 15px;
  color: var(--ember);
  letter-spacing: .02em;
}
.remark {
  margin: -4px 0 10px;
  font-size: 13.5px;
  color: var(--cream-dim);
  line-height: 1.4;
}

.score { display: flex; justify-content: center; gap: 26px; margin: 0 0 20px; }
.score div { text-align: center; }
.score dt { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--cream-dim); }
.score dd { margin: 3px 0 0; font-family: var(--display); font-size: 21px; color: #f3e2bf; }

.panel-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.panel-actions .btn-sm { align-self: center; }

.help { text-align: left; margin: 0 0 18px; padding-left: 20px; line-height: 1.65; color: #eadcc0; font-size: 15px; }
.help li { margin-bottom: 7px; }
.link {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 16px;
  padding: 8px 16px;
  border: 1px solid rgba(242, 196, 99, .4);
  border-radius: 20px;
  background: rgba(16, 24, 34, .55);
  color: #f2c463;
  font: 600 14px var(--ui);
  cursor: pointer;
}
.link:hover { background: rgba(28, 42, 58, .75); border-color: rgba(242, 196, 99, .7); }
.help b { color: var(--ember); }

/* ---------------------------------------------------------------- layout tweaks */
@media (max-height: 560px) {
  .controls { padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  .topbar { padding: 6px 12px; }
  .stats { font-size: 14px; gap: 12px; }
  .menu { gap: 9px; margin-top: 16px; }
  .sign { padding: 14px 18px 18px; }
  /* the title footer (purse, ad chip, sound) was sliding below the fold on
     450-510px-tall frames; tighten the stack so it stays tappable */
  .title-foot { margin-top: 10px; }
  .title-foot .purse-chip { font-size: 15px; padding: 5px 10px 5px 8px; }
  .menu .btn { padding: 10px 20px; }
  .account { margin-top: 6px; }
}
/* phone landscape and short widescreen frames: stack the chrome either side
   of the board so the tray gets the full height */
@media (orientation: landscape) and (max-height: 600px) and (min-width: 480px) {
  #path-dock { padding: 4px 6px; }
  #path-dock button { padding: 4px 3px 5px; }
  #path-dock button b { font-size: 13px; }
  #path-dock button i { font-size: 12px; }
  #mat-dock { top: 44px; padding: 0 6px 4px; }
  #mat-dock button { padding: 4px 3px; }
  #s-levels.screen { padding-top: 58px; }
  #s-game.screen { padding-top: 58px; }
  #ov-purse.shop-overlay { top: 44px; }
  #ov-achieve.achieve-overlay { top: 44px; }
  /* Title, counters, board, and buttons are siblings. A row with the
     counters at width 100% shoved the board past the right edge. */
  #s-game.screen.show {
    display: grid;
    grid-template-columns: clamp(128px, 22vw, 200px) minmax(0, 1fr) clamp(112px, 18vw, 168px);
    grid-template-rows: auto minmax(0, 1fr);
    align-items: stretch;
  }
  #s-game .hud {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: auto;
    min-width: 0;
    justify-content: flex-end;
    gap: 6px;
    padding: 6px 6px 2px 8px;
  }
  #s-game .hud > :first-child { display: none; }
  #s-game .hud .icon { align-self: flex-start; }
  #s-game .hud-mid { text-align: left; }
  #s-game .hud h2 { text-align: left; white-space: normal; font-size: 17px; }
  #s-game .stats {
    grid-column: 1;
    grid-row: 2;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    margin: 0;
    padding: 4px 6px 8px 8px;
    width: auto;
    min-width: 0;
  }
  #s-game .chip, #s-game #ad-game { max-width: 100%; min-width: 0; width: auto; align-self: center; box-sizing: border-box; padding: 1px 8px 2px; }
  #s-game .chip i, #s-game #ad-game i { font-size: 12px; letter-spacing: .04em; }
  #s-game .chip b, #s-game #ad-game b { font-size: 18px; }
  #s-game .chip.purse .coin-sm, #s-game #ad-game .coin-sm { width: 20px; height: 20px; }
  #s-game .hud-title { padding: 4px 8px 5px; max-width: 100%; }
  #s-game .hud-title h2 { font-size: 14px; white-space: normal; overflow-wrap: anywhere; }
  #s-game .board-wrap { grid-column: 2; grid-row: 1 / span 2; min-width: 0; }
  #s-game .controls {
    grid-column: 3;
    grid-row: 1 / span 2;
    display: flex;
    flex-direction: column;
    width: auto;
    min-width: 0;
    justify-content: center;
    padding: 8px 8px 8px 4px;
    margin: 0;
  }
  /* the buttons must fit the narrow side column - at 800-907px wide they were
     spilling off the right edge of the viewport, unreachable */
  #s-game .controls .btn-sm {
    min-width: 0;
    width: 100%;
    flex: 0 0 auto;
    max-width: none;
    box-sizing: border-box;
    padding: 7px 6px;
    min-height: 36px;
    font-size: 13px;
    letter-spacing: .02em;
    white-space: normal;
    overflow: hidden;
    line-height: 1.15;
  }
  #s-game .board-wrap { padding: 6px 2px; }
  .board-wrap.has-rating { padding-top: 32px; }
  .board-wrap.has-combo { padding-top: 40px; }
  .board-wrap.has-rating.has-combo { padding-top: 68px; }
  .board-rating b { font-size: clamp(12px, 3vw, 16px); padding: 3px 10px 4px; }
  .combo-shout { top: 2px; }
  .combo-shout b { font-size: clamp(14px, 3.6vw, 24px); padding: 4px 10px 5px; }
  #s-game .hud-right { position: static; justify-content: flex-end; }

  /* short and wide: the panel goes beside the board, not on top of it */
  #ov-win {
    align-items: center;
    justify-content: flex-end;
    padding: 10px 12px;
    background: linear-gradient(to right,
                rgba(10,16,24,0) 0%, rgba(10,16,24,.16) 38%, rgba(10,16,24,.72) 70%, rgba(10,16,24,.9) 100%);
  }
  #ov-win[data-mat="linen"] {
    background: linear-gradient(to right,
                rgba(34,12,14,0) 0%, rgba(34,12,14,.16) 38%, rgba(34,12,14,.7) 70%, rgba(28,10,12,.9) 100%);
  }
  #ov-win[data-mat="ceramic"] {
    background: linear-gradient(to right,
                rgba(10,16,36,0) 0%, rgba(10,16,36,.16) 38%, rgba(12,20,48,.7) 70%, rgba(8,14,36,.9) 100%);
  }
  #ov-win[data-mat="marble"] {
    background: linear-gradient(to right,
                rgba(8,16,12,0) 0%, rgba(8,16,12,.16) 38%, rgba(10,22,16,.7) 70%, rgba(6,14,10,.9) 100%);
  }
  #ov-win .panel { width: min(354px, 46vw); padding: 12px 16px 14px; }
  #ov-win .win-break { font-size: clamp(16px, 3.6vw, 22px); max-width: 100%; }
  #ov-win .panel h2 { font-size: 19px; margin: 2px 0 6px; }
  #ov-win .score { gap: 14px; margin-bottom: 10px; }
  #ov-win .score dd { font-size: 16px; }
  #ov-win .panel-actions { flex-direction: column; gap: 8px; }
  #ov-win .panel-actions .btn-lg { width: 100%; }
  #s-game.celebrate .board-wrap { transform: translateX(-16%) scale(.84); }
}

@media (max-width: 719px) {
  /* Six across a phone left 8px names. Three across keeps each row of six
     as two rows, and the names at a size you can read. */
  .grid.locks-shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .locks-shelf .card { aspect-ratio: 1 / 1.3; }
}
@media (min-width: 720px) {
  .grid {
    gap: 18px;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    /* six across, so 6/12/24-board chapters fill even rows and a leftover
       never sits alone in the middle of the shelf */
    max-width: 1140px;
  }
  .scroll { padding: 4px 26px 30px; }
}
/* short screens: the win panel and the help sheet have to leave the board and
   their own buttons visible */
@media (max-height: 560px) {
  #ov-win .panel { padding: 10px 16px 12px; }
  #ov-win .panel h2 { font-size: 18px; margin: 2px 0 6px; }
  #ov-win .kicker { font-size: 13px; }
  #ov-win .score { gap: 14px; margin-bottom: 9px; }
  #ov-win .score dd { font-size: 15px; }
  #ov-win .score dt { font-size: 14px; }
  .help { font-size: 13px; line-height: 1.45; margin-bottom: 12px; }
  .panel h2 { font-size: 20px; margin-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .screen.fade, .overlay.show, .panel { animation: none; }
  .loader .mark { animation-duration: 3s; }
}

/* narrow phones: drop the grid size and tighten the stats so the clock never
   slides under the buttons on the right */
@media (max-width: 430px) {
  #ov-win .panel-actions { flex-direction: column; align-items: stretch; }
  #ov-win .panel-actions .btn-lg { width: 100%; }
  #ov-win .panel-actions .btn-sm { align-self: center; }
}

/* The rotate bar sits on top of the screen. Leave it room so Finish row
   and Restart stay above it on a tall phone. */
@media (orientation: portrait) and (max-width: 899px) {
  #s-game.screen { padding-bottom: 56px; }
}

@media (max-width: 420px) {
  .topbar { gap: 6px; padding: 8px 8px; }
  .hud-mid { overflow: hidden; }
  .stats { gap: 10px; font-size: 14px; }
}


/* ---- the rare one -------------------------------------------------------
   Teleport is the marquee move, so it wants to catch the eye - but it must not
   do that by being a different colour from the other priced buttons, because
   then the colour reads as "this one costs coins" and Peek, which also costs
   coins, looks free. So it keeps the same face as its neighbours and is set
   apart by a lit edge and a shine that crosses it now and then. */
.btn.rare {
  border-color: rgba(255, 206, 128, .5);
  box-shadow: 0 0 0 1px rgba(255, 198, 112, .3) inset,
              0 5px 0 var(--btn-edge),
              0 10px 20px var(--shadow),
              0 0 18px rgba(255, 168, 68, .22);
  position: relative;
  overflow: hidden;
}
.btn.rare { outline: 2px solid rgba(255, 206, 128, .35); outline-offset: -4px; border-radius: 10px; }
.btn.rare::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 235, 190, .38) 50%, transparent 62%);
  transform: translateX(-120%);
  animation: rare-shine 5.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes rare-shine {
  0%, 72% { transform: translateX(-120%); }
  86%, 100% { transform: translateX(120%); }
}
@media (prefers-reduced-motion: reduce) {
  .btn.rare::after { animation: none; opacity: 0; }
}

/* ---- watching an ad for coins ------------------------------------------- */
.btn.getcoins {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; margin-top: 4px;
}
.btn.getcoins .price { color: var(--gold, #ffcf6a); }
.btn.getcoins[disabled] { opacity: .55; }

.win-again {
  margin: 4px 0 14px;
  font-size: 18px;
  font-weight: 700;
  color: #e4dcb8;
  letter-spacing: .01em;
  line-height: 1.35;
}
.win-medals {
  position: relative;
  z-index: 1;
  margin: 0 0 8px;
  padding: 6px 16px;
  display: inline-block;
  border-radius: 18px;
  background: rgba(255,255,255,.35);
  letter-spacing: .01em;
  color: #8a5520;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
}

/* the teleport button while it waits for a piece to be picked */
.btn.rare.armed {
  background-image: linear-gradient(180deg, #6d4a24 0%, #513417 52%, #3d2410 100%);
  border-color: rgba(255, 226, 156, .75);
  box-shadow: 0 0 0 2px rgba(255, 214, 130, .45) inset,
              0 3px 0 rgba(40, 22, 8, .8),
              0 0 22px rgba(255, 186, 78, .4);
  animation: armed-breathe 1.4s ease-in-out infinite;
}
.btn.rare.armed::after { animation: none; opacity: 0; }
@keyframes armed-breathe {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255, 214, 130, .45) inset,
                         0 3px 0 rgba(40, 22, 8, .8), 0 0 14px rgba(255, 186, 78, .28); }
  50%      { box-shadow: 0 0 0 2px rgba(255, 232, 176, .7) inset,
                         0 3px 0 rgba(40, 22, 8, .8), 0 0 28px rgba(255, 196, 96, .55); }
}
@media (prefers-reduced-motion: reduce) {
  .btn.rare.armed { animation: none; }
  .win-burst, .coin-got { animation: none; }
  #ov-win .panel { animation: none; }
}


/* ---- the boards are not all made of wood ---------------------------------
   A timed board is etched metal and a move-limited one is painted porcelain,
   and the furniture round them changes to match: brass buttons over gunmetal,
   or porcelain buttons lettered in cobalt. Nothing tells the player which kind
   of board they are on except the way it looks, which is the point - you can
   see what you are in for from across the room. */

#app[data-material="metal"],
#app[data-material="iron"] {
  --panel-face: var(--wood-panel);
  --cream: #eef3fb;
  --cream-dim: #b9c6d8;
  --ember: #f0c250;
  --shadow: rgba(4, 6, 10, 0.62);
  --wood-panel: linear-gradient(#2a3038, #161a20);
  --btn-face: linear-gradient(#eccc72, #b08a2a);
  --btn-edge: #6a5011;
  --btn-ink: #2c2104;
  --btn-shine: rgba(255,246,205,.6);
  --btn-lip: rgba(255,244,196,.55);
}
#app[data-material="metal"] .icon,
#app[data-material="iron"] .icon {
  background: rgba(46, 52, 62, .92);
  border-color: rgba(214, 178, 84, .45);
  color: #f0d9a0;
}
#app[data-material="metal"] .icon:hover,
#app[data-material="iron"] .icon:hover {
  background: rgba(64, 72, 84, .95);
  border-color: rgba(240, 202, 108, .7);
}
#app[data-material="metal"] .chip,
#app[data-material="iron"] .chip {
  background: #161410;
  border-color: rgba(206, 170, 84, .45);
}
#app[data-material="metal"] .hud-title,
#app[data-material="iron"] .hud-title {
  background: #161410;
  border-color: rgba(206, 170, 84, .4);
}

#app[data-material="ceramic"] {
  --panel-face: var(--wood-panel);
  --cream: #eaf1ff;
  --cream-dim: #b5c4e0;
  --ember: #6f9be8;
  --shadow: rgba(6, 10, 26, 0.6);
  --wood-panel: linear-gradient(#2b3450, #161c2e);
  --btn-face: var(--ceramic-btn, linear-gradient(#f2f6fd, #c3d0e6));
  --btn-edge: #6b7c9c;
  --btn-ink: #1d3f8c;
  --btn-shine: rgba(255,255,255,.85);
  --btn-lip: rgba(255,255,255,.9);
}
#app[data-material="ceramic"] .btn { text-shadow: 0 1px 0 rgba(255,255,255,.85); }
#app[data-material="ceramic"] .icon {
  background: rgba(40, 50, 76, .92);
  border-color: rgba(150, 180, 235, .42);
  color: #d3e0f8;
}
#app[data-material="ceramic"] .icon:hover {
  background: rgba(56, 68, 100, .95);
  border-color: rgba(170, 200, 250, .68);
}
#app[data-material="ceramic"] .chip {
  background: #151c30;
  border-color: rgba(150, 180, 235, .4);
}
#app[data-material="ceramic"] .hud-title {
  background: #151c30;
  border-color: rgba(150, 180, 235, .4);
}

/* the teleport keeps its own warmth on wood, but on the other boards it takes
   the material's brightest finish so it still reads as the rare one */
#app[data-material="metal"] .btn.rare,
#app[data-material="iron"] .btn.rare { border-color: rgba(255, 226, 160, .75); }
#app[data-material="ceramic"] .btn.rare { border-color: rgba(120, 160, 235, .8); }


#app[data-material="plastic"] {
  --panel-face: var(--wood-panel);
  --cream: #fff4dd;
  --cream-dim: #d9c9a8;
  --ember: #ffc24a;
  --shadow: rgba(3, 6, 16, 0.55);
  --wood-panel: linear-gradient(#233056, #131a30);
  --btn-face: linear-gradient(#ffd24f, #e8971c);
  --btn-edge: #9a5f0c;
  --btn-ink: #402203;
  --btn-shine: rgba(255,240,200,.75);
  --btn-lip: rgba(255,246,214,.8);
}
#app[data-material="plastic"] .icon {
  background: rgba(30, 44, 82, .92);
  border-color: rgba(255, 200, 90, .45);
  color: #ffe0a0;
}
#app[data-material="plastic"] .icon:hover {
  background: rgba(44, 62, 110, .95);
  border-color: rgba(255, 214, 120, .72);
}
#app[data-material="plastic"] .chip { border-color: rgba(255, 200, 90, .3); }
#app[data-material="plastic"] .btn.rare { border-color: rgba(255, 236, 180, .8); }


/* ---- carved marble: white panels in a dark green stone frame ---- */
#app[data-material="marble"] {
  --panel-face: var(--wood-panel);
  --cream: #eef6f1;
  --cream-dim: #b5c9bd;
  --ember: #8fd9ae;
  --shadow: rgba(4, 12, 9, 0.6);
  --wood-panel: linear-gradient(#25352d, #131d18);
  --btn-face: var(--marble-btn, linear-gradient(#f2f6f3, #c3cfc7));
  --btn-edge: #5d6f64;
  --btn-ink: #1d3329;
  --btn-shine: rgba(255,255,255,.85);
  --btn-lip: rgba(255,255,255,.9);
}
#app[data-material="marble"] .btn { text-shadow: 0 1px 0 rgba(255,255,255,.8); }
#app[data-material="marble"] .icon {
  background: rgba(32, 50, 42, .92);
  border-color: rgba(150, 210, 178, .42);
  color: #d6ece0;
}
#app[data-material="marble"] .icon:hover {
  background: rgba(46, 70, 58, .95);
  border-color: rgba(170, 230, 196, .7);
}
#app[data-material="marble"] .chip {
  background: #121a16;
  border-color: rgba(150, 210, 178, .4);
}
#app[data-material="marble"] .hud-title {
  background: #121a16;
  border-color: rgba(150, 210, 178, .4);
}
#app[data-material="marble"] .btn.rare { border-color: rgba(140, 220, 180, .8); }

/* ---- woven linen: cool oatmeal cloth, madder-red dye, not another wood ---- */
#app[data-material="linen"] {
  --panel-face: var(--wood-panel);
  --cream: #eef0e8;
  --cream-dim: #b4b8ae;
  --ember: #d0645a;
  --shadow: rgba(22, 8, 8, 0.58);
  --wood-panel: linear-gradient(#561c1e, #2c1012);
  --btn-face: var(--linen-btn, linear-gradient(#f2f1e6, #c8cbb8));
  --btn-edge: #7a3a34;
  --btn-ink: #7a1616;
  --btn-shine: rgba(255,255,250,.9);
  --btn-lip: rgba(255,255,252,.85);
}
#app[data-material="linen"] .btn { text-shadow: 0 1px 0 rgba(255,255,250,.8); }
#app[data-material="linen"] .icon {
  background: rgba(72, 28, 30, .92);
  border-color: rgba(230, 156, 140, .45);
  color: #f8dcd4;
}
#app[data-material="linen"] .icon:hover {
  background: rgba(100, 40, 40, .95);
  border-color: rgba(245, 180, 166, .7);
}
#app[data-material="linen"] .chip {
  background: #21161a;
  border-color: rgba(230, 156, 140, .4);
}
#app[data-material="linen"] .hud-title {
  background: #21161a;
  border-color: rgba(230, 156, 140, .4);
}
#app[data-material="linen"] .btn.rare { border-color: rgba(230, 130, 110, .85); }


/* ---- fixes from the tester pass ---------------------------------------- */

/* A panel taller than the screen scrolled, but nothing said so and the close
   button was simply off the bottom. The actions now ride along at the foot of
   the panel wherever you are in it. */
.panel-actions {
  position: sticky;
  bottom: -2px;
  padding: 14px 0 8px;
  margin-top: 10px;
  z-index: 2;
}
/* Only a panel that really scrolls (.scrolls, set in ui.js) gets the solid
   footer bar and its fade: mid-scroll it reads as a footer rather than as
   buttons floating over the text. On a panel that fits, a dark bar with a
   shadow over the last line made a light card look blurred. */
.panel.scrolls .panel-actions {
  background: #163028;
  box-shadow: 0 -10px 16px -4px rgba(12, 22, 18, .95);
}
#app[data-material="ceramic"] .panel.scrolls .panel-actions { background: #161c2e; }
#app[data-material="marble"] .panel.scrolls .panel-actions { background: #131d18; }
#app[data-material="linen"] .panel.scrolls .panel-actions { background: #163028; }
.panel { scrollbar-width: thin; overscroll-behavior: contain; }
/* a soft fade riding above the footer bar, so cut-off content visibly
   continues instead of ending mid-sentence */
.panel.scrolls .panel-actions::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: -26px;
  height: 26px;
  background: linear-gradient(rgba(22, 48, 40, 0), rgba(22, 48, 40, .85));
  pointer-events: none;
}

/* a signed-in account chip is a label, not a button */
.account:disabled { cursor: default; opacity: 1; }
.account:disabled:hover { background: rgba(22, 32, 44, .92); border-color: #ffc107; }

/* the headline number was dark brown on a dark panel */
#purse-total { color: var(--ember); text-shadow: 0 1px 0 rgba(30,16,4,.7); }

/* the ad button's three text nodes were each becoming a flex item */
.btn.getcoins > span:not(.tv) { display: inline; }

/* long board names were being cut off in the header, which is now the only
   place a board is named at all */
.hud h2 {
  min-width: 0;
  overflow: visible;
  white-space: normal;
  font-size: clamp(16px, 4.2vw, 26px);
  line-height: 1.15;
}

/* the coach must never sit over a panel */
.overlay.show ~ #coach, #coach.hushed { display: none !important; }


/* Phone: two even columns. */
@media (max-width: 720px) {
  .controls {
    gap: 8px;
    padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  }
  .controls .btn-sm {
    flex-basis: calc(50% - 6px);
    max-width: calc(50% - 6px);
    font-size: 15px;
    padding: 9px 6px;
    min-height: 48px;
    letter-spacing: .05em;
  }
  .btn .coin-in { margin: 0 2px 0 4px; width: 14px; height: 14px; }
}


/* the board's name, with what it is made of underneath it */
.hud-title h2 { margin: 0; }
#g-material {
  margin: 1px 0 0;
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #d4c49a;
  opacity: 1;
}
@media (max-width: 480px) { #g-material { font-size: 13px; letter-spacing: .1em; } }

/* wood keeps the pine plaque. Other materials use --btn-face from their theme. */
.btn:hover {
  background: var(--btn-face);
  background-size: cover;
  filter: brightness(1.04);
}
.btn:active, .btn.held, .btn.is-press {
  transform: translateY(5px) scale(0.96);
  filter: brightness(0.78);
  box-shadow: inset 0 6px 12px rgba(20, 8, 2, .5), 0 0 0 rgba(0, 0, 0, 0);
  background: var(--btn-face);
  background-size: cover;
}
.btn.rare::after { display: none; }

/* overlay type sits on a painted panel — a drop shadow or highlight lip
   reads as shading on the letters */
.win-shout, .panel h2, #ov-win .panel h2, #ov-fail .panel h2, #ov-buy .panel h2,
#ov-intro .win-shout, .haul b, .win-streak, .purse b,
#ov-win[data-mat] .win-shout, #ov-win[data-mat] #win-tier, #ov-win[data-mat] .haul b {
  text-shadow: none;
}

/* Celadon paper for the counters and the board name, on every material.
   The puzzle keeps its own cloth, wood, porcelain, or stone. */
#app .hud-title,
#app[data-material] .hud-title {
  background: linear-gradient(#f3faf6, #c5dfd2);
  border: 2px solid #246b56;
  box-shadow: 0 3px 0 #1a4034;
}
#app .hud-title h2,
#app[data-material] .hud-title h2 { color: #163028; }
#g-material { color: #245544; }

#app .chip,
#app[data-material] .chip,
#app .chip.moves,
#app[data-material] .chip.moves,
#app .chip.time,
#app[data-material] .chip.time,
#app .chip.purse,
#app[data-material] .chip.purse,
#ad-game.adchip {
  background: linear-gradient(#f3faf6, #c5dfd2);
  border: 2px solid #246b56;
  box-shadow: 0 3px 0 #1a4034;
  color: #163028;
}
#app .chip i,
#app .chip.moves i,
#app .chip.time i,
#app .chip.purse i,
#ad-game.adchip i { color: #245544; }
#app .chip b,
#app .chip.moves b,
#app .chip.time b { color: #163028; }
#app .chip.purse b,
#ad-game.adchip b { color: #163028; }

/* Chalkboard, gallery look 23, on every material. */
#ov-win .panel,
#ov-win[data-mat] .panel,
#ov-win[data-mat] .panel.win-hot,
#ov-win[data-mat] .panel.again {
  background: linear-gradient(180deg, #244438 0%, #163028 100%);
  border: 3px solid #c9b48a;
  color: #f4f0d8;
  box-shadow:
    inset 0 0 0 2px rgba(244, 240, 216, .18),
    0 8px 0 #0c1612,
    0 18px 36px rgba(12, 22, 18, .45);
}
#ov-win .linky,
#ov-win[data-mat] .linky { color: #f2c463; }
#ov-win .linky:hover,
#ov-win[data-mat] .linky:hover { color: #ffe08a; }
#ov-win .win-break,
#ov-win[data-mat] .win-break,
#ov-win .win-break b,
#ov-win[data-mat] .win-break b,
#ov-win .win-break li.plus b,
#ov-win .win-break li.minus b,
#ov-win[data-mat] .win-break li.minus b { color: #e4dcb8; }
#ov-win .haul b,
#ov-win[data-mat] .haul b { color: #ffe08a; }
#ov-win #win-tier,
#ov-win[data-mat] #win-tier,
#ov-win #win-tier[data-rank="0"],
#ov-win #win-tier[data-rank="1"],
#ov-win #win-tier[data-rank="2"],
#ov-win #win-tier[data-rank="3"],
#ov-win #win-tier[data-rank="again"],
#ov-win[data-mat] #win-tier[data-rank="0"],
#ov-win[data-mat] #win-tier[data-rank="1"],
#ov-win[data-mat] #win-tier[data-rank="2"],
#ov-win[data-mat] #win-tier[data-rank="3"],
#ov-win[data-mat] #win-tier[data-rank="again"],
#ov-win .win-streak { color: #f4f0d8; }
#ov-win .win-again,
#win-fork-note { color: #e4dcb8; }
#s-levels .topbar h2 {
  color: #eef4fa;
  text-shadow: none;
}

/* --------------------------------------------------------- achievements */
#ov-achieve.achieve-overlay {
  top: 58px;
  padding: 0;
  align-items: stretch;
  justify-content: flex-start;
  flex-direction: column;
  isolation: isolate;
  background:
    radial-gradient(ellipse 100% 58% at 50% -12%, rgba(140, 170, 200, .34), transparent 64%),
    linear-gradient(180deg, transparent 0 34%, rgba(190, 210, 230, .4) 50%, transparent 66%),
    linear-gradient(180deg, #2a3848 0%, #161e28 100%);
  z-index: 20;
}
#ov-achieve.achieve-overlay::before {
  content: none;
}
.achieve-hud,
.achieve-scroll { position: relative; z-index: 1; }
.achieve-hud {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 8px;
  flex: 0 0 auto;
}
.achieve-hud-balance { width: 92px; }
.achieve-plaque {
  width: min(440px, 100%);
  margin: 0 auto;
  padding: 8px 18px 12px;
  text-align: center;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(0, 0, 0, .18));
  border: 1px solid rgba(190, 210, 230, .55);
  box-shadow: none;
}
.achieve-plaque .kicker {
  margin: 0;
  color: rgba(238, 244, 250, .75);
  font-size: 12px;
  letter-spacing: .22em;
}
.achieve-plaque h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: .06em;
  text-transform: none;
  color: #eef4fa;
  text-shadow: none;
}
#achieve-count {
  margin: 1px 0 8px;
  color: #eef4fa;
  font-family: var(--display);
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: 13px;
}
.achieve-meter {
  height: 9px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, .28);
  border: 0;
  box-shadow: none;
}
#achieve-meter-bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: rgba(190, 210, 230, .9);
}
.achieve-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 4px 14px 28px;
}
/* The list is the achievements engine's markup (LGAchievements.fillList,
   shared with the site's other games): h3.lgach-group, then ul.lgach-list of
   li.lgach-item (is-on / is-off) holding .lgach-plate and .lgach-words. It
   wears this game's page here. */
#achieve-list {
  max-width: 1100px;
  margin: 0 auto;
}
#achieve-list .lgach-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
#achieve-list .lgach-group {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #eef4fa;
}
#achieve-list .lgach-group small {
  order: 2;
  font-size: 12px;
  letter-spacing: .08em;
  color: #f2c463;
}
#achieve-list .lgach-group::before,
#achieve-list .lgach-group::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(190, 210, 230, .55) 20%, rgba(190, 210, 230, .55) 80%, transparent);
}
#achieve-list .lgach-group::after { order: 3; }
#achieve-list .lgach-item {
  position: relative;
  display: grid;
  grid-template-columns: 64px 1fr;
  column-gap: 10px;
  align-items: center;
  padding: 12px 12px 14px;
  border-radius: 14px;
  min-height: 92px;
}
#achieve-list .lgach-item.is-off {
  background:
    linear-gradient(180deg, rgba(190, 214, 232, .10), transparent 46%),
    linear-gradient(180deg, #3a4c60 0%, #1c2836 100%);
  border: 1px solid rgba(168, 196, 220, .42);
  color: #c5d4e4;
  box-shadow:
    inset 0 1px 0 rgba(210, 226, 240, .16),
    inset 0 -10px 16px rgba(0, 0, 0, .32);
}
#achieve-list .lgach-item.is-off::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 10px;
  border: 1px solid rgba(168, 198, 222, .16);
  pointer-events: none;
}
#achieve-list .lgach-item.is-off h3 { color: #e4eef6; }
#achieve-list .lgach-item.is-off .lgach-plate {
  filter: grayscale(1);
  opacity: .55;
  background: #121a24;
  box-shadow: inset 0 0 0 2px rgba(168, 198, 222, .34);
}
#achieve-list .lgach-item.is-on {
  /* Celadon paper, kin to the dock and the green card, on the indigo page. */
  background: linear-gradient(180deg, #f3faf6 0%, #c5dfd2 100%);
  border: 2px solid #246b56;
  color: #163028;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .5),
    0 4px 0 rgba(18, 48, 40, .32),
    0 10px 18px rgba(8, 16, 24, .22);
}
#achieve-list .lgach-item.is-on h3 { color: #163028; }
/* Earned and not yet seen here: a warm glow and a New tag (the engine adds
   is-new and span.lgach-new; it pulses unless motion is reduced). */
#achieve-list .lgach-item.is-new {
  border-color: #e0a24a;
  box-shadow:
    0 0 0 3px rgba(242, 196, 99, .6),
    0 0 22px 6px rgba(242, 196, 99, .55),
    0 4px 0 rgba(18, 48, 40, .32);
  animation: lp-new-glow 1.6s ease-in-out infinite alternate;
}
#achieve-list .lgach-new {
  position: absolute; top: -10px; right: 10px;
  padding: 2px 10px; border-radius: 999px;
  font: 800 13px/1.3 var(--ui); letter-spacing: .04em;
  color: #2b1f12; background: #f2c463; box-shadow: 0 2px 0 #8a5a1e;
}
@keyframes lp-new-glow {
  from { box-shadow: 0 0 0 3px rgba(242, 196, 99, .45), 0 0 10px 2px rgba(242, 196, 99, .3), 0 4px 0 rgba(18, 48, 40, .32); }
  to { box-shadow: 0 0 0 3px rgba(242, 196, 99, .95), 0 0 28px 9px rgba(242, 196, 99, .7), 0 4px 0 rgba(18, 48, 40, .32); }
}
@media (prefers-reduced-motion: reduce) { #achieve-list .lgach-item.is-new { animation: none; } }
#achieve-list .lgach-item.is-on .lgach-plate {
  background: radial-gradient(circle at 38% 32%, #1c4034, #10241c 72%);
  box-shadow:
    inset 0 0 0 2px #8ec4ae,
    0 3px 0 #163028;
}
#achieve-list .lgach-plate {
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #16202c;
  box-shadow: inset 0 0 0 2px rgba(168, 198, 222, .35);
}
#achieve-list .lgach-plate svg { display: block; width: 46px; height: 46px; }
#achieve-list .lgach-words h3 {
  margin: 0 0 2px;
  font-family: var(--display);
  font-size: 16px;
  letter-spacing: .02em;
  text-transform: none;
}
#achieve-list .lgach-words p {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
}
/* where a shared mark was earned, when it was another of the site's games */
#achieve-list .lgach-in {
  display: block;
  margin-top: 4px;
  font-family: var(--display);
  font-size: 12px;
  color: #246b56;
}
/* The lock sits under the sentence, not beside it: a pill in the corner took
   a third of the card and wrapped the text a word to a line. */
#achieve-list .lgach-item.is-off .lgach-words::after {
  content: 'Locked';
  display: inline-block;
  margin-top: 6px;
  padding: 2px 7px 2px 21px;
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #e7f1fa;
  background: rgba(120, 160, 190, .22) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' width='12' height='12'%3E%3Crect x='3' y='7' width='10' height='7' rx='1.5' fill='%23e7f1fa'/%3E%3Cpath d='M5 7V5a3 3 0 016 0v2' fill='none' stroke='%23e7f1fa' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat 6px 50%;
  border: 1px solid rgba(190, 214, 232, .4);
  border-radius: 999px;
}

#ov-achieve-pop.achieve-pop {
  z-index: 90;
  background: rgba(10, 16, 24, .72);
}
#achieve-fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.achieve-toast {
  position: relative;
  z-index: 1;
  width: min(380px, 92vw);
  padding: 16px 22px 18px;
  text-align: center;
  border-radius: 22px;
  background: linear-gradient(180deg, #244438 0%, #163028 100%);
  border: 3px solid #c9b48a;
  box-shadow:
    inset 0 0 0 2px rgba(244, 240, 216, .18),
    0 8px 0 #0c1612,
    0 18px 40px rgba(12, 22, 18, .45);
  color: #f4f0d8;
  animation: achieve-spring .55s cubic-bezier(.2, 1.35, .4, 1) backwards;
}
.paper-crest { line-height: 0; margin: 0 auto 4px; }
.paper-crest svg { display: block; margin: 0 auto; }
.achieve-toast .lgach-kicker {
  margin: 0 0 8px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #f2c463;
  font-family: var(--display);
  font-size: 13px;
}
.achieve-toast h2 {
  margin: 8px 0 6px;
  font-family: var(--display);
  font-size: clamp(22px, 5vw, 28px);
  letter-spacing: .03em;
  text-transform: none;
  color: #f4f0d8;
  text-shadow: none;
}
.achieve-toast .lgach-text {
  margin: 0 0 16px;
  color: #e4dcb8;
  font-size: 16px;
  line-height: 1.35;
}
.achieve-toast .lgach-plate {
  width: 74px;
  height: 74px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #1a3028;
  color: #f4f0d8;
  box-shadow: inset 0 0 0 3px #f2c463, 0 3px 0 rgba(0, 0, 0, .18);
}
.achieve-toast .lgach-plate svg { width: 52px; height: 52px; }
/* a guest on loadsofgames.com: keep the mark with a free account */
.achieve-toast .lgach-keep {
  display: block;
  margin: 12px 0 0;
  padding: 12px 10px;
  min-height: 48px;
  border-radius: 14px;
  border: 2px solid #8ec4ae;
  color: #d8f0e4;
  font-family: var(--display);
  font-size: 16px;
  text-decoration: none;
}
.achieve-toast .lgach-keep:hover { background: rgba(142, 196, 174, .14); }
@keyframes achieve-spring {
  0% { transform: scale(.55) translateY(18px); opacity: 0; }
  55% { transform: scale(1.06) translateY(0); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .achieve-toast { animation: none; }
  .win-glint { animation: none; }
}
@media (max-width: 520px) {
  #path-dock { gap: 4px; padding: 5px 4px 6px; }
  #path-dock button {
    flex: 1 1 auto;
    min-width: min-content;
    padding: 6px 4px 7px;
  }
  #path-dock button b {
    font-size: 12px;
    letter-spacing: .01em;
    white-space: nowrap;
  }
  /* seven tabs: the four board walls on top, then Daily, Rooms, and
     Achievements, still two rows */
  #path-dock button { flex: 1 1 22%; min-width: 0; }
  #path-dock #path-daily, #path-dock #path-rooms, #path-dock #path-achieve { flex-basis: 30%; }
  #s-levels.screen, #s-game.screen { padding-top: 108px; }
  .achieve-hud { grid-template-columns: auto minmax(0, 1fr); padding: 8px 8px 6px; }
  .achieve-hud-balance { display: none; }
  .achieve-plaque { padding: 6px 10px 8px; }
  .achieve-plaque h2 { font-size: 20px; }
  #achieve-count { font-size: 12px; margin-bottom: 6px; }
  #achieve-list .lgach-list { grid-template-columns: 1fr; }
}

/* Chalkboard paper: a faint chalk line inside the pale frame, then the dark lip. */
#ov-win .panel,
#ov-win[data-mat] .panel,
#ov-win[data-mat] .panel.win-hot,
#ov-win[data-mat] .panel.again {
  box-shadow:
    inset 0 0 0 2px rgba(244, 240, 216, .18),
    0 8px 0 #0c1612,
    0 18px 36px rgba(12, 22, 18, .45);
}
#ov-win .panel { padding-top: 12px; }
#ov-win .paper-crest { margin: -2px auto -4px; }
#ov-win .paper-crest svg { width: 64px; height: 24px; }
#ov-win #win-tier { margin: 0; }
#ov-win .haul { margin: 2px 0 8px; }
#win-plate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #f2c463;
}
#win-plate::before,
#win-plate::after {
  content: '';
  width: 22px;
  height: 1px;
  background: #e0a24a;
  flex: 0 0 auto;
}
#ov-win .win-medals {
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal;
}
.win-glint {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #e0a24a;
  pointer-events: none;
  box-shadow: 0 0 6px rgba(224, 162, 74, .85);
  animation: win-twinkle 2.6s ease-in-out infinite;
}
.win-glint.g1 { top: 16px; left: 16px; }
.win-glint.g2 { top: 28px; right: 18px; width: 6px; height: 6px; animation-delay: .7s; }
.win-glint.g3 { bottom: 18px; left: 28px; width: 5px; height: 5px; animation-delay: 1.3s; }
@keyframes win-twinkle {
  0%, 100% { opacity: .35; transform: rotate(45deg) scale(.8); }
  50% { opacity: 1; transform: rotate(45deg) scale(1.15); }
}
@media (orientation: portrait) and (max-width: 899px) {
  #ov-win { padding-bottom: 56px; }
}
@media (max-height: 560px) {
  #ov-win .paper-crest { display: none; }
  #ov-win .win-glint { display: none; }
  #win-plate { font-size: 12px; margin-bottom: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .win-glint { animation: none; opacity: .7; }
}

/* A phone on its side is under 420px tall. The title stack - sign, Play,
   sign-in, purse, and the tabs - was taller than that and the tabs fell off
   the bottom. The sign narrows (and so shortens) and the gaps close up. */
@media (max-height: 460px) {
  #s-title .sign.sign--art { width: min(100%, 300px); margin-inline: auto; }
  #s-title .menu { margin-top: 10px; gap: 6px; }
  #s-title .menu .btn { padding-top: 7px; padding-bottom: 7px; }
  #s-title .account { margin-top: 4px; padding-top: 4px; padding-bottom: 4px; }
  #s-title .title-foot { margin-top: 6px; }
  #app[data-screen="title"] #path-dock { margin-top: 6px; }
}
/* The win card on a phone on its side: the full card was taller than the
   screen and Next board sat below it. Tighter, and it scrolls if it must. */
@media (max-height: 500px) {
  #ov-win { align-items: center; padding: 8px; }
  #ov-win .panel { max-height: 100%; overflow-y: auto; padding: 8px 14px 10px; }
  #ov-win #win-tier { font-size: 34px; line-height: 1.05; }
  #ov-win #win-plate { margin-bottom: 2px; }
  #ov-win .win-medals { margin-bottom: 4px; padding: 4px 12px; font-size: 14px; }
  #ov-win .haul { margin: 0 0 4px; }
  #ov-win .haul b { font-size: 34px; }
  #ov-win .haul .coin { width: 36px; height: 36px; min-width: 36px; min-height: 36px; }
  #ov-win .win-break { font-size: 16px; margin-bottom: 6px; }
  #ov-win .win-break li { margin: 3px 0; padding: 3px 12px; }
  #ov-win .win-break b { font-size: 16px; }
  #ov-win .panel-actions { gap: 4px; }
  #ov-win .panel-actions .btn-lg { padding: 8px 18px; font-size: 16px; }
}

/* A finger needs about 40px. On a touch screen no control is shorter or
   narrower than that (test/ui/compat.js checks it); a mouse keeps the tighter
   sizes above. Last in the file, so it wins over every layout above. */
@media (pointer: coarse) {
  #path-dock button, #mat-dock button, .controls .btn, .controls .btn-sm, #s-game .controls .btn-sm,
  .purse-chip, .account, #ad-game, .shop-room, .sound-btn, .icon,
  .overlay button:not(.shop-spot), .screen button.btn {
    min-height: 40px;
    box-sizing: border-box;
  }
  .icon, .sound-btn { min-width: 40px; }
}

/* An upright phone plays the board as it is held. The rotate bar is gone
   from the board screen (only the rooms ask for the phone on its side), so
   the bar's 56px comes back, and the name, the counters, and the buttons
   pack tighter so the plate gets the height. Buttons stay 40px for a thumb. */
@media (orientation: portrait) and (max-width: 600px) {
  #s-game.screen { padding-bottom: 0; }
  /* the card's gold rim needs air under it, or it reads as cut off */
  #ov-win { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  #s-game .topbar { padding: 4px 8px; gap: 6px; }
  #s-game .hud-title { padding: 2px 12px 3px; border-radius: 12px; }
  #s-game .hud-title h2 { font-size: 17px; letter-spacing: .1em; }
  #s-game #g-material { font-size: 12px; margin: 0; }
  #s-game .stats { padding: 0 8px 2px; gap: 6px; }
  #s-game .chip, #s-game #ad-game {
    flex-direction: row; align-items: center; gap: 6px;
    padding: 3px 10px; min-height: 40px; max-width: none; box-sizing: border-box;
  }
  #s-game .chip b, #s-game #ad-game b { font-size: 20px; }
  /* the coin says it: no word, so the board's difficulty has the room */
  #s-game #g-purse > i { display: none; }
  #s-game .stats .board-rating b { font-size: 14px; letter-spacing: .03em; padding: 3px 10px; }
  #s-game .board-wrap { padding: 4px 6px 6px; }
  #s-game .board-wrap.has-rating { padding-top: 32px; }
  #s-game .controls { margin: 0 auto; padding: 4px 8px calc(8px + env(safe-area-inset-bottom)); gap: 6px; width: calc(100% - 8px); }
  #s-game .controls .btn-sm {
    flex: 1 1 calc(33.33% - 6px); max-width: calc(33.33% - 4px);
    min-height: 40px; padding: 4px 4px; font-size: 14px; line-height: 1.1;
    letter-spacing: .03em; white-space: normal;
  }
}

/* Rooms on a phone on its side: the painting is wide and the screen is
   short, so every pixel of height goes to the painting. The room tabs stand
   in a column on the left, Back and the coins on the right, and the painting
   fills the middle, top to bottom, whole (never cropped). */
@media (orientation: landscape) and (max-height: 500px) {
  /* only while open: a closed overlay must stay display:none */
  #ov-purse.shop-overlay.show {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto auto minmax(0, 1fr);
  }
  #ov-purse .shop-hud { display: contents; }
  #ov-purse .shop-hud > * { pointer-events: auto; }
  /* the right column's backing: a grid item of its own, under the chips */
  #ov-purse.shop-overlay::before {
    content: ''; grid-column: 3; grid-row: 1 / -1;
    background: #2a3848; pointer-events: auto;
  }
  #ov-purse .shop-rooms {
    grid-column: 1; grid-row: 1 / -1; order: 0;
    /* safe: a column taller than the screen starts at the top, not cut off there */
    flex-direction: column; flex-wrap: nowrap; justify-content: flex-start; justify-content: safe center; gap: 4px;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px)) calc(2px + env(safe-area-inset-left, 0px));
    background: #2a3848; overflow-y: auto; scrollbar-width: none;
  }
  /* The painting is the point: a slim dock, and the columns either side
     as narrow as their words allow. */
  #app.shop-open #path-dock { padding: 3px 6px 4px; gap: 5px; }
  #app.shop-open #path-dock button { padding: 3px 3px 4px; border-radius: 8px; }
  #app.shop-open #path-dock button b { font-size: 12px; }
  #app.shop-open #path-dock button i { display: none; }
  #ov-purse .shop-room { font-size: 12px; letter-spacing: .02em; padding: 3px 8px; line-height: 1.2; text-align: center; border-radius: 10px; }
  #ov-purse #shop-stage { grid-column: 2; grid-row: 1 / -1; width: auto; }
  #ov-purse #purse-close, #ov-purse #shop-purse, #ov-purse #purse-ad {
    grid-column: 3; justify-self: stretch; align-self: start; z-index: 1;
    margin: 6px calc(6px + env(safe-area-inset-right, 0px)) 0 6px;
  }
  #ov-purse #shop-furnish { grid-column: 3; grid-row: 2; justify-self: stretch; align-self: start; z-index: 1;
    margin: 6px calc(6px + env(safe-area-inset-right, 0px)) 0 6px; font-size: 13px; padding: 6px 10px; min-height: 40px; }
  #ov-purse #purse-close { grid-row: 1; }
  #ov-purse #shop-purse { grid-row: 3; }
  #ov-purse #purse-ad { grid-row: 4; }
  #ov-purse #purse-close.is-off { display: none; }
  #ov-purse #shop-purse i, #ov-purse #purse-ad i { display: none; }
  #ov-purse #shop-purse, #ov-purse #purse-ad { justify-content: center; padding-left: 8px; padding-right: 10px; }
  #ov-purse #purse-close { min-height: 0; padding: 5px 10px; font-size: 14px; }
  #ov-purse #shop-purse, #ov-purse #purse-ad { padding-top: 4px; padding-bottom: 4px; font-size: 14px; }
  #ov-purse #shop-purse b, #ov-purse #purse-ad b { font-size: 15px; }
}

/* ---- the Daily tab: today's plate, then the month ------------------- */
.daily-page {
  display: grid; gap: 14px; align-items: start;
  max-width: 560px; margin: 4px auto 24px; padding: 0 4px;
}
@media (min-width: 700px) {
  .daily-page { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); max-width: 900px; }
}
.daily-hero {
  display: flex; gap: 14px; align-items: center; width: 100%;
  padding: 12px; border-radius: 14px; cursor: pointer; text-align: left;
  background: linear-gradient(#3a4c60, #1c2836);
  border: 1px solid rgba(200, 220, 240, .25);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .35);
  color: #eef4fa; font: inherit;
}
.daily-hero canvas { flex: 0 0 auto; width: min(44%, 220px); height: auto; aspect-ratio: 240 / 210; border-radius: 8px; }
.daily-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.daily-kicker { font-style: normal; font-size: 14px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #b8c6d4; }
.daily-name { font-family: var(--display); font-size: 23px; line-height: 1.15; color: #fff3d0; }
.daily-size { font-size: 16px; color: #e2e8f0; }
.daily-go {
  align-self: flex-start; margin: 4px 0 2px; padding: 8px 18px; min-height: 40px; box-sizing: border-box;
  display: inline-flex; align-items: center;
  border-radius: 10px; border: 1px solid #4e7064;
  background: linear-gradient(180deg, #b4d0c0, #78a090); box-shadow: 0 3px 0 #304840;
  font-family: var(--display); font-size: 16px; letter-spacing: .06em; text-transform: uppercase; color: #1c2824;
}
.daily-hero.done .daily-go { background: linear-gradient(180deg, #e7eef6, #a8b8c8); }
.daily-run { font-size: 16px; color: #f2c463; font-weight: 600; }
.daily-next { font-size: 15px; color: #d0dae4; }
.daily-month {
  padding: 10px 10px 8px; border-radius: 14px;
  background: rgba(22, 30, 40, .55); border: 1px solid rgba(200, 220, 240, .18);
}
.daily-month h3 {
  margin: 0 0 8px; text-align: center; font-family: var(--display); font-size: 18px;
  letter-spacing: .1em; text-transform: uppercase; color: #eef4fa;
}
.daily-cal { display: grid; grid-template-columns: repeat(7, minmax(40px, 52px)); justify-content: center; gap: 5px; }
.daily-wd { text-align: center; font-size: 14px; font-weight: 600; color: #b8c6d4; padding-bottom: 2px; }
.daily-day {
  position: relative; min-height: 40px; aspect-ratio: 1; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid rgba(200, 220, 240, .14);
  background: rgba(58, 76, 96, .45); color: #8fa2b4; font: inherit; padding: 0;
}
.daily-day b { font-family: var(--display); font-size: 17px; font-weight: 600; }
.daily-day.blank { visibility: hidden; }
.daily-day.later { color: #6f8396; background: rgba(40, 54, 70, .45); border-color: rgba(200, 220, 240, .08); }
.daily-day.missed { color: #8fa2b4; background: rgba(40, 54, 70, .45); }
button.daily-day { cursor: pointer; color: #eef4fa; }
.daily-day.done { background: linear-gradient(180deg, #b4d0c0, #78a090); border-color: #4e7064; color: #1c2824; }
.daily-day.done i {
  position: absolute; right: 3px; bottom: 1px; font-style: normal; font-size: 15px; font-weight: 600; color: #1c3a2c;
}
.daily-day.today { box-shadow: 0 0 0 3px #e8b44a; border-color: #e8b44a; color: #fff3d0; }
.daily-day.today.done { color: #1c2824; }
.daily-legend { margin: 10px 2px 0; font-size: 15px; line-height: 1.35; color: #d0dae4; text-align: center; }

/* Back sits with the dock's tabs, so it wears their celadon face on every
   material instead of the material's plaque (wood here, red on linen). */
#app #lv-back, #app #purse-close, #app #achieve-close {
  border: 1px solid #4e7064;
  background: linear-gradient(180deg, #b4d0c0, #78a090);
  color: #1c2824;
  box-shadow: 0 4px 0 #304840, 0 6px 10px rgba(0, 0, 0, .22);
  text-shadow: none;
}
#app #lv-back:hover, #app #purse-close:hover, #app #achieve-close:hover {
  background: linear-gradient(180deg, #b4d0c0, #78a090);
  filter: brightness(1.05);
}

/* the room painting keeps a margin under it, so its floor is never at the
   screen's very edge */
#ov-purse #shop-stage { margin-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }

/* Before Little Star is cleared there is no dock, so the board screen
   starts at the top instead of under an empty strip. */
#app.no-dock #s-levels.screen, #app.no-dock #s-game.screen { padding-top: 8px; }
#app.no-dock #ov-purse.shop-overlay, #app.no-dock #ov-achieve { top: 0; }

/* a board's picture is still on its way (plates load on demand) */
#app.plate-wait { cursor: progress; }
#app.plate-wait::after {
  content: 'Loading the picture…';
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%); z-index: 90; pointer-events: none;
  padding: 6px 14px; border-radius: 999px; font-size: 14px;
  background: rgba(14, 18, 24, 0.86); color: #eef4fa;
}

/* "No ad right now" and the like: a quiet line that fades on its own */
#quiet-note {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%); z-index: 95; pointer-events: none;
  max-width: calc(100% - 32px); text-align: center;
  padding: 6px 14px; border-radius: 999px; font-size: 14px;
  background: rgba(14, 18, 24, 0.9); color: #eef4fa;
}
#quiet-note[hidden] { display: none; }
#app.room-wait::after {
  content: 'Loading the rooms…';
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%); z-index: 90; pointer-events: none;
  padding: 6px 14px; border-radius: 999px; font-size: 14px;
  background: rgba(14, 18, 24, 0.86); color: #eef4fa;
}

/* ---- a finished picture, shown whole (#ov-art) ---- */
#ov-art { z-index: 70; padding: 16px; background: rgba(6, 9, 13, .94); }
#ov-art .art-view {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  max-width: 100%; max-height: 100%;
}
#ov-art .art-view.side { flex-direction: row; gap: 20px; }
#art-canvas {
  display: block; max-width: 100%; max-height: 100%;
  border-radius: 10px; box-shadow: 0 12px 40px rgba(0, 0, 0, .6);
}
#ov-art .art-foot { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 220px; }
#ov-art .art-caption { text-align: center; color: #eef4fa; }
#ov-art .art-caption b { display: block; font-size: 20px; letter-spacing: .04em; }
#ov-art .art-caption span { display: block; font-size: 14px; color: #c3ccd8; margin-top: 2px; }
#ov-art .art-actions { display: flex; gap: 10px; width: min(360px, calc(100vw - 32px)); }
#ov-art .art-view.side .art-actions { flex-direction: column; width: 220px; }
#ov-art .art-actions .btn { flex: 1 1 0; }

/* a held button (Peek while the picture shows) presses down but keeps its
   size, so it stays a full 40px touch target */
.btn.held { transform: translateY(5px); }

/* ---- stars ---- */
.card .medals { font-size: 16px; letter-spacing: .12em; color: #f2c463; }
#ov-win .win-stars { margin: 2px 0 6px; text-align: center; }
#ov-win .win-stars[hidden] { display: none; }
#ov-win .win-stars b { display: block; font-size: 30px; letter-spacing: .18em; color: #f2c463; line-height: 1.1; }
#ov-win .win-stars span { display: block; font-size: 14px; color: #e8dcc6; margin-top: 2px; }

/* ---- the set-cleared card: three ways on ---- */
.chapter-picks { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 10px; }
.chapter-picks .btn.pick { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 11px 16px; text-transform: none; }
.chapter-picks .btn.pick b { font-size: 19px; letter-spacing: .04em; }
.chapter-picks .btn.pick span { font-size: 15px; letter-spacing: 0; opacity: .95; line-height: 1.3; }
#ov-chapter .remark { font-size: 17px; }
/* the shout on two lines at most; what opened in gold */
#ov-chapter .win-shout { font-size: clamp(30px, 6vw, 42px); line-height: 1.05; }
#ov-chapter .remark b { color: #f2c463; font-weight: 700; }
/* design #2: the kind of choice on the button's corner */
#ov-chapter .chapter-picks { gap: 14px; padding-top: 6px; }
#ov-chapter .chapter-picks .btn.pick { position: relative; overflow: visible; }
.pick-tag {
  position: absolute; top: -10px; right: 10px;
  padding: 2px 9px; border-radius: 10px;
  font-family: var(--display); font-style: normal; font-size: 13px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; line-height: 1.3;
  background: #f5c75e; color: #2a1a08; box-shadow: 0 2px 4px rgba(0, 0, 0, .3);
}
.pick-tag.up { background: #e08a4a; color: #fff; }
.pick-tag.same { background: #8fc0a8; color: #10281e; }
.pick-tag.again { background: #c9b8e8; color: #24183c; }
.pick-tag.new { background: #f5c75e; color: #2a1a08; }
#ov-chapter #chapter-go { background: none !important; border: 0; box-shadow: none !important; color: #f2c463 !important; text-shadow: none; min-height: 40px; padding: 8px 16px; }
/* short screens (a CrazyGames frame, a phone on its side): stars and the
   next-star note share one line so the win card's buttons stay on screen */
@media (max-height: 560px) {
  #ov-win .win-stars { margin: 0 0 2px; line-height: 1.2; }
  #ov-win .win-stars b { display: inline; font-size: 17px; letter-spacing: .1em; margin-right: 6px; }
  #ov-win .win-stars span { display: inline; font-size: 13px; }
}

/* a help button whose press plays an ad: a small TV with a play mark */
.btn.needs-ad b::before {
  content: '';
  display: inline-block;
  width: 18px; height: 14px;
  margin-right: 6px;
  vertical-align: -2px;
  /* in the button's own ink, whatever the material */
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 14'%3E%3Crect x='1' y='1' width='16' height='12' rx='2.5' fill='none' stroke='black' stroke-width='2'/%3E%3Cpath d='M7 4.2v5.6l4.6-2.8z' fill='black'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 14'%3E%3Crect x='1' y='1' width='16' height='12' rx='2.5' fill='none' stroke='black' stroke-width='2'/%3E%3Cpath d='M7 4.2v5.6l4.6-2.8z' fill='black'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* The set-cleared card sits under the tabs, never behind them, and on a
   short screen (the small CrazyGames frame, a phone on its side) it is
   compact enough to show whole. */
#ov-chapter { top: 60px; }
#ov-chapter .panel { max-height: calc(100% - 12px); overflow-y: auto; }
@media (max-height: 620px) {
  #ov-chapter { padding: 6px 12px; }
  #ov-chapter .panel { padding: 12px 18px 10px; }
  #ov-chapter .win-shout { font-size: 26px; margin: 0; }
  #ov-chapter .remark { font-size: 14px; margin: 4px 0 2px; }
  #ov-chapter .chapter-picks { gap: 10px; }
  #ov-chapter .chapter-picks .btn.pick { padding: 7px 12px; }
  #ov-chapter .chapter-picks .btn.pick b { font-size: 16px; }
  #ov-chapter .chapter-picks .btn.pick span { font-size: 13px; }
  #ov-chapter .linky { margin-top: 6px; font-size: 15px; min-height: 0; padding: 4px; }
}
/* very short (a phone on its side): the choices two to a row */
@media (max-height: 480px) and (min-width: 600px) {
  #ov-chapter .panel { width: min(640px, 94vw); max-width: none; }
  #ov-chapter .chapter-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; }
  #ov-chapter .chapter-picks .btn.pick span { font-size: 12px; }
}
/* the sideways note never sits on a card: hidden while one is open */
body:has(.overlay.show) #ov-rotate.hint.hint-up { display: none; }

/* A short wide frame (the CrazyGames page frame, about 1235×650): yesterday's
   stacked layout, with less above and below the board so it is bigger. The
   difficulty and coins sit on the title's line at the left, and the help
   buttons are one row. */
@media (min-aspect-ratio: 3/2) and (min-height: 601px) and (max-height: 820px) and (min-width: 900px) {
  /* one grid: the title row (the title centred, the help and sound at the
     right, the difficulty and coins laid over its empty left side), then
     the board, then the buttons */
  #s-game.screen.show { display: grid; grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) auto; }
  #s-game .hud { grid-row: 1; grid-column: 1; padding-top: 6px; padding-bottom: 4px; }
  #s-game .stats { grid-row: 1; grid-column: 1; justify-self: start; align-self: center; padding: 0 0 0 14px; z-index: 2; }
  #s-game .board-wrap { grid-row: 2; grid-column: 1; min-height: 0; }
  #s-game .controls { grid-row: 3; grid-column: 1; }
  #s-game .controls { flex-wrap: nowrap; width: min(980px, calc(100% - 24px)); padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); margin-top: 4px; }
  #s-game .controls .btn-sm { flex: 1 1 0; min-width: 0; padding: 9px 8px; }
}

/* Poki: every reward button shows a 🎬, and none is green (their rules) */
html[data-portal="poki"] .tv {
  width: auto !important; height: auto !important; border: 0 !important;
  background: none !important; vertical-align: 0 !important;
}
html[data-portal="poki"] .tv::after {
  content: '🎬' !important; position: static !important; border: 0 !important;
  font-size: 1.1em; margin-right: 4px;
}
html[data-portal="poki"] .btn.needs-ad b::before {
  content: '🎬'; width: auto; height: auto; background: none;
  -webkit-mask: none; mask: none; vertical-align: 0;
}
html[data-portal="poki"] .purse-chip.adchip {
  color: #2a1404; background: linear-gradient(#fbf3e4, #e7d3b1); border-color: #8a6a3c;
}
html[data-portal="poki"] .purse-chip.adchip i { color: #6b4a22; }

/* a tab pressed while a board's end card is up: the card gives a small shake */
@keyframes card-nudge { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.panel.nudge { animation: card-nudge .28s ease-in-out 1; }

/* loadsofgames.com: back to the hub, top left of the title screen */
#all-games {
  position: fixed; top: max(12px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left));
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; box-sizing: border-box;
  z-index: 5; padding: 6px 14px 6px 10px; border-radius: 8px; font-weight: 700; font-size: 15px;
  color: var(--cream, #f3e7d3); text-decoration: none; background: rgba(20, 12, 6, .55);
  border: 1px solid rgba(240, 200, 120, .45);
}
#all-games:hover { background: rgba(20, 12, 6, .75); }
#all-games svg { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
/* only on the title screen; a board has the tabs and its own way back */
#app:not([data-screen="title"]) #all-games { display: none; }

/* loadsofgames.com: Home, a wooden square like ? and ♪ with a house and the
   word in it, stacked; side by side on a wide screen (owner, 2026-11-16) */
.icon.exit-game { text-decoration: none; flex-direction: column; gap: 1px; padding: 0; }
.icon.exit-game svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.icon.exit-game .exit-words { font-size: 12px; line-height: 1; }
@media (min-width: 900px) {
  .icon.exit-game { width: auto; flex-direction: row; padding: 0 12px 0 9px; gap: 6px; }
  .icon.exit-game svg { width: 22px; height: 22px; }
  .icon.exit-game .exit-words { font-size: 15px; letter-spacing: .04em; text-transform: uppercase; }
}

/* How to Play's way to the full rules page (our own site only: js/ui.js addAllGamesLink) */
.help-rules { display: flex; align-items: center; justify-content: center; min-height: 44px; margin: 4px 0 0; font-weight: 700; color: #f2c463; text-decoration: underline; text-underline-offset: 3px; }

/* ---- A phone on its side (owner, 2026-11-15: "the achievements popups are
   too big and I have to scroll"): the celebration card lies down, the mark on
   the left and the words and buttons on the right, and the achievements
   page's plaque is one short row. Checked at 844x390 and 667x375. */
#win-achieve { white-space: nowrap; }
@media (max-height: 520px) and (min-width: 520px) {
  .achieve-toast {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    column-gap: 18px;
    align-items: center;
    width: min(600px, 94vw);
    max-height: calc(100vh - 16px);
    padding: 12px 18px 14px;
    text-align: left;
  }
  .achieve-toast > [data-lgach] { grid-column: 2; }
  .achieve-toast .paper-crest { display: none; }
  .achieve-toast > .lgach-plate { grid-column: 1; grid-row: 1 / span 6; width: 92px; height: 92px; }
  .achieve-toast .lgach-plate svg { width: 64px; height: 64px; }
  .achieve-toast .lgach-kicker { margin: 0 0 2px; font-size: 12px; }
  .achieve-toast h2 { margin: 0 0 2px; font-size: 24px; }
  .achieve-toast .lgach-text { margin: 0 0 10px; font-size: 16px; line-height: 1.3; }
  .achieve-toast #achieve-pop-go { width: 100%; min-height: 48px; margin: 0; padding-top: 8px; padding-bottom: 8px; }
  .achieve-toast .lgach-keep { margin-top: 8px; min-height: 44px; padding: 10px; text-align: center; }

  .achieve-hud { padding-top: 6px; padding-bottom: 4px; }
  .achieve-plaque {
    display: flex; align-items: center; justify-content: center; gap: 14px;
    padding: 6px 14px;
  }
  .achieve-plaque .kicker { display: none; }
  .achieve-plaque h2 { font-size: 20px; }
  #achieve-count { margin: 0; white-space: nowrap; }
  .achieve-meter { flex: 0 1 160px; }
}
