/* ==========================================================================
   PINFALL BOWLING — theme: realistic dark walnut + leather + brushed brass.
   Loaded after the layout css; art comes from assets/ui.
   Pills use a 3-slice (fixed height, `--h`), cards use a full 9-slice.
   No cream/beige surfaces: panels are dark wood, leather, glass, teal, red or gold.
   ========================================================================== */
:root {
  --panel-solid: #1d130f;
  --line: rgba(233, 180, 76, 0.22);
  --brass: #e9b44c;
  --u: 1;
  /* Cyrillic/CJK fall back per glyph to system fonts (no bundled CJK font: licence + size). */
  --f-cjk:
    'Hiragino Sans', 'Yu Gothic UI', 'Meiryo', 'Malgun Gothic', 'Apple SD Gothic Neo', 'Microsoft YaHei', 'PingFang SC',
    'Noto Sans CJK SC', 'Noto Sans CJK JP', 'Noto Sans CJK KR', 'Noto Sans SC', 'Noto Sans JP', 'Noto Sans KR';
  --f-display: 'PF Display', 'Arial Black', Impact, var(--f-cjk), sans-serif;
  --f-ui: 'PF UI', 'Segoe UI', Roboto, Helvetica, Arial, var(--f-cjk), sans-serif;
}
html:lang(ja) {
  --f-ui: 'PF UI', 'Hiragino Sans', 'Yu Gothic UI', 'Meiryo', 'Noto Sans CJK JP', 'Noto Sans JP', sans-serif;
}
html:lang(ko) {
  --f-ui: 'PF UI', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans CJK KR', 'Noto Sans KR', sans-serif;
}
html:lang(zh-Hans) {
  --f-ui: 'PF UI', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Noto Sans SC', sans-serif;
}
html:lang(ja) .btn-big b,
html:lang(ko) .btn-big b,
html:lang(zh-Hans) .btn-big b {
  letter-spacing: 0;
}
.ic img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.55));
  pointer-events: none;
}
.nine {
  border-image: none !important;
  background-size: 100% 100% !important;
  background-origin: border-box !important;
  background-clip: border-box !important;
  background-repeat: no-repeat !important;
}

/* ---------- pills (3-slice, height from --h) ---------- */
.btn,
.back-btn,
.pill,
.tickets,
.best,
.tab,
.hud-chip,
.chip,
.hint,
.new-best,
.tickets-chip,
.lang-card {
  --h: 52px;
  height: var(--h);
  min-height: 0;
  padding: 0 !important;
  background-color: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  border-style: solid;
  border-color: transparent;
  border-width: 0 calc(var(--h) / 2);
  border-image: url(../assets/ui/btn-dark.webp) 0 85 fill / 0 calc(var(--h) / 2) stretch;
  color: var(--text);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.btn:active {
  border-image-source: url(../assets/ui/btn-dark-down.webp);
  transform: translateY(1px);
}
.btn.primary,
.tab.on,
.new-best {
  border-image-source: url(../assets/ui/btn-gold.webp);
  color: #2a1606;
  text-shadow: 0 1px 0 rgba(255, 236, 170, 0.6);
}
.btn.primary:active {
  border-image-source: url(../assets/ui/btn-gold-down.webp);
}
.btn:disabled {
  border-image-source: url(../assets/ui/btn-dark-off.webp);
  opacity: 0.8;
}
.btn.primary:disabled {
  border-image-source: url(../assets/ui/btn-gold-off.webp);
}
.btn.danger {
  filter: hue-rotate(-12deg) saturate(1.5);
}
.btn.sm {
  --h: 40px;
}
.back-btn {
  --h: 44px;
  gap: 6px;
  font-weight: 800;
}
.back-btn .ic {
  width: 18px;
  height: 18px;
}
.chip,
.hud-chip {
  --h: 30px;
  font-size: 12px;
  font-weight: 700;
  gap: 4px;
}
.tickets,
.best {
  --h: 38px;
  gap: 6px;
  font-size: 15px;
  color: var(--primary);
}
.best {
  color: var(--muted);
}
.tickets .ic,
.best .ic {
  width: 22px;
  height: 22px;
}
.tab {
  --h: 40px;
  font-weight: 700;
}

/* ---------- round / square buttons ---------- */
.icon-btn,
.hud-btn {
  background: url(../assets/ui/round-dark.webp) center / 100% 100% no-repeat !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  border-radius: 0 !important;
}
.icon-btn:active,
.hud-btn:active {
  background-image: url(../assets/ui/round-dark-down.webp) !important;
}
.hud-btn {
  width: 46px;
  height: 46px;
}
.hud-btn.pause .ic img {
  filter: grayscale(1) brightness(1.9) drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.55));
}
.icon-btn .ic,
.hud-btn .ic {
  width: 55%;
  height: 55%;
}

