/* Общие элементы: кнопки-эмалевые таблички, окна-пергаменты в латунной раме, списки */
:root {
  --ink: #3a2414;
  --cream: #fff3d6;
  --paper: #ffe9b8;
  --brass: #f2b632;
  --brass-d: #9a5d08;
  --red: #e2364f;
  --teal: #12b5a6;
  --blue: #2f6fe4;
  --green: #49b84c;
  --orange: #ff7a1a;
  --pink: #ff5fa2;
  --violet: #9a5cf0;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}
button {
  font-family: var(--font);
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  outline: none;
  touch-action: manipulation;
}
canvas {
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  touch-action: none;
}
svg.ic {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  pointer-events: none;
  overflow: visible;
}
#svg-sprite {
  position: absolute;
  left: -10px;
  top: -10px;
  pointer-events: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  background: radial-gradient(circle at 50% 40%, rgba(72, 30, 8, 0.58) 0%, rgba(26, 10, 3, 0.84) 100%);
}
.overlay.show {
  display: flex;
}
#menuIn,
.fitwrap {
  position: absolute;
  left: 0;
  top: 0;
  overflow: hidden;
}

.scroller {
  overflow-y: auto;
  scrollbar-width: none;
}
.scroller::-webkit-scrollbar {
  display: none;
}
.scroller.x {
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
}

/* ---------- цвета кнопок ---------- */
.c-green {
  --b1: #a8ec5c;
  --b2: #3fae3a;
  --bd: #1c6b22;
  --bt: #0f3d14;
}
.c-teal {
  --b1: #6ff0de;
  --b2: #11a597;
  --bd: #0b5e58;
  --bt: #063a36;
}
.c-blue {
  --b1: #8dc0ff;
  --b2: #2f6fe4;
  --bd: #17306e;
  --bt: #0c1d47;
}
.c-orange {
  --b1: #ffc35c;
  --b2: #ff7a1a;
  --bd: #8a3a05;
  --bt: #5a2203;
}
.c-pink {
  --b1: #ffb0d1;
  --b2: #f04a92;
  --bd: #7d1846;
  --bt: #4f0b2a;
}
.c-violet {
  --b1: #d6b5ff;
  --b2: #8a4de6;
  --bd: #3d1c73;
  --bt: #25104a;
}
.c-gold {
  --b1: #fff0a0;
  --b2: #ffbf2e;
  --bd: #8a4b10;
  --bt: #5a2c05;
}
.c-red {
  --b1: #ff9c8a;
  --b2: #e2364f;
  --bd: #6d1220;
  --bt: #470810;
}

.btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 14px;
  border-radius: 15px;
  flex: 1 1 0;
  min-width: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: #fff;
  text-shadow:
    0 1.5px 0 var(--bd),
    0 0 4px rgba(0, 0, 0, 0.28);
  background:
    radial-gradient(
      circle at 9px 9px,
      rgba(255, 255, 255, 0.9) 0 2px,
      rgba(0, 0, 0, 0.25) 2.4px 3.3px,
      transparent 3.6px
    ),
    radial-gradient(
      circle at calc(100% - 9px) 9px,
      rgba(255, 255, 255, 0.9) 0 2px,
      rgba(0, 0, 0, 0.25) 2.4px 3.3px,
      transparent 3.6px
    ),
    linear-gradient(180deg, var(--b1) 0%, var(--b2) 62%, var(--b2) 100%);
  border: 2.5px solid var(--bd);
  box-shadow:
    0 5px 0 var(--bd),
    0 8px 10px rgba(40, 14, 2, 0.35),
    inset 0 2px 0 rgba(255, 255, 255, 0.55),
    inset 0 -4px 0 rgba(0, 0, 0, 0.14);
  transition:
    transform 0.07s ease-out,
    box-shadow 0.07s ease-out;
}
.btn:active {
  transform: translateY(4px);
  box-shadow:
    0 1px 0 var(--bd),
    0 2px 4px rgba(40, 14, 2, 0.35),
    inset 0 2px 0 rgba(255, 255, 255, 0.4);
}
.btn .lbl {
  white-space: nowrap;
}
.btn.btn-sm {
  min-height: 46px;
  font-size: 13px;
  padding: 0 6px;
  gap: 4px;
  border-radius: 13px;
}
.btn.btn-sm svg.ic {
  width: 20px;
  height: 20px;
}
.btn.off {
  filter: grayscale(0.85) brightness(0.92);
}
.btn-play {
  --b1: #c9ff6a;
  --b2: #36b53a;
  --bd: #14601c;
  --bt: #0b3a10;
  min-height: 62px;
  font-size: 24px;
  letter-spacing: 0.8px;
  flex: 0 0 auto;
  animation: playpulse 1.9s ease-in-out infinite;
}
.btn-play svg.ic {
  width: 36px;
  height: 36px;
}
@keyframes playpulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.13);
  }
}

