/* ===== Meta progression / hub ===== */
.brand {
     cursor: pointer;
     -webkit-tap-highlight-color: transparent;
   }
   .brand:active {
     transform: scale(0.985);
   }
   .progress-label {
     display: flex;
     gap: 5px;
     align-items: center;
   }
   .progress-stars {
     color: #ffd86a;
     font-weight: 900;
     letter-spacing: 0;
   }
   .hub {
     position: fixed;
     inset: 0;
     z-index: 13000;
     display: none;
     background: linear-gradient(165deg, #161039f5, #0e153af7);
     backdrop-filter: blur(14px);
     overflow: hidden;
   }
   .hub.show {
     display: block;
   }
   .hub-shell {
     width: min(520px, 100%);
     height: 100%;
     margin: auto;
     display: grid;
     grid-template-rows: auto minmax(0, 1fr) auto;
     background: linear-gradient(160deg, #29205d, #151d4a);
     box-shadow: 0 0 60px #0008;
   }
   .hub-head {
     display: flex;
     align-items: center;
     gap: 10px;
     padding: max(14px, env(safe-area-inset-top)) 14px 10px;
     border-bottom: 1px solid #ffffff12;
   }
   .hub-head h2 {
     margin: 0;
     flex: 1;
     font-size: 20px;
   }
   .hub-scroll {
     overflow: auto;
     padding: 14px 12px 18px;
     display: grid;
     gap: 11px;
     overscroll-behavior: contain;
   }
   .hub-hero {
     padding: 15px;
     border-radius: 20px;
     background: linear-gradient(135deg, #8b61ff33, #4ed7ff1e);
     border: 1px solid #ffffff18;
     box-shadow: inset 0 1px #ffffff13;
   }
   .hub-hero-top {
     display: flex;
     align-items: center;
     justify-content: space-between;
     gap: 10px;
   }
   .hub-level {
     font-size: 12px;
     color: #c9c6ef;
   }
   .hub-stars {
     font-size: 25px;
     font-weight: 900;
     color: #ffd968;
   }
   .hub-progress {
     height: 8px;
     margin-top: 10px;
     border-radius: 99px;
     background: #ffffff12;
     overflow: hidden;
   }
   .hub-progress > i {
     display: block;
     height: 100%;
     width: 0;
     background: linear-gradient(90deg, #4ed7ff, #8b62ff, #ff64aa);
     border-radius: inherit;
   }
   .hub-actions {
     display: grid;
     grid-template-columns: 1fr 1fr;
     gap: 8px;
   }
   .hub-action {
     min-height: 66px;
     border: 1px solid #ffffff14;
     border-radius: 17px;
     background: #ffffff0d;
     color: #fff;
     text-align: left;
     padding: 11px 12px;
     font-weight: 900;
     box-shadow: inset 0 1px #ffffff0d;
   }
   .hub-action strong {
     display: block;
     font-size: 13px;
   }
   .hub-action span {
     display: block;
     margin-top: 4px;
     font-size: 9px;
     color: #bbb7df;
     font-weight: 700;
   }
   .hub-action.daily {
     background: linear-gradient(135deg, #ff8f5630, #ff5ea226);
   }
   .hub-action.primary {
     background: linear-gradient(135deg, #815fff, #4d7df5);
     box-shadow: 0 8px 22px #00000030;
   }
   .hub-section {
     padding: 13px;
     border-radius: 19px;
     background: #ffffff08;
     border: 1px solid #ffffff12;
   }
   .hub-section-head {
     display: flex;
     align-items: center;
     justify-content: space-between;
     gap: 10px;
     margin-bottom: 10px;
   }
   .hub-section h3 {
     margin: 0;
     font-size: 14px;
   }
   .hub-section small {
     color: #aaa6cf;
     font-size: 9px;
   }
   .theme-grid {
     display: grid;
     grid-template-columns: repeat(3, 1fr);
     gap: 7px;
   }
   .theme-tile {
     position: relative;
     min-height: 67px;
     border: 1px solid #ffffff14;
     border-radius: 14px;
     color: #fff;
     padding: 8px;
     font-weight: 900;
     text-align: left;
     overflow: hidden;
   }
   .theme-tile::after {
     content: "";
     position: absolute;
     inset: auto -15px -28px auto;
     width: 62px;
     height: 62px;
     border-radius: 50%;
     background: #fff2;
   }
   .theme-tile.locked {
     filter: grayscale(0.75);
     opacity: 0.48;
   }
   .theme-tile.selected {
     outline: 2px solid #fff;
     outline-offset: -3px;
   }
   .theme-tile b {
     position: relative;
     z-index: 1;
     font-size: 10px;
   }
   .theme-tile span {
     position: relative;
     z-index: 1;
     display: block;
     margin-top: 3px;
     font-size: 8px;
     opacity: 0.78;
   }
   .theme-violet {
     background: linear-gradient(145deg, #785aff, #3e53d9);
   }
   .theme-ocean {
     background: linear-gradient(145deg, #13b5c8, #225bd7);
   }
   .theme-sunset {
     background: linear-gradient(145deg, #ff8e52, #d94b9c);
   }
   .theme-paper {
     background: linear-gradient(145deg, #f7eee0, #a79c91);
     color: #312c31;
   }
   .theme-aurora {
     background: linear-gradient(145deg, #25d2a2, #704cff);
   }
   .theme-neon {
     background: linear-gradient(145deg, #11162c, #e42cff);
   }
   .collection-grid {
     display: grid;
     grid-template-columns: repeat(4, 1fr);
     gap: 6px;
     max-height: 190px;
     overflow: auto;
     padding-right: 2px;
   }
   .collection-item {
     min-height: 49px;
     border-radius: 12px;
     padding: 7px 4px;
     display: grid;
     place-items: center;
     text-align: center;
     background: #ffffff0b;
     border: 1px solid #ffffff10;
     font-size: 8px;
     font-weight: 850;
     line-height: 1.05;
   }
   .collection-item.locked {
     color: #747194;
   }
   .collection-item.seen {
     background: linear-gradient(145deg, #6f55e42e, #43cae71d);
     color: #f5f3ff;
     border-color: #978aff2c;
   }
   .achievement-list {
     display: grid;
     gap: 6px;
     max-height: 220px;
     overflow: auto;
   }
   .achievement {
     display: grid;
     grid-template-columns: 34px 1fr auto;
     gap: 8px;
     align-items: center;
     padding: 8px;
     border-radius: 12px;
     background: #ffffff08;
   }
   .achievement .ico {
     width: 32px;
     height: 32px;
     border-radius: 10px;
     display: grid;
     place-items: center;
     background: #ffffff0d;
     font-size: 10px;
     line-height: 1;
     letter-spacing: -1.5px;
     white-space: nowrap;
     overflow: hidden;
     text-align: center;
   }
   .achievement b {
     font-size: 10px;
   }
   .achievement p {
     margin: 2px 0 0;
     color: #aaa6cb;
     font-size: 8px;
   }
   .achievement.locked {
     opacity: 0.43;
   }
   .achievement .done {
     font-size: 10px;
     color: #83e7ab;
   }
   .stats-grid {
     display: grid;
     grid-template-columns: repeat(2, 1fr);
     gap: 7px;
   }
   .stat-box {
     padding: 10px;
     border-radius: 13px;
     background: #ffffff08;
   }
   .stat-box b {
     display: block;
     font-size: 17px;
   }
   .stat-box span {
     font-size: 8px;
     color: #aaa6cf;
     text-transform: uppercase;
     letter-spacing: 0.05em;
   }
   .daily-badge {
     display: inline-flex;
     align-items: center;
     gap: 4px;
     padding: 4px 7px;
     border-radius: 99px;
     background: #ffb04b20;
     color: #ffd17d;
     font-size: 8px;
     font-weight: 900;
   }
   /* Win progression */
   .win-modal.show {
     animation: winBackdropIn 0.28s ease-out both;
   }
   .win-modal .win-modal-card {
     width: min(354px, 93vw);
     padding: 27px 21px 21px;
     overflow: visible;
     transform-origin: center 58%;
   }
   .win-modal.show .win-modal-card {
     animation: winModalIn 0.46s cubic-bezier(0.18, 0.88, 0.24, 1.12) both;
   }
   .win-modal .win-modal-card::after {
     content: "";
     position: absolute;
     width: 190px;
     height: 190px;
     left: 50%;
     top: -66px;
     z-index: -1;
     border-radius: 50%;
     opacity: 0;
     pointer-events: none;
     background: radial-gradient(circle, #ffd76766 0 15%, #ffb7682f 32%, #8bdfff1a 52%, transparent 72%);
     filter: blur(8px);
     transform: translateX(-50%) scale(.82);
   }
   .win-modal.perfect .win-modal-card::after {
     opacity: 0.72;
     animation: perfectAura 1.9s ease-in-out infinite;
   }
   .win-modal.perfect .win-modal-card {
     border-color: #ffe69a;
     box-shadow:
       0 28px 76px #000a,
       0 0 0 2px #ffd96d4f,
       0 0 42px #ffca5d34;
   }
   .win-modal .win-icon {
     border-radius: 50%;
     background: radial-gradient(circle at 35% 28%, #fff4a8, #ffc34d 44%, #ff9b55 78%);
   }
   .win-modal.perfect .win-icon {
     box-shadow:
       0 12px 30px #ff9c4c55,
       0 0 0 5px #ffd76728,
       0 0 32px #ffd05b6b,
       inset 0 1px #fff8;
     animation: perfectIconFloat 1.7s ease-in-out infinite;
   }
   .win-modal.perfect-burst .win-modal-card {
     animation: perfectCardPop 0.62s cubic-bezier(0.2, 0.85, 0.22, 1) both;
   }
   .win-stars {
     position: relative;
     display: grid;
     grid-template-columns: repeat(3, minmax(0, 1fr));
     gap: 7px;
     margin: 9px -3px 18px;
   }
   .win-star-item {
     min-width: 0;
     display: grid;
     justify-items: center;
     align-content: start;
     gap: 6px;
     opacity: 0;
     transform: translateY(8px);
   }
   .win-star-item.revealed {
     opacity: 1;
     transform: translateY(0);
     transition:
       opacity 0.2s ease,
       transform 0.28s cubic-bezier(0.2, 0.82, 0.2, 1);
   }
   .win-star-symbol {
     display: block;
     font-size: clamp(46px, 14vw, 58px);
     line-height: 0.94;
     color: #d7d3e4;
     text-shadow: 0 3px 9px #7d72851c;
     transform: scale(0.72) rotate(-8deg);
     filter: grayscale(0.5);
   }
   .win-star-item.revealed .win-star-symbol {
     animation: winStarMiss 0.34s ease-out both;
   }
   .win-star-item.earned.revealed .win-star-symbol {
     color: #ffc43d;
     filter: none;
     text-shadow:
       0 4px 11px #ff9d3f66,
       0 0 20px #ffd65e70;
     animation: winStarEarn 0.58s cubic-bezier(0.18, 0.9, 0.24, 1.2) both;
   }
   .win-star-label {
     display: block;
     max-width: 96px;
     min-height: 27px;
     color: #8b879b;
     font-size: 9px;
     line-height: 1.15;
     font-weight: 850;
     text-align: center;
   }
   .win-star-item.earned.revealed .win-star-label {
     color: #514b61;
   }
   .win-next-unlock {
     position: relative;
     min-height: 14px;
     color: #777287;
     font-size: 9px;
     margin: 0 0 16px;
   }
   .modal-actions {
     display: grid;
     gap: 15px;
   }
   .modal-actions .win-next {
     min-height: 49px;
     font-size: 13px;
   }
   .modal-secondary-actions {
     display: grid;
     grid-template-columns: 1fr 1fr;
     gap: 9px;
   }
   .modal-card .secondary {
     min-height: 43px;
     background: #ebe8f7;
     color: #4d4960;
     box-shadow: none;
     font-size: 11px;
   }
   @keyframes winBackdropIn {
     from { opacity: 0; }
     to { opacity: 1; }
   }
   @keyframes winModalIn {
     0% { opacity: 0; transform: translateY(28px) scale(0.88) rotate(-1.2deg); }
     68% { opacity: 1; transform: translateY(-3px) scale(1.025) rotate(0.35deg); }
     100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
   }
   @keyframes winStarEarn {
     0% { transform: scale(0.5) rotate(-16deg); opacity: 0.35; }
     56% { transform: scale(1.2) rotate(7deg); opacity: 1; }
     76% { transform: scale(0.94) rotate(-2deg); }
     100% { transform: scale(1) rotate(0); opacity: 1; }
   }
   @keyframes winStarMiss {
     from { transform: scale(0.66) rotate(-7deg); opacity: 0; }
     to { transform: scale(0.9) rotate(0); opacity: 0.72; }
   }
   @keyframes perfectAura {
     0%, 100% { transform: translateX(-50%) scale(.82); opacity: .48; }
     50% { transform: translateX(-50%) scale(1.08); opacity: .82; }
   }
   @keyframes perfectIconFloat {
     0%, 100% { transform: translateY(0) rotate(-4deg) scale(1); }
     50% { transform: translateY(-4px) rotate(2deg) scale(1.045); }
   }
   @keyframes perfectCardPop {
     0% { transform: scale(1); }
     38% { transform: scale(1.025); }
     100% { transform: scale(1); }
   }
   /* tutorial */
   .coach.tutorial {
     pointer-events: none;
     max-width: 92%;
     font-size: 10px;
     padding: 11px 13px;
     background: #17152bf5;
   }
   .coach .coach-step {
     display: block;
     margin-bottom: 3px;
     color: #ffd86a;
     font-weight: 900;
     font-size: 8px;
     letter-spacing: 0.08em;
     text-transform: uppercase;
   }
   /* themes */
   body[data-theme="ocean"] {
     background: linear-gradient(155deg, #061e2d, #062e48 60%, #071d3d);
   }
   body[data-theme="ocean"] .app,
   body[data-theme="ocean"] .hub-shell {
     background: linear-gradient(160deg, #0d5265, #123a68 48%, #102858);
   }
   body[data-theme="ocean"] .brand-mark,
   body[data-theme="ocean"] .controls .primary {
     background: linear-gradient(145deg, #28d2ca, #2785f3);
   }
   body[data-theme="ocean"] .card.face-down {
     background: linear-gradient(145deg, #17bec9, #246fed 60%, #164fb7);
   }
   body[data-theme="sunset"] {
     background: linear-gradient(155deg, #32101c, #4c193d 60%, #241339);
   }
   body[data-theme="sunset"] .app,
   body[data-theme="sunset"] .hub-shell {
     background: linear-gradient(160deg, #713151, #4a2557 46%, #24204d);
   }
   body[data-theme="sunset"] .brand-mark,
   body[data-theme="sunset"] .controls .primary {
     background: linear-gradient(145deg, #ffac4c, #ff548d);
   }
   body[data-theme="sunset"] .card.face-down {
     background: linear-gradient(145deg, #ff9b55, #f4519a 55%, #8051d9);
   }
   body[data-theme="paper"] {
     background: #cfc6b8;
   }
   body[data-theme="paper"] .app,
   body[data-theme="paper"] .hub-shell {
     background: linear-gradient(160deg, #81796e, #5e625e 55%, #474e50);
   }
   body[data-theme="paper"] .card.face-down {
     background: linear-gradient(145deg, #8c8072, #625b54);
     border-color: #d8cfc4;
   }
   body[data-theme="paper"] .brand-mark,
   body[data-theme="paper"] .controls .primary {
     background: linear-gradient(145deg, #b88c5d, #78654f);
   }
   body[data-theme="aurora"] {
     background: linear-gradient(155deg, #061c26, #102f3d 60%, #18183f);
   }
   body[data-theme="aurora"] .app,
   body[data-theme="aurora"] .hub-shell {
     background:
       radial-gradient(circle at 0 20%, #2bdab538, transparent 35%),
       radial-gradient(circle at 100% 5%, #7458ff48, transparent 35%),
       linear-gradient(160deg, #124c50, #222154 58%, #121b42);
   }
   body[data-theme="aurora"] .brand-mark,
   body[data-theme="aurora"] .controls .primary {
     background: linear-gradient(145deg, #35e1b0, #685cff);
   }
   body[data-theme="aurora"] .card.face-down {
     background: linear-gradient(145deg, #33d7ac, #4e74e7 55%, #7856e7);
   }
   body[data-theme="neon"] {
     background: #040510;
   }
   body[data-theme="neon"] .app,
   body[data-theme="neon"] .hub-shell {
     background:
       radial-gradient(circle at 80% 0, #d92bff26, transparent 30%), linear-gradient(160deg, #0b0f23, #101638);
   }
   body[data-theme="neon"] .brand-mark,
   body[data-theme="neon"] .controls .primary {
     background: linear-gradient(145deg, #00eaff, #e22cff);
   }
   body[data-theme="neon"] .card.face-down {
     background: linear-gradient(145deg, #121b47, #b228dd);
     border-color: #43e9ff;
   }

/* ===== Game feel, special levels, chapters and deadlock UI ===== */
.special-badge {
  display: inline-flex;
  align-items: center;
  max-width: 118px;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 3px 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffd85c24, #ff7fb92c);
  border: 1px solid #ffd76c38;
  color: #ffe598;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: none;
  white-space: nowrap;
}
.special-badge[hidden] { display: none; }

.combo-pop {
  position: fixed;
  left: 50%;
  top: max(86px, calc(env(safe-area-inset-top) + 72px));
  z-index: 10040;
  display: grid;
  place-items: center;
  gap: 2px;
  min-width: 118px;
  padding: 9px 14px 8px;
  border-radius: 16px;
  transform: translate(-50%, -8px) scale(.9);
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(145deg, #1b1745e8, #36276ee8);
  border: 1px solid #ffffff2d;
  box-shadow: 0 12px 32px #05051b7a, inset 0 1px #ffffff1c;
  backdrop-filter: blur(12px);
  transition: opacity .18s ease, transform .18s ease;
}
.combo-pop.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.combo-pop.pop { animation: comboPop .42s cubic-bezier(.2,.8,.2,1); }
.combo-pop strong { color: #ffd85c; font-size: 17px; line-height: 1; letter-spacing: -.03em; }
.combo-pop span { color: #d7d2f3; font-size: 8px; font-weight: 800; }
@keyframes comboPop {
  0% { transform: translate(-50%, 4px) scale(.88); }
  55% { transform: translate(-50%, -3px) scale(1.08); }
  100% { transform: translate(-50%, 0) scale(1); }
}

.bad-target { animation: badTarget .32s ease; }
@keyframes badTarget {
  0%,100% { box-shadow: inherit; }
  45% { box-shadow: 0 0 0 3px #ff6b7852, inset 0 0 0 2px #ff798366; filter: brightness(1.08); }
}
.stock.hint-stock { animation: hintStock .65s ease 2; }
@keyframes hintStock {
  50% { transform: translateY(-5px) scale(1.035); filter: brightness(1.15); }
}
.stock.exhausted::after {
  content: "×";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #ffffff54;
  font-size: 26px;
  font-weight: 700;
}

.slot.category-completing { z-index: 50; }
.slot.category-completing::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: calc(var(--radius) + 8px);
  background: radial-gradient(circle, #ffd95b58, #ffd95b18 42%, transparent 70%);
  animation: categoryGlow .46s ease-out both;
  pointer-events: none;
}
@keyframes categoryGlow {
  0% { opacity: 0; transform: scale(.72); }
  45% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0; transform: scale(1.26); }
}
.category-complete-label {
  position: fixed;
  z-index: 10060;
  pointer-events: none;
  transform: translate(-50%, 0);
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff;
  color: #40366f;
  border: 1px solid #fff;
  box-shadow: 0 8px 24px #09052255;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.deadlock-modal {
  position: fixed;
  inset: 0;
  z-index: 14500;
  display: none;
  place-items: center;
  padding: 20px;
  background: #09071dc7;
  backdrop-filter: blur(9px);
}
.deadlock-modal.show { display: grid; }
.deadlock-card {
  width: min(330px, 92vw);
  padding: 23px 20px 18px;
  border-radius: 24px;
  text-align: center;
  background: linear-gradient(165deg, #fff, #f1edff);
  color: #26223e;
  box-shadow: 0 25px 70px #0009;
  border: 1px solid #fff;
}
.deadlock-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  background: linear-gradient(145deg, #ffcf65, #ff7f74);
  color: #44283b;
  font-size: 27px;
  font-weight: 900;
  box-shadow: 0 10px 24px #ff8f5c42;
}
.deadlock-card h2 { margin: 0 0 6px; font-size: 21px; letter-spacing: -.035em; }
.deadlock-card p { margin: 0 0 16px; color: #777187; font-size: 11px; }
.deadlock-actions { display: grid; gap: 7px; }
.deadlock-actions button {
  min-height: 44px;
  border: 0;
  border-radius: 13px;
  background: #e8e4f4;
  color: #4d4762;
  font-weight: 900;
}
.deadlock-actions .primary { background: linear-gradient(135deg, #8b62ff, #527cf6); color: #fff; }
.deadlock-actions .secondary { background: transparent; color: #817a91; }
.deadlock-actions button:disabled { opacity: .35; }

.chapter-section { overflow: hidden; }
.chapter-head { display: grid; grid-template-columns: 34px 1fr 34px; text-align: center; }
.chapter-head > div { min-width: 0; }
.chapter-nav {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 11px;
  background: #ffffff0d;
  color: #fff;
  font-size: 23px;
  line-height: 1;
}
.chapter-nav:disabled { opacity: .28; }
.chapter-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.chapter-level {
  position: relative;
  min-width: 0;
  min-height: 58px;
  padding: 7px 3px 6px;
  border: 1px solid #ffffff12;
  border-radius: 13px;
  background: #ffffff09;
  color: #f7f5ff;
  display: grid;
  align-content: center;
  gap: 5px;
  font-weight: 900;
}
.chapter-level.current { outline: 2px solid #9e8bff; outline-offset: -2px; background: #8b62ff25; }
.chapter-level.locked { opacity: .36; }
.chapter-level-number { font-size: 12px; }
.chapter-level-number i { margin-right: 2px; color: #ffd96d; font-style: normal; font-size: 9px; }
.chapter-level-stars { color: #ffd66a; font-size: 8px; letter-spacing: -1px; white-space: nowrap; }

.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.setting-toggle {
  min-height: 55px;
  padding: 9px 10px;
  border: 1px solid #ffffff13;
  border-radius: 13px;
  background: #ffffff08;
  color: #fff;
  text-align: left;
}
.setting-toggle.on { background: linear-gradient(135deg, #7256e92c, #43c9df1d); border-color: #8d7cff38; }
.setting-toggle.install { grid-column: 1 / -1; }
.setting-toggle b { display: block; font-size: 10px; }
.setting-toggle span { display: block; margin-top: 3px; color: #aaa6cf; font-size: 8px; font-weight: 700; }
.setting-toggle:disabled { opacity: .55; }

/* Chapters subtly change the board atmosphere while keeping the selected theme intact. */
body[data-chapter-tone="2"] .app::before { background: #4ed7ff24; }
body[data-chapter-tone="2"] .app::after { background: #85e6a71b; }
body[data-chapter-tone="3"] .app::before { background: #ffd85c20; }
body[data-chapter-tone="3"] .app::after { background: #ff5fa222; }
body[data-chapter-tone="4"] .app::before { background: #85e6a720; }
body[data-chapter-tone="4"] .app::after { background: #a85cff22; }
.hub-scroll {
  align-content: start;
  grid-auto-rows: max-content;
}

/* ===== Achievement card backs ===== */
.cardback-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}
.cardback-tile {
  min-width: 0;
  min-height: 106px;
  padding: 7px 5px 8px;
  border: 1px solid #ffffff14;
  border-radius: 14px;
  background: #ffffff08;
  color: #fff;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 5px;
  text-align: center;
}
.cardback-tile.locked { opacity: .42; filter: saturate(.45); }
.cardback-tile.selected { outline: 2px solid #fff; outline-offset: -3px; background: #ffffff10; }
.cardback-tile.rare:not(.locked) { border-color: #ffd76a55; box-shadow: inset 0 0 22px #ffd56a0b; }
.cardback-tile b { font-size: 9px; line-height: 1; }
.cardback-tile > span:last-child { color: #aaa6cf; font-size: 7px; line-height: 1.12; font-weight: 750; }
.cardback-preview {
  position: relative;
  width: 42px;
  height: 58px;
  overflow: hidden;
  border: 2px solid #b8a9ff;
  border-radius: 9px;
  box-shadow: 0 5px 10px #05051650, inset 0 1px #ffffff55;
  display: grid;
  place-items: center;
}
.cardback-preview::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 6px;
  border: 1px solid #ffffff4a;
}
.cardback-preview i { position: relative; z-index: 2; color: #fff; font-style: normal; font-size: 15px; text-shadow: 0 2px 5px #0008; }
.cardback-preview.back-classic { background: linear-gradient(145deg, #8b62ff, #684dff 48%, #3c69e8); }
.cardback-preview.back-prism { background: conic-gradient(from 210deg, #7b5cff, #2ed9df, #4f72ff, #d34cff, #7b5cff); }
.cardback-preview.back-constellation { background: radial-gradient(circle at 28% 28%, #fff 0 1px, transparent 1.8px), radial-gradient(circle at 70% 62%, #88dcff 0 1px, transparent 1.7px), radial-gradient(circle at 45% 80%, #fff 0 1px, transparent 1.6px), linear-gradient(155deg, #101b4d, #18265e 55%, #0b1233); }
.cardback-preview.back-trophy { background: radial-gradient(circle at 50% 32%, #ffe79655, transparent 26%), linear-gradient(145deg, #6d3e92, #9a672a 55%, #55316c); border-color: #ffd96f; }
.cardback-preview.back-crown { background: linear-gradient(145deg, #12131d, #3b2b16 65%, #12131d); border-color: #f0ca67; }
.cardback-preview.back-ember { background: radial-gradient(circle at 50% 76%, #ffb24f7a, transparent 28%), linear-gradient(145deg, #541a2c, #a7372c 58%, #341323); border-color: #ffac61; }
.cardback-preview.back-legend { background: radial-gradient(circle at 20% 20%, #9affdc2a, transparent 25%), linear-gradient(145deg, #0b3b35, #345878 52%, #3c235f); border-color: #78f0c9; }
.cardback-preview.back-obsidian { background: radial-gradient(circle at 70% 15%, #d232ff44, transparent 28%), linear-gradient(145deg, #080910, #171329 55%, #05060a); border-color: #7eeaff; box-shadow: 0 0 12px #6eefff35, inset 0 1px #ffffff55; }

/* Selected back overrides the selected color theme only for the reverse side. */
body[data-card-back="classic"] .card.face-down {
  background: radial-gradient(circle at 30% 22%, #ffffff18 0 5%, transparent 6%), radial-gradient(circle at 72% 68%, #ffffff12 0 4%, transparent 5%), linear-gradient(145deg, #8b62ff 0%, #684dff 48%, #3c69e8 100%);
  border-color: #b8a9ff;
}
body[data-card-back="prism"] .card.face-down {
  background: conic-gradient(from 210deg at 52% 48%, #7b5cff, #2ed9df, #4f72ff, #d34cff, #7b5cff);
  border-color: #b9f5ff;
  box-shadow: 0 4px 0 #3c2f8d, 0 8px 16px #06072266, inset 0 1px #ffffffaa;
}
body[data-card-back="prism"] .card.face-down::before { background: linear-gradient(45deg, transparent 43%, #ffffff18 44% 47%, transparent 48%), linear-gradient(-45deg, transparent 43%, #ffffff10 44% 47%, transparent 48%); background-size: 15px 15px; }
body[data-card-back="constellation"] .card.face-down {
  background: radial-gradient(circle at 25% 20%, #fff 0 1px, transparent 1.7px), radial-gradient(circle at 72% 34%, #a8e8ff 0 1px, transparent 1.8px), radial-gradient(circle at 38% 72%, #fff 0 1px, transparent 1.6px), radial-gradient(circle at 80% 82%, #8da8ff 0 1px, transparent 1.8px), linear-gradient(155deg, #101b4d, #172961 58%, #090e28);
  border-color: #8ec8ff;
  box-shadow: 0 4px 0 #0a1747, 0 8px 18px #02051680, inset 0 1px #ffffff88;
}
body[data-card-back="constellation"] .card.face-down::before { background: none; border-color: #8fdcff45; }
body[data-card-back="constellation"] .card.face-down::after { content: "✧"; transform: none; border-radius: 50%; border-color: #b7e9ff; }
body[data-card-back="trophy"] .card.face-down {
  background: radial-gradient(circle at 50% 25%, #ffe99b55, transparent 25%), linear-gradient(145deg, #5d347f, #9b672a 56%, #4e2a66);
  border-color: #ffd96f;
  box-shadow: 0 4px 0 #70441d, 0 8px 18px #06051378, inset 0 1px #fff0a5aa;
}
body[data-card-back="trophy"] .card.face-down::before { background: repeating-linear-gradient(135deg, #ffd96b10 0 5px, transparent 5px 11px); border-color: #ffe8a05c; }
body[data-card-back="trophy"] .card.face-down::after { content: "★"; transform: none; border-color: #ffe8a0; color: #ffe071; }
body[data-card-back="crown"] .card.face-down {
  background: radial-gradient(circle at 50% 30%, #e9be5930, transparent 30%), linear-gradient(145deg, #11131b, #3a2a16 62%, #0d0e14);
  border-color: #edc765;
  box-shadow: 0 4px 0 #3a2a13, 0 8px 18px #0009, inset 0 1px #ffe69966;
}
body[data-card-back="crown"] .card.face-down::before { background: none; border-color: #d9b95955; }
body[data-card-back="crown"] .card.face-down::after { content: "♛"; transform: none; border: 0; color: #f4d579; font-size: 22px; text-shadow: 0 2px 8px #000; }
body[data-card-back="ember"] .card.face-down {
  background: radial-gradient(circle at 50% 83%, #ffb14f78, transparent 28%), radial-gradient(circle at 35% 55%, #ff593340, transparent 23%), linear-gradient(145deg, #4b1525, #a6362d 58%, #2c101b);
  border-color: #ffad62;
  box-shadow: 0 4px 0 #641e1b, 0 8px 18px #16040880, inset 0 1px #ffd5a477;
}
body[data-card-back="ember"] .card.face-down::before { background: repeating-radial-gradient(ellipse at 50% 100%, #ffcb6b14 0 4px, transparent 5px 10px); border-color: #ffc07744; }
body[data-card-back="ember"] .card.face-down::after { content: "◆"; transform: none; border-color: #ffd08d; color: #ffcf78; }
body[data-card-back="legend"] .card.face-down {
  background: radial-gradient(circle at 20% 18%, #9affdc2b, transparent 25%), radial-gradient(circle at 75% 78%, #bd85ff25, transparent 24%), linear-gradient(145deg, #0a3832, #345777 52%, #3a235c);
  border-color: #7cf0cc;
  box-shadow: 0 4px 0 #163e48, 0 8px 18px #02051380, inset 0 1px #a7ffe288;
}
body[data-card-back="legend"] .card.face-down::before { background: linear-gradient(60deg, transparent 47%, #c3ffe31b 48% 51%, transparent 52%); background-size: 14px 14px; border-color: #a2f8da45; }
body[data-card-back="legend"] .card.face-down::after { content: "✦"; transform: none; border-radius: 50%; border-color: #9affdc; }
body[data-card-back="obsidian"] .card.face-down {
  background: radial-gradient(circle at 75% 16%, #d232ff42, transparent 28%), radial-gradient(circle at 18% 78%, #28ddff2c, transparent 28%), linear-gradient(145deg, #06070c, #171229 58%, #05060a);
  border-color: #78eaff;
  box-shadow: 0 0 14px #58eaff2f, 0 4px 0 #20182f, 0 8px 20px #000a, inset 0 1px #ffffff66;
}
body[data-card-back="obsidian"] .card.face-down::before { background: linear-gradient(135deg, transparent 45%, #7eeaff12 46% 48%, transparent 49%), linear-gradient(45deg, transparent 45%, #d95aff12 46% 48%, transparent 49%); background-size: 14px 14px; border-color: #7eeaff42; }
body[data-card-back="obsidian"] .card.face-down::after { content: "✦"; transform: none; border-color: #7eeaff; color: #d7fbff; box-shadow: 0 0 12px #7eeaff45; }

.achievement.rare:not(.locked) { background: linear-gradient(135deg, #ffd85c10, #8b62ff10); box-shadow: inset 0 0 0 1px #ffd96920; }

@media (max-width: 370px) {
  .cardback-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ===== Extended theme collection ===== */
.theme-forest { background: linear-gradient(145deg, #36b878, #185d58 58%, #15394a); }
.theme-frost { background: linear-gradient(145deg, #d9fbff, #6fc8ed 48%, #667be8); color: #16314a; }
.theme-candy { background: linear-gradient(145deg, #ff8bc5, #ffb15c 52%, #8869ff); }
.theme-midnight { background: linear-gradient(145deg, #071126, #17265a 52%, #64388d); }
.theme-gold { background: linear-gradient(145deg, #f7d56a, #c37a2f 54%, #6d3c35); }

body[data-theme="forest"] { background: linear-gradient(155deg, #071d1a, #0d302d 58%, #10243a); }
body[data-theme="forest"] .app,
body[data-theme="forest"] .hub-shell { background: radial-gradient(circle at 12% 8%, #55d99b28, transparent 28%), linear-gradient(160deg, #1d5b50, #1a4052 48%, #18294c); }
body[data-theme="forest"] .brand-mark,
body[data-theme="forest"] .controls .primary { background: linear-gradient(145deg, #55d995, #2b87a2); }
body[data-theme="forest"] .card.face-down { background: linear-gradient(145deg, #45bd78, #287468 55%, #31549b); border-color: #a0efc8; }

body[data-theme="frost"] { background: linear-gradient(155deg, #dff8ff, #9fd8ed 56%, #7188bc); }
body[data-theme="frost"] .app,
body[data-theme="frost"] .hub-shell { background: radial-gradient(circle at 84% 4%, #ffffff5c, transparent 25%), linear-gradient(160deg, #7dc8df, #6d8bc5 50%, #53659c); }
body[data-theme="frost"] .brand-mark,
body[data-theme="frost"] .controls .primary { background: linear-gradient(145deg, #baf5ff, #62a9ed 55%, #6c6ee8); }
body[data-theme="frost"] .card.face-down { background: linear-gradient(145deg, #bff7ff, #6fc7eb 52%, #7278e3); border-color: #e7fdff; }

body[data-theme="candy"] { background: linear-gradient(155deg, #401735, #64234c 54%, #39295d); }
body[data-theme="candy"] .app,
body[data-theme="candy"] .hub-shell { background: radial-gradient(circle at 10% 12%, #ffcf7050, transparent 27%), radial-gradient(circle at 90% 6%, #ff72c64a, transparent 28%), linear-gradient(160deg, #8a3e68, #57366e 50%, #303668); }
body[data-theme="candy"] .brand-mark,
body[data-theme="candy"] .controls .primary { background: linear-gradient(145deg, #ffb654, #ff6caf 52%, #8969ff); }
body[data-theme="candy"] .card.face-down { background: linear-gradient(145deg, #ff9b75, #f455bd 52%, #805bdf); border-color: #ffd5ee; }

body[data-theme="midnight"] { background: #030712; }
body[data-theme="midnight"] .app,
body[data-theme="midnight"] .hub-shell { background: radial-gradient(circle at 82% 4%, #7953e92b, transparent 28%), linear-gradient(160deg, #09142b, #121d43 53%, #171337); }
body[data-theme="midnight"] .brand-mark,
body[data-theme="midnight"] .controls .primary { background: linear-gradient(145deg, #405fe0, #793cb4); }
body[data-theme="midnight"] .card.face-down { background: radial-gradient(circle at 70% 15%, #6f8cff35, transparent 24%), linear-gradient(145deg, #0c1937, #243678 55%, #432761); border-color: #718cff; }

body[data-theme="gold"] { background: linear-gradient(155deg, #24140c, #462718 55%, #2b1b21); }
body[data-theme="gold"] .app,
body[data-theme="gold"] .hub-shell { background: radial-gradient(circle at 80% 5%, #ffd97036, transparent 27%), linear-gradient(160deg, #705126, #503225 52%, #30213c); }
body[data-theme="gold"] .brand-mark,
body[data-theme="gold"] .controls .primary { background: linear-gradient(145deg, #ffe27a, #d69338 58%, #a75543); }
body[data-theme="gold"] .card.face-down { background: linear-gradient(145deg, #f5d064, #b8762b 56%, #74422c); border-color: #ffe7a0; }

/* ===== Extended card-back collection ===== */
.cardback-preview.back-mosaic { background: conic-gradient(from 45deg, #ff7ab5 0 12.5%, #704dff 0 25%, #44d8c4 0 37.5%, #ffd15f 0 50%, #ff7ab5 0 62.5%, #704dff 0 75%, #44d8c4 0 87.5%, #ffd15f 0); background-size: 18px 18px; }
.cardback-preview.back-velvet { background: radial-gradient(circle at 50% 25%, #efb4cf24, transparent 24%), linear-gradient(145deg, #58193f, #87265d 55%, #33162e); border-color: #eba5c9; }
.cardback-preview.back-glacier { background: linear-gradient(135deg, #e8fdff, #68cce7 45%, #5478d7); border-color: #eaffff; }
.cardback-preview.back-lotus { background: radial-gradient(ellipse at 50% 70%, #ffb1cf 0 18%, transparent 19%), radial-gradient(ellipse at 32% 58%, #ff8fbd 0 16%, transparent 17%), radial-gradient(ellipse at 68% 58%, #ff8fbd 0 16%, transparent 17%), linear-gradient(145deg, #213c53, #613e70); border-color: #ffc0da; }
.cardback-preview.back-master { background: linear-gradient(135deg, #171928, #4b3e91 48%, #d6aa44); border-color: #ffe080; }
.cardback-preview.back-atlas { background: radial-gradient(circle at 50% 50%, transparent 0 28%, #81d7bf33 29% 31%, transparent 32%), linear-gradient(145deg, #153e42, #256a66 52%, #182e42); border-color: #8de2c8; }
.cardback-preview.back-chronicle { background: repeating-linear-gradient(0deg, #f2dfb8 0 6px, #e5cb99 6px 7px), linear-gradient(#f2dfb8, #cda96e); border-color: #ffe9b9; }
.cardback-preview.back-phoenix { background: radial-gradient(circle at 50% 70%, #ffd45f88, transparent 25%), radial-gradient(circle at 50% 55%, #ff683e66, transparent 32%), linear-gradient(145deg, #421329, #8b2526 58%, #26101f); border-color: #ffb15f; }

body[data-card-back="mosaic"] .card.face-down { background: conic-gradient(from 45deg at 50% 50%, #ff73b0 0 12.5%, #704dff 0 25%, #43d4c1 0 37.5%, #ffd05b 0 50%, #ff73b0 0 62.5%, #704dff 0 75%, #43d4c1 0 87.5%, #ffd05b 0); background-size: 28px 28px; border-color: #fff0c9; }
body[data-card-back="mosaic"] .card.face-down::before { background: #140f3030; border-color: #ffffff70; }
body[data-card-back="mosaic"] .card.face-down::after { content: "◆"; transform: none; border-color: #fff; }
body[data-card-back="velvet"] .card.face-down { background: radial-gradient(circle at 50% 18%, #ffc9e32d, transparent 27%), linear-gradient(145deg, #4a1436, #84265b 56%, #2c1028); border-color: #e9a0c5; box-shadow: 0 4px 0 #49132f, 0 8px 18px #10030c88, inset 0 1px #ffd7e677; }
body[data-card-back="velvet"] .card.face-down::before { background: repeating-radial-gradient(circle at 50% 50%, #ffffff08 0 2px, transparent 3px 7px); border-color: #f4b5d255; }
body[data-card-back="velvet"] .card.face-down::after { content: "✦"; transform: none; border: 0; color: #ffd0e6; font-size: 21px; }
body[data-card-back="glacier"] .card.face-down { background: linear-gradient(135deg, #e5fcff, #76cfe9 45%, #5578da); border-color: #eaffff; box-shadow: 0 4px 0 #477ca8, 0 8px 18px #07122870, inset 0 1px #ffffffdd; }
body[data-card-back="glacier"] .card.face-down::before { background: linear-gradient(135deg, transparent 44%, #ffffff35 45% 47%, transparent 48%), linear-gradient(45deg, transparent 44%, #ffffff20 45% 47%, transparent 48%); background-size: 17px 17px; border-color: #ffffff99; }
body[data-card-back="glacier"] .card.face-down::after { content: "❄"; transform: none; border: 0; color: #fff; font-size: 22px; text-shadow: 0 2px 7px #4776ad; }
body[data-card-back="lotus"] .card.face-down { background: radial-gradient(ellipse at 50% 70%, #ffc0d8 0 18%, transparent 19%), radial-gradient(ellipse at 32% 58%, #ff8cbb 0 16%, transparent 17%), radial-gradient(ellipse at 68% 58%, #ff8cbb 0 16%, transparent 17%), linear-gradient(145deg, #18394b, #613b6d); border-color: #ffc4dd; }
body[data-card-back="lotus"] .card.face-down::before { background: none; border-color: #ffd7e455; }
body[data-card-back="lotus"] .card.face-down::after { content: "✿"; transform: none; border: 0; color: #ffe0ec; font-size: 24px; }
body[data-card-back="master"] .card.face-down { background: radial-gradient(circle at 70% 15%, #ffd55a30, transparent 25%), linear-gradient(145deg, #121522, #443986 54%, #8d6b27); border-color: #ffda67; box-shadow: 0 0 14px #ffd75b25, 0 8px 18px #05051285; }
body[data-card-back="master"] .card.face-down::before { background: linear-gradient(45deg, transparent 46%, #ffd96a18 47% 50%, transparent 51%); background-size: 14px 14px; border-color: #ffe18a55; }
body[data-card-back="master"] .card.face-down::after { content: "×10"; transform: none; border: 0; width: auto; color: #ffe28a; font-size: 17px; font-weight: 900; }
body[data-card-back="atlas"] .card.face-down { background: radial-gradient(circle at 50% 50%, transparent 0 29%, #94e0c737 30% 32%, transparent 33%), radial-gradient(circle at 50% 50%, transparent 0 44%, #94e0c720 45% 47%, transparent 48%), linear-gradient(145deg, #12383b, #266b65 54%, #172d41); border-color: #8ce0c7; }
body[data-card-back="atlas"] .card.face-down::before { background: linear-gradient(90deg, transparent 49%, #b7f4df1f 50% 51%, transparent 52%), linear-gradient(0deg, transparent 49%, #b7f4df18 50% 51%, transparent 52%); border-color: #a9efd966; }
body[data-card-back="atlas"] .card.face-down::after { content: "◎"; transform: none; border-color: #b9f5e0; color: #d9fff1; }
body[data-card-back="chronicle"] .card.face-down { background: repeating-linear-gradient(0deg, #f0ddb7 0 8px, #e1c68e 8px 9px); border-color: #fff0c9; color: #5b432c; box-shadow: 0 4px 0 #9d7e50, 0 8px 18px #24180d55, inset 0 1px #fff; }
body[data-card-back="chronicle"] .card.face-down::before { background: none; border-color: #9d774d55; }
body[data-card-back="chronicle"] .card.face-down::after { content: "100"; transform: none; border-color: #8e683e; color: #765332; font-size: 15px; font-weight: 900; }
body[data-card-back="phoenix"] .card.face-down { background: radial-gradient(circle at 50% 82%, #ffd45f80, transparent 24%), radial-gradient(circle at 50% 58%, #ff633e64, transparent 33%), linear-gradient(145deg, #3a1024, #8b2527 58%, #250d1c); border-color: #ffad5e; box-shadow: 0 0 16px #ff6a3830, 0 8px 18px #18040880; }
body[data-card-back="phoenix"] .card.face-down::before { background: repeating-radial-gradient(ellipse at 50% 100%, #ffc15b12 0 4px, transparent 5px 11px); border-color: #ffc97955; }
body[data-card-back="phoenix"] .card.face-down::after { content: "♨"; transform: none; border: 0; color: #ffd071; font-size: 24px; text-shadow: 0 2px 8px #6d1710; }

/* ===== Game hub v2 ===== */
.move-counter { display:inline-flex; align-items:center; gap:2px; color:#c8c3ea; font-weight:800; }
.move-counter b { color:#fff; }
.hub-nav {
  position: relative;
  z-index: 30;
  padding: 8px 12px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid #ffffff12;
  background: linear-gradient(180deg, #17143be8, #12102eea);
  box-shadow: 0 -12px 30px #08071c3b, inset 0 1px #ffffff0b;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.hub-tabs {
  display:grid;
  grid-template-columns:repeat(6,minmax(0,1fr));
  gap:6px;
}
.hub-tabs button {
  min-width:0;
  min-height:54px;
  border:1px solid #ffffff10;
  border-radius:15px;
  background:#ffffff08;
  color:#aaa6cf;
  display:grid;
  place-items:center;
  align-content:center;
  gap:4px;
  padding:5px 2px;
  -webkit-tap-highlight-color:transparent;
}
.hub-tabs button i { font-style:normal; font-size:17px; line-height:1; }
.hub-tabs button span { font-size:8px; font-weight:850; white-space:nowrap; }
.hub-tabs button.active {
  color:#fff;
  background:linear-gradient(145deg,#7658ed66,#4acde02d);
  border-color:#a393ff55;
  box-shadow:0 7px 18px #0000002a,inset 0 1px #ffffff22;
}
.profile-hero { display:grid; grid-template-columns:48px minmax(0,1fr) auto; gap:10px; align-items:center; padding:12px 13px; border:1px solid #ffffff14; border-radius:18px; background:linear-gradient(135deg,#ffffff0e,#7059e817); }
.profile-avatar { width:48px; height:48px; border-radius:15px; display:grid; place-items:center; font-size:22px; font-weight:900; background:linear-gradient(145deg,#9868ff,#4f7cff); box-shadow:0 8px 18px #00000030,inset 0 1px #fff7; }
.profile-copy b,.profile-meta b { display:block; font-size:13px; }
.profile-copy span,.profile-meta span { display:block; margin-top:3px; color:#aaa6cf; font-size:8px; font-weight:750; }
.profile-meta { text-align:right; }
.profile-meta b { color:#ffd86a; }
.play-hero { display:grid; gap:10px; }
.hero-play { width:100%; min-height:56px; border:0; border-radius:16px; background:linear-gradient(135deg,#8b62ff,#5e61ed 50%,#438cf5); color:#fff; font-size:15px; font-weight:900; box-shadow:0 10px 24px #00000035,inset 0 1px #ffffff66; }
.mode-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.mode-card { min-height:86px; border:1px solid #ffffff14; border-radius:18px; padding:11px 12px; background:#ffffff0a; color:#fff; text-align:left; display:grid; grid-template-columns:auto 1fr; grid-template-rows:auto auto; column-gap:9px; align-content:center; }
.mode-card i { grid-row:1/3; width:35px; height:35px; display:grid; place-items:center; border-radius:12px; background:#ffffff10; font-style:normal; font-size:19px; }
.mode-card b { font-size:12px; }
.mode-card span { color:#aaa6cf; font-size:8px; font-weight:700; margin-top:3px; }
.mode-card.daily { background:linear-gradient(135deg,#ff9f5221,#ff5fa21b); }
.mode-card.marathon { background:linear-gradient(135deg,#6659ff28,#b95cff1d); }
.mode-card.calm { background:linear-gradient(135deg,#4ed7ff20,#85e6a715); }
.mode-card.challenge { background:linear-gradient(135deg,#ffd85c18,#8c62ff20); }
.weekly-card { display:grid; grid-template-columns:48px 1fr; gap:11px; padding:13px; border-radius:18px; border:1px solid #ffffff14; background:linear-gradient(135deg,#ffd85c10,#8b62ff18); }
.weekly-card.done { border-color:#85e6a74b; background:linear-gradient(135deg,#85e6a71b,#4ed7ff12); }
.weekly-icon { width:48px; height:48px; display:grid; place-items:center; border-radius:14px; background:#ffffff0c; color:#ffd96a; font-size:20px; font-weight:900; }
.weekly-copy small { display:block; color:#ffd96a; font-size:7px; letter-spacing:.11em; font-weight:900; }
.weekly-copy b { display:block; margin-top:3px; font-size:12px; }
.weekly-copy span { display:block; margin-top:3px; color:#aaa6cf; font-size:8px; }
.weekly-copy em { display:block; margin-top:4px; color:#cbc7ea; font-size:8px; font-style:normal; font-weight:800; }
.weekly-progress { height:6px; margin-top:8px; border-radius:99px; background:#ffffff10; overflow:hidden; }
.weekly-progress i { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,#ffd85c,#ff7fb4); }
.challenge-input-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:7px; }
.challenge-input-row input { min-width:0; height:42px; border:1px solid #ffffff18; border-radius:12px; padding:0 11px; background:#09091f55; color:#fff; outline:0; font:inherit; font-size:10px; user-select:text; -webkit-user-select:text; }
.challenge-input-row button,.wide-secondary,.save-tools button { border:1px solid #ffffff14; border-radius:12px; background:#ffffff0d; color:#fff; font-weight:850; padding:0 12px; }

/* Chapter map — alternating path instead of a dashboard grid. */
.chapter-path {
  position:relative;
  display:grid;
  grid-template-columns:repeat(6,minmax(0,1fr));
  gap:10px 7px;
  padding:8px 4px 4px;
}
.chapter-path::before { display:none; }
.chapter-path .chapter-level { position:relative; z-index:1; }
.chapter-path .chapter-level::after {
  content:"";
  position:absolute;
  top:50%;
  left:100%;
  width:7px;
  height:1px;
  background:#9f91ff2e;
  pointer-events:none;
}
.chapter-path .chapter-level:nth-child(5n)::after,
.chapter-path .chapter-level:last-child::after { display:none; }
.chapter-section.perfect { border-color:#ffd96a3d; box-shadow:inset 0 0 28px #ffd85c08; }

/* Achievement progress. */
.achievement-filters { display:flex; gap:5px; margin:-2px 0 9px; overflow:auto; scrollbar-width:none; }
.achievement-filters button { flex:0 0 auto; border:1px solid #ffffff11; border-radius:99px; padding:6px 9px; background:#ffffff08; color:#aaa6cf; font-size:8px; font-weight:850; }
.achievement-filters button.active { background:#8162ef45; color:#fff; border-color:#9d89ff45; }
.achievement-copy { min-width:0; }
.achievement-progress { height:4px; margin-top:5px; background:#ffffff10; border-radius:99px; overflow:hidden; }
.achievement-progress i { display:block; height:100%; background:linear-gradient(90deg,#4ed7ff,#8b62ff,#ff68ad); }
.achievement-copy small { display:block; margin-top:2px; color:#8f8bad; font-size:7px; }
.achievement.done-achievement .achievement-progress i { background:linear-gradient(90deg,#85e6a7,#4ed7ff); }
.title-grid { display:flex; gap:6px; flex-wrap:wrap; }
.title-chip { border:1px solid #ffffff13; border-radius:99px; padding:7px 9px; background:#ffffff08; color:#c5c1e6; font-size:8px; font-weight:850; }
.title-chip.selected { color:#fff; background:#7c5cff45; border-color:#9e8aff55; }
.title-chip.locked { opacity:.35; }
.text-button { border:0; background:none; color:#9e91ff; font-size:8px; font-weight:850; }

/* Encyclopedia. */
.encyclopedia-detail { margin-bottom:11px; padding:12px; border-radius:16px; background:linear-gradient(135deg,#ffffff0c,#6d56d817); border:1px solid #ffffff12; }
.encyclopedia-title { display:flex; gap:10px; align-items:center; }
.encyclopedia-title > span { width:40px; height:40px; border-radius:12px; display:grid; place-items:center; background:hsl(var(--cat) 70% 50%); font-size:17px; font-weight:900; box-shadow:inset 0 1px #fff5; }
.encyclopedia-title b { display:block; font-size:14px; }
.encyclopedia-title small { display:block; color:#aaa6cf; font-size:8px; margin-top:2px; }
.encyclopedia-meta { display:grid; grid-template-columns:repeat(3,1fr); gap:5px; margin-top:9px; }
.encyclopedia-meta span { padding:6px 5px; border-radius:9px; background:#ffffff08; color:#aaa6cf; font-size:7px; text-align:center; }
.encyclopedia-meta b { color:#fff; }
.word-collection { display:flex; flex-wrap:wrap; gap:5px; margin-top:10px; }
.word-collection span { padding:5px 7px; border-radius:99px; font-size:8px; font-weight:800; background:#ffffff0a; color:#aaa6cf; }
.word-collection .known { background:#805fff2d; color:#f5f3ff; border:1px solid #9887ff22; }
.word-collection .unknown { letter-spacing:.08em; opacity:.48; }
.encyclopedia-grid .collection-item { border:0; color:inherit; }
.encyclopedia-grid .collection-item.selected { outline:2px solid #9b87ff; outline-offset:-2px; }

/* Appearance preview and effects. */
.effect-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; }
.effect-tile { min-width:0; min-height:90px; padding:8px 5px; border:1px solid #ffffff14; border-radius:14px; background:#ffffff08; color:#fff; display:grid; justify-items:center; gap:4px; }
.effect-tile.selected { outline:2px solid #fff; outline-offset:-3px; }
.effect-tile.locked { opacity:.42; }
.effect-tile b { font-size:9px; }
.effect-tile > span:last-child { color:#aaa6cf; font-size:7px; text-align:center; }
.effect-preview { position:relative; display:block; width:48px; height:42px; }
.effect-preview i { position:absolute; left:50%; top:50%; width:7px; height:7px; border-radius:2px; background:#ffd85c; transform:translate(-50%,-50%); }
.effect-preview i:nth-child(1){transform:translate(-20px,-15px) rotate(25deg)}.effect-preview i:nth-child(2){transform:translate(12px,-9px) rotate(55deg)}.effect-preview i:nth-child(3){transform:translate(-2px,11px) rotate(10deg)}
.effect-confetti i{background:#ff6caf}.effect-petals i{border-radius:80% 20% 80% 20%;background:#ff9bc6}.effect-comet i{width:14px;height:4px;border-radius:99px;background:linear-gradient(90deg,transparent,#8ff5ff)}.effect-aurora i{width:20px;height:7px;border-radius:50%;filter:blur(2px);background:#5effc8}.effect-legend i{background:#fff;box-shadow:0 0 9px #ffd85c}

/* Save tools / health. */
.save-tools { display:grid; grid-template-columns:1fr 1fr; gap:7px; }
.save-tools button,.wide-secondary { min-height:44px; }
.bank-health-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:6px; }
.bank-health-grid span { padding:8px; border-radius:11px; background:#ffffff08; color:#aaa6cf; font-size:8px; }
.bank-health-grid b { color:#fff; font-size:13px; }
.bank-health p { color:#8f8bad; font-size:8px; line-height:1.35; margin:8px 0 0; }
.empty-state { padding:20px 10px; text-align:center; color:#8581a7; font-size:9px; }

/* Win record. */
.win-record { position:relative; margin:2px 0 9px; color:#777287; font-size:10px; font-weight:800; }
.win-record.new-record { color:#7a58e8; animation:recordPop .55s cubic-bezier(.2,.9,.2,1); }
@keyframes recordPop { 0%{transform:scale(.88);opacity:0} 55%{transform:scale(1.06)} 100%{transform:scale(1);opacity:1} }

/* App update banner. */
.update-banner { position:fixed; z-index:20000; left:50%; bottom:max(12px,env(safe-area-inset-bottom)); width:min(430px,calc(100vw - 24px)); transform:translate(-50%,120%); opacity:0; pointer-events:none; display:grid; grid-template-columns:1fr auto; gap:10px; align-items:center; padding:12px 13px; border-radius:17px; background:#17152bf5; border:1px solid #ffffff25; box-shadow:0 16px 44px #0008; transition:.28s cubic-bezier(.2,.8,.2,1); }
.update-banner.show { transform:translate(-50%,0); opacity:1; pointer-events:auto; }
.update-banner b { display:block; font-size:11px; }.update-banner span{display:block;margin-top:2px;color:#aaa6cf;font-size:8px}.update-banner button{border:0;border-radius:11px;background:linear-gradient(135deg,#8b62ff,#4e83f5);color:#fff;font-weight:900;padding:10px 12px}

/* Cosmetic victory particles. */
.spark-petals { border-radius:85% 15% 80% 20%; }
.spark-comet { width:16px; height:4px; border-radius:99px; background:linear-gradient(90deg,transparent,hsl(var(--spark-h) 95% 70%)); }
.spark-aurora { width:20px; height:7px; border-radius:50%; filter:blur(2px); }
.spark-legend { border-radius:50%; box-shadow:0 0 10px currentColor; }

/* Subtle board parallax while a card is dragged. */
.app::before { transform:translate(var(--parallax-x,0),var(--parallax-y,0)); transition:transform .16s ease-out; }

/* Shareable Daily/challenge/level results. */
.win-share {
  width:100%; margin:2px 0 10px; min-height:42px; border:1px solid #7868ba26; border-radius:13px;
  background:#f0edf9; color:#514a76; font-weight:900; font-size:10px; box-shadow:none;
}
.win-share[hidden] { display:none !important; }


/* Profile editor + neutral-shadow cleanup. */
.profile-settings { display:grid; gap:10px; }
.profile-settings .hub-section-head { margin-bottom:0; }
.profile-field { display:grid; gap:5px; }
.profile-field > span { color:#aaa6cf; font-size:8px; font-weight:850; text-transform:uppercase; letter-spacing:.06em; }
.profile-field input, .profile-field select {
  width:100%; height:44px; border:1px solid #ffffff18; border-radius:12px; padding:0 12px;
  background:#0b0c22b8; color:#fff; font:inherit; font-size:11px; font-weight:800; outline:none;
  user-select:text; -webkit-user-select:text;
}
.profile-field select { appearance:auto; }
.profile-field input:focus, .profile-field select:focus { border-color:#ffffff42; box-shadow:none; }
.profile-save { min-height:44px; border:1px solid #ffffff1b; border-radius:12px; background:#ffffff12; color:#fff; font-weight:900; }

/* Colored UI glows are intentionally disabled; shadows stay neutral. */
.hub-tabs button.active, .profile-avatar, .hero-play, .brand-mark, .controls .primary { filter:none; }

/* ===== Network friend challenges ===== */
.owned-challenge-list { display:grid; gap:8px; }
.owned-challenge { padding:11px; border:1px solid #ffffff12; border-radius:14px; background:#ffffff08; }
.owned-challenge.completed { border-color:#85e6a737; background:linear-gradient(135deg,#85e6a70f,#4ed7ff0c); }
.owned-challenge-code { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.owned-challenge-code b { font:900 18px/1 ui-monospace,SFMono-Regular,Menlo,monospace; letter-spacing:.08em; color:#fff; }
.owned-challenge-code span { max-width:62%; text-align:right; color:#aaa6cf; font-size:8px; line-height:1.25; font-weight:750; }
.owned-challenge-results { display:grid; gap:7px; margin-top:9px; color:#c9c6e8; font-size:8px; }
.owned-challenge-results strong { color:#ffd86a; font-size:8px; }
.challenge-result-row { display:grid; gap:3px; padding:7px 8px; border-radius:10px; background:#ffffff07; border:1px solid #ffffff0d; }
.challenge-result-row > div { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.challenge-result-row b { color:#fff; font-size:9px; }
.challenge-result-row span { color:#d7d3ef; font-size:8px; font-weight:800; }
.challenge-result-row small { color:#aaa6cf; font-size:7.5px; line-height:1.25; }
.challenge-result-row.empty { opacity:.65; }
.owned-challenge-actions { display:flex; gap:7px; margin-top:9px; }
.owned-challenge-actions button { min-height:36px; border:1px solid #ffffff16; border-radius:10px; background:#ffffff0d; color:#fff; padding:0 11px; font-weight:850; font-size:9px; }
.challenge-input-row input { text-transform:uppercase; letter-spacing:.12em; font-weight:900; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; }

/* ===== Retention systems v3 ===== */
.splash {
  position: fixed;
  inset: 0;
  z-index: 30000;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 15%, #3c8fb42b 0 18%, transparent 37%),
    radial-gradient(circle at 82% 78%, #d2679730 0 16%, transparent 38%),
    linear-gradient(155deg, #11152f 0%, #24204d 48%, #172b4c 100%);
  opacity: 1;
  transition: opacity .42s ease, visibility .42s ease;
}
.splash.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.splash::before {
  content: "";
  position: absolute;
  width: min(88vw, 430px);
  aspect-ratio: 1;
  border: 1px solid #ffffff0c;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff05 0 1px, transparent 1.5px) 0 0/19px 19px;
  animation: splashSpin 28s linear infinite;
}
.splash-core { position: relative; z-index: 2; width: min(78vw, 330px); text-align: center; }
.splash-mark {
  width: 82px;
  height: 82px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  border: 1px solid #ffffff36;
  background: linear-gradient(145deg, #8d70ef, #547be4 55%, #419ac1);
  box-shadow: 0 16px 32px #00000035, inset 0 1px #ffffff80;
  font-size: 39px;
  font-weight: 950;
  animation: splashMark 2.6s ease-in-out infinite;
}
.splash h1 { margin: 0; font-size: clamp(36px, 11vw, 48px); line-height: .95; letter-spacing: -.055em; }
.splash p { margin: 10px 0 26px; color: #cbc9e6; font-size: 10px; font-weight: 850; letter-spacing: .2em; text-transform: uppercase; }
.splash-progress { width: 100%; height: 7px; overflow: hidden; border-radius: 99px; background: #ffffff12; border: 1px solid #ffffff0d; }
.splash-progress i { display: block; width: 7%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #5fd6e9, #8f79ef, #f08bad); transition: width .28s ease; }
.splash-status { display: block; min-height: 17px; margin-top: 10px; color: #aeadcc; font-size: 10px; font-weight: 750; }
.splash-retry { margin-top: 13px; min-height: 40px; padding: 0 16px; border: 1px solid #ffffff20; border-radius: 12px; background: #ffffff10; color: #fff; font-weight: 850; }
.splash.error .splash-progress i { background: #ff7f86; }
.splash-orbit { position: absolute; inset: 0; pointer-events: none; }
.splash-mini-card {
  position: absolute;
  width: 70px;
  height: 96px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid #ffffffbc;
  background: linear-gradient(160deg, #fff, #f1f2f7);
  box-shadow: 0 12px 28px #00000028;
  color: #20243e;
  font-size: 10px;
  font-weight: 900;
  opacity: .42;
}
.splash-mini-card.c1 { left: 7%; top: 17%; transform: rotate(-12deg); animation: splashFloatA 4.3s ease-in-out infinite; }
.splash-mini-card.c2 { right: 5%; top: 24%; transform: rotate(10deg); animation: splashFloatB 4.8s ease-in-out infinite .3s; }
.splash-mini-card.c3 { left: 11%; bottom: 13%; transform: rotate(8deg); animation: splashFloatB 5.1s ease-in-out infinite .6s; }
.splash-mini-card.c4 { right: 8%; bottom: 11%; transform: rotate(-9deg); animation: splashFloatA 4.6s ease-in-out infinite .9s; }
@keyframes splashSpin { to { transform: rotate(360deg); } }
@keyframes splashMark { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-5px) scale(1.025); } }
@keyframes splashFloatA { 0%,100% { translate: 0 0; } 50% { translate: 0 -12px; } }
@keyframes splashFloatB { 0%,100% { translate: 0 0; } 50% { translate: 0 10px; } }

.bonus-objective-wrap { min-height: 0; display: flex; justify-content: flex-end; overflow: hidden; }
.bonus-objective-wrap:empty { display: none; }
.bonus-objective-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid #ffffff16;
  border-radius: 999px;
  background: #090b22a8;
  color: #f4f2ff;
  font-size: 8px;
  font-weight: 900;
  white-space: nowrap;
}
.bonus-objective-chip small { color: #aaa9c5; font-size: 7px; font-weight: 800; }
.bonus-objective-chip.failed { opacity: .56; text-decoration: line-through; }

.profile-hero { position: relative; overflow: hidden; }
.profile-hero::after { content:""; position:absolute; inset:0; border-radius:inherit; border:1px solid hsl(var(--frame-h,250) 74% 72% / .22); pointer-events:none; }
.profile-hero[data-frame="none"]::after { display:none; }
.profile-avatar { border: 2px solid hsl(var(--frame-h,250) 70% 72% / .58) !important; box-shadow: 0 7px 18px #00000025 !important; }
.profile-copy { min-width: 0; }
.profile-xp { display:block; height: 5px; margin-top: 6px; overflow: hidden; border-radius: 99px; background: #ffffff12; }
.profile-xp i { display:block; height:100%; border-radius:inherit; background: linear-gradient(90deg,#58cee1,#efb463); }

.smart-action {
  display: grid;
  grid-template-columns: 46px minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid #ffffff18;
  border-radius: 18px;
  background: linear-gradient(135deg,#ffffff0e,#2d789f16);
  box-shadow: 0 9px 22px #00000020;
}
.smart-icon { width:46px; height:46px; display:grid; place-items:center; border-radius:14px; background:#ffffff0d; border:1px solid #ffffff12; font-size:22px; }
.smart-copy { min-width:0; }
.smart-copy small { display:block; color:#73d9e4; font-size:7.5px; letter-spacing:.12em; font-weight:900; }
.smart-copy b { display:block; margin-top:2px; font-size:13px; }
.smart-copy span { display:block; margin-top:3px; color:#aaa7ca; font-size:8px; line-height:1.25; }
.smart-action button { min-height:38px; padding:0 11px; border:1px solid #ffffff20; border-radius:11px; background:#ffffff12; color:#fff; font-size:8.5px; font-weight:900; }
.smart-duel { border-color:#ffd76938; background:linear-gradient(135deg,#ffd65b12,#ffffff08); }
.smart-duel .smart-copy small { color:#ffd76b; }
.smart-daily { background:linear-gradient(135deg,#ffad6814,#ffffff08); }
.smart-chapter { background:linear-gradient(135deg,#5fd0df14,#ffffff08); }

.daily-calendar { padding: 12px; border:1px solid #ffffff13; border-radius:18px; background:#ffffff08; }
.daily-calendar-head { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.daily-calendar-head small { display:block; color:#aaa6cc; font-size:7.5px; font-weight:900; letter-spacing:.13em; }
.daily-calendar-head b { display:block; margin-top:2px; font-size:13px; }
.daily-calendar-head > span { color:#ffbe65; font-size:10px; font-weight:900; }
.daily-days { display:grid; grid-template-columns:repeat(7,1fr); gap:5px; margin-top:10px; }
.daily-day { min-width:0; padding:6px 2px; display:grid; gap:4px; place-items:center; border:1px solid #ffffff0d; border-radius:10px; background:#ffffff06; color:#9692b5; }
.daily-day span { font-size:7px; font-weight:850; }
.daily-day i { width:20px; height:20px; display:grid; place-items:center; border-radius:50%; background:#ffffff09; color:#fff; font-size:9px; font-style:normal; font-weight:900; }
.daily-day.today { border-color:#63d3df55; color:#fff; }
.daily-day.done { background:#60d0a312; color:#d7ffec; border-color:#68d2aa35; }
.daily-day.done i { background:#5ec99d; color:#10261f; }
.daily-milestones { display:grid; grid-template-columns:repeat(3,1fr); gap:6px; margin-top:9px; }
.daily-milestones span { display:flex; align-items:center; justify-content:space-between; gap:4px; padding:5px 7px; border-radius:9px; background:#ffffff06; color:#817e9d; }
.daily-milestones b { font-size:7.5px; }
.daily-milestones small { font-size:6.5px; }
.daily-milestones .reached { color:#ffe7a0; background:#ffd7650d; }
.daily-milestones .claimed { color:#a9e8ce; }

.near-goals { display:grid; gap:7px; padding:12px; border:1px solid #ffffff12; border-radius:18px; background:#ffffff07; }
.near-goals-head { display:flex; align-items:baseline; justify-content:space-between; gap:10px; }
.near-goals-head b { font-size:12px; }
.near-goals-head span { color:#9894b9; font-size:7.5px; }
.near-goal { display:grid; grid-template-columns:32px 1fr; align-items:center; gap:8px; padding:7px 8px; border-radius:11px; background:#ffffff06; }
.near-goal > i { width:32px; height:32px; display:grid; place-items:center; border-radius:10px; background:#ffffff0a; color:#f0d477; font-style:normal; font-weight:900; }
.near-goal b,.near-goal span { display:block; }
.near-goal b { font-size:9px; }
.near-goal span { margin-top:2px; color:#aaa7c9; font-size:7.5px; }
.near-goal em { display:block; height:4px; margin-top:5px; overflow:hidden; border-radius:99px; background:#ffffff0c; }
.near-goal em u { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,#59cedd,#eab968); text-decoration:none; }

.mastery-progress { position:relative; height:17px; margin-top:9px; overflow:hidden; border-radius:99px; background:#ffffff08; border:1px solid #ffffff0c; }
.mastery-progress i { display:block; height:100%; background:linear-gradient(90deg,#52c9c4,#e9c05e); border-radius:inherit; opacity:.8; }
.mastery-progress span { position:absolute; inset:0; display:grid; place-items:center; color:#fff; font-size:7px; font-weight:900; }
.encyclopedia-detail.mastered { border-color:#e7c75d40; background:linear-gradient(135deg,#e3bf5410,#ffffff08); }
.collection-item.mastered { border-color:#e5c45b4a !important; }

.frame-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; }
.frame-tile { min-height:82px; display:grid; place-items:center; align-content:center; gap:4px; padding:7px 5px; border:1px solid hsl(var(--frame-h,250) 70% 65% / .27); border-radius:13px; background:#ffffff07; color:#fff; }
.frame-tile i { width:32px; height:32px; display:grid; place-items:center; border:2px solid hsl(var(--frame-h,250) 73% 70% / .72); border-radius:10px; color:hsl(var(--frame-h,250) 76% 76%); font-style:normal; }
.frame-tile b { font-size:8px; }
.frame-tile span { color:#9995b9; font-size:6.5px; }
.frame-tile.selected { outline:2px solid #fff; outline-offset:-3px; }
.frame-tile.locked { opacity:.42; filter:grayscale(.5); }

.slot.locked-slot { opacity:.48; border-color:#ffffff0d; filter:saturate(.4); }
.slot.locked-slot::after { content:"🔒" !important; color:#ffffff8a !important; font-size:15px !important; }

.challenge-series-line { margin-top:7px; padding:5px 7px; border-radius:8px; background:#ffffff06; color:#d3cfed; font-size:7.5px; font-weight:800; }

.win-xp { min-height:31px; margin:2px 0 8px; display:flex; align-items:center; justify-content:center; gap:4px; color:#686476; font-size:9px; }
.win-xp b { color:#327b88; font-size:14px; }
.win-goals { margin-bottom:9px; text-align:left; }
.win-goals .near-goals { padding:8px; border-radius:12px; background:#f1f2f7; border-color:#e4e5eb; }
.win-goals .near-goals-head span { color:#8a8793; }
.win-goals .near-goal { background:#fff; }
.win-goals .near-goal b { color:#232638; }
.win-goals .near-goal span { color:#777583; }
.win-goals .near-goal > i { background:#eceef3; color:#776d4b; }
.win-goals .near-goal em { background:#e8e9ee; }

.duel-result-modal {
  position:fixed;
  inset:0;
  z-index:22000;
  display:grid;
  place-items:center;
  padding:20px;
  background:#070914d4;
  backdrop-filter:blur(12px);
  opacity:0;
  visibility:hidden;
  transition:opacity .22s ease,visibility .22s ease;
}
.duel-result-modal.show { opacity:1; visibility:visible; }
.duel-result-card { position:relative; width:min(390px,100%); padding:22px 18px 18px; border:1px solid #ffffff1b; border-radius:24px; background:linear-gradient(160deg,#25284a,#171a34); box-shadow:0 28px 70px #00000070; text-align:center; transform:translateY(18px) scale(.96); transition:transform .34s cubic-bezier(.2,.9,.2,1); }
.duel-result-modal.show .duel-result-card { transform:none; }
.duel-close { position:absolute; right:11px; top:11px; width:34px; height:34px; border:0; border-radius:11px; background:#ffffff0c; color:#fff; font-size:18px; }
.duel-result-icon { width:62px; height:62px; margin:0 auto 9px; display:grid; place-items:center; border-radius:19px; background:#ffffff0c; border:1px solid #ffffff14; font-size:29px; animation:duelPop .55s cubic-bezier(.2,1,.2,1); }
.duel-kicker { color:#8fdce1; font-size:7px; font-weight:900; letter-spacing:.16em; }
.duel-result-card h2 { margin:4px 0 2px; font-size:22px; }
.duel-result-card > p { margin:0; color:#aaa7c8; font-size:8px; }
.duel-score { margin:13px auto 10px; font-size:34px; font-weight:950; letter-spacing:.08em; }
.duel-players { display:grid; grid-template-columns:1fr 1fr; gap:7px; text-align:left; }
.duel-players .challenge-result-row { min-height:75px; }
.duel-rematch { width:100%; min-height:48px; margin-top:12px; border:1px solid #ffffff1f; border-radius:14px; background:linear-gradient(135deg,#327f91,#536ba8); color:#fff; font-weight:900; }
.duel-result-modal.win .duel-score { color:#ffd66c; }
.duel-result-modal.lose .duel-score { color:#d3cfe7; }
@keyframes duelPop { 0% { transform:scale(.5) rotate(-8deg); opacity:0; } 70% { transform:scale(1.08); } 100% { transform:none; opacity:1; } }

.notification-prompt { position:fixed; z-index:23000; left:50%; bottom:max(14px,env(safe-area-inset-bottom)); width:min(420px,calc(100% - 20px)); transform:translate(-50%,130%); transition:transform .34s cubic-bezier(.2,.85,.2,1); }
.notification-prompt.show { transform:translate(-50%,0); }
.notification-prompt-card { display:grid; grid-template-columns:42px minmax(0,1fr); gap:10px; padding:12px; border:1px solid #ffffff20; border-radius:18px; background:#171a33f5; box-shadow:0 18px 42px #0000005c; backdrop-filter:blur(14px); }
.notification-prompt-icon { width:42px; height:42px; display:grid; place-items:center; border-radius:13px; background:#ffffff0c; }
.notification-prompt-card b { display:block; font-size:11px; }
.notification-prompt-card span { display:block; margin-top:3px; color:#aaa7c7; font-size:8px; line-height:1.35; }
.notification-prompt-actions { grid-column:1/-1; display:grid; grid-template-columns:1fr 1fr; gap:7px; }
.notification-prompt-actions button { min-height:39px; border:1px solid #ffffff16; border-radius:11px; background:#ffffff0d; color:#fff; font-size:9px; font-weight:850; }
.notification-prompt-actions button:first-child { background:#347d8e; }
.settings-note { margin:9px 2px 0; color:#9591b4; font-size:7.5px; line-height:1.45; }

/* ===== Avatar, illustrated card packs and notification controls ===== */
.avatar-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
}
.avatar-emoji {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid #ffffff14;
  border-radius: 11px;
  background: #ffffff09;
  color: #fff;
  font-size: 19px;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px #ffffff0d;
}
.avatar-emoji.selected {
  border-color: #ffffff68;
  background: #ffffff18;
  outline: 2px solid #ffffffc7;
  outline-offset: -3px;
}
.association-collection-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px;
}
.association-collection-card {
  min-width:0;
  border:1px solid #ffffff14;
  border-radius:15px;
  background:#ffffff08;
  color:#fff;
  padding:10px;
  text-align:left;
  box-shadow:inset 0 1px #ffffff0c;
}
.association-collection-card:active { transform:scale(.985); }
.association-collection-preview { display:flex; align-items:center; height:48px; margin-bottom:7px; }
.association-collection-preview i {
  width:38px; height:46px; display:grid; place-items:center; border-radius:9px;
  border:1px solid #ffffffd8; background:linear-gradient(165deg,#fff,#f4f4f8);
  font-size:20px; font-style:normal; box-shadow:0 3px 8px #00000028;
}
.association-collection-preview i+i { margin-left:-10px; }
.association-collection-copy { display:block; }
.association-collection-copy b { display:block; font-size:10px; }
.association-collection-copy small { display:block; min-height:22px; margin-top:3px; color:#aaa6cf; font-size:7.5px; line-height:1.3; }
.association-collection-progress { display:block; height:5px; margin-top:8px; border-radius:99px; overflow:hidden; background:#ffffff0d; }
.association-collection-progress i { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,#45d6c5,#ffd665); }
.association-collection-meta { display:block; margin-top:5px; color:#d8d4eb; font-size:7.5px; font-weight:800; }
.notification-state {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  margin-bottom: 8px;
  padding: 0 9px;
  border: 1px solid #ffffff10;
  border-radius: 10px;
  background: #ffffff07;
  color: #aaa7c7;
  font-size: 8px;
  font-weight: 800;
}
.notification-state i {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #8b8ca0;
}
.notification-state.ok i { background:#64d59a; box-shadow:0 0 0 3px #64d59a18; }
.notification-state.blocked i { background:#ff7b82; box-shadow:0 0 0 3px #ff7b8215; }
.notification-test {
  width: 100%;
  min-height: 40px;
  margin-top: 8px;
  border: 1px solid #ffffff17;
  border-radius: 11px;
  background: #ffffff0d;
  color: #fff;
  font-size: 9px;
  font-weight: 900;
}
.notification-test:disabled { opacity:.38; }

.challenge-result-row {
  grid-template-columns: 28px minmax(0,1fr);
  align-items: center;
}
.challenge-result-row > .challenge-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #ffffff0d;
  border: 1px solid #ffffff12;
  font-size: 16px;
  line-height: 1;
}
.challenge-result-row > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.challenge-result-row > div > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.challenge-result-row.empty > div { display:grid; gap:2px; }

/* ===== Profile modal + compact secondary sections ===== */
.profile-edit-trigger {
  -webkit-tap-highlight-color: transparent;
}
button.profile-avatar {
  padding: 0;
  color: #fff;
  cursor: pointer;
}
button.profile-copy {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.profile-edit-trigger:active { transform: scale(.985); }
.profile-copy b { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.profile-copy span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.profile-meta strong {
  display: block;
  margin-top: 2px;
  color: #fff;
  font-size: 9px;
  line-height: 1.05;
  font-weight: 900;
}
.profile-meta span { margin-top: 4px; }

.collapsible-section {
  padding: 0;
  overflow: hidden;
}
.collapsible-section > summary {
  min-height: 54px;
  margin: 0;
  padding: 12px 13px;
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}
.collapsible-section > summary::-webkit-details-marker { display:none; }
.collapsible-section > summary > div { min-width:0; }
.collapsible-section > summary h3,
.collapsible-section > summary small { display:block; }
.section-chevron {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #ffffff08;
  color: #bbb7d7;
  font-size: 16px;
  line-height: 1;
  font-style: normal;
  transition: transform .18s ease, background .18s ease;
}
.collapsible-section[open] .section-chevron {
  transform: rotate(180deg);
  background: #ffffff10;
}
.collapsible-content {
  padding: 0 13px 13px;
}
.collapsible-section.notification-settings .notification-state { margin-top: 0; }
.collapsible-section.bank-health .bank-health-grid { margin-top: 0; }

.profile-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 24000;
  display: grid;
  place-items: center;
  padding: max(14px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom));
  background: #070914d9;
  backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.profile-editor-modal.show {
  opacity: 1;
  visibility: visible;
}
.profile-editor-card {
  position: relative;
  width: min(430px, 100%);
  max-height: min(760px, calc(100dvh - 28px));
  overflow: hidden;
  border: 1px solid #ffffff1a;
  border-radius: 24px;
  background: linear-gradient(165deg, #233459, #172342 58%, #151c35);
  box-shadow: 0 28px 70px #00000070;
  transform: translateY(14px) scale(.98);
  transition: transform .25s cubic-bezier(.2,.9,.2,1);
}
.profile-editor-modal.show .profile-editor-card { transform: none; }
.profile-editor-close {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 1px solid #ffffff12;
  border-radius: 11px;
  background: #ffffff0c;
  color: #fff;
  font-size: 20px;
}
.profile-editor-content {
  max-height: min(760px, calc(100dvh - 28px));
  overflow: auto;
  overscroll-behavior: contain;
  padding: 18px 16px 16px;
}
.profile-editor-head {
  display: grid;
  grid-template-columns: 50px minmax(0,1fr);
  gap: 11px;
  align-items: center;
  padding-right: 40px;
  margin-bottom: 15px;
}
.profile-editor-avatar-preview {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 2px solid #ffffff5f;
  border-radius: 15px;
  background: linear-gradient(145deg,#9368ff,#4e7cf1);
  font-size: 24px;
  box-shadow: 0 8px 18px #0000002a;
}
.profile-editor-head small {
  display: block;
  color: #9f9abb;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .14em;
}
.profile-editor-head h2 { margin: 3px 0 0; font-size: 18px; }
.profile-editor-content .profile-field { margin-top: 13px; }
.profile-editor-content .profile-field input { background: #0b1227b8; }

.title-pill-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 7px;
}
.title-pill {
  min-width: 0;
  min-height: 48px;
  display: grid;
  grid-template-columns: 30px minmax(0,1fr);
  gap: 7px;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid #ffffff14;
  border-radius: 12px;
  background: #ffffff08;
  color: #fff;
  text-align: left;
  box-shadow: inset 0 1px #ffffff0c;
}
.title-pill i {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #ffffff0c;
  color: #ffd86a;
  font-size: 10px;
  font-style: normal;
  font-weight: 950;
}
.title-pill span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 8.5px;
  line-height: 1.15;
  font-weight: 850;
}
.title-pill.selected {
  border-color: #ffffff68;
  background: #ffffff17;
  outline: 2px solid #ffffffc3;
  outline-offset: -3px;
}
.profile-editor-actions {
  position: sticky;
  bottom: -16px;
  display: grid;
  grid-template-columns: .75fr 1.25fr;
  gap: 8px;
  margin: 17px -2px -2px;
  padding: 10px 2px 2px;
  background: linear-gradient(180deg, transparent, #172342 32%);
}
.profile-editor-actions button {
  min-height: 46px;
  border: 1px solid #ffffff18;
  border-radius: 13px;
  color: #fff;
  font-weight: 900;
}
.profile-editor-actions .secondary { background:#ffffff0b; }
.profile-editor-actions .primary { background:linear-gradient(135deg,#3f8292,#596fae); }

/* ===== Unified encyclopedia + card source settings ===== */
.encyclopedia-shell { display:grid; gap:12px; }
.encyclopedia-main-head { margin-bottom:0; }
.encyclopedia-main-head > div { min-width:0; }
.encyclopedia-main-head strong {
  flex:0 0 auto;
  padding:6px 9px;
  border-radius:999px;
  background:#ffffff0d;
  border:1px solid #ffffff14;
  color:#f4f1ff;
  font-size:10px;
  font-weight:950;
}
.encyclopedia-type-tabs {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:7px;
  padding:4px;
  border-radius:15px;
  background:#080d213d;
  border:1px solid #ffffff10;
}
.encyclopedia-type-tabs button {
  min-height:44px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  border:0;
  border-radius:11px;
  background:transparent;
  color:#aaa6c9;
  font-weight:900;
}
.encyclopedia-type-tabs button b { font-size:10px; }
.encyclopedia-type-tabs button span {
  min-width:34px;
  padding:3px 6px;
  border-radius:999px;
  background:#ffffff0a;
  font-size:7.5px;
}
.encyclopedia-type-tabs button.active {
  background:#ffffff12;
  color:#fff;
  box-shadow:inset 0 1px #ffffff12;
}
.encyclopedia-pane { display:grid; gap:12px; }
.hub-subhead {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin:1px 1px 9px;
}
.hub-subhead h4 { margin:0; font-size:11px; }
.hub-subhead small { color:#aaa6c9; font-size:7.5px; }
.association-collections-block {
  padding:11px;
  border-radius:16px;
  background:#ffffff06;
  border:1px solid #ffffff0f;
}
.picture-categories-head { margin-top:2px; margin-bottom:0; }
.visual-category-groups { display:grid; gap:10px; }
.visual-category-group {
  padding:10px;
  border-radius:15px;
  background:#ffffff05;
  border:1px solid #ffffff0d;
}
.visual-category-group-head {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  margin-bottom:8px;
}
.visual-category-group-head b { font-size:9px; }
.visual-category-group-head span { color:#aaa6c9; font-size:7.5px; }
.visual-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
.collection-item.visual-item {
  position:relative;
  min-height:54px;
  display:grid;
  grid-template-columns:24px minmax(0,1fr);
  gap:5px;
  align-items:center;
  padding:6px 7px;
  text-align:left;
}
.collection-item.visual-item i {
  width:24px;
  height:30px;
  display:grid;
  place-items:center;
  border-radius:8px;
  background:#ffffff0d;
  font-size:15px;
  font-style:normal;
}
.collection-item.visual-item span {
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  font-size:7.5px;
  font-weight:850;
}
.collection-item.visual-item em {
  position:absolute;
  right:4px;
  bottom:3px;
  color:#aaa6c9;
  font-size:6px;
  font-style:normal;
}
.visual-encyclopedia-detail .visual-category-icon {
  background:#ffffff10;
  font-size:21px;
}
.picture-collection {
  display:grid;
  grid-template-columns:repeat(6,1fr);
  gap:6px;
  margin-top:10px;
}
.picture-collection span {
  min-width:0;
  aspect-ratio:1;
  display:grid;
  place-items:center;
  border-radius:10px;
  background:#ffffff0a;
  border:1px solid #ffffff0f;
  font-size:18px;
}
.picture-collection span.unknown { opacity:.42; filter:grayscale(1); }
.card-source-setting {
  margin-bottom:10px;
  padding:10px;
  border-radius:15px;
  background:#ffffff06;
  border:1px solid #ffffff0e;
}
.card-source-options {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:7px;
}
.card-source-options button {
  min-width:0;
  min-height:62px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:5px;
  padding:7px 5px;
  border:1px solid #ffffff12;
  border-radius:12px;
  background:#ffffff07;
  color:#c8c4df;
  font-weight:900;
}
.card-source-options button i { font-style:normal; font-size:18px; }
.card-source-options button span { font-size:7.5px; line-height:1.1; }
.card-source-options button.active {
  color:#fff;
  background:#ffffff16;
  border-color:#ffffff55;
  outline:2px solid #ffffff9a;
  outline-offset:-3px;
}

/* ===== Product polish v8 ===== */
.onboarding-modal,
.weekly-digest-modal {
  position: fixed;
  inset: 0;
  z-index: 21000;
  display: none;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
  background: rgba(7, 9, 28, .84);
  backdrop-filter: blur(18px);
}
.onboarding-modal.show,
.weekly-digest-modal.show { display: grid; }
.onboarding-card,
.weekly-digest-card {
  width: min(430px, 100%);
  max-height: min(720px, 94dvh);
  overflow: auto;
  border: 1px solid #ffffff1d;
  border-radius: 28px;
  background: linear-gradient(160deg, #252b60, #171d49 58%, #111833);
  box-shadow: 0 28px 80px #0009, inset 0 1px #ffffff16;
  padding: 20px;
}
.onboarding-logo { display:flex; align-items:center; gap:10px; margin-bottom:18px; }
.onboarding-logo span { width:38px; height:38px; display:grid; place-items:center; border-radius:12px; background:linear-gradient(145deg,#8b69ff,#437bf5); font-size:20px; }
.onboarding-logo b { font-size:20px; }
.onboarding-step > small,
.weekly-digest-card > small { color:#9edcff; font-size:10px; font-weight:900; letter-spacing:.14em; }
.onboarding-step h2,
.weekly-digest-card h2 { margin:6px 0 8px; font-size:25px; line-height:1.06; letter-spacing:-.035em; }
.onboarding-step p { margin:0 0 17px; color:#c7c5e6; font-size:13px; line-height:1.45; }
.onboarding-step label { display:grid; gap:6px; margin-bottom:13px; font-size:10px; color:#b8b5d6; font-weight:900; text-transform:uppercase; letter-spacing:.08em; }
.onboarding-step input,
.profile-field select {
  width:100%; height:46px; border:1px solid #ffffff18; border-radius:14px; background:#0b1330cc; color:#fff; padding:0 13px; font:inherit; font-weight:800; outline:none;
}
.onboarding-step input:focus,.profile-field select:focus { border-color:#7adfff; box-shadow:0 0 0 2px #58c9ff22; }
.onboarding-step input.error { border-color:#ff7b88; }
.onboarding-avatar-picker {
  display:grid;
  grid-template-columns:minmax(0,1fr);
  align-items:center;
  width:100%;
  min-width:0;
  margin-top:1px;
}
.onboarding-avatar-scroll {
  display:none;
  width:34px;
  height:46px;
  border:1px solid #ffffff24;
  border-radius:12px;
  background:#0d1536e8;
  color:#fff;
  font-size:25px;
  line-height:1;
  box-shadow:0 6px 16px #0004;
  cursor:pointer;
  flex:0 0 auto;
}
.onboarding-avatar-scroll:disabled { opacity:.18; cursor:default; }
.onboarding-avatar-grid {
  grid-column:1;
  display:flex;
  width:100%;
  min-width:0;
  overflow-x:auto;
  overflow-y:hidden;
  padding:0;
  scroll-snap-type:x mandatory;
  scroll-behavior:smooth;
  overscroll-behavior-x:contain;
  touch-action:pan-x;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
}
.onboarding-avatar-grid::-webkit-scrollbar { display:none; }
.onboarding-avatar-page {
  flex:0 0 100%;
  width:100%;
  box-sizing:border-box;
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  grid-template-rows:repeat(2,52px);
  gap:7px;
  padding:4px 5px 5px;
  scroll-snap-align:start;
  scroll-snap-stop:always;
}
.onboarding-avatar-page .onboarding-avatar {
  justify-self:center;
}
.onboarding-avatar-grid.mouse-dragging {
  cursor:grabbing;
  scroll-snap-type:none;
  scroll-behavior:auto;
  user-select:none;
}
.avatar-page-dots {
  margin:12px 0 13px;
}
.avatar-page-dots i {
  cursor:pointer;
}
@media (hover:hover) and (pointer:fine) {
  .onboarding-avatar-picker {
    grid-template-columns:34px minmax(0,1fr) 34px;
    gap:8px;
  }
  .onboarding-avatar-scroll {
    display:grid;
    place-items:center;
    position:static;
    transform:none;
  }
  .onboarding-avatar-scroll.prev { grid-column:1; grid-row:1; }
  .onboarding-avatar-grid { grid-column:2; grid-row:1; cursor:grab; }
  .onboarding-avatar-scroll.next { grid-column:3; grid-row:1; }
}
.onboarding-avatar { width:52px; height:52px; border:1px solid #ffffff16; border-radius:13px; background:#ffffff09; color:#fff; font-size:22px; }
.onboarding-avatar.selected { border-color:#fff; outline:2px solid #72d9ff; outline-offset:1px; background:#ffffff16; }
.onboarding-demo { display:flex; align-items:flex-end; justify-content:center; gap:6px; min-height:150px; padding:18px 8px; }
.onboarding-demo span,.onboarding-demo b { width:72px; height:100px; border-radius:15px; display:grid; place-items:center; padding:8px; text-align:center; font-size:11px; }
.onboarding-demo span { background:linear-gradient(150deg,#8765ff,#526fea); color:#fff; transform:translateY(-12px); }
.onboarding-demo b { background:#fff; color:#17203f; box-shadow:0 8px 20px #0004; }
.onboarding-demo b:nth-of-type(2){transform:translateX(-34px) translateY(22px)}
.onboarding-demo b:nth-of-type(3){transform:translateX(-68px) translateY(44px)}
.onboarding-demo.picture b { font-size:30px; }
.onboarding-ready { display:grid; grid-template-columns:auto 1fr auto 1fr auto 1fr; gap:9px; align-items:center; padding:18px 10px; margin:16px 0; border-radius:18px; background:#ffffff08; }
.onboarding-ready i { font-style:normal; font-size:24px; }
.onboarding-ready span { font-size:11px; color:#d7d4ee; font-weight:850; }
.onboarding-dots { display:flex; justify-content:center; gap:6px; margin:18px 0 13px; }
.onboarding-dots i { width:7px; height:7px; border-radius:50%; background:#ffffff1c; }
.onboarding-dots i.active { width:22px; border-radius:99px; background:#7adfff; }
.onboarding-actions { display:flex; gap:8px; }
.onboarding-actions button { flex:1; min-height:48px; border:0; border-radius:15px; color:#fff; font-weight:900; }
.onboarding-actions .primary { background:linear-gradient(135deg,#7d62ff,#497cf4); }
.onboarding-actions .secondary { background:#ffffff0c; border:1px solid #ffffff16; }

.weekly-digest-card { position:relative; text-align:center; }
.weekly-digest-close { position:absolute; right:12px; top:12px; width:36px; height:36px; border:0; border-radius:11px; background:#ffffff0b; color:#fff; font-size:20px; }
.weekly-digest-icon { width:68px; height:68px; margin:4px auto 12px; display:grid; place-items:center; border-radius:22px; background:linear-gradient(145deg,#54d9ff,#7b63ff); font-size:32px; box-shadow:0 12px 26px #0003; }
.weekly-digest-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin:18px 0 12px; }
.weekly-digest-grid div { min-height:88px; padding:10px 5px; border-radius:16px; background:#ffffff08; border:1px solid #ffffff0f; display:grid; place-items:center; align-content:center; gap:3px; }
.weekly-digest-grid i { font-style:normal; font-size:20px; }
.weekly-digest-grid b { font-size:20px; }
.weekly-digest-grid span { font-size:9px; color:#b9b7d9; }
.weekly-digest-xp { margin:10px 0 14px; font-weight:900; color:#ffd66d; }
.weekly-digest-next { width:100%; min-height:48px; border:0; border-radius:15px; color:#fff; background:linear-gradient(135deg,#7d62ff,#497cf4); font-weight:900; }

.profile-showcase-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:7px; }
.profile-showcase-grid > div { min-width:0; padding:9px; border-radius:13px; background:#ffffff07; }
.profile-showcase-grid span { display:block; font-size:8px; color:#aaa7cc; margin-bottom:4px; }
.profile-showcase-grid b { display:block; font-size:11px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.featured-achievements { display:flex; gap:7px; margin-top:8px; }
.featured-achievements > span { min-width:0; flex:1; display:flex; gap:6px; align-items:center; padding:8px; border-radius:12px; background:#ffffff08; }
.featured-achievements i { font-style:normal; font-size:17px; }
.featured-achievements b { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:9px; }
.featured-achievements > small { color:#aaa7cc; font-size:9px; }
.featured-picker { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; max-height:210px; overflow:auto; }
.featured-pick { min-height:46px; border:1px solid #ffffff13; border-radius:12px; background:#ffffff07; color:#fff; text-align:left; padding:7px; display:flex; align-items:center; gap:7px; }
.featured-pick i { width:29px; height:29px; flex:0 0 auto; display:grid; place-items:center; border-radius:9px; background:#ffffff0b; font-style:normal; }
.featured-pick span { font-size:9px; font-weight:800; }
.featured-pick.selected { border-color:#79dcff; outline:1px solid #79dcff; background:#64cfff12; }

.duel-history-list { display:grid; gap:7px; }
.duel-history-list article { display:grid; grid-template-columns:40px minmax(0,1fr) auto; gap:9px; align-items:center; padding:9px; border:1px solid #ffffff0e; border-radius:14px; background:#ffffff06; }
.duel-history-avatar { width:40px; height:40px; display:grid; place-items:center; border-radius:13px; background:#ffffff0d; font-size:21px; }
.duel-history-list b,.duel-history-list small,.duel-history-list em { display:block; }
.duel-history-list b { font-size:11px; }
.duel-history-list small { font-size:9px; color:#c2bfdd; margin-top:2px; }
.duel-history-list em { font-size:8px; color:#8f8cb3; font-style:normal; margin-top:2px; }
.duel-history-list button { min-height:34px; border:1px solid #ffffff15; border-radius:10px; background:#ffffff0b; color:#fff; font-size:9px; font-weight:900; padding:0 9px; }

.encyclopedia-tools { margin:11px 0; display:grid; gap:8px; }
.encyclopedia-search { position:relative; display:block; }
.encyclopedia-search i { position:absolute; left:11px; top:50%; transform:translateY(-50%); font-style:normal; color:#9b98bd; }
.encyclopedia-search input { width:100%; height:42px; border:1px solid #ffffff12; border-radius:13px; background:#090e25a8; color:#fff; padding:0 12px 0 32px; font:inherit; font-size:11px; outline:none; }
.encyclopedia-search input:focus { border-color:#70d8ff; }
.encyclopedia-filters,.encyclopedia-sort { display:flex; gap:5px; overflow-x:auto; padding-bottom:2px; scrollbar-width:none; }
.encyclopedia-filters::-webkit-scrollbar,.encyclopedia-sort::-webkit-scrollbar { display:none; }
.encyclopedia-filters button,.encyclopedia-sort button { flex:0 0 auto; min-height:31px; border:1px solid #ffffff11; border-radius:999px; background:#ffffff06; color:#bbb8d7; padding:0 10px; font-size:9px; font-weight:850; }
.encyclopedia-filters button.active,.encyclopedia-sort button.active { color:#fff; border-color:#7bdcff66; background:#64d6ff16; }
.encyclopedia-sort { align-items:center; }
.encyclopedia-sort > span { color:#8f8caf; font-size:8px; margin-right:2px; }
.encyclopedia-empty { grid-column:1/-1; }

.qa-summary { display:flex; justify-content:space-between; gap:10px; align-items:center; padding:10px; border-radius:12px; background:#ffffff07; }
.qa-summary.ok b { color:#8fe7ad; }
.qa-summary.warn b { color:#ffd36e; }
.qa-summary span { font-size:9px; color:#aaa7c7; }
.qa-checks { display:grid; gap:5px; margin-top:8px; }
.qa-checks > span { display:grid; grid-template-columns:20px 1fr; align-items:center; min-height:32px; padding:5px 7px; border-radius:10px; background:#ffffff05; font-size:9px; }
.qa-checks i { font-style:normal; color:#8fe7ad; }
.qa-checks .warn i { color:#ffd36e; }
.qa-checks small { grid-column:2; color:#8f8cad; font-size:8px; }
.analytics-health { margin-top:10px; padding:10px; border-radius:12px; background:#ffffff06; }
.analytics-health b,.analytics-health span,.analytics-health small { display:block; }
.analytics-health b { font-size:11px; }
.analytics-health span { margin-top:3px; font-size:9px; color:#c5c2df; }
.analytics-health small { margin-top:3px; color:#8885a7; font-size:8px; line-height:1.35; }

/* ===== Unified duel center ===== */
.duels-hub { overflow:hidden; }
.duel-tabs {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:6px;
  padding:4px;
  margin-bottom:10px;
  border:1px solid #ffffff10;
  border-radius:13px;
  background:#080b1b2e;
}
.duel-tabs button {
  min-height:38px;
  border:0;
  border-radius:10px;
  background:transparent;
  color:#aaa7c9;
  font-size:10px;
  font-weight:900;
}
.duel-tabs button span {
  display:inline-grid;
  min-width:18px;
  height:18px;
  margin-left:4px;
  padding:0 5px;
  place-items:center;
  border-radius:99px;
  background:#ffffff0b;
  color:#c8c5df;
  font-size:8px;
}
.duel-tabs button.active {
  background:#ffffff12;
  color:#fff;
  box-shadow:inset 0 1px #ffffff10;
}
.duel-tabs button.active span { background:#ffffff16; color:#fff; }
.duel-tab-content { min-height:70px; }
.duel-active-list { gap:9px; }
.duel-card { position:relative; }
.duel-direction {
  display:inline-flex;
  align-items:center;
  min-height:20px;
  margin-top:7px;
  padding:0 7px;
  border:1px solid #ffffff10;
  border-radius:999px;
  background:#ffffff07;
  color:#9f9bbb;
  font-size:7.5px;
  font-weight:850;
  letter-spacing:.04em;
  text-transform:uppercase;
}

.confetti-piece {
  position: fixed;
  left: var(--confetti-x);
  top: -18px;
  width: 8px;
  height: 14px;
  z-index: 10950;
  border-radius: 2px;
  background: hsl(var(--confetti-h) 88% 62%);
  opacity: 0;
  animation: confettiFall var(--confetti-time) cubic-bezier(.18,.72,.3,1) var(--confetti-delay) forwards;
}
.confetti-piece:nth-child(3n) { width: 6px; height: 10px; border-radius: 50%; }
.confetti-piece:nth-child(4n) { width: 11px; height: 5px; }
@keyframes confettiFall {
  0% { transform: translate3d(0,-16px,0) rotate(0); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translate3d(var(--confetti-drift),105vh,0) rotate(var(--confetti-rot)); opacity: .85; }
}

/* Rank-up reward modal. */
.rank-up-modal {
  position: fixed; inset: 0; z-index: 12100; display: none; place-items: center;
  padding: 20px; background: #08091ddd; backdrop-filter: blur(10px);
}
.rank-up-modal.show { display: grid; animation: winBackdropIn .22s ease-out both; }
.rank-up-card {
  position: relative; overflow: hidden; width: min(340px,92vw); padding: 28px 22px 22px;
  border-radius: 28px; border: 1px solid #ffffff35;
  background: linear-gradient(160deg,#242758,#161b42); color: #fff; text-align: center;
  box-shadow: 0 28px 70px #000a;
  animation: winModalIn .42s cubic-bezier(.18,.88,.24,1.12) both;
}
.rank-up-card::before { content:""; position:absolute; width:220px; height:220px; left:50%; top:-128px; transform:translateX(-50%); border-radius:50%; background:radial-gradient(circle,#8de8ff66,#8c68ff24 48%,transparent 72%); }
.rank-up-burst { position:relative; width:66px; height:66px; margin:0 auto 10px; display:grid; place-items:center; border-radius:50%; font-size:30px; background:linear-gradient(145deg,#7b70ff,#49cbe5); box-shadow:0 10px 28px #0005,inset 0 1px #fff8; }
.rank-up-card > small { position:relative; color:#8de8ff; font-size:10px; font-weight:900; letter-spacing:.16em; }
.rank-up-number { position:relative; margin:5px 0 0; font-size:30px; font-weight:950; letter-spacing:-.04em; }
.rank-up-card h2 { position:relative; margin:0 0 16px; color:#ffd86a; font-size:17px; }
.rank-up-rewards { position:relative; display:grid; gap:8px; margin-bottom:17px; }
.rank-reward { display:flex; align-items:center; gap:11px; padding:10px 12px; border-radius:15px; background:#ffffff0d; border:1px solid #ffffff18; text-align:left; }
.rank-reward > i { width:42px; height:42px; flex:0 0 42px; display:grid; place-items:center; border-radius:13px; background:#ffffff12; font-style:normal; font-size:24px; }
.rank-reward span { display:grid; gap:2px; min-width:0; }
.rank-reward b { font-size:12px; }
.rank-reward small { color:#b9b9d4; font-size:9px; }
.rank-up-card button { width:100%; min-height:48px; border:0; border-radius:15px; color:#fff; font-weight:900; background:linear-gradient(135deg,#765fff,#4f86ff); box-shadow:0 8px 20px #0004; }

/* ===== Persistent player header ===== */
.global-profile-button {
  min-width: 0;
  border: 0;
  color: #fff;
  background: transparent;
  font: inherit;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.game-profile-button {
  display: grid;
  grid-template-columns: 38px minmax(0,1fr);
  align-items: center;
  gap: 9px;
  max-width: min(210px, 48vw);
  padding: 2px 0;
}
.global-profile-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 13px;
  border: 1px solid #ffffff28;
  background: linear-gradient(145deg,#ffffff19,#ffffff0a);
  box-shadow: inset 0 1px #ffffff25, 0 5px 14px #0003;
  font-size: 21px;
}
.global-profile-copy { display: block; min-width: 0; }
.global-profile-copy b,
.global-profile-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.global-profile-copy b { font-size: 14px; line-height: 1.1; font-weight: 950; }
.global-profile-copy small { margin-top: 4px; color: #bbb8da; font-size: 8.5px; font-weight: 850; }
.global-profile-button:active { transform: scale(.985); }
.hub-profile-button {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0,1fr);
  align-items: center;
  gap: 10px;
  flex: 1;
  min-height: 48px;
  padding: 3px 4px 7px 0;
}
.hub-profile-button .global-profile-avatar { width: 42px; height: 42px; font-size: 23px; }
.hub-profile-button .global-profile-copy b { font-size: 15px; }
.hub-profile-xp {
  position: absolute;
  left: 52px;
  right: 4px;
  bottom: 1px;
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: #ffffff10;
}
.hub-profile-xp i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#62d8ee,#ffd467); }

/* Startup choice in settings. */
.startup-setting { margin-top: 14px; }
.startup-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.startup-options button {
  min-height: 58px;
  display: grid;
  grid-template-columns: 28px minmax(0,1fr);
  align-items: center;
  gap: 7px;
  border: 1px solid #ffffff12;
  border-radius: 13px;
  padding: 8px;
  background: #ffffff07;
  color: #fff;
  text-align: left;
}
.startup-options button > i { font-style: normal; font-size: 18px; text-align: center; }
.startup-options button span b,.startup-options button span small { display:block; }
.startup-options button span b { font-size: 10px; }
.startup-options button span small { margin-top:2px; color:#9794b6; font-size:7.5px; line-height:1.25; }
.startup-options button.active { border-color:#75dcff88; background:#65d9ff12; box-shadow:inset 0 0 0 1px #75dcff33; }

/* Destructive challenge action. */
.owned-challenge-actions .challenge-delete {
  color: #ffb3bd;
  border-color: #ff80952c;
  background: #ff6f8510;
}

/* ===== UI consolidation v15 ===== */
/* Larger, consistent typography across the game hub. */
.hub-head {
  min-height: 68px;
  align-items: center;
  padding: max(12px, env(safe-area-inset-top)) 16px 10px;
}
.hub-scroll { gap: 13px; padding: 14px 14px 22px; }
.hub-section { padding: 14px; border-radius: 19px; }
.hub-section-head { margin-bottom: 11px; }
.hub-section h3 { font-size: 16px; line-height: 1.15; letter-spacing: -.015em; }
.hub-section h4, .hub-subhead h4 { font-size: 13px; line-height: 1.2; }
.hub-section small, .hub-subhead small { font-size: 10px; line-height: 1.35; }
.empty-state, .settings-note, .hub-section p { font-size: 10px; line-height: 1.42; }

/* Persistent player strip. Avatar is vertically centered and XP-to-next-rank is readable. */
.hub-profile-button {
  align-self: center;
  min-height: 50px;
  padding: 4px 4px 9px 0;
}
.hub-profile-button .global-profile-avatar { align-self: center; justify-self: center; }
.global-profile-copy b { font-size: 16px; line-height: 1.12; }
.global-profile-copy small { margin-top: 4px; font-size: 10px; line-height: 1.25; }
.hub-profile-button .global-profile-copy b { font-size: 16px; }
.hub-profile-xp { height: 4px; bottom: 1px; }
.game-profile-button .global-profile-copy b { font-size: 14px; }
.game-profile-button .global-profile-copy small { font-size: 9px; }

/* Explicit Play action is part of the bottom navigation. */
.hub-nav { display: block; padding-top: 8px; }
.hub-tabs { grid-template-columns: repeat(6,minmax(0,1fr)); gap: 4px; }
.hub-tabs button { min-height: 56px; border-radius: 14px; }
.hub-tabs button i { font-size: 18px; }
.hub-tabs button span { font-size: 8px; }
.hub-tabs .hub-play {
  color:#fff;
  border-color:#8fa5ff66;
  background:linear-gradient(145deg,#675dce,#416fbd);
  box-shadow:0 7px 18px #0003,inset 0 1px #ffffff25;
}
.hub-tabs .hub-play i { font-size:19px; }

/* Game modes are a first-class destination. */
.mode-grid { gap: 9px; }
.mode-card {
  min-height: 104px; padding: 12px; grid-template-columns: 38px minmax(0,1fr); grid-template-rows: auto auto auto;
  column-gap: 10px; row-gap: 2px;
}
.mode-card i { grid-row: 1 / 4; width: 38px; height: 38px; font-size: 20px; }
.mode-card b { font-size: 13px; }
.mode-card span { font-size: 9.5px; line-height: 1.28; }
.mode-card em { color: #d3d0e8; font-size: 8.5px; font-style: normal; font-weight: 800; }
.mode-card.zen { background: linear-gradient(135deg,#4ed7ff20,#85e6a715); }
.mode-card.duel { background: linear-gradient(135deg,#ffd85c18,#8c62ff20); }

/* Weekly challenge: clearer and harder-goal presentation. */
.weekly-card { grid-template-columns: 54px minmax(0,1fr); gap: 12px; padding: 15px; }
.weekly-icon { width: 54px; height: 54px; overflow: hidden; white-space: nowrap; font-size: 18px; letter-spacing: -2px; }
.weekly-copy small { font-size: 8.5px; letter-spacing: .08em; }
.weekly-copy b { font-size: 14px; margin-top: 4px; }
.weekly-copy span { font-size: 10px; line-height: 1.3; }
.weekly-copy em { font-size: 9.5px; line-height: 1.3; }
.weekly-progress { height: 7px; }

/* Progress cards and achievements. */
.achievement-list { gap: 8px; max-height: 330px; }
.achievement { grid-template-columns: 40px minmax(0,1fr) auto; gap: 9px; min-height: 56px; padding: 9px; }
.achievement .ico {
  width: 38px; height: 38px; max-width: 38px; overflow: hidden; padding: 3px;
  border-radius: 11px; font-size: 17px; line-height: 1; letter-spacing: -.04em;
  text-overflow: clip; white-space: nowrap;
}
.achievement .ico.icon-medium { font-size: 11px; letter-spacing: -.08em; }
.achievement .ico.icon-long { font-size: 8px; letter-spacing: -.1em; }
.achievement b { font-size: 11.5px; line-height: 1.2; }
.achievement p { margin-top: 3px; font-size: 9.5px; line-height: 1.3; }
.achievement-copy small { font-size: 8.5px; }
.achievement-filters button { min-height: 31px; padding-inline: 11px; font-size: 9px; }
.stat-box { padding: 11px; }
.stat-box b { font-size: 18px; }
.stat-box span { font-size: 9px; line-height: 1.25; }

/* Rank reward roadmap. */
.rank-roadmap-list { display: grid; gap: 7px; }
.rank-roadmap-item {
  display: grid; grid-template-columns: 34px 54px minmax(0,1fr); align-items: center; gap: 9px;
  min-height: 52px; padding: 7px 9px; border-radius: 13px; background: #ffffff07; border: 1px solid #ffffff0d;
}
.rank-roadmap-level { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: #ffffff0b; color: #ffd86a; font-size: 12px; font-weight: 950; }
.rank-roadmap-icons { display: flex; align-items: center; gap: 3px; }
.rank-roadmap-icons i { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; background: #ffffff0c; font-style: normal; font-size: 15px; }
.rank-roadmap-item > span:last-child { min-width: 0; display: grid; gap: 2px; }
.rank-roadmap-item > span:last-child b { font-size: 10.5px; line-height: 1.2; }
.rank-roadmap-item > span:last-child small { font-size: 9px; }

/* Rewards for distinct login days. */
.login-reward-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 6px; }
.login-reward { min-width: 0; display: grid; justify-items: center; gap: 4px; padding: 8px 3px; border-radius: 12px; border: 1px solid #ffffff0e; background: #ffffff06; text-align: center; opacity: .64; }
.login-reward.done { opacity: 1; border-color: #77dcbf3d; background: #67d7b20c; }
.login-reward > i { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 10px; background: #ffffff0b; font-style: normal; font-size: 17px; }
.login-reward span { min-width: 0; display: grid; gap: 2px; }
.login-reward b { font-size: 8.5px; line-height: 1.1; }
.login-reward small { font-size: 7.5px; line-height: 1.15; }
.login-next { margin: 9px 0 0 !important; color: #bcb9d7; font-size: 9.5px !important; }
.login-next b { color: #ffd86a; }
.login-next.complete { color: #86e4ae; }

/* Compact profile editor. */
.profile-editor-card { width: min(430px,94vw); max-height: min(760px,92dvh); }
.profile-editor-content { padding: 15px 14px 12px; }
.profile-editor-head.compact { grid-template-columns: 43px minmax(0,1fr); gap: 9px; margin-bottom: 9px; }
.profile-editor-head.compact .profile-editor-avatar-preview { width: 43px; height: 43px; border-radius: 13px; font-size: 23px; }
.profile-editor-head.compact h2 { font-size: 16px; }
.profile-editor-head.compact small { font-size: 8px; }
.profile-editor-identity { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.profile-editor-content .profile-field { margin-top: 0; gap: 4px; }
.profile-field > span { font-size: 8px; }
.profile-field input, .profile-field select { min-height: 39px; height: 39px; padding: 0 9px; font-size: 10px; border-radius: 11px; }
.profile-compact-section { margin-top: 8px; border: 1px solid #ffffff10; border-radius: 12px; background: #ffffff05; overflow: hidden; }
.profile-compact-section > summary { list-style: none; min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; cursor: pointer; }
.profile-compact-section > summary::-webkit-details-marker { display: none; }
.profile-compact-section > summary > span { font-size: 10.5px; font-weight: 900; }
.profile-compact-section > summary > small { max-width: 62%; font-size: 8.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-compact-section[open] > summary { border-bottom: 1px solid #ffffff0d; }
.profile-compact-section .avatar-emoji-grid,
.profile-compact-section .title-pill-grid,
.profile-compact-section .featured-picker { margin: 0; padding: 9px; }
.profile-compact-section .avatar-emoji-grid { max-height: 190px; overflow: auto; }
.profile-compact-section .title-pill-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.title-pill { min-height: 42px; }
.title-pill span { font-size: 9px; }
.featured-pick span { font-size: 9.5px; }
.profile-editor-actions { margin-top: 10px; gap: 7px; }
.profile-editor-actions button { min-height: 42px; }

/* Duel center text scale. */
.duel-tabs button { font-size: 11px; }
.duel-tabs button span { font-size: 9px; }
.owned-challenge-code span { font-size: 9.5px; }
.owned-challenge-results, .owned-challenge-results strong { font-size: 9px; }
.challenge-result-row b { font-size: 10px; }
.challenge-result-row span { font-size: 9px; }
.challenge-result-row small { font-size: 8.5px; }
.duel-direction { font-size: 8.5px; }
.challenge-input-row input { font-size: 11px; }

/* Settings and encyclopedia readability. */
.setting-toggle b { font-size: 11px; }
.setting-toggle span { font-size: 9px; line-height: 1.25; }
.startup-options button span b { font-size: 11px; }
.startup-options button span small { font-size: 8.5px; }
.theme-tile b, .cardback-tile b { font-size: 10px; }
.theme-tile span, .cardback-tile > span:last-child { font-size: 8.5px; }
.collection-item { font-size: 9px; }
.encyclopedia-filters button, .encyclopedia-sort button { font-size: 9.5px; }
.encyclopedia-sort > span { font-size: 9px; }

/* Bamboo replaces the old lotus silhouette. The id stays 'lotus' for save compatibility. */
.cardback-preview.back-lotus {
  background:
    linear-gradient(82deg, transparent 0 18%, #c6df8f 19% 23%, transparent 24% 49%, #9fc86f 50% 55%, transparent 56% 78%, #d9eba7 79% 82%, transparent 83%),
    repeating-linear-gradient(0deg, transparent 0 13px, #e5f4b51b 14px 16px),
    linear-gradient(145deg,#173b34,#315c43 55%,#18372f);
  border-color: #b9dc8e;
}
.cardback-preview.back-lotus::after { content:"🎋"; position:relative; z-index:2; font-size:18px; }
body[data-card-back="lotus"] .card.face-down {
  background:
    linear-gradient(82deg, transparent 0 18%, #c6df8f 19% 23%, transparent 24% 49%, #9fc86f 50% 55%, transparent 56% 78%, #d9eba7 79% 82%, transparent 83%),
    repeating-linear-gradient(0deg, transparent 0 17px, #e5f4b514 18px 20px),
    linear-gradient(145deg,#173b34,#315c43 55%,#18372f);
  border-color:#b9dc8e;
  box-shadow:0 4px 0 #254c38,0 8px 18px #06130d70,inset 0 1px #e6f6c266;
}
body[data-card-back="lotus"] .card.face-down::before { background:none; border-color:#d9efaf55; }
body[data-card-back="lotus"] .card.face-down::after { content:"🎋"; transform:none; border:0; color:#efffcf; font-size:24px; }

/* New reward backs. */
.cardback-preview.back-duelist { background: linear-gradient(135deg,#161c34,#3d4a70 52%,#7b6030); border-color:#e5c778; }
.cardback-preview.back-duelist::after { content:"⚔"; position:relative; z-index:2; color:#ffe38d; font-size:18px; }
body[data-card-back="duelist"] .card.face-down { background:linear-gradient(135deg,#141a31,#3d4a70 52%,#70582d); border-color:#e5c778; }
body[data-card-back="duelist"] .card.face-down::before { background:linear-gradient(45deg,transparent 47%,#ffe28a18 48% 52%,transparent 53%); border-color:#ffe7a85c; }
body[data-card-back="duelist"] .card.face-down::after { content:"⚔"; transform:none; border:0; color:#ffe18a; font-size:22px; }
.cardback-preview.back-anniversary { background:radial-gradient(circle at 50% 34%,#fff5a34b,transparent 28%),linear-gradient(145deg,#153c56,#3a5c8b 54%,#6d3c73);border-color:#ffe69a; }
.cardback-preview.back-anniversary::after { content:"🏅"; position:relative; z-index:2; font-size:17px; }
body[data-card-back="anniversary"] .card.face-down { background:radial-gradient(circle at 50% 34%,#fff5a34b,transparent 28%),linear-gradient(145deg,#153c56,#3a5c8b 54%,#6d3c73);border-color:#ffe69a; }
body[data-card-back="anniversary"] .card.face-down::after { content:"🏅"; transform:none; border:0; font-size:23px; }
.spark-duel { width: 15px; height: 3px; border-radius: 99px; background: linear-gradient(90deg,#ffe07d,#8fe7ff); box-shadow: 0 0 7px #ffe07d55; }
.effect-preview.effect-duel i { width: 13px; height: 3px; border-radius: 99px; background: linear-gradient(90deg,#ffe07d,#8fe7ff); }
.effect-preview.effect-duel i:nth-child(1) { transform: translate(-18px,-13px) rotate(38deg); }
.effect-preview.effect-duel i:nth-child(2) { transform: translate(8px,-7px) rotate(-38deg); }
.effect-preview.effect-duel i:nth-child(3) { transform: translate(-4px,10px) rotate(0); }
/* Readability for retention cards. */
.smart-action button { font-size: 9.5px; }
.daily-calendar-head small { font-size: 8.5px; }
.daily-calendar-head b { font-size: 14px; }
.daily-calendar-head > span { font-size: 11px; }
.near-goals-head b { font-size: 14px; }
.near-goals-head span { font-size: 9px; }
.near-goal { grid-template-columns: 36px minmax(0,1fr); gap: 9px; padding: 8px 9px; }
.near-goal > i { width: 36px; height: 36px; }
.near-goal b { font-size: 10.5px; }
.near-goal span { font-size: 9px; line-height: 1.3; }
.profile-showcase-grid span { font-size: 9px; }
.profile-showcase-grid b { font-size: 11.5px; }


/* ===== v16 stability, rank economy and duel profiles ===== */
.card-source-setting { border: 0; }
.startup-setting { margin-bottom: 18px; }
.settings-subgroup { margin-top: 14px; padding-top: 12px; border-top: 1px solid #ffffff0e; }
.settings-subgroup:first-of-type { margin-top: 8px; }
.compact-settings.one-column { grid-template-columns: 1fr; }
.full-setting { width: 100%; min-height: 54px; }

/* Finite, calm victory entrance: no repeated card/icon pumping. */
@keyframes winBackdropSmooth { from { opacity:0; } to { opacity:1; } }
@keyframes winCardSmooth { from { opacity:0; transform:translateY(12px) scale(.975); } to { opacity:1; transform:translateY(0) scale(1); } }
.win-modal.show { animation: winBackdropSmooth .38s ease both !important; }
.win-modal.show .win-modal-card { animation: winCardSmooth .56s cubic-bezier(.16,.82,.22,1) both !important; }
.win-modal.perfect .win-modal-card::after { animation:none !important; opacity:.58; }
.win-modal.perfect .win-icon { animation:none !important; }
.win-modal.perfect-burst .win-modal-card { animation: winCardSmooth .56s cubic-bezier(.16,.82,.22,1) both !important; }
.win-star-item { transition: opacity .38s ease, transform .45s cubic-bezier(.18,.82,.22,1); }

/* Bamboo: keep only the striped green pattern, without an emoji/symbol. */
.cardback-preview.back-lotus::after,
body[data-card-back="lotus"] .card.face-down::after { content:"" !important; display:none !important; }

/* 1000-star theme. */
.theme-galaxy { background: radial-gradient(circle at 72% 24%,#dfb2ff 0 4%,transparent 5%),radial-gradient(circle at 25% 32%,#7be9ff 0 3%,transparent 4%),linear-gradient(145deg,#090f2d,#302066 52%,#7b2d7f); }
body[data-theme="galaxy"] { background:linear-gradient(155deg,#020817,#0b1230 52%,#24103d); }
body[data-theme="galaxy"] .app, body[data-theme="galaxy"] .hub-shell { background:radial-gradient(circle at 83% 7%,#a657d847,transparent 27%),radial-gradient(circle at 10% 20%,#39d8ff26,transparent 25%),linear-gradient(160deg,#101945,#241d5b 50%,#371744); }
body[data-theme="galaxy"] .brand-mark, body[data-theme="galaxy"] .controls .primary { background:linear-gradient(145deg,#5ad9ef,#755ce5 52%,#d65ea8); }
body[data-theme="galaxy"] .card.face-down { background:radial-gradient(circle at 70% 18%,#ffffff38 0 2%,transparent 3%),linear-gradient(145deg,#17255d,#4b347d 54%,#852e72);border-color:#aeeaff; }

/* Duel history is grouped by social profile; details open in a modal. */
.duel-profile-row { width:100%; display:grid; grid-template-columns:48px minmax(0,1fr) 20px; align-items:center; gap:10px; padding:11px; border:1px solid #ffffff12; border-radius:15px; background:#ffffff08; color:#fff; text-align:left; }
.duel-profile-row + .duel-profile-row { margin-top:8px; }
.duel-profile-row > i { font-style:normal; font-size:24px; color:#aaa6c7; text-align:center; }
.duel-profile-copy { min-width:0; display:grid; gap:3px; }
.duel-profile-copy b { font-size:14px; }
.duel-profile-copy small,.duel-profile-copy em { font-size:10px; color:#aaa6c7; font-style:normal; }
.duel-history-modal { position:fixed; inset:0; z-index:25000; display:grid; place-items:center; padding:18px; background:#050716b8; opacity:0; visibility:hidden; transition:opacity .24s ease; }
.duel-history-modal.show { opacity:1; visibility:visible; }
.duel-history-card { position:relative; width:min(420px,100%); max-height:min(78dvh,700px); overflow:auto; padding:20px 16px 16px; border:1px solid #ffffff1b; border-radius:24px; background:linear-gradient(160deg,#25284a,#171a34); box-shadow:0 28px 70px #0008; transform:translateY(12px) scale(.985); transition:transform .3s cubic-bezier(.2,.85,.2,1); }
.duel-history-modal.show .duel-history-card { transform:none; }
.duel-history-close { position:absolute; top:10px; right:10px; width:36px; height:36px; border:0; border-radius:12px; background:#ffffff0c; color:#fff; font-size:20px; }
.duel-history-profile { display:grid; grid-template-columns:54px minmax(0,1fr); align-items:center; gap:12px; padding-right:42px; margin-bottom:14px; }
.duel-history-profile > span { width:54px; height:54px; display:grid; place-items:center; border-radius:16px; background:#ffffff0d; border:1px solid #ffffff16; font-size:28px; }
.duel-history-profile small { color:#8eddf1; font-size:9px; font-weight:900; letter-spacing:.12em; }
.duel-history-profile h2 { margin:3px 0; font-size:20px; }
.duel-history-profile p { margin:0; color:#aaa6c7; font-size:11px; }
.duel-history-matches { display:grid; gap:8px; }
.duel-history-match { padding:10px 11px; border-radius:14px; background:#ffffff07; border:1px solid #ffffff0f; }
.duel-history-match > div { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:5px; }
.duel-history-match b { font-size:12px; }
.duel-history-match > div span,.duel-history-match small { color:#aaa6c7; font-size:10px; line-height:1.45; }
.duel-history-match.win b { color:#ffe082; }
.duel-history-match.lose b { color:#ffadb9; }
.duel-history-rematch { width:100%; min-height:46px; margin-top:12px; border:1px solid #ffffff1b; border-radius:14px; background:linear-gradient(135deg,#6a58e7,#427ff0); color:#fff; font-weight:900; }

/* v16.1: very calm level-complete motion. The dialog itself never pops twice. */
@keyframes winCardCalm {
  from { opacity: 0; transform: translate3d(0, 8px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
.win-modal.show { animation: winBackdropSmooth .46s ease-out both !important; }
.win-modal.show .win-modal-card {
  animation: winCardCalm .68s cubic-bezier(.22,.72,.2,1) both !important;
  will-change: opacity, transform;
}
.win-modal.perfect-burst .win-modal-card { animation: none !important; }
.win-star-item,
.win-star-item.revealed {
  transition: opacity .48s ease-out, transform .52s cubic-bezier(.22,.72,.2,1) !important;
}
.win-star-item { transform: translateY(4px) !important; }
.win-star-item.revealed { transform: translateY(0) !important; }
.win-star-symbol,
.win-star-item.revealed .win-star-symbol,
.win-star-item.earned.revealed .win-star-symbol {
  animation: none !important;
  transform: scale(1) rotate(0) !important;
  transition: color .45s ease, filter .45s ease, text-shadow .45s ease !important;
}

/* Settings rhythm. */
.card-source-setting { padding-inline: 0; border: 0 !important; outline: 0 !important; box-shadow: none !important; }
.startup-setting { margin-bottom: 22px !important; }
.settings-subgroup { border-top-color: #ffffff12; }
.feedback-settings { grid-template-columns: repeat(3, minmax(0,1fr)); }
.feedback-settings .setting-toggle { min-width:0; min-height:58px; padding-inline:7px; }
.feedback-settings .setting-toggle b { font-size:10px; }
.feedback-settings .setting-toggle span { font-size:8.5px; }
@media (max-width:350px) {
  .feedback-settings { grid-template-columns:1fr; }
  .feedback-settings .setting-toggle { min-height:50px; }
}

/* ===== Home / profile / picture mode refinements v17 ===== */
.global-profile-avatar[data-frame]:not([data-frame="none"]),
.profile-editor-avatar-preview[data-frame]:not([data-frame="none"]),
.profile-card-avatar[data-frame]:not([data-frame="none"]) {
  border: 2px solid hsl(var(--frame-h,250) 78% 72% / .9) !important;
  outline: 2px solid hsl(var(--frame-h,250) 80% 65% / .26);
  outline-offset: 2px;
  box-shadow: inset 0 1px #ffffff28, 0 0 0 4px hsl(var(--frame-h,250) 75% 60% / .08), 0 6px 15px #0004;
}
.home-welcome { padding: 4px 2px 0; }
.home-welcome-copy small { color:#7bd8eb; font-size:9px; font-weight:950; letter-spacing:.12em; }
.home-welcome-copy h2 { margin:4px 0 2px; font-size:23px; }
.home-welcome-copy p { margin:0; color:#aaa7ca; font-size:10px; }
.home-welcome + .smart-action { grid-template-columns:52px minmax(0,1fr); padding:15px; }
.home-welcome + .smart-action .smart-icon { width:52px; height:52px; font-size:25px; }
.home-welcome + .smart-action button { grid-column:1/-1; width:100%; min-height:48px; margin-top:2px; border:0; border-radius:14px; background:linear-gradient(135deg,#765fff,#4f86ff); font-size:13px; }
.profile-card-view { display:grid; gap:13px; }
.profile-card-identity { display:grid; grid-template-columns:58px minmax(0,1fr); align-items:center; gap:12px; }
.profile-card-avatar { width:58px; height:58px; display:grid; place-items:center; border-radius:18px; background:#ffffff10; border:1px solid #ffffff20; font-size:31px; }
.profile-card-identity small { color:#7edaf0; font-size:8px; font-weight:950; letter-spacing:.12em; }
.profile-card-identity h2 { margin:2px 0 0; font-size:22px; }
.profile-card-identity p { margin:4px 0 0; color:#b6b2d2; font-size:10px; }
.profile-card-xp { height:5px; overflow:hidden; border-radius:99px; background:#ffffff10; }
.profile-card-xp i { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,#62d8ee,#ffd467); }
.profile-card-edit { min-height:46px; border:0; border-radius:14px; background:linear-gradient(135deg,#765fff,#4f86ff); color:#fff; font-weight:950; font-size:12px; }
.picture-mode-modal { position:fixed; inset:0; z-index:170; display:none; align-items:center; justify-content:center; padding:18px; background:#050715c9; backdrop-filter:blur(9px); }
.picture-mode-modal.show { display:flex; }
.picture-mode-card { position:relative; width:min(520px,100%); max-height:min(82vh,760px); overflow:auto; padding:20px; border:1px solid #ffffff1d; border-radius:24px; background:linear-gradient(165deg,#202553,#12162f); box-shadow:0 24px 70px #0008; }
.picture-mode-close { position:absolute; right:12px; top:12px; width:36px; height:36px; border:1px solid #ffffff16; border-radius:12px; background:#ffffff0c; color:#fff; font-size:20px; }
.picture-mode-head { padding-right:42px; margin-bottom:14px; }
.picture-mode-head small { color:#7bd8eb; font-size:8px; letter-spacing:.12em; font-weight:950; }
.picture-mode-head h2 { margin:4px 0 2px; font-size:22px; }
.picture-mode-head p { margin:0; color:#aaa7ca; font-size:10px; }
.mode-card.pictures { background:linear-gradient(145deg,#21626322,#ffffff08); border-color:#64d8d83a; }

/* ===== v18 stability, special levels, developer mail ===== */
/* Picture picker must sit above the hub; previously z-index:170 left it hidden
   behind the menu until another mode closed the hub. */
.picture-mode-modal { z-index: 24600 !important; }

/* Keep the victory card physically still after its first entrance. */
.win-modal.perfect-burst .win-modal-card,
.win-modal.perfect-burst .win-icon { animation: none !important; }

.special-level-modal {
  position: fixed;
  inset: 0;
  z-index: 25200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 7, 22, .82);
  backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .28s ease, visibility .28s ease;
}
.special-level-modal.show { opacity: 1; visibility: visible; }
.special-level-card {
  width: min(410px, 94vw);
  padding: 24px 22px 20px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 26px;
  background: linear-gradient(160deg, rgba(32,38,82,.98), rgba(18,22,52,.98));
  box-shadow: 0 28px 80px rgba(0,0,0,.42);
  text-align: center;
  transform: translateY(12px) scale(.98);
  transition: transform .34s cubic-bezier(.2,.8,.2,1);
}
.special-level-modal.show .special-level-card { transform: none; }
.special-level-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: linear-gradient(135deg,#ffd86a24,#7a8cff2c);
  border: 1px solid #ffffff18;
  font-size: 32px;
}
.special-level-card > small { color:#ffd977; font-size:10px; font-weight:950; letter-spacing:.16em; }
.special-level-card h2 { margin:8px 0 8px; font-size:24px; line-height:1.08; }
.special-level-card p { margin:0 auto; max-width:330px; color:#c8c7dc; font-size:13px; line-height:1.45; }
.special-level-rule { margin:16px 0; padding:11px 12px; border-radius:14px; background:#ffffff08; border:1px solid #ffffff10; color:#fff; font-size:12px; font-weight:850; line-height:1.35; }
.special-level-card button { width:100%; min-height:50px; border:0; border-radius:15px; background:linear-gradient(135deg,#6b61ff,#4f86ff); color:#fff; font-size:14px; font-weight:950; }

.profile-editor-mail {
  position: absolute;
  top: 12px;
  right: 58px;
  z-index: 3;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid #ffffff16;
  border-radius: 13px;
  background: #ffffff0b;
  color: #fff;
  font-size: 18px;
}
.profile-editor-mail.has-unread { background: linear-gradient(135deg,#557fff33,#d469a72b); }
.profile-editor-mail span {
  position:absolute;
  top:-5px;
  right:-5px;
  min-width:18px;
  height:18px;
  padding:0 4px;
  display:grid;
  place-items:center;
  border-radius:9px;
  background:#ff6c87;
  color:#fff;
  font-size:9px;
  font-weight:950;
  box-shadow:0 2px 8px #0005;
}
.profile-card-actions { display:grid; grid-template-columns:1fr 1.45fr; gap:8px; margin-top:12px; }
.profile-card-actions button { min-height:44px; border-radius:13px; font-weight:900; }
.profile-card-settings { border:1px solid #ffffff14; background:#ffffff08; color:#fff; }
.profile-card-edit { margin-top:0 !important; width:100%; }

.developer-mail-modal {
  position:fixed;
  inset:0;
  z-index:25500;
  display:grid;
  place-items:center;
  padding:18px;
  background:#050716c9;
  backdrop-filter:blur(12px);
  opacity:0;
  visibility:hidden;
  transition:opacity .25s ease, visibility .25s ease;
}
.developer-mail-modal.show { opacity:1; visibility:visible; }
.developer-mail-card {
  position:relative;
  width:min(430px,94vw);
  max-height:min(760px,90dvh);
  overflow:hidden;
  border:1px solid #ffffff16;
  border-radius:24px;
  background:linear-gradient(160deg,#1d234d,#12162f);
  box-shadow:0 28px 80px #0008;
}
.developer-mail-close { position:absolute; top:12px; right:12px; width:40px; height:40px; border:1px solid #ffffff16; border-radius:13px; background:#ffffff0b; color:#fff; font-size:22px; z-index:2; }
.developer-mail-head { display:grid; grid-template-columns:48px 1fr; gap:11px; align-items:center; padding:18px 62px 14px 17px; border-bottom:1px solid #ffffff0c; }
.developer-mail-head > span { width:48px; height:48px; display:grid; place-items:center; border-radius:15px; background:#ffffff0a; font-size:23px; }
.developer-mail-head small { color:#86dbff; font-size:8px; font-weight:950; letter-spacing:.13em; }
.developer-mail-head h2 { margin:4px 0 0; font-size:18px; }
.developer-mail-list { max-height:calc(min(760px,90dvh) - 82px); overflow:auto; padding:13px; }
.developer-message { padding:15px; border:1px solid #ffffff0f; border-radius:17px; background:#ffffff06; }
.developer-message + .developer-message { margin-top:10px; }
.developer-message.latest { border-color:#75dfff30; background:linear-gradient(135deg,#5fdcff0c,#986aff0d); }
.developer-message-meta { display:flex; justify-content:space-between; align-items:center; gap:10px; color:#aaa8c5; font-size:9px; }
.developer-message-meta b { color:#92e6ff; font-size:8px; letter-spacing:.12em; }
.developer-message h3 { margin:7px 0 6px; font-size:15px; }
.developer-message p { margin:0 0 9px; color:#c6c4d8; font-size:11px; line-height:1.45; }
.developer-message ul { margin:0; padding-left:18px; color:#e4e3ef; font-size:10.5px; line-height:1.5; }
.developer-message li + li { margin-top:4px; }


/* ===== v19 launch sync, full-width nav and monthly challenge ===== */
.hub-nav { padding-left: max(5px, env(safe-area-inset-left)) !important; padding-right: max(5px, env(safe-area-inset-right)) !important; }
.hub-tabs { width: 100%; grid-template-columns: repeat(6, minmax(0, 1fr)) !important; gap: 4px; box-sizing: border-box; }
.hub-tabs button { width: 100%; }
.monthly-card { border-color:#8dc9ff33; background:linear-gradient(145deg,#173052aa,#221b4baa); }
.monthly-card .monthly-icon { background:linear-gradient(145deg,#5d8fff33,#9c69ff22); color:#d6e7ff; }
.monthly-card .weekly-progress i { background:linear-gradient(90deg,#68d8ff,#8d8cff 52%,#d17cff); }
.monthly-card.done { border-color:#92d8ff66; box-shadow:inset 0 0 0 1px #8ddcff15; }

/* ===== v20 player-facing polish ===== */
/* The gameplay header stays focused on the board; profile lives in the hub. */
.game-profile-button { display:none !important; }

/* Three-line profile: avatar spans the stack, identity left, rank data right. */
.hub-profile-button {
  grid-template-columns:48px minmax(0,1fr) minmax(92px,auto) !important;
  grid-template-rows:auto !important;
  column-gap:11px !important;
  min-height:62px;
  padding:6px 2px !important;
}
.hub-profile-button .global-profile-avatar { width:48px; height:48px; font-size:26px; align-self:center; }
.hub-profile-button .global-profile-copy { display:grid; grid-template-rows:auto auto auto; align-content:center; gap:4px; min-width:0; }
.hub-profile-button .global-profile-copy > b,
.hub-profile-button .global-profile-copy > small { margin:0 !important; }
.hub-profile-button .hub-profile-xp { position:relative; inset:auto; width:100%; height:5px; border-radius:99px; background:#ffffff18; overflow:hidden; }
.global-profile-rank { align-self:center; justify-self:end; display:grid; gap:2px; text-align:right; min-width:92px; }
.global-profile-rank b { font-size:11px; line-height:1.15; color:#fff; }
.global-profile-rank small { font-size:8.5px; line-height:1.15; color:#c3c0df; font-weight:850; }

/* Achievement hint takes a complete row instead of squeezing into the text column. */
.mode-card .mode-nearest { grid-column:1 / -1; grid-row:auto; width:100%; margin:8px 0 0 !important; padding:7px 9px; border-radius:10px; background:#75dfff0e; border:1px solid #75dfff18; color:#a9ebff !important; box-sizing:border-box; }

/* Chapter rows must always contain exactly five level cells. */
.chapter-grid { grid-template-columns:repeat(5,minmax(0,1fr)) !important; }

/* Brighter, more playful overlays. */
.win-modal, .developer-mail-modal, .profile-editor-modal, .picture-mode-modal, .special-level-modal,
.onboarding-modal, .weekly-digest-modal, .duel-result-modal, .duel-history-modal, .rank-up-modal,
.patch-notes-modal, .leaderboard-modal { background:radial-gradient(circle at 20% 10%,#925dff55,transparent 35%),radial-gradient(circle at 82% 14%,#3fdcff40,transparent 30%),#11152ccc !important; backdrop-filter:blur(11px); }
.win-modal-card, .developer-mail-card, .profile-editor-card, .picture-mode-card, .special-level-card,
.onboarding-card, .weekly-digest-card, .duel-result-card, .duel-history-card, .rank-up-card,
.patch-notes-card, .leaderboard-card { background:linear-gradient(155deg,#343b81 0%,#28255e 48%,#1d2252 100%) !important; border-color:#b9a8ff3d !important; box-shadow:0 28px 80px #090b205f, inset 0 1px #ffffff22 !important; }
.win-modal-card::before, .special-level-card::before, .patch-notes-card::before, .leaderboard-card::before { content:""; position:absolute; inset:0; pointer-events:none; border-radius:inherit; background:radial-gradient(circle at 15% 2%,#ffd65f22,transparent 28%),radial-gradient(circle at 86% 8%,#54e7ff1b,transparent 28%); }

.developer-mail-toolbar { position:sticky; top:0; z-index:3; display:flex; align-items:center; justify-content:space-between; gap:8px; padding:7px 3px 11px; background:linear-gradient(#25295cf2,#25295ccc,transparent); }
.developer-mail-toolbar span { color:#bfbcda; font-size:9px; font-weight:800; }
.developer-mail-toolbar button { border:1px solid #ffabb52f; border-radius:11px; padding:7px 10px; background:#ff778817; color:#ffd1d7; font-size:9px; font-weight:900; }
.developer-mail-toolbar button:disabled { opacity:.4; }

.patch-notes-modal, .leaderboard-modal { position:fixed; inset:0; z-index:25800; display:grid; place-items:center; padding:18px; opacity:0; visibility:hidden; transition:.24s ease; }
.patch-notes-modal.show, .leaderboard-modal.show { opacity:1; visibility:visible; }
.patch-notes-card, .leaderboard-card { position:relative; width:min(440px,94vw); max-height:min(780px,90dvh); overflow:auto; border:1px solid; border-radius:28px; padding:22px; color:#fff; }
.patch-notes-burst { width:64px; height:64px; display:grid; place-items:center; margin:0 auto 12px; border-radius:22px; background:linear-gradient(145deg,#ffce65,#ff799f 50%,#836dff); font-size:31px; box-shadow:0 10px 30px #ff8ca53d; transform:rotate(-4deg); }
#patchNotesContent > small { display:block; text-align:center; color:#8deaff; font-size:9px; font-weight:950; letter-spacing:.12em; }
#patchNotesContent h2 { text-align:center; margin:7px 0 8px; font-size:23px; }
#patchNotesContent p { text-align:center; margin:0 0 14px; color:#dedcf0; font-size:11px; line-height:1.45; }
#patchNotesContent ul { margin:0 0 17px; padding:0; list-style:none; display:grid; gap:7px; }
#patchNotesContent li { padding:9px 11px 9px 31px; border-radius:13px; background:#ffffff0d; font-size:10.5px; line-height:1.4; position:relative; }
#patchNotesContent li::before { content:"✦"; position:absolute; left:11px; top:9px; color:#ffd873; }
#patchNotesDone { width:100%; min-height:47px; border:0; border-radius:15px; color:#fff; font-weight:950; background:linear-gradient(135deg,#ff7d9d,#8c69ff 55%,#45cde9); box-shadow:0 9px 24px #11163c55; }

.leaderboard-card { padding:0; overflow:hidden; }
.leaderboard-close { position:absolute; z-index:3; top:12px; right:12px; width:40px; height:40px; border:1px solid #ffffff20; border-radius:13px; background:#ffffff0d; color:#fff; font-size:22px; }
.leaderboard-head { display:grid; grid-template-columns:50px 1fr; gap:11px; align-items:center; padding:18px 60px 12px 17px; }
.leaderboard-head > span { width:50px; height:50px; display:grid; place-items:center; border-radius:17px; background:linear-gradient(145deg,#ffd66d33,#ff80a326); font-size:26px; }
.leaderboard-head small { color:#8deaff; font-size:8px; letter-spacing:.12em; font-weight:950; }
.leaderboard-head h2 { margin:3px 0 0; font-size:20px; }
.leaderboard-tabs { display:flex; gap:6px; overflow:auto; padding:5px 14px 12px; scrollbar-width:none; }
.leaderboard-tabs button { flex:0 0 auto; border:1px solid #ffffff17; border-radius:99px; padding:7px 10px; background:#ffffff08; color:#c7c4de; font-size:9px; font-weight:900; }
.leaderboard-tabs button.active { background:#7769ff45; border-color:#b6adff65; color:#fff; }
.leaderboard-list { padding:0 13px 14px; max-height:60dvh; overflow:auto; }
.leaderboard-row { display:grid; grid-template-columns:28px 34px minmax(0,1fr) auto; gap:8px; align-items:center; min-height:49px; margin-top:6px; padding:6px 9px; border:1px solid #ffffff0e; border-radius:14px; background:#ffffff08; }
.leaderboard-row.me { border-color:#75e7ff55; background:linear-gradient(135deg,#64deff18,#8f72ff18); }
.leaderboard-row > b { text-align:center; color:#a9a6c7; font-size:11px; }
.leaderboard-row > span { font-size:21px; text-align:center; }
.leaderboard-row > div strong, .leaderboard-row > div small { display:block; }
.leaderboard-row > div strong { font-size:11px; }
.leaderboard-row > div small { margin-top:2px; color:#83e4f9; font-size:7.5px; }
.leaderboard-row > em { font-style:normal; color:#fff0a9; font-size:10px; font-weight:950; }
.leaders-open { border:1px solid #ffe07d38; border-radius:11px; padding:7px 10px; background:#ffe07d12; color:#ffeaa0; font-size:9px; font-weight:950; }

/* Large, unmistakable selected cosmetic at the end of every successful level. */
.victory-cosmetic { position:absolute; left:50%; top:43%; width:min(74vw,330px); aspect-ratio:1; transform:translate(-50%,-50%); display:grid; place-items:center; border-radius:50%; animation:victoryCosmeticIn 2.35s cubic-bezier(.18,.78,.18,1) forwards; }
.victory-cosmetic::before { content:""; position:absolute; inset:12%; border:3px solid #fff9; border-radius:50%; box-shadow:0 0 34px #fff6, inset 0 0 34px #86e6ff4d; animation:victoryRing 1.35s ease-out both; }
.victory-cosmetic > b { position:relative; z-index:2; display:grid; place-items:center; width:92px; height:92px; border-radius:30px; background:linear-gradient(145deg,#ffffffee,#ffd96bdd 45%,#ff83addd); color:#39244f; font-size:42px; box-shadow:0 14px 45px #11174266; animation:victoryBadge .85s cubic-bezier(.2,.9,.25,1.25) both; }
.victory-cosmetic > i { position:absolute; left:50%; top:50%; width:12px; height:28px; border-radius:8px; background:hsl(var(--vh) 95% 70%); transform:translate(-50%,-50%) rotate(var(--vr)) translateY(-110px); box-shadow:0 0 14px currentColor; animation:victoryRay 1.5s ease-out var(--vd) both; }
.victory-cosmetic.effect-stars > i::after { content:"★"; color:#fff5a5; font-size:18px; }
.victory-cosmetic.effect-crown-rain > i::after { content:"♛"; color:#fff0a0; font-size:20px; }
@keyframes victoryCosmeticIn { 0%{opacity:0;filter:blur(4px)} 14%,76%{opacity:1;filter:none} 100%{opacity:0;transform:translate(-50%,-50%) scale(1.08)} }
@keyframes victoryRing { from{opacity:0;transform:scale(.3)} 55%{opacity:1} to{opacity:0;transform:scale(1.28)} }
@keyframes victoryBadge { from{opacity:0;transform:scale(.2) rotate(-18deg)} to{opacity:1;transform:scale(1) rotate(0)} }
@keyframes victoryRay { from{opacity:0;transform:translate(-50%,-50%) rotate(var(--vr)) translateY(-35px) scale(.4)} 30%{opacity:1} to{opacity:0;transform:translate(-50%,-50%) rotate(var(--vr)) translateY(-145px) scale(1)} }

@media (max-width:390px){
  .hub-profile-button { grid-template-columns:44px minmax(0,1fr) 82px !important; column-gap:8px !important; }
  .hub-profile-button .global-profile-avatar { width:44px; height:44px; }
  .global-profile-rank { min-width:82px; }
  .global-profile-rank b { font-size:10px; }
  .global-profile-rank small { font-size:7.5px; }
}
.combo-xp-status { display:inline-flex; align-items:center; min-height:20px; padding:3px 7px; border-radius:99px; background:linear-gradient(135deg,#ffe26f18,#ff8ba716); border:1px solid #ffe88d25; color:#ffe9a8; font-size:8px; font-weight:900; white-space:nowrap; }
/* Celebration must sit above the result modal so the chosen cosmetic is actually visible. */
.celebration { z-index:11100 !important; }
.profile-editor-mail span[hidden] { display:none !important; }
.duel-rating-note { display:block; margin:7px 2px 10px; color:#aaa8c7; font-size:8.5px; line-height:1.35; }

/* ===== v20.1 layout polish ===== */
/* Progress is vertical-only: no child may widen the hub beyond the viewport. */
.hub-shell,
.hub-scroll,
#hubContent,
.hub-scroll > *,
.hub-section,
.near-goals,
.login-rewards,
.chapter-section,
.collapsible-section {
  min-width: 0;
  max-width: 100%;
}
.hub-scroll {
  overflow-y: auto;
  overflow-x: hidden;
}
.achievement-filters {
  flex-wrap: wrap;
  overflow: visible;
}
.achievement-filters button { min-width: 0; }
.chapter-path { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
.rank-roadmap-item,
.near-goal,
.achievement,
.stats-grid,
.login-reward-grid { min-width: 0; }
.rank-roadmap-item > *,
.near-goal > *,
.achievement > * { min-width: 0; }

/* Custom rules now live in a modal opened from the mode card. */
.custom-rules-modal {
  position: fixed;
  inset: 0;
  z-index: 25850;
  display: grid;
  place-items: center;
  padding: 18px;
  background: radial-gradient(circle at 18% 8%, #8b6cff45, transparent 35%), #0d1235c7;
  backdrop-filter: blur(11px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s ease, visibility .22s ease;
}
.custom-rules-modal.show { opacity: 1; visibility: visible; }
.custom-rules-card {
  position: relative;
  width: min(420px, 94vw);
  max-height: min(720px, 90dvh);
  overflow: auto;
  padding: 20px;
  border: 1px solid #ffffff28;
  border-radius: 25px;
  background: linear-gradient(155deg, #353b80, #28265e 52%, #1e2859);
  color: #fff;
  box-shadow: 0 26px 74px #06091f73, inset 0 1px #ffffff20;
}
.custom-rules-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid #ffffff1a;
  border-radius: 13px;
  background: #ffffff0d;
  color: #fff;
  font-size: 22px;
}
.custom-rules-head {
  display: grid;
  grid-template-columns: 48px minmax(0,1fr);
  gap: 11px;
  align-items: start;
  padding-right: 42px;
  margin-bottom: 15px;
}
.custom-rules-head > span {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(145deg,#ffd76d,#ff86ad 55%,#8a74ff);
  color: #352852;
  font-size: 24px;
  box-shadow: 0 8px 24px #1316364a;
}
.custom-rules-head small { color:#8deaff; font-size:8px; font-weight:950; letter-spacing:.12em; }
.custom-rules-head h2 { margin:3px 0 5px; font-size:21px; }
.custom-rules-head p { margin:0; color:#d2d0e6; font-size:10px; line-height:1.4; }
.custom-rules-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 8px;
}
.custom-rules-grid label {
  min-width: 0;
  display: grid;
  gap: 5px;
  color: #c6c3dd;
  font-size: 9px;
  font-weight: 850;
}
.custom-rules-grid input[type="number"] {
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 1px solid #ffffff18;
  border-radius: 12px;
  padding: 0 10px;
  background: #1016339c;
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  outline: none;
}
.custom-rules-grid .custom-check {
  grid-column: span 3;
  min-height: 42px;
  grid-template-columns: auto minmax(0,1fr);
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid #ffffff12;
  border-radius: 12px;
  background: #ffffff08;
  color: #fff;
}
.custom-rules-grid .custom-check input { width: 18px; height: 18px; margin: 0; }
.custom-rules-actions { display:grid; grid-template-columns: .72fr 1.28fr; gap:8px; margin-top:14px; }
.custom-rules-actions button {
  min-height: 46px;
  border: 1px solid #ffffff15;
  border-radius: 14px;
  color:#fff;
  font-weight: 900;
}
.custom-rules-actions .secondary { background:#ffffff0d; }
.custom-rules-actions .primary { background:linear-gradient(135deg,#7561ff,#4b86ee); box-shadow:0 8px 22px #1015364d; }

/* Profile: the XP bar and numeric XP are the third row of the same grid. */
.hub-profile-button .global-profile-copy,
.hub-profile-button .global-profile-rank {
  grid-template-rows: minmax(14px,auto) minmax(12px,auto) 10px;
  align-content: center;
}
.hub-profile-button .hub-profile-xp {
  align-self: center;
  height: 5px;
  margin: 0;
}
.hub-profile-button .global-profile-rank > small:last-child {
  align-self: center;
  line-height: 10px;
}

/* Gameplay HUD stays inside the board width even on narrow phones. */
.app,
.hud,
.top,
.stats,
.progress-wrap,
.progress-track,
.progress-label { min-width: 0; max-width: 100%; }
.progress-wrap {
  display: grid;
  grid-template-columns: minmax(56px,1fr) minmax(0,68%);
  align-items: center;
  gap: 6px;
}
.progress-label {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 3px 5px;
  white-space: normal;
  line-height: 1.15;
}
.combo-xp-status {
  min-width: 0;
  max-width: 100%;
  min-height: 18px;
  padding: 2px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0;
  text-transform: none;
  font-size: 8px;
}
.rule-metric { max-width: 34vw; overflow:hidden; text-overflow:ellipsis; }

/* Player card actions use one visual size and baseline. */
.profile-editor-mail,
.profile-editor-close {
  top: 12px;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
}
.profile-editor-close { right: 12px; }
.profile-editor-mail { right: 60px; }

/* Level completion is bright and light; the selected cosmetic remains around it. */
.win-modal {
  background: radial-gradient(circle at 20% 8%, #8b71ff5c, transparent 35%), radial-gradient(circle at 85% 15%, #5ce9ff42, transparent 30%), #5658a77a !important;
}
.win-modal-card {
  background: linear-gradient(155deg, #fffdf7 0%, #f8f4ff 48%, #eef9ff 100%) !important;
  color: #25243d !important;
  border-color: #ffffff !important;
  box-shadow: 0 26px 72px #18205352, inset 0 1px #fff !important;
}
.win-modal-card::before {
  background: radial-gradient(circle at 15% 2%,#ffd95e4d,transparent 31%), radial-gradient(circle at 88% 8%,#5bdff43d,transparent 29%) !important;
}
.win-modal-card h2 { color:#24233e; }
.win-modal-card #winText { color:#716d83; }
.win-modal-card .win-next-unlock { color:#706c81; }
.win-modal-card .win-share { color:#5a5570; border-color:#ddd7ee; background:#ffffffc7; }
.win-modal-card .modal-secondary-actions .secondary { color:#514c69; border-color:#ded8ec; background:#f3f0fa; }
.win-modal.perfect .win-modal-card {
  border-color:#ffe18b !important;
  box-shadow:0 26px 72px #18205352,0 0 0 2px #ffd7655c,0 0 38px #ffd7633b !important;
}
/* The transient central badge looked like an unexplained icon; keep only the cosmetic rays/ring. */
.victory-cosmetic > b { display:none !important; }
.victory-cosmetic::before { inset:22%; opacity:.78; }

@media (max-width: 370px) {
  .progress-wrap { grid-template-columns:minmax(44px,1fr) minmax(0,72%); }
  .progress-label { gap:2px 4px; font-size:8px; }
  .combo-xp-status { font-size:7.5px; padding-inline:5px; }
  .custom-rules-grid { grid-template-columns:1fr 1fr; }
  .custom-rules-grid label:nth-child(3) { grid-column:1 / -1; }
  .custom-rules-grid .custom-check { grid-column:1 / -1; }
}

/* ===== v21 accounts ===== */
.profile-account-strip {
  width:100%; min-width:0; display:grid; grid-template-columns:42px minmax(0,1fr) 18px; gap:10px; align-items:center;
  padding:11px 12px; border:1px solid #ffffff14; border-radius:16px; background:linear-gradient(135deg,#ffffff0a,#6d75ff0d); color:#fff; text-align:left;
}
.profile-account-strip.connected { border-color:#62d9bd33; background:linear-gradient(135deg,#42d6ac12,#567cff13); }
.profile-account-strip > span { width:42px; height:42px; display:grid; place-items:center; border-radius:13px; background:#ffffff0d; font-size:20px; font-weight:950; }
.profile-account-strip.connected > span { background:#4ad6b21a; color:#8cf1d3; }
.profile-account-strip div { min-width:0; display:grid; gap:1px; }
.profile-account-strip small { color:#8eddf1; font-size:7.5px; font-weight:950; letter-spacing:.13em; }
.profile-account-strip b { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11.5px; }
.profile-account-strip em { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#aaa8c6; font-size:8.5px; font-style:normal; font-weight:650; }
.profile-account-strip > i { color:#9f9bbb; font-style:normal; font-size:22px; }

.account-modal {
  position:fixed; inset:0; z-index:26000; display:grid; place-items:center;
  padding:max(16px,env(safe-area-inset-top)) 14px max(16px,env(safe-area-inset-bottom));
  background:rgba(8,10,27,.74); backdrop-filter:blur(14px); opacity:0; visibility:hidden;
  transition:opacity .2s ease,visibility .2s ease;
}
.account-modal.show { opacity:1; visibility:visible; }
.account-card {
  position:relative; width:min(430px,100%); max-height:min(780px,calc(100dvh - 28px)); overflow:auto;
  padding:20px; border:1px solid #ffffffbd; border-radius:26px;
  background:linear-gradient(160deg,#ffffff,#f3f2ff 55%,#edf8ff); color:#25223d;
  box-shadow:0 30px 90px #05061978,0 2px 0 #fff inset;
  transform:translateY(10px) scale(.985); transition:transform .25s cubic-bezier(.2,.9,.2,1);
}
.account-modal.show .account-card { transform:none; }
.account-close {
  position:absolute; top:12px; right:12px; width:40px; height:40px; border:1px solid #dcd9ef; border-radius:13px;
  background:#fff; color:#56516d; box-shadow:0 5px 14px #423c7712; font-size:22px; z-index:2;
}
.account-content { display:grid; gap:14px; }
.account-hero { display:grid; grid-template-columns:58px minmax(0,1fr); gap:12px; align-items:center; padding-right:38px; }
.account-hero > span { width:58px; height:58px; display:grid; place-items:center; border-radius:18px; background:linear-gradient(145deg,#7466ff,#4f91ff); color:#fff; box-shadow:0 12px 26px #655fff35; font-size:25px; font-weight:950; }
.account-hero.signed > span { background:linear-gradient(145deg,#45cfa5,#54a9ec); }
.account-hero.recovery > span { background:linear-gradient(145deg,#ffcc63,#ff8c69); }
.account-hero small { color:#6c66a1; font-size:8px; font-weight:950; letter-spacing:.14em; }
.account-hero h2 { margin:3px 0 3px; color:#24213b; font-size:22px; letter-spacing:-.03em; }
.account-hero p { margin:0; color:#77738c; font-size:10.5px; line-height:1.4; }
.account-form { display:grid; gap:10px; }
.account-form label { display:grid; gap:5px; color:#69657d; font-size:9px; font-weight:900; }
.account-form input {
  width:100%; min-height:47px; box-sizing:border-box; border:1px solid #d9d6e8; border-radius:14px; outline:0; padding:0 13px;
  background:#fff; color:#27233d; font:inherit; font-size:13px; box-shadow:0 4px 12px #49436b0b inset;
}
.account-form input:focus { border-color:#756cff; box-shadow:0 0 0 3px #756cff17; }
.account-password-note,.account-note { margin:0; color:#807b92; font-size:9.5px; line-height:1.45; }
.account-error { min-height:14px; color:#d84f68; font-size:9.5px; font-weight:850; }
.account-primary,.account-link,.account-danger,.account-cloud-card button {
  min-height:47px; border:0; border-radius:14px; font-weight:950; font-size:12px;
}
.account-primary { width:100%; background:linear-gradient(135deg,#7565ff,#4c8cff); color:#fff; box-shadow:0 10px 22px #625eff27; }
.account-primary:disabled,.account-cloud-card button:disabled { opacity:.55; }
.account-link { min-height:36px; background:transparent; color:#625a91; }
.account-link.subtle { margin-top:-8px; color:#8b879b; font-size:10px; }
.account-cloud-card { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; align-items:center; padding:13px; border:1px solid #dedbea; border-radius:16px; background:#fff; }
.account-cloud-card div { min-width:0; display:grid; gap:2px; }
.account-cloud-card span { color:#827d91; font-size:9px; }
.account-cloud-card b { color:#2c2941; font-size:13px; }
.account-cloud-card small { color:#9a95a8; font-size:8.5px; }
.account-cloud-card button { padding:0 13px; background:#eeecff; color:#5b55a1; }
.account-actions { display:grid; padding-top:4px; border-top:1px solid #e8e5f0; }
.account-danger { background:#fff0f2; color:#c74c63; }
.recovery-code { padding:16px 10px; border:1px dashed #9c8fff; border-radius:16px; background:#f3f0ff; color:#4e478a; text-align:center; font-size:17px; font-weight:950; letter-spacing:.08em; overflow-wrap:anywhere; }

@media (max-width:420px) {
  .account-card { padding:18px 15px 16px; border-radius:22px; }
  .account-hero { grid-template-columns:50px minmax(0,1fr); gap:10px; }
  .account-hero > span { width:50px; height:50px; border-radius:15px; font-size:22px; }
  .account-hero h2 { font-size:19px; }
  .profile-account-strip em { white-space:normal; line-height:1.25; }
}