/* ---------- screens: dark lounge background for list screens ---------- */
.screen:not(.menu):not(.results) {
  background: #120a07 url(../assets/ui/salao-paisagem.webp) center / cover no-repeat !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
@media (orientation: portrait) {
  .screen:not(.menu):not(.results) {
    background-image: url(../assets/ui/salao-retrato.webp) !important;
  }
}
#pf-ui.over-game .screen:not(.menu):not(.results) {
  background-color: rgba(18, 10, 7, 0.94) !important;
  background-image: none !important;
}
.scr-head h2 {
  color: var(--text);
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.7);
}

/* ---------- cards / panels (9-slice) ---------- */
.card,
.set-card {
  background-color: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 4px 2px 0 !important;
  border: 24px solid transparent;
  border-image: url(../assets/ui/card-wide.webp) 78 fill / 24px stretch;
  margin: 0 0 14px;
}
.card h3 {
  color: var(--brass);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}
.ch-item,
.shop-item,
.party-row,
.res-row,
.tile {
  background-color: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  border: 20px solid transparent;
  border-image: url(../assets/ui/row.webp) 60 fill / 20px stretch;
}
.ch-item.done {
  border-image-source: url(../assets/ui/row-done.webp);
}
.ch-item.locked {
  border-image-source: url(../assets/ui/row-locked.webp);
  opacity: 1;
}
.shop-item.equipped {
  border-image-source: url(../assets/ui/tile-on.webp);
  border-width: 22px;
  border-image-slice: 50;
  border-image-width: 22px;
}
.shop-item {
  border-image-source: url(../assets/ui/tile.webp);
  border-width: 22px;
  border-image-slice: 50;
  border-image-width: 22px;
}
.modal-card,
.res-card {
  background-color: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 26px 26px 22px;
  border: 38px solid transparent;
  border-image: url(../assets/ui/card-big.webp) 120 fill / 38px stretch;
}
.res-card,
.modal-card {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* ---------- main menu ---------- */
.logo {
  width: min(80vw, 500px, 52vh);
  filter: drop-shadow(0 10px 26px rgba(0, 0, 0, 0.65));
}
.btn-big {
  --h: 76px;
  height: var(--h);
  min-height: 0;
  padding: 0 !important;
  background-color: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  border-style: solid;
  border-color: transparent;
  border-width: 0 calc(var(--h) / 2);
  border-image: url(../assets/ui/btn-dark.webp) 0 85 fill / 0 calc(var(--h) / 2) stretch;
  width: 100%;
}
.btn-big:active {
  border-image-source: url(../assets/ui/btn-dark-down.webp);
  transform: translateY(2px);
  box-shadow: none;
}
.btn-big.primary {
  border-image-source: url(../assets/ui/btn-gold.webp);
}
.btn-big.primary:active {
  border-image-source: url(../assets/ui/btn-gold-down.webp);
}
.btn-big .bb-ic {
  width: 46px;
  height: 46px;
  background: none;
  margin-left: -6px;
}
.btn-big .bb-ic .ic {
  width: 100%;
  height: 100%;
}
.btn-big b {
  color: var(--text);
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.6);
}
.btn-big small {
  color: rgba(251, 241, 220, 0.72);
}
.btn-big.primary b {
  color: #2a1606;
  text-shadow: 0 1px 0 rgba(255, 236, 170, 0.6);
}
.btn-big.primary small {
  color: rgba(42, 22, 6, 0.78);
}
.menu-row .pill {
  --h: 60px;
  height: var(--h);
  border-width: 0 22px;
  border-image: url(../assets/ui/btn-dark.webp) 0 85 fill / 0 22px stretch;
  flex-direction: column;
}
.menu-row .pill .ic {
  width: 26px;
  height: 26px;
}
.lo-card {
  --h: 60px;
  height: var(--h);
  background-color: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  border-radius: 0;
  overflow: visible;
  border-style: solid;
  border-color: transparent;
  border-width: 0 30px;
  border-image: url(../assets/ui/btn-dark.webp) 0 85 fill / 0 30px stretch;
}
.lo-arrow {
  width: 44px;
  margin: 0 -22px 0 -22px;
  z-index: 1;
}
.btn-big small .ic {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
}
.ach-ic .ic {
  width: 22px;
  height: 22px;
}
.lo-arrow .ic {
  width: 18px;
  height: 18px;
}
.lo-txt small {
  color: var(--brass);
}
.menu-top {
  padding: 0 2px;
}