.rbtn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--b1), var(--b2));
  border: 2.5px solid var(--bd);
  box-shadow:
    0 4px 0 var(--bd),
    0 6px 8px rgba(40, 14, 2, 0.35),
    inset 0 2px 0 rgba(255, 255, 255, 0.55);
  transition:
    transform 0.07s ease-out,
    box-shadow 0.07s ease-out;
  pointer-events: auto;
}
.rbtn:active {
  transform: translateY(3px);
  box-shadow:
    0 1px 0 var(--bd),
    inset 0 2px 0 rgba(255, 255, 255, 0.4);
}
.rbtn svg.ic {
  width: 26px;
  height: 26px;
}

.xbtn {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #ff9c8a, #e2364f);
  border: 2.5px solid #6d1220;
  box-shadow:
    0 3px 0 #6d1220,
    inset 0 2px 0 rgba(255, 255, 255, 0.5);
}
.xbtn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #6d1220;
}
.xbtn svg.ic {
  width: 20px;
  height: 20px;
}

.linkbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 12px;
  margin: 0 auto;
  font-size: 13px;
  font-weight: 700;
  color: #fff7dc;
  text-shadow: 0 1px 2px rgba(60, 20, 0, 0.9);
  background: rgba(70, 28, 8, 0.55);
  border-radius: 20px;
  border: 1.5px solid rgba(255, 220, 150, 0.55);
}
.linkbtn svg.ic {
  width: 18px;
  height: 18px;
}
.linkbtn:active {
  background: rgba(70, 28, 8, 0.8);
}

.coinbox {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 38px;
  padding: 0 12px 0 6px;
  border-radius: 20px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #5c2c10, #3a1a08);
  border: 2.5px solid #f2b632;
  box-shadow:
    0 3px 0 #7a4408,
    inset 0 2px 3px rgba(0, 0, 0, 0.5);
  font-size: 17px;
  font-weight: 900;
  color: #ffe07a;
  text-shadow: 0 1px 0 #2a1004;
}
.coinbox svg.ic {
  width: 26px;
  height: 26px;
}
.coinbox.bump {
  animation: bump 0.32s ease-out;
}
@keyframes bump {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.25);
  }
  100% {
    transform: scale(1);
  }
}