/* ---------- settings controls ---------- */
.seg {
  --h: 44px;
  height: var(--h);
  padding: 0;
  gap: 0;
  align-items: center;
  background-color: transparent !important;
  box-shadow: none !important;
  border-style: solid;
  border-color: transparent;
  border-width: 0 22px;
  border-image: url(../assets/ui/btn-dark.webp) 0 85 fill / 0 22px stretch;
}
.seg-b {
  --h: 40px;
  margin: 0;
  padding: 0 !important;
  min-width: 0 !important;
  font-size: 13px;
  border: solid transparent;
  border-width: 0 12px;
  height: var(--h);
  border-radius: 0;
  background: none;
  color: var(--text);
  font-weight: 700;
  min-width: 56px;
}
.seg-b.on {
  border-image: url(../assets/ui/btn-gold.webp) 0 85 fill / 0 12px stretch;
  color: #2a1606;
  text-shadow: 0 1px 0 rgba(255, 236, 170, 0.6);
}
.toggle {
  width: 77px;
  height: 40px;
  border-radius: 0 !important;
  background: url(../assets/ui/switch-off.webp) center / 100% 100% no-repeat !important;
  box-shadow: none !important;
}
.toggle.on {
  background-image: url(../assets/ui/switch-on.webp) !important;
}
.toggle i {
  display: none;
}
.slider {
  -webkit-appearance: none;
  appearance: none;
  height: 30px;
  background: transparent;
  border-radius: 0;
  --v: 50%;
}
.slider::-webkit-slider-runnable-track {
  height: 30px;
  background:
    url(../assets/ui/slider-fill.webp) left center / var(--v) 24px no-repeat,
    url(../assets/ui/slider-track.webp) center / 100% 24px no-repeat;
}
.slider::-moz-range-track {
  height: 30px;
  background:
    url(../assets/ui/slider-fill.webp) left center / var(--v) 24px no-repeat,
    url(../assets/ui/slider-track.webp) center / 100% 24px no-repeat;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 0;
  background: url(../assets/ui/slider-knob.webp) center / contain no-repeat;
  margin-top: 0;
}
.slider::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 0;
  background: url(../assets/ui/slider-knob.webp) center / contain no-repeat;
}

/* compact rows & tiles (leather art, small corners) */
.ch-item {
  padding: 0 2px;
  border-width: 14px;
  border-image-width: 14px;
  border-image-slice: 60;
  gap: 10px;
}
.ch-txt b {
  font-size: 15px;
}
.ch-txt small {
  font-size: 12px;
  color: rgba(251, 241, 220, 0.68);
}
.party-row {
  border-width: 14px;
  border-image-width: 14px;
  border-image-slice: 60;
  padding: 2px 2px;
}
.tile {
  border-width: 16px;
  border-image-source: url(../assets/ui/tile.webp);
  border-image-slice: 50;
  border-image-width: 16px;
  padding: 0 2px;
}
.res-row {
  border-width: 14px;
  border-image-width: 14px;
  border-image-slice: 60;
}
.res-tickets,
.ach {
  background-color: transparent;
}
/* ---------- stars / lock ---------- */
.ic.flip img {
  transform: scaleX(-1);
}
.stars .ic {
  width: 22px;
  height: 22px;
}
.stars .ic:not(.on) {
  opacity: 0.9;
}
.ch-item .ic {
  width: 22px;
  height: 22px;
}

/* ---------- HUD ---------- */
.sb {
  background-color: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  color: var(--text);
  overflow: visible;
  border: 14px solid transparent;
  border-image: url(../assets/ui/hud-board.webp) 70 fill / 14px stretch;
  padding: 0 2px 2px;
}
.sb.cur {
  box-shadow: none !important;
}
.sb-head {
  background: none !important;
  color: var(--text);
  padding: 1px 6px 3px;
  font-size: 13px;
}
.sb-name {
  font-weight: 800;
  letter-spacing: 0.01em;
}
.sb-max {
  color: #e8dfcd !important;
  font-weight: 600;
}
.sb-total {
  font-size: 17px;
  font-weight: 700;
}
.chip small,
.hud-info .chip small {
  color: #f6f0e2;
  opacity: 0.9;
}
.sb-total {
  color: var(--primary);
}
.sb-frames {
  gap: 0;
}
.sb-f {
  border: 1px solid rgba(233, 180, 76, 0.55) !important;
  margin-left: -1px;
  background: linear-gradient(135deg, #0c2d30, #082022);
  position: relative;
}
.sb-f.now {
  background: linear-gradient(135deg, #b87b12, #8a5a0c) !important;
  box-shadow:
    inset 0 0 0 1px #f2c14e,
    0 0 8px rgba(242, 181, 58, 0.6);
  z-index: 1;
}
.sb-n {
  background: none !important;
  color: #f6f0e2 !important;
  font-size: 10px;
  font-weight: 600;
}
.sb-f.now .sb-n {
  color: #fff !important;
}
.sb-b i {
  border: 0 !important;
  color: #fff;
}
.sb-b i.mx {
  background: var(--secondary);
  color: #fff;
  border-radius: 3px;
}
.sb-b i.ms {
  background: none;
  color: var(--accent);
  clip-path: none;
  text-shadow: 0 0 6px rgba(43, 179, 168, 0.8);
}
.sb-s {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.sb-s.pend {
  color: rgba(255, 255, 255, 0.4);
}
.pinmap {
  background-color: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  border-radius: 0 !important;
  width: 56px;
  padding: 0;
  border: 16px solid transparent;
  border-image: url(../assets/ui/corner-btn.webp) 50 fill / 16px stretch;
}
.pm-row i.down {
  box-shadow: inset 0 0 0 1.5px rgba(233, 180, 76, 0.45);
}
.hint {
  --h: 44px;
}
.hud-info .chip {
  --h: 34px;
}

/* ---------- title (Tap to start) ---------- */
.title .logo {
  margin-top: 6vh;
  width: min(88vw, 560px, 58vh);
}
.btn-start {
  --h: 84px;
  width: min(100%, 440px);
  margin: auto 0 4vh;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(22px, 6vw, 30px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  animation: startPulse 2.6s ease-in-out infinite;
}
@keyframes startPulse {
  50% {
    transform: scale(1.03);
  }
}
@media (prefers-reduced-motion: reduce) {
  .btn-start {
    animation: none;
  }
}
.root-reduced .btn-start {
  animation: none;
}

/* ---------- language ---------- */
.lang-logo {
  display: block;
  width: min(58%, 260px);
  margin: 0 auto 14px;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.55));
}
.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 10px;
}
@media (min-aspect-ratio: 4/3) {
  .lang-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .lang-logo {
    width: min(30%, 220px);
  }
}
.lang-card {
  --h: 60px;
  width: 100%;
  min-width: 0;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-weight: 700;
  font-size: 15px;
}
.lang-card.on {
  filter: drop-shadow(0 0 7px rgba(242, 181, 58, 0.9));
}
.lang-badge {
  flex: none;
  width: 36px;
  height: 36px;
  margin-left: -8px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  color: #2a1606;
  background: url(../assets/ui/medal-gold.webp) center / 100% 100% no-repeat;
  text-shadow: 0 1px 0 rgba(255, 236, 170, 0.6);
}
.lang-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lang-check {
  width: 22px;
  height: 22px;
  margin-right: -6px;
}
.lang-open .ic {
  width: 20px;
  height: 20px;
}

/* ---------- loading ---------- */
#pf-loading .ld-logo img {
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.6));
}