/* ---------- окна ---------- */
.panel {
  position: relative;
  width: 336px;
  flex-shrink: 0;
  padding: 46px 16px 18px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 14px 14px, #fff8d0 0 2.6px, #7a4408 3px 4.6px, transparent 5px),
    radial-gradient(circle at calc(100% - 14px) 14px, #fff8d0 0 2.6px, #7a4408 3px 4.6px, transparent 5px),
    radial-gradient(circle at 14px calc(100% - 14px), #fff8d0 0 2.6px, #7a4408 3px 4.6px, transparent 5px),
    radial-gradient(circle at calc(100% - 14px) calc(100% - 14px), #fff8d0 0 2.6px, #7a4408 3px 4.6px, transparent 5px),
    repeating-linear-gradient(115deg, rgba(190, 120, 40, 0.07) 0 3px, rgba(255, 255, 255, 0) 3px 11px),
    linear-gradient(180deg, #fff6dc 0%, #ffe3a6 100%);
  border: 5px solid #f2b632;
  box-shadow:
    0 0 0 3px #7a4408,
    0 0 0 6px #ffd978,
    0 0 0 8px #7a4408,
    0 16px 30px rgba(20, 6, 0, 0.6),
    inset 0 0 0 2px rgba(122, 68, 8, 0.4);
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--ink);
}
.overlay.show .panel {
  animation: panelpop 0.3s cubic-bezier(0.2, 1.5, 0.5, 1) both;
}
@keyframes panelpop {
  from {
    transform: translateY(26px) rotate(-2deg);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.pn-small {
  width: 312px;
}
.pn-list {
  width: 344px;
}
.pn-ribbon {
  position: absolute;
  left: 50%;
  top: -5px;
  transform: translateX(-50%);
  white-space: nowrap;
  min-width: 190px;
  height: 42px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 0 var(--bd);
  background: linear-gradient(180deg, var(--b1), var(--b2));
  border: 2.5px solid var(--bd);
  border-radius: 0 0 16px 16px;
  box-shadow:
    0 4px 0 var(--bd),
    inset 0 2px 0 rgba(255, 255, 255, 0.5);
}
.pn-col {
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.pn-info {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: #7a4a1c;
}
.m-row {
  display: flex;
  gap: 10px;
}

.toggle {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 56px 0 10px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  background: linear-gradient(180deg, #fffaf0, #ffdf9c);
  border: 2.5px solid #9a5d08;
  box-shadow: 0 3px 0 #9a5d08;
}
.toggle svg.ic {
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.45));
}
.toggle .tg-knob {
  position: absolute;
  right: 8px;
  top: 50%;
  width: 42px;
  height: 22px;
  margin-top: -11px;
  border-radius: 12px;
  background: #b9a07a;
  border: 2px solid #6b4a22;
  transition: background 0.15s;
}
.toggle .tg-knob::after {
  content: '';
  position: absolute;
  left: 1px;
  top: 1px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff, #d9d0c0);
  border: 1.5px solid #6b4a22;
  transition: transform 0.15s;
}
.toggle.on .tg-knob {
  background: #49b84c;
}
.toggle.on .tg-knob::after {
  transform: translateX(20px);
}
.tg-row {
  display: flex;
  gap: 8px;
}
.tg-row .toggle {
  padding: 0 52px 0 8px;
  font-size: 14px;
}
.tg-row .toggle svg.ic {
  width: 20px;
  height: 20px;
}

#toast {
  position: absolute;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: fit-content;
  top: 8px;
  transform: translateY(-30px);
  z-index: 80;
  pointer-events: none;
  max-width: 86%;
  padding: 10px 18px;
  border-radius: 16px;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  color: #fff7dc;
  text-shadow: 0 1px 0 #2a1004;
  background: linear-gradient(180deg, #7a3c14, #4a2209);
  border: 2.5px solid #ffd24a;
  box-shadow: 0 6px 14px rgba(20, 6, 0, 0.5);
  opacity: 0;
  transition:
    opacity 0.2s,
    transform 0.2s;
}
#toast.show {
  opacity: 1;
  transform: translateY(0);
}
#fly-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 70;
  overflow: hidden;
}
.fly-coin {
  position: absolute;
  left: 0;
  top: 0;
  width: 26px;
  height: 26px;
  will-change: transform;
}
.fly-coin svg {
  width: 26px;
  height: 26px;
}
.fly-text {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 20px;
  font-weight: 900;
  white-space: nowrap;
  will-change: transform, opacity;
  color: #fff;
  text-shadow:
    0 2px 0 #5a2203,
    0 0 6px rgba(0, 0, 0, 0.4);
}

/* ---------- строки списков ---------- */
.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 14px;
  min-height: 66px;
  background: linear-gradient(180deg, #fffdf2, #ffeebe);
  border: 2px solid #c98a2b;
  box-shadow: 0 2px 0 #c98a2b;
}
.row + .row {
  margin-top: 8px;
}
.row .row-ic {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--b1, #ffe79a), var(--b2, #ffb52e));
  border: 2px solid var(--bd, #8a4b10);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55);
}
.row .row-ic svg.ic {
  width: 32px;
  height: 32px;
}
.row .row-ic canvas {
  position: static;
  width: 40px;
  height: 40px;
}
.row .row-main {
  flex: 1;
  min-width: 0;
}
.row .row-name {
  font-size: 15px;
  font-weight: 900;
  color: #4a2609;
  line-height: 1.15;
}
.row .row-desc {
  font-size: 12px;
  font-weight: 600;
  color: #7a5a2c;
  line-height: 1.2;
  margin-top: 2px;
}
.row .row-pips {
  display: flex;
  gap: 3px;
  margin-top: 4px;
}
.row .row-pips i {
  width: 14px;
  height: 7px;
  border-radius: 3px;
  background: #dcc48f;
  border: 1px solid #a8843f;
}
.row .row-pips i.on {
  background: #49b84c;
  border-color: #1c6b22;
}
.row.done {
  background: linear-gradient(180deg, #f4ffd9, #cdeea0);
  border-color: #4c9a2f;
  box-shadow: 0 2px 0 #4c9a2f;
}
.row.locked {
  filter: grayscale(0.7);
  opacity: 0.82;
}
.row .sbtn {
  flex-shrink: 0;
  min-width: 84px;
  min-height: 44px;
  padding: 0 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 1px 0 var(--bd);
  background: linear-gradient(180deg, var(--b1), var(--b2));
  border: 2px solid var(--bd);
  box-shadow:
    0 3px 0 var(--bd),
    inset 0 2px 0 rgba(255, 255, 255, 0.5);
}
.row .sbtn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--bd);
}
.row .sbtn svg.ic {
  width: 18px;
  height: 18px;
}
.row .sbtn.dim {
  filter: grayscale(0.8);
  opacity: 0.8;
}
.row .sbtn .lbl {
  white-space: nowrap;
}
.row .tag {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 900;
  color: #1c6b22;
  display: flex;
  align-items: center;
  gap: 4px;
}
.row .tag svg.ic {
  width: 20px;
  height: 20px;
}
.sect {
  margin: 10px 2px 6px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #a35a12;
}
.sect:first-child {
  margin-top: 0;
}

/* ---------- рейтинг ---------- */
#lb-list {
  overflow-y: auto;
  max-height: 320px;
  height: 320px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lb-my {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 800;
  color: #fff7dc;
  background: linear-gradient(180deg, #3c7ae8, #2552b8);
  border: 2px solid #17306e;
}
.lb-my b {
  font-size: 19px;
  color: #ffe07a;
}
.lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #fffdf2, #ffeebe);
  border: 2px solid #c98a2b;
  font-weight: 800;
  font-size: 15px;
  color: #4a2609;
}
.lb-medal {
  width: 30px;
  text-align: center;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 900;
  color: #8a6a3a;
}
.lb-medal.gold,
.lb-medal.silver,
.lb-medal.bronze {
  width: 30px;
  height: 30px;
  line-height: 26px;
  border-radius: 50%;
  font-size: 15px;
  color: #fff;
  border: 2px solid #7a4408;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.6),
    0 2px 0 rgba(0, 0, 0, 0.25);
}
.lb-medal.gold {
  background: radial-gradient(circle at 35% 30%, #fffbe0, #ffc93c 55%, #c77a08);
}
.lb-medal.silver {
  background: radial-gradient(circle at 35% 30%, #ffffff, #c3ccd9 55%, #77849a);
  border-color: #57606e;
}
.lb-medal.bronze {
  background: radial-gradient(circle at 35% 30%, #ffe0bd, #e08a48 55%, #9a4d18);
  border-color: #6b3210;
}
.lb-avatar {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(180deg, #6ff0de, #11a597);
  border: 2px solid #0b5e58;
  color: #fff;
  font-weight: 900;
}
.lb-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.lb-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-score {
  flex-shrink: 0;
  color: #b5500a;
  font-weight: 900;
}
.lb-empty {
  text-align: center;
  padding: 20px;
  font-size: 15px;
  font-weight: 700;
  color: #7a5a2c;
}
.lb-row.top-1 {
  background: linear-gradient(180deg, #fff9c9, #ffd95a);
  border-color: #b77a12;
}
.lb-row.top-2 {
  background: linear-gradient(180deg, #ffffff, #dfe6f0);
  border-color: #77849a;
}
.lb-row.top-3 {
  background: linear-gradient(180deg, #fff0e0, #f3b98a);
  border-color: #9a4d18;
}
.lb-row.me {
  border-color: #2f6fe4;
  box-shadow:
    0 0 0 2px #2f6fe4,
    0 0 10px rgba(47, 111, 228, 0.6);
}

/* ---------- вкладки ---------- */
.tabs {
  display: flex;
  gap: 5px;
  flex: 1;
  min-width: 0;
}
.tab {
  flex: 1 1 0;
  min-width: 0;
  min-height: 40px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 900;
  color: #7a4a1c;
  background: linear-gradient(180deg, #ffeec0, #f3c979);
  border: 2px solid #b5802a;
}
.tab.on {
  color: #fff;
  text-shadow: 0 1px 0 #7d1846;
  background: linear-gradient(180deg, #ffb0d1, #f04a92);
  border-color: #7d1846;
  box-shadow: 0 2px 0 #7d1846;
}
.tab .lbl {
  white-space: nowrap;
}