/* ---------- small-screen text fit (14 languages) ---------- */
.scr-head {
  gap: 8px;
}
.scr-head .back-btn {
  --h: 40px;
  font-size: 14px;
}
.scr-head .tickets {
  --h: 32px;
  font-size: 13px;
}
.scr-head h2 {
  font-size: clamp(14px, 4.4vw, 22px);
  white-space: normal;
  text-overflow: clip;
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.btn.wide {
  white-space: normal;
  text-align: center;
  line-height: 1.1;
}
.menu-row .pill {
  --h: 60px;
  border-width: 16px;
  border-image: url(../assets/ui/btn-dark.webp) 60 85 fill / 16px stretch;
  height: var(--h);
}
.menu-row .pill span {
  font-size: clamp(10px, 3.1vw, 12.5px);
  overflow-wrap: anywhere;
  text-align: center;
}
.lang-card {
  gap: 6px;
  font-size: 13.5px;
  position: relative;
}
.lang-badge {
  width: 32px;
  height: 32px;
  font-size: 11px;
  margin-left: -10px;
}
.lang-check {
  position: absolute;
  right: 12px;
  margin: 0;
}
.lang-name {
  overflow: visible;
  white-space: normal;
  overflow-wrap: break-word;
}
.lang-card.on .lang-name {
  padding-right: 18px;
}
.lang-check {
  right: 6px;
  width: 18px;
  height: 18px;
}
.lo-art-lane {
  width: 34px;
  height: 28px;
}
.lo-main {
  gap: 5px;
}
.swatch {
  width: 40px;
  height: 40px;
}
.icon-btn.sm {
  width: 40px;
  height: 40px;
}

/* ---------- settings layout (segments sit on the label's line, section titles get a rule) ---------- */
.set-row {
  flex-wrap: wrap;
  gap: 8px;
}
.set-row .set-l {
  flex: 1 1 0;
  min-width: min-content;
}
.set-row .seg,
.set-row .toggle,
.set-row .slider,
.set-row .lang-open {
  flex: none;
}
.seg-b {
  border-width: 0;
  padding: 0 12px !important;
  font-size: 12.5px;
  border-radius: 20px;
}
.seg-b.on {
  border-image: none;
  background: linear-gradient(180deg, #ffd978, #e6a82e 55%, #b97c14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 1px 3px rgba(0, 0, 0, 0.5);
}
.seg {
  --h: 44px;
  border-width: 0 22px;
}
.slider {
  width: 44%;
}
.card h3 {
  display: flex;
  align-items: center;
  gap: 10px;
}
.card h3::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(233, 180, 76, 0.65), rgba(233, 180, 76, 0));
}
.set-l small {
  color: #d3c7b2;
}
.sb-head .sb-name {
  color: #fff;
}

/* ---------- game-style polish ---------- */
/* baked art must never be clipped by the old layout radius (it ate the gold rim of the pills) */
.nine {
  border-radius: 0 !important;
}
/* game scrollbars: thin brass thumb on a dark groove, no white browser bar */
.scr-body,
.shop-grid,
.ch-grid {
  scrollbar-width: thin;
  scrollbar-color: #c98f2e rgba(10, 6, 4, 0.6);
}
.scr-body::-webkit-scrollbar {
  width: 10px;
}
.scr-body::-webkit-scrollbar-track {
  background: rgba(10, 6, 4, 0.6);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(233, 180, 76, 0.25);
}
.scr-body::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, #f5cf6e, #c98f2e 55%, #8a5a12);
  border-radius: 6px;
  border: 2px solid rgba(10, 6, 4, 0.6);
}
.scr-body::-webkit-scrollbar-button {
  display: none;
  height: 0;
}
/* lane / ball pickers: arrows live in the end caps, never over the picture */
.lo-arrow {
  width: 28px;
  margin: 0;
}
.lo-arrow:first-child {
  margin-left: -20px;
}
.lo-arrow:last-child {
  margin-right: -20px;
}
.lo-main {
  padding: 0 4px;
  gap: 8px;
}
.lo-art-lane,
.shop-item .art-lane {
  background-size: cover !important;
  background-position: center !important;
  background-color: transparent;
}
.lo-art-lane {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  box-shadow:
    0 0 0 1.5px rgba(233, 180, 76, 0.7),
    0 2px 6px rgba(0, 0, 0, 0.5);
}
.lo-art-lane::after,
.shop-item .art-lane::after {
  display: none;
}
.shop-item .art-lane {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  max-width: 150px;
  border-radius: 14px;
  box-shadow:
    0 0 0 1.5px rgba(233, 180, 76, 0.55),
    0 4px 10px rgba(0, 0, 0, 0.5);
}
/* lanes tab: the real 3D lane shows behind the cards, so a switch is seen at once */
.screen.shop.see-3d {
  background: linear-gradient(
    180deg,
    rgba(14, 8, 6, 0.92) 0%,
    rgba(14, 8, 6, 0.55) 38%,
    rgba(14, 8, 6, 0) 62%
  ) !important;
}
/* bigger pause, same size as the pin map */
.hud-btn {
  width: 56px;
  height: 56px;
}
/* tutorial bubble: dark leather, light text, readable gold button, below the frame chip */
.tut-bubble {
  top: calc(var(--sat) + 38%);
  background: linear-gradient(180deg, rgba(48, 28, 18, 0.97), rgba(26, 15, 10, 0.97));
  color: var(--text);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  box-shadow:
    0 0 0 1.5px rgba(233, 180, 76, 0.75),
    0 12px 30px rgba(0, 0, 0, 0.55);
  border-radius: 18px;
}
.tut-btns .btn {
  border-image-source: url(../assets/ui/btn-gold.webp);
  color: #2a1606 !important;
  text-shadow: 0 1px 0 rgba(255, 236, 170, 0.6);
  --h: 44px;
  min-width: 120px;
  font-weight: 800;
}
/* settings in tabs: one card, no page scroll */
.settings .tabs {
  justify-content: center;
}
.settings .set-tab {
  margin: 0;
}
.settings .set-tab .btn {
  margin-bottom: 10px;
}
@media (min-aspect-ratio: 4/3) {
  .settings .set-tab.cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 22px;
  }
  .settings .set-tab.cols > h3 {
    grid-column: 1 / -1;
  }
}
/* challenges: two columns on wide screens, so the list is half as long */
@media (min-width: 900px) {
  .ch-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
  }
  .challenges .scr-body {
    max-width: 1040px;
  }
}
/* small pills use wide end caps, so the gloss in the art never shows as a box in the middle */
.tab {
  border-width: 0 calc(var(--h) / 2);
  border-image-slice: 0 170 fill;
  border-image-width: 0 var(--h);
  min-width: calc(var(--h) * 2);
}
.tab > .ic {
  width: 22px;
  height: 22px;
}
.tabs .tab {
  padding: 0 12px !important;
} /* short words: the two wide end caps never meet in the middle (that left a seam line) */
.tab.on .ic img {
  filter: brightness(0.3) sepia(1) saturate(2);
}
/* the Frame · Ball chip goes under the scoreboard (height measured by hud.js) */
.hud-info {
  top: calc(var(--hud-top-h, 96px) + 2px);
}
/* tutorial bubble on wide screens: to the side, so it never covers the pins */
@media (min-aspect-ratio: 4/3) {
  .tut-bubble {
    left: calc(var(--sal) + 18px);
    top: 46%;
    transform: none;
    width: min(30vw, 320px);
  }
}
/* scrolling lists fade out at the bottom edge: you can tell there is more */
.scr-body {
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 34px), transparent);
  mask-image: linear-gradient(180deg, #000 calc(100% - 34px), transparent);
  padding-bottom: 34px;
}
.reward .ic {
  margin-right: 5px;
}
/* settings: the card sits centred, not lost at the top of an empty page; the long hint gets its own full line */
.settings .scr-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 640px;
  -webkit-mask-image: none;
  mask-image: none;
  padding-bottom: 8px;
}
.settings .set-tab.cols {
  max-width: none;
}
@media (min-aspect-ratio: 4/3) {
  .settings .scr-body:has(.cols) {
    max-width: 900px;
  }
  .settings .set-tab.cols .set-row:first-of-type {
    grid-column: 1 / -1;
  }
}
/* lanes tab: one centred strip of cards at the bottom, the top of the screen is the live lane */
.screen.shop.see-3d {
  background: linear-gradient(
    180deg,
    rgba(14, 8, 6, 0.9) 0%,
    rgba(14, 8, 6, 0) 22%,
    rgba(14, 8, 6, 0) 52%,
    rgba(14, 8, 6, 0.88) 100%
  ) !important;
}
.see-3d .scr-body {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  -webkit-mask-image: none;
  mask-image: none;
  padding-bottom: 6px;
}
.see-3d .shop-grid {
  grid-template-columns: repeat(3, minmax(0, 170px));
  justify-content: center;
}
.shop-grid {
  justify-content: center;
  grid-template-columns: repeat(auto-fill, minmax(140px, 180px));
}
.see-3d .shop-item {
  border-width: 14px;
  border-image-width: 14px;
  padding: 4px 2px 6px;
  gap: 6px;
}
.see-3d .shop-item .art-lane {
  max-width: 96px;
}
.see-3d .tag {
  white-space: nowrap;
  font-size: 11px;
  padding: 3px 8px;
}
@media (orientation: portrait) {
  .tut-bubble {
    top: calc(var(--sat) + 42%);
  }
}
.si-name {
  min-height: 2.5em;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
}
/* in-game ball swap: round button under the pause button, picker grid in a dark card */
.hud-ball {
  position: absolute;
  left: calc(8px + var(--sal));
  top: calc(var(--hud-top-h, 96px) + 4px);
  width: 56px;
  height: 56px;
  pointer-events: auto;
  transition: opacity 0.25s;
}
.hud-ball .ball-thumb {
  width: 64%;
  height: 64%;
}
.hud-ball.off {
  opacity: 0;
  pointer-events: none;
}
.ball-pick-card {
  width: min(92vw, 520px);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ball-pick-card h2 {
  margin: 0;
  text-align: center;
  font-family: var(--f-display);
  font-weight: 400;
  text-transform: uppercase;
}
.ball-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
  overflow-y: auto;
  padding: 2px;
}
.ball-opt {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 0 0 1.5px rgba(233, 180, 76, 0.25);
}
.ball-opt.on {
  box-shadow:
    inset 0 0 0 2px var(--primary),
    0 0 12px rgba(242, 181, 58, 0.4);
}
.ball-opt small {
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
  line-height: 1.1;
}
/* results card: nothing shrinks to 0 when the card is full (the "new best" pill collapsed and its text spilled), buttons stay visible */
.res-card > * {
  flex-shrink: 0;
}
.new-best {
  white-space: nowrap;
  padding: 0 4px !important;
}
.res-card > .res-btns {
  position: sticky;
  bottom: -22px;
  padding: 10px 0 4px;
  background: linear-gradient(180deg, rgba(26, 15, 10, 0), rgba(26, 15, 10, 0.96) 35%);
}
.res-card {
  scrollbar-width: thin;
  scrollbar-color: #c98f2e rgba(10, 6, 4, 0.6);
}
/* party results: name and mini stats stacked, so the name always shows (it was squeezed to 0 px) */
.res-who {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 1px;
}
.res-who .res-name {
  flex: none;
}
.res-mini {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* party setup on phones: the ball picker drops to its own line, the name field gets the width */
.party-row {
  flex-wrap: wrap;
}
.party-row .name-in {
  flex: 1 1 150px;
}
/* expanded scoreboard with 4 players on a short screen scrolls instead of being cut */
.sb-wrap {
  max-height: calc(100dvh - 16px - var(--sat));
  overflow-y: auto;
  scrollbar-width: none;
}
.stars.big .ic {
  width: 46px;
  height: 46px;
}
@media (max-height: 500px) {
  .res-card {
    gap: 6px;
    padding: 10px 18px 10px;
    width: min(100%, 760px);
  }
  .res-kicker {
    display: none;
  }
  .big-score {
    font-size: 50px;
  }
  .new-best {
    --h: 40px;
  }
  .res-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
  }
  .res-card:has(.res-win) .big-score {
    display: none;
  } /* party: the rows already show every total */
  .res-row {
    padding: 0 4px;
  }
}
@media (max-width: 480px) {
  .res-card {
    border-width: 26px;
    border-image-width: 26px;
    padding: 16px 6px 14px;
  }
  .res-list {
    width: 100%;
  }
}
/* paused: the tutorial bubble and the HUD never draw over the pause menu or the Help/Settings opened from it */
.modal:not(.hidden) ~ .tut,
#pf-ui.over-game .tut,
#pf-ui.over-game .hud {
  visibility: hidden;
}
/* short landscape: the pause card fits (two columns of buttons) */
@media (max-height: 500px) {
  .pause-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 10px;
    padding: 8px 14px 6px;
    width: min(92vw, 560px);
  }
  .pause-card h2 {
    grid-column: 1 / -1;
    margin: 0;
  }
  .pause-card .btn {
    --h: 44px;
    margin: 0;
  }
  .pause-card .btn.primary {
    grid-column: 1 / -1;
  }
}
/* narrow phones: pickers keep the whole name, tab rows fit without scrolling sideways */
@media (max-width: 480px) {
  .lo-card {
    border-width: 0 22px;
    border-image-width: 0 22px;
  }
  .lo-arrow:first-child {
    margin-left: -16px;
  }
  .lo-arrow:last-child {
    margin-right: -16px;
  }
  .lo-arrow {
    width: 24px;
  }
  .lo-main {
    gap: 6px;
    padding: 0 2px;
  }
  .lo-art,
  .lo-art-lane {
    width: 32px;
    height: 32px;
  }
  .lo-txt b {
    font-size: 12.5px;
  }
  .tabs {
    gap: 4px;
  }
  .tab {
    --h: 38px;
    font-size: 12.5px;
  }
  /* narrow phones: end caps 28 px cut at 125 art px (same proportion, no squash), words never break, the bar scrolls if a language is long */
  .tabs .tab {
    flex: none;
    border-width: 0 10px;
    border-image-slice: 0 125 fill;
    border-image-width: 0 28px;
    padding: 0 6px !important;
    min-width: 64px;
    white-space: nowrap;
  }
  .tabs .tab:has(> .ic) {
    flex: none;
    min-width: 64px;
  }
}
/* short landscape: settings rows tighten and the long help line goes, so a tab never scrolls */
@media (max-height: 500px) {
  .settings .set-l small {
    display: none;
  }
  .settings .set-row {
    padding: 5px 0;
  }
  .settings .scr-head {
    margin-bottom: 6px;
  }
  .settings .tabs {
    margin-bottom: 6px;
  }
  .settings .card {
    border-width: 18px;
    border-image-width: 18px;
  }
  .settings .card h3 {
    margin: 0 0 2px;
    font-size: 13px;
  }
}
.hint {
  white-space: normal;
  width: max-content;
  max-width: min(94vw, 640px);
  text-align: center;
  line-height: 1.12;
  font-size: clamp(11.5px, 3.2vw, 14px);
  overflow: visible;
}
.hint > span {
  min-width: 0;
}
.btn-start {
  font-size: clamp(15px, 4.4vw, 30px);
  white-space: normal;
  line-height: 1.05;
  text-align: center;
}
.set-l > span {
  white-space: nowrap;
}
.res-place {
  width: auto;
  min-width: 28px;
  white-space: nowrap;
}
.ach-grid {
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
}
.tag.lock {
  font-size: 10.5px;
  line-height: 1.12;
  padding: 3px 5px;
  gap: 3px;
}
.tag.lock span {
  word-break: keep-all;
}
.shop-item:has(.tag.lock) {
  padding-left: 0;
  padding-right: 0;
}
.tag.lock .ic {
  flex: none;
}
@media (min-aspect-ratio: 1/1) {
  .res-card:has(.res-win) {
    width: min(100%, 760px);
  }
  .res-card:has(.res-win) .res-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
  }
}
@media (max-width: 480px) {
  .lang-card {
    font-size: 12px;
  }
  .lang-name {
    overflow-wrap: normal;
  }
}
/* End of css/theme.css (complete file). */
