:root {
  color-scheme: dark;
  font-family: "Segoe UI", "Noto Sans TC", sans-serif;
  --phone-ratio: 511 / 908;
  --menu-width: clamp(112px, 29%, 136px);
  --member-rail-width: clamp(38px, 9%, 46px);
  --member-anchor-top: clamp(48px, 5.5dvh, 54px);
  --member-toggle-height: clamp(96px, 17dvh, 128px);
  --gold: #ffd564;
  --pink: #ff5dba;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 25%, #393040 0, #17131d 42%, #08070b 100%);
}

.prototype-stage {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: grid;
  place-items: center;
}

.phone {
  position: relative;
  width: min(100%, calc(100dvh * 511 / 908), 511px);
  aspect-ratio: var(--phone-ratio);
  overflow: hidden;
  isolation: isolate;
  background: #09070d;
  box-shadow: 0 20px 65px rgb(0 0 0 / 55%);
}

.slot-background {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.menu-dismiss {
  position: absolute;
  inset: 0;
  z-index: 10;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: default;
}

.member-menu {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--menu-width);
  padding: var(--member-anchor-top) 10px max(16px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgb(0 0 0 / 90%);
  box-shadow: 10px 0 28px rgb(0 0 0 / 42%);
  transform: translateX(-100%);
  transition: transform 240ms cubic-bezier(.22, .8, .32, 1);
}

.menu-logo {
  height: var(--member-toggle-height);
  flex: 0 0 var(--member-toggle-height);
  display: grid;
  place-items: center;
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(22px, 6.5vw, 34px);
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  text-shadow: 0 0 12px rgb(255 68 173 / 70%);
}

.menu-functions {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: clamp(8px, 1.8dvh, 15px);
}

.function-button {
  position: relative;
  width: 100%;
  min-height: clamp(76px, 12dvh, 104px);
  padding: 8px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(160deg, rgb(255 255 255 / 13%), rgb(255 255 255 / 4%));
  cursor: pointer;
}

.function-button:active {
  transform: scale(.97);
}

.function-icon {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 35%);
  border-radius: 50%;
  color: var(--gold);
  background: rgb(0 0 0 / 45%);
  font-size: 22px;
  line-height: 1;
}

.function-label {
  font-size: clamp(12px, 3.3vw, 15px);
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
}

.count-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: #e92d78;
  font: 800 11px/1 "Segoe UI", sans-serif;
}

.notice-dot {
  position: absolute;
  top: -3px;
  right: -2px;
  width: 11px;
  height: 11px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #f0283f;
  box-shadow: 0 0 8px #f0283f;
}

.bean-icon {
  color: #ffc84b;
  text-shadow: -5px 2px 0 #b87510, 5px -2px 0 #ffea91;
}

.member-rail {
  position: absolute;
  z-index: 30;
  top: var(--member-anchor-top);
  left: 0;
  width: var(--member-rail-width);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  filter: drop-shadow(5px 5px 8px rgb(0 0 0 / 55%));
  transition: left 240ms cubic-bezier(.22, .8, .32, 1);
}

.member-toggle {
  width: 100%;
  height: var(--member-toggle-height);
  padding: 0 8px 0 0;
  display: grid;
  place-items: center;
  border: 1px solid #ffe1a1;
  border-left: 0;
  clip-path: polygon(0 0, 72% 0, 100% 12%, 100% 88%, 72% 100%, 0 100%);
  color: #fff;
  background: linear-gradient(90deg, #8f1f55, #e5489c 70%, #6c143e);
  cursor: pointer;
}

.member-toggle span {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(17px, 4.9vw, 25px);
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 2px 5px rgb(0 0 0 / 65%);
  transform: rotate(-90deg);
}

.bean-meter {
  position: relative;
  width: 54%;
  height: clamp(82px, 15dvh, 112px);
  margin: 5px 0 0;
  overflow: hidden;
  border: 2px solid #f8d37b;
  border-radius: 999px;
  background: rgb(16 10 20 / 88%);
  box-shadow: inset 0 0 0 2px rgb(0 0 0 / 38%);
}

.bean-meter-fill {
  position: absolute;
  inset: 40% 0 0;
  border-radius: 999px;
  background: linear-gradient(0deg, #ff9b20, #ffe66f 75%, #fff4b3);
  box-shadow: 0 0 10px #ffba35;
}

.bean-mark {
  position: absolute;
  left: 50%;
  bottom: 8px;
  color: #fff9bd;
  font-size: 10px;
  transform: translateX(-50%);
}

.phone.menu-open .member-menu {
  transform: translateX(0);
}

.phone.menu-open .member-rail {
  left: var(--menu-width);
}

.phone.menu-open .member-toggle span {
  font-family: "Segoe UI", sans-serif;
  font-size: 32px;
  font-style: normal;
  transform: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 50;
  padding: 7%;
  display: grid;
  place-items: center;
  background: rgb(3 2 5 / 72%);
  animation: fade-in 160ms ease-out;
}

.modal-backdrop[hidden],
.menu-dismiss[hidden] {
  display: none;
}

.placeholder-modal {
  position: relative;
  width: 100%;
  min-height: 62%;
  display: grid;
  place-items: center;
  border: 2px solid rgb(255 218 142 / 78%);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgb(52 22 48 / 96%), rgb(15 11 21 / 98%));
  box-shadow: 0 24px 60px rgb(0 0 0 / 60%), inset 0 0 30px rgb(255 82 175 / 12%);
  animation: modal-in 180ms ease-out;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0 0 4px;
  border: 1px solid rgb(255 255 255 / 48%);
  border-radius: 50%;
  color: #fff;
  background: rgb(0 0 0 / 45%);
  cursor: pointer;
  font-size: 30px;
  line-height: 1;
}

.placeholder-content {
  padding: 72px 22px 36px;
  text-align: center;
}

.placeholder-kicker {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
}

.placeholder-content h1 {
  margin: 0 0 14px;
  color: #fff;
  font-size: clamp(28px, 8vw, 42px);
}

.placeholder-content p:last-child {
  margin: 0;
  color: rgb(255 255 255 / 65%);
  font-size: 14px;
}

.placeholder-content[hidden],
.member-game[hidden] {
  display: none;
}

.modal-backdrop.game-active {
  padding: 14px;
}

.placeholder-modal.game-mode {
  height: 100%;
  min-height: 0;
  max-height: 100%;
  display: block;
  overflow: hidden;
  border-radius: 18px;
}

.placeholder-modal.game-mode .modal-close {
  z-index: 8;
  top: 10px;
  right: 10px;
}

.member-game {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  color: #fff;
}

.game-header {
  min-height: 66px;
  flex: 0 0 66px;
  padding: 12px 62px 10px 16px;
  border-bottom: 1px solid rgb(255 255 255 / 14%);
  background: rgb(0 0 0 / 24%);
}

.game-header p {
  margin: 0 0 2px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
}

.game-header h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.game-scroll {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 12px 18px;
  scrollbar-width: thin;
  scrollbar-color: rgb(255 213 100 / 60%) transparent;
}

.game-scroll::-webkit-scrollbar {
  width: 4px;
}

.game-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgb(255 213 100 / 60%);
}

.game-resources {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.resource-card {
  min-width: 0;
  padding: 7px 4px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 9px;
  background: rgb(0 0 0 / 30%);
  text-align: center;
}

.resource-card span {
  display: block;
  overflow: hidden;
  color: rgb(255 255 255 / 58%);
  font-size: 9px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-card strong {
  display: block;
  margin-top: 3px;
  color: #fff;
  font-size: 13px;
  line-height: 1.2;
}

.resource-card strong span {
  display: inline;
  color: inherit;
  font: inherit;
}

.character-stage {
  position: relative;
  height: clamp(190px, 27dvh, 238px);
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 24%);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 22%, rgb(255 211 128 / 34%), transparent 24%),
    linear-gradient(160deg, #5c244f, #171321 62%, #0b0910);
  box-shadow: inset 0 0 30px rgb(255 89 182 / 13%);
}

.character-stage::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 24px;
  height: 18px;
  border-radius: 50%;
  background: rgb(0 0 0 / 40%);
  filter: blur(8px);
}

.stage-light {
  position: absolute;
  top: -50px;
  width: 75px;
  height: 250px;
  opacity: .26;
  background: linear-gradient(#fff8c8, transparent);
  filter: blur(5px);
  transform-origin: top;
}

.stage-light-left {
  left: 9%;
  transform: rotate(-20deg);
}

.stage-light-right {
  right: 9%;
  transform: rotate(20deg);
}

.character-placeholder {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 20px;
  width: 112px;
  height: 176px;
  transform: translateX(-50%);
}

.character-head {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 0;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 2px solid rgb(255 255 255 / 70%);
  border-radius: 50%;
  color: #5b294b;
  background: linear-gradient(145deg, #ffe9d4, #e0a88e);
  box-shadow: 0 5px 14px rgb(0 0 0 / 34%);
  font: 800 24px/1 Georgia, serif;
}

.character-body {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 106px;
  height: 130px;
  border: 2px solid rgb(255 255 255 / 46%);
  border-radius: 52px 52px 18px 18px;
  background: linear-gradient(160deg, #f3bed4, #9f3f78 62%, #48243f);
  transform: translateX(-50%);
  box-shadow: 0 10px 24px rgb(0 0 0 / 42%);
}

.stage-caption {
  position: absolute;
  z-index: 3;
  left: 10px;
  bottom: 8px;
  margin: 0;
  color: rgb(255 255 255 / 56%);
  font-size: 9px;
}

.performance-status {
  position: absolute;
  z-index: 4;
  top: 10px;
  right: 10px;
  padding: 5px 8px;
  border: 1px solid rgb(255 255 255 / 25%);
  border-radius: 999px;
  color: rgb(255 255 255 / 72%);
  background: rgb(0 0 0 / 46%);
  font-size: 10px;
  font-weight: 750;
}

.character-stage.is-performing .character-placeholder {
  animation: character-performance 620ms ease-in-out infinite alternate;
}

.character-stage.is-performing .stage-light-left {
  animation: light-left 480ms ease-in-out infinite alternate;
}

.character-stage.is-performing .stage-light-right {
  animation: light-right 480ms ease-in-out infinite alternate;
}

.character-stage.is-performing .performance-status {
  color: #1c1420;
  background: var(--gold);
}

.round-result {
  min-height: 54px;
  margin-top: 9px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgb(255 255 255 / 17%);
  border-radius: 12px;
  background: rgb(0 0 0 / 26%);
}

.round-result strong {
  flex: 0 0 auto;
  font-size: 15px;
}

.round-result span {
  color: rgb(255 255 255 / 68%);
  font-size: 11px;
  text-align: right;
}

.round-result.is-win {
  border-color: #ffd45e;
  background: rgb(104 72 10 / 48%);
}

.round-result.is-win strong {
  color: #ffe77f;
}

.round-result.is-lose {
  border-color: rgb(255 255 255 / 22%);
  background: rgb(72 62 78 / 52%);
}

.section-heading {
  margin: 14px 0 7px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.section-heading h2 {
  margin: 0;
  font-size: 15px;
}

.section-heading span {
  color: rgb(255 255 255 / 48%);
  font-size: 9px;
}

.result-history {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
  list-style: none;
}

.history-item {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 3px;
}

.history-chip {
  width: min(100%, 34px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid rgb(255 255 255 / 36%);
  border-radius: 50%;
  color: #fff;
  background: var(--result-color, #766879);
  box-shadow: inset 0 0 8px rgb(0 0 0 / 28%);
  font-size: 11px;
  font-weight: 900;
}

.history-item small {
  width: 100%;
  overflow: hidden;
  color: rgb(255 255 255 / 62%);
  font-size: 8px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-red { --result-color: #d93652; }
.result-yellow { --result-color: #d7a912; }
.result-blue { --result-color: #3479d7; }
.result-green { --result-color: #2b9b64; }
.result-white { --result-color: #e9e9ed; color: #352c39; }
.result-black { --result-color: #17151b; }
.result-underwear { --result-color: #e870ad; }
.result-underpants { --result-color: #8d6bd1; }
.result-none { --result-color: #d78e62; }

.bet-group + .bet-group {
  margin-top: 10px;
}

.bet-group h3 {
  margin: 0 0 5px;
  color: rgb(255 255 255 / 60%);
  font-size: 10px;
  font-weight: 700;
}

.bet-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.bet-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bet-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.bet-option {
  position: relative;
  min-width: 0;
  min-height: 57px;
  padding: 7px 5px;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(155deg, rgb(255 255 255 / 11%), rgb(0 0 0 / 20%));
  cursor: pointer;
  line-height: 1.15;
}

.bet-option strong,
.bet-option span {
  display: block;
}

.bet-option strong {
  font-size: 12px;
}

.bet-option span {
  margin-top: 4px;
  color: var(--gold);
  font-size: 9px;
}

.bet-option.selected {
  border-color: #ffe071;
  background: linear-gradient(150deg, #a12f75, #5f214e);
  box-shadow: 0 0 0 2px rgb(255 224 113 / 35%), 0 0 16px rgb(255 74 175 / 35%);
  transform: translateY(-1px);
}

.bet-option:disabled {
  cursor: wait;
  opacity: .62;
}

.game-actions {
  min-height: 78px;
  flex: 0 0 78px;
  padding: 9px 11px 11px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border-top: 1px solid rgb(255 255 255 / 16%);
  background: rgb(10 7 13 / 96%);
  box-shadow: 0 -9px 22px rgb(0 0 0 / 32%);
}

.play-button {
  min-width: 0;
  min-height: 56px;
  padding: 7px 6px;
  border: 1px solid rgb(255 255 255 / 32%);
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.play-free {
  background: linear-gradient(145deg, #8a3570, #55204d);
}

.play-paid {
  background: linear-gradient(145deg, #c68a21, #75501a);
}

.play-button span,
.play-button small {
  display: block;
}

.play-button small {
  margin-top: 2px;
  color: rgb(255 255 255 / 70%);
  font-size: 9px;
}

.play-button:disabled {
  cursor: not-allowed;
  opacity: .38;
  filter: grayscale(.7);
}

/* Step 3 compact game layout */
.modal-backdrop.game-active {
  padding: 6px 6px 6px calc(var(--member-rail-width) + 4px);
}

.modal-visible .member-rail {
  z-index: 70;
  pointer-events: none;
  filter: drop-shadow(4px 4px 8px rgb(0 0 0 / 72%));
}

.placeholder-modal.game-mode {
  width: 100%;
  height: 100%;
  border-radius: 15px;
}

.member-game {
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr) auto;
}

.game-header {
  min-height: 52px;
  height: 52px;
  padding: 7px 58px 6px 12px;
}

.game-header p {
  margin-bottom: 0;
  font-size: 8px;
}

.game-header h1 {
  font-size: 19px;
}

.game-scroll {
  display: grid;
  grid-template-rows: minmax(116px, 1.2fr) 26px 34px 18px minmax(238px, 2fr);
  gap: 4px;
  overflow: hidden;
  padding: 5px 7px 6px;
  scrollbar-width: none;
}

.game-scroll::-webkit-scrollbar {
  display: none;
}

.character-stage {
  height: auto;
  min-height: 0;
  border-radius: 11px;
}

.character-stage::after {
  bottom: 11px;
  height: 10px;
}

.character-placeholder {
  bottom: 7px;
  width: clamp(70px, 20vw, 98px);
  height: clamp(108px, 27vw, 142px);
}

.character-head {
  width: 52%;
  height: auto;
  aspect-ratio: 1;
  font-size: clamp(17px, 5vw, 24px);
}

.character-body {
  width: 94%;
  height: 72%;
  border-radius: 45% 45% 14px 14px;
}

.stage-caption {
  left: 7px;
  bottom: 5px;
  font-size: 7px;
}

.performance-status {
  top: 6px;
  right: 6px;
  padding: 3px 6px;
  font-size: 8px;
}

.reward-toast {
  min-width: 0;
  min-height: 26px;
  align-self: center;
  justify-self: center;
  padding: 5px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  opacity: 0;
  color: #291826;
  background: transparent;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.2;
  text-align: center;
  transform: translateY(4px) scale(.96);
  transition: opacity 160ms ease, transform 160ms ease;
}

.reward-toast.is-visible {
  border-color: #ffe69a;
  opacity: 1;
  background: linear-gradient(135deg, #fff3b0, #f0b849);
  box-shadow: 0 5px 14px rgb(0 0 0 / 28%);
  transform: translateY(0) scale(1);
}

.history-section {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.history-section h2 {
  margin: 0;
  font-size: 10px;
  white-space: nowrap;
}

.result-history {
  gap: 3px;
}

.history-item {
  display: block;
}

.history-chip {
  width: 100%;
  max-width: 27px;
  margin: 0 auto;
  border-width: 1px;
  font-size: 8px;
}

.history-item small {
  display: none;
}

.bet-section {
  min-height: 0;
  display: contents;
}

.bet-section > h2 {
  align-self: center;
  margin: 0;
  color: rgb(255 255 255 / 82%);
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.bet-board {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.82fr) minmax(88px, 1fr);
  gap: 5px;
}

.bet-main-column {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 5px;
}

.bet-panel,
.special-bet {
  min-width: 0;
  min-height: 0;
  border: 1px solid rgb(255 255 255 / 23%);
  border-radius: 10px;
  background: linear-gradient(150deg, rgb(255 255 255 / 8%), rgb(0 0 0 / 20%));
}

.bet-panel {
  padding: 4px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 14px;
  gap: 2px;
}

.bet-panel > p {
  align-self: center;
  margin: 0;
  color: var(--gold);
  font-size: 9px;
  font-weight: 850;
  line-height: 1;
  text-align: center;
}

.color-bet-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 3px;
}

.combo-bet-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.special-bet-stack {
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.bet-contents {
  display: contents;
}

.bet-option {
  min-height: 0;
  padding: 2px;
  border-radius: 8px;
  touch-action: manipulation;
}

.color-bet,
.combo-bet {
  display: grid;
  place-items: center;
}

.color-bet img {
  width: min(82%, 50px);
  height: min(82%, 50px);
  object-fit: contain;
}

.combo-icons {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.combo-icons img {
  width: 35%;
  max-width: 38px;
  aspect-ratio: 1;
  object-fit: contain;
}

.combo-icons img + img {
  margin-left: -6%;
}

.special-bet {
  padding: 3px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  place-items: center;
  color: #fff;
  cursor: pointer;
}

.special-bet img,
.special-placeholder {
  width: min(58%, 54px);
  height: min(100%, 54px);
  object-fit: contain;
}

.special-placeholder {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px dashed rgb(255 255 255 / 42%);
  border-radius: 9px;
  color: #ffd5e9;
  background: rgb(255 255 255 / 7%);
  font-size: 14px;
  font-weight: 850;
}

.special-bet strong {
  font-size: 10px;
  line-height: 1.1;
}

.special-bet span:last-child {
  margin: 1px 0 0;
  color: var(--gold);
  font-size: 8px;
  line-height: 1.1;
}

.bet-option.selected,
.special-bet.selected {
  border-color: #ffe071;
  background: linear-gradient(150deg, #a12f75, #5f214e);
  box-shadow: inset 0 0 0 1px rgb(255 224 113 / 65%), 0 0 12px rgb(255 74 175 / 38%);
  transform: none;
}

.game-actions {
  min-height: 66px;
  height: 66px;
  padding: 6px 7px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 5px;
}

.mode-options {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.free-mode-button {
  flex: 0 0 auto;
  width: 46px;
  height: 42px;
  padding: 3px;
  border: 1px solid rgb(255 255 255 / 28%);
  border-radius: 9px;
  color: #fff;
  background: #512344;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
}

.chip-options {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 3px;
}

.chip-button {
  width: clamp(29px, 6.4vw, 34px);
  height: clamp(29px, 6.4vw, 34px);
  padding: 0;
  border: 3px dashed rgb(255 255 255 / 55%);
  border-radius: 50%;
  color: #fff;
  background: var(--chip-color, #71486a);
  box-shadow: inset 0 0 0 2px rgb(0 0 0 / 27%), 0 2px 5px rgb(0 0 0 / 34%);
  cursor: pointer;
  font-size: 8px;
  font-weight: 900;
}

.free-mode-button.selected,
.chip-button.selected {
  border-color: #fff6a6;
  box-shadow: 0 0 0 2px #f2c54b, 0 0 12px rgb(255 207 75 / 64%);
  transform: translateY(-1px);
}

.free-mode-button:disabled,
.chip-button:disabled {
  cursor: not-allowed;
  opacity: .38;
}

.chip-10 { --chip-color: #9e3759; }
.chip-20 { --chip-color: #2f7c93; }
.chip-50 { --chip-color: #438650; }
.chip-100 { --chip-color: #8b5ba7; }
.chip-500 { --chip-color: #a36c22; }

.point-balance {
  color: #fff0b0;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.start-game-button {
  min-width: 76px;
  height: 44px;
  padding: 5px 8px;
  border: 1px solid #ffe18b;
  border-radius: 10px;
  color: #231522;
  background: linear-gradient(145deg, #ffe17c, #d59428);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.start-game-button:disabled {
  border-color: rgb(255 255 255 / 20%);
  opacity: .38;
  color: #fff;
  background: #3f3541;
  cursor: not-allowed;
}

@keyframes character-performance {
  from { transform: translateX(-50%) translateY(2px) rotate(-2deg); }
  to { transform: translateX(-50%) translateY(-5px) rotate(2deg); }
}

@keyframes light-left {
  to { transform: rotate(-6deg); opacity: .55; }
}

@keyframes light-right {
  to { transform: rotate(6deg); opacity: .55; }
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
}

@media (max-height: 620px) {
  .member-menu { gap: 8px; padding-right: 8px; padding-bottom: 10px; padding-left: 8px; }
  .menu-functions { gap: 5px; }
  .function-button { min-height: 66px; }
  .function-icon { width: 34px; height: 34px; font-size: 18px; }
  .modal-backdrop.game-active { padding: 8px; }
  .game-header { min-height: 58px; flex-basis: 58px; padding-top: 8px; }
  .game-actions { min-height: 70px; flex-basis: 70px; padding: 6px 8px 8px; }
}

@media (max-width: 430px) {
  .modal-backdrop.game-active {
    padding: 4px 4px 4px calc(var(--member-rail-width) + 3px);
  }

  .placeholder-modal.game-mode .modal-close {
    top: 6px;
    right: 6px;
    width: 36px;
    height: 36px;
    font-size: 25px;
  }

  .member-game {
    grid-template-rows: 46px minmax(0, 1fr) 88px;
  }

  .game-header {
    min-height: 46px;
    height: 46px;
    padding: 5px 46px 4px 9px;
  }

  .game-header h1 {
    font-size: 17px;
  }

  .game-scroll {
    grid-template-rows: minmax(105px, 1fr) 24px 30px 16px minmax(225px, 2fr);
    gap: 3px;
    padding: 4px 5px;
  }

  .reward-toast {
    min-height: 24px;
    padding: 4px 9px;
    font-size: 10px;
  }

  .history-section {
    gap: 4px;
  }

  .history-section h2 {
    font-size: 9px;
  }

  .result-history {
    gap: 2px;
  }

  .bet-board,
  .bet-main-column,
  .special-bet-stack {
    gap: 3px;
  }

  .bet-panel {
    padding: 3px;
  }

  .special-bet strong {
    font-size: 9px;
  }

  .game-actions {
    min-height: 88px;
    height: 88px;
    padding: 4px 6px 5px;
    grid-template-columns: 1fr auto;
    grid-template-rows: 45px 30px;
    grid-template-areas:
      "modes modes"
      "points start";
    gap: 3px 6px;
  }

  .mode-options {
    grid-area: modes;
    justify-content: center;
  }

  .free-mode-button {
    width: 43px;
    height: 35px;
  }

  .chip-button {
    width: 31px;
    height: 31px;
  }

  .point-balance {
    grid-area: points;
    justify-self: start;
    padding-left: 4px;
  }

  .start-game-button {
    grid-area: start;
    min-width: 82px;
    height: 30px;
    padding: 3px 8px;
  }
}

/* Step 3 readability and in-bet chip markers */
.member-game {
  grid-template-rows: 64px minmax(0, 1fr) 104px;
}

.game-header {
  min-height: 64px;
  height: 64px;
  padding: 6px 58px 5px 12px;
}

.game-header p,
.game-header h1,
.stage-caption,
.performance-status,
.reward-toast,
.history-section h2,
.bet-section > h2,
.bet-panel > p,
.special-bet strong,
.special-bet span:last-child,
.free-mode-button,
.chip-button,
.point-balance,
.start-game-button {
  font-size: 20px;
}

.game-header p {
  line-height: 1;
}

.game-header h1 {
  font-size: 24px;
  line-height: 1.1;
}

.game-scroll {
  grid-template-rows: minmax(126px, 1fr) 36px 42px 28px minmax(330px, 2.35fr);
  gap: 4px;
  padding: 5px 6px 6px;
}

.character-placeholder {
  width: clamp(62px, 17vw, 86px);
  height: clamp(92px, 22vw, 118px);
}

.stage-caption {
  left: 8px;
  bottom: 6px;
  max-width: 66%;
  line-height: 1.1;
}

.performance-status {
  top: 7px;
  right: 7px;
  max-width: 58%;
  padding: 4px 7px;
  line-height: 1.1;
  text-align: right;
}

.reward-toast {
  min-height: 34px;
  padding: 4px 12px;
  line-height: 1.1;
}

.history-section {
  gap: 5px;
}

.history-section h2 {
  line-height: 1;
}

.result-history {
  gap: 2px;
}

.history-chip {
  max-width: 28px;
  font-size: 14px;
}

.bet-section > h2 {
  line-height: 28px;
}

.bet-board {
  grid-template-columns: minmax(0, 2.08fr) minmax(102px, .92fr);
  gap: 4px;
}

.bet-main-column,
.special-bet-stack {
  gap: 4px;
}

.bet-main-column {
  grid-template-rows: minmax(0, 1.48fr) minmax(0, 1fr);
}

.bet-panel {
  grid-template-rows: minmax(0, 1fr) 24px;
  gap: 2px;
  padding: 4px;
}

.bet-panel > p {
  line-height: 22px;
}

.color-bet-grid {
  gap: 3px;
}

.color-bet img {
  width: min(68%, 44px);
  height: min(68%, 44px);
}

.combo-icons img {
  max-width: 32px;
}

.special-bet {
  grid-template-rows: minmax(28px, 1fr) auto auto;
  padding: 3px;
}

.special-bet img,
.special-placeholder {
  width: min(45%, 42px);
  height: min(100%, 42px);
}

.special-bet strong,
.special-bet span:last-child {
  line-height: 1;
  white-space: nowrap;
}

.special-bet span:last-child {
  margin-top: 2px;
}

.bet-option {
  position: relative;
  overflow: hidden;
}

.bet-marker {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 4;
  display: grid;
  place-items: center;
  pointer-events: none;
  color: #fff;
  font-size: 20px;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 1px 2px rgb(0 0 0 / 75%);
  box-sizing: border-box;
}

.paid-bet-marker {
  width: 34px;
  height: 34px;
  border: 3px dashed rgb(255 255 255 / 76%);
  border-radius: 50%;
  background: var(--chip-color, #9e3759);
  box-shadow: inset 0 0 0 2px rgb(0 0 0 / 28%), 0 2px 7px rgb(0 0 0 / 48%);
}

.free-bet-marker {
  width: 44px;
  height: 32px;
  border: 2px solid #fff3a8;
  border-radius: 16px;
  color: #2d1d22;
  background: linear-gradient(145deg, #fff5a6, #e5a52c);
  letter-spacing: 0;
}

.has-bet-marker.color-bet img {
  width: 28px;
  height: 28px;
  align-self: end;
  justify-self: end;
  margin: 0 2px 2px 0;
}

.has-bet-marker.combo-bet .combo-icons {
  align-self: end;
  justify-content: flex-end;
  width: 68%;
  margin: 0 2px 3px 0;
}

.has-bet-marker.special-bet img,
.has-bet-marker.special-bet .special-placeholder {
  justify-self: end;
  width: 34px;
  height: 34px;
  margin-right: 3px;
}

.game-actions {
  min-height: 104px;
  height: 104px;
  padding: 5px 7px 7px;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 50px 40px;
  grid-template-areas:
    "modes modes"
    "points start";
  gap: 3px 8px;
}

.mode-options {
  grid-area: modes;
  justify-content: center;
  gap: 4px;
}

.free-mode-button {
  width: 72px;
  height: 42px;
  padding: 2px 4px;
  line-height: 1;
}

.chip-options {
  gap: 4px;
}

.chip-button {
  width: 40px;
  height: 40px;
  line-height: 1;
}

.point-balance {
  grid-area: points;
  justify-self: start;
  padding-left: 4px;
  line-height: 1;
}

.start-game-button {
  grid-area: start;
  min-width: 120px;
  height: 40px;
  padding: 3px 9px;
  line-height: 1;
}

@media (max-width: 430px) {
  .member-game {
    grid-template-rows: 64px minmax(0, 1fr) 104px;
  }

  .game-header {
    min-height: 64px;
    height: 64px;
    padding: 6px 46px 5px 9px;
  }

  .game-header h1 {
    font-size: 24px;
  }

  .game-scroll {
    grid-template-rows: minmax(92px, 1fr) 34px 36px 26px minmax(270px, 2.3fr);
    gap: 3px;
    padding: 4px 5px 5px;
  }

  .bet-board {
    grid-template-columns: minmax(0, 2.08fr) minmax(102px, .92fr);
  }

  .bet-panel {
    grid-template-rows: minmax(0, 1fr) 24px;
    padding: 3px;
  }

  .game-actions {
    min-height: 104px;
    height: 104px;
    padding: 4px 5px 6px;
    grid-template-rows: 50px 40px;
  }

  .free-mode-button {
    width: 64px;
    height: 40px;
    font-size: 20px;
  }

  .chip-button {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }

  .point-balance,
  .start-game-button {
    font-size: 20px;
  }

  .start-game-button {
    min-width: 116px;
    height: 40px;
  }
}

/* Step 4 character collection */
.character-collection[hidden],
.collection-home[hidden],
.collection-detail[hidden],
.collection-confirm[hidden],
.story-toggle[hidden],
.story-overlay[hidden],
.collection-action[hidden] {
  display: none !important;
}

.character-collection {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr);
  overflow: hidden;
  color: #fff;
  background: linear-gradient(180deg, rgb(47 18 42 / 96%), rgb(16 12 23 / 98%));
}

.collection-header {
  min-height: 64px;
  padding: 15px 58px 10px 16px;
  border-bottom: 1px solid rgb(255 255 255 / 16%);
  background: linear-gradient(90deg, rgb(102 29 78 / 92%), rgb(31 19 36 / 88%));
}

.collection-header h1 {
  margin: 0;
  color: #fff;
  font-size: 26px;
  line-height: 1.2;
}

.collection-home,
.collection-detail {
  grid-row: 2;
  min-width: 0;
  min-height: 0;
}

.collection-home {
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px;
  scrollbar-width: thin;
  scrollbar-color: #b95a91 transparent;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
}

.character-card {
  min-width: 0;
  min-height: 224px;
  padding: 6px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 34px;
  gap: 5px;
  border: 1px solid rgb(255 255 255 / 24%);
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(150deg, rgb(255 255 255 / 10%), rgb(0 0 0 / 28%));
  cursor: pointer;
  touch-action: manipulation;
}

.character-card:focus-visible,
.character-card:hover {
  border-color: #ffd96a;
  box-shadow: 0 0 0 2px rgb(255 217 106 / 38%), 0 8px 18px rgb(0 0 0 / 32%);
}

.character-card strong {
  align-self: center;
  color: #ffe38a;
  font-size: 20px;
  line-height: 1;
  white-space: nowrap;
}

.character-thumbnail {
  position: relative;
  min-height: 0;
  overflow: hidden;
  display: grid;
  place-items: start center;
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 24%, color-mix(in srgb, var(--character-accent) 72%, white), transparent 20%),
    linear-gradient(155deg, color-mix(in srgb, var(--character-accent) 52%, #341c3b), #16121d 76%);
}

.character-thumbnail::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8%;
  width: 70%;
  height: 68%;
  border-radius: 45% 45% 16% 16%;
  background: linear-gradient(180deg, rgb(255 255 255 / 46%), var(--character-accent));
  transform: translateX(-50%);
  opacity: .62;
}

.character-thumbnail span {
  position: relative;
  z-index: 2;
  margin-top: 14px;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 2px solid rgb(255 255 255 / 74%);
  border-radius: 50%;
  color: #fff;
  background: color-mix(in srgb, var(--character-accent) 76%, #392138);
  font-size: 26px;
  font-weight: 900;
  box-shadow: 0 5px 16px rgb(0 0 0 / 38%);
}

.character-card:not(.is-image-unlocked) .character-thumbnail {
  filter: grayscale(.72) brightness(.68);
}

.character-card.is-animation-unlocked .character-thumbnail {
  box-shadow: inset 0 0 0 2px #ffe487, 0 0 16px rgb(255 97 190 / 44%);
}

.collection-detail {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 126px;
  gap: 8px;
  overflow: hidden;
  padding: 9px 9px 8px;
}

.collection-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 24%);
  border-radius: 15px;
  background: radial-gradient(circle at 50% 18%, #6e315d, #1a1421 68%);
  cursor: default;
  isolation: isolate;
}

.collection-stage.is-animation-unlocked {
  cursor: pointer;
}

.collection-stage-light {
  position: absolute;
  top: -16%;
  width: 38%;
  height: 92%;
  background: linear-gradient(180deg, rgb(255 232 162 / 38%), transparent 76%);
  clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%);
  opacity: .52;
}

.collection-stage-light-left {
  left: 4%;
  transform: rotate(-9deg);
}

.collection-stage-light-right {
  right: 4%;
  transform: rotate(9deg);
}

.collection-visual {
  --character-accent: #ef71ad;
  position: absolute;
  inset: 8% 11% 8%;
  overflow: hidden;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  border: 2px solid rgb(255 255 255 / 30%);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 24%, color-mix(in srgb, var(--character-accent) 75%, white), transparent 17%),
    linear-gradient(155deg, color-mix(in srgb, var(--character-accent) 48%, #351d3c), #14121a 78%);
  box-shadow: inset 0 0 54px rgb(0 0 0 / 36%);
}

.collection-visual::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10%;
  width: 54%;
  height: 68%;
  border-radius: 46% 46% 14% 14%;
  background: linear-gradient(180deg, rgb(255 255 255 / 42%), var(--character-accent));
  transform: translateX(-50%);
  opacity: .76;
}

.collection-stage.is-locked .collection-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background:
    repeating-linear-gradient(0deg, rgb(18 14 22 / 74%) 0 18px, rgb(98 72 101 / 70%) 18px 36px),
    repeating-linear-gradient(90deg, transparent 0 18px, rgb(220 200 219 / 22%) 18px 36px);
  background-blend-mode: multiply;
  backdrop-filter: blur(7px);
}

.collection-letter {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 90px;
  height: 90px;
  border: 3px solid rgb(255 255 255 / 78%);
  border-radius: 50%;
  color: #fff;
  background: color-mix(in srgb, var(--character-accent) 74%, #332033);
  font-size: 48px;
  font-weight: 900;
  box-shadow: 0 8px 24px rgb(0 0 0 / 38%);
}

.collection-visual strong {
  position: relative;
  z-index: 4;
  padding: 6px 12px;
  border-radius: 999px;
  color: #fff;
  background: rgb(18 12 20 / 74%);
  font-size: 20px;
  line-height: 1.15;
  text-align: center;
}

.collection-stage.is-animation-unlocked .collection-visual {
  animation: collection-scene-pulse 1.8s ease-in-out infinite alternate;
}

.collection-stage.is-animation-unlocked .collection-letter {
  animation: collection-character-breathe 1.4s ease-in-out infinite alternate;
}

.story-toggle {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 8;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 2px solid #ffe58b;
  border-radius: 50%;
  color: #fff;
  background: rgb(30 18 32 / 88%);
  font-size: 24px;
  cursor: pointer;
}

.story-overlay {
  position: absolute;
  z-index: 7;
  left: 5%;
  right: 5%;
  bottom: 6%;
  min-height: 104px;
  padding: 13px 16px;
  border: 1px solid rgb(255 224 133 / 62%);
  border-radius: 13px;
  color: #fff;
  background: rgb(20 12 22 / 86%);
  box-shadow: 0 8px 20px rgb(0 0 0 / 34%);
}

.story-overlay h2,
.story-overlay p {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.story-overlay h2 {
  margin-bottom: 7px;
  color: #ffe188;
}

.collection-actions {
  min-width: 0;
  display: grid;
  grid-template-columns: 74px minmax(116px, 1fr) minmax(112px, auto);
  align-items: center;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 13px;
  background: rgb(12 10 17 / 76%);
}

.collection-action {
  min-width: 0;
  min-height: 48px;
  padding: 7px 9px;
  border: 1px solid #e9ba57;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(145deg, #8d2d6a, #572049);
  font-size: 20px;
  font-weight: 850;
  line-height: 1.15;
  cursor: pointer;
  touch-action: manipulation;
}

.collection-action:disabled,
.collection-confirm-choice:disabled {
  cursor: not-allowed;
  opacity: .38;
  filter: grayscale(.7);
}

.collection-back {
  grid-column: 1;
  background: #3a2939;
}

.unlock-animation {
  grid-column: 2;
  justify-self: stretch;
  min-height: 66px;
}

.collection-fragment-actions {
  grid-column: 3;
  min-width: 0;
  display: grid;
  justify-items: stretch;
  gap: 7px;
}

.collection-fragment-actions strong {
  color: #ffe48c;
  font-size: 20px;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.exchange-beans {
  min-height: 46px;
  color: #281a1e;
  background: linear-gradient(145deg, #ffe27d, #d99b2f);
}

.collection-confirm {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgb(7 5 10 / 82%);
}

.collection-confirm-card {
  width: min(100%, 370px);
  padding: 20px;
  border: 1px solid #e8b75a;
  border-radius: 16px;
  background: linear-gradient(160deg, #4b213f, #17131d 76%);
  box-shadow: 0 18px 46px rgb(0 0 0 / 58%);
}

.collection-confirm-card h2 {
  margin: 0 0 12px;
  color: #ffe18a;
  font-size: 24px;
  line-height: 1.2;
}

.collection-confirm-copy p,
.collection-confirm-copy small {
  display: block;
  margin: 6px 0;
  color: #fff;
  font-size: 20px;
  line-height: 1.3;
}

.collection-confirm-copy small {
  color: rgb(255 255 255 / 72%);
}

.collection-confirm-options {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.collection-confirm-choice,
.collection-confirm-cancel {
  min-height: 50px;
  padding: 8px 12px;
  border: 1px solid #f0c45d;
  border-radius: 10px;
  color: #fff;
  background: #7c2a60;
  font-size: 20px;
  font-weight: 850;
  cursor: pointer;
}

.collection-confirm-cancel {
  width: 100%;
  margin-top: 9px;
  border-color: rgb(255 255 255 / 28%);
  background: #372a37;
}

@keyframes collection-scene-pulse {
  from { filter: saturate(.9) brightness(.94); }
  to { filter: saturate(1.18) brightness(1.08); }
}

@keyframes collection-character-breathe {
  from { transform: translateY(3px) scale(.98); }
  to { transform: translateY(-5px) scale(1.02); }
}

@media (max-width: 430px) {
  .collection-header {
    padding: 15px 48px 10px 12px;
  }

  .collection-home {
    padding: 7px;
  }

  .character-grid {
    gap: 6px;
  }

  .character-card {
    min-height: 190px;
    padding: 4px;
    grid-template-rows: minmax(0, 1fr) 31px;
  }

  .character-card strong {
    font-size: 18px;
  }

  .character-thumbnail span {
    width: 44px;
    height: 44px;
    font-size: 24px;
  }

  .collection-detail {
    grid-template-rows: minmax(0, 1fr) 132px;
    gap: 6px;
    padding: 7px 6px 6px;
  }

  .collection-visual {
    inset: 7% 8% 7%;
  }

  .collection-actions {
    grid-template-columns: 68px minmax(102px, 1fr) minmax(103px, auto);
    gap: 5px;
    padding: 6px;
  }

  .collection-action,
  .collection-fragment-actions strong {
    font-size: 18px;
  }

  .story-overlay {
    left: 4%;
    right: 4%;
    bottom: 5%;
    min-height: 100px;
    padding: 11px 13px;
  }

  .collection-confirm {
    padding: 12px;
  }

  .collection-confirm-card {
    padding: 17px;
  }
}

/* Step 5 tasks and weekly event */
.notice-dot[hidden],
.task-activity[hidden],
.daily-task-panel[hidden],
.weekly-task-panel[hidden],
.task-dev-panel[hidden] {
  display: none !important;
}

.task-activity {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: 64px 56px minmax(0, 1fr);
  overflow: hidden;
  color: #fff;
  background: linear-gradient(180deg, rgb(47 18 42 / 96%), rgb(16 12 23 / 98%));
}

.task-header {
  min-height: 64px;
  padding: 15px 58px 10px 16px;
  border-bottom: 1px solid rgb(255 255 255 / 16%);
  background: linear-gradient(90deg, rgb(102 29 78 / 92%), rgb(31 19 36 / 88%));
}

.task-header h1 {
  margin: 0;
  color: #fff;
  font-size: 26px;
  line-height: 1.2;
}

.task-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 7px 10px;
  border-bottom: 1px solid rgb(255 255 255 / 14%);
  background: rgb(12 10 17 / 62%);
}

.task-tab {
  min-width: 0;
  border: 1px solid rgb(255 255 255 / 24%);
  border-radius: 9px;
  color: rgb(255 255 255 / 78%);
  background: #3b293b;
  font-size: 20px;
  font-weight: 850;
  cursor: pointer;
}

.task-tab.selected {
  border-color: #f2c85e;
  color: #2c1c22;
  background: linear-gradient(145deg, #ffe17c, #d89d33);
  box-shadow: 0 0 11px rgb(255 204 81 / 30%);
}

.task-scroll {
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px;
  scrollbar-width: thin;
  scrollbar-color: #b95a91 transparent;
}

.daily-task-panel,
.weekly-task-panel {
  min-width: 0;
}

.daily-bet-summary {
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid rgb(255 218 111 / 42%);
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, rgb(125 39 91 / 76%), rgb(35 22 38 / 86%));
  font-size: 20px;
  line-height: 1.2;
}

.daily-bet-summary strong {
  color: #ffe17b;
  font-size: 22px;
}

.daily-task-list {
  display: grid;
  gap: 9px;
}

.task-group-heading {
  margin: 8px 0 0;
  color: #ffe18a;
  font-size: 22px;
  line-height: 1.2;
}

.daily-task-card {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 102px;
  grid-template-areas:
    "copy button"
    "progress button"
    "progress-copy button"
    "reward button";
  gap: 7px 10px;
  padding: 12px;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 13px;
  background: linear-gradient(150deg, rgb(255 255 255 / 9%), rgb(0 0 0 / 25%));
}

.daily-task-card.is-claimable {
  border-color: #f3ca5d;
  box-shadow: inset 0 0 0 1px rgb(243 202 93 / 28%), 0 0 14px rgb(238 171 60 / 18%);
}

.daily-task-card.is-claimed {
  border-color: rgb(117 202 151 / 46%);
  background: linear-gradient(150deg, rgb(64 120 85 / 20%), rgb(0 0 0 / 25%));
}

.daily-task-card.is-extra {
  border-color: rgb(255 212 91 / 36%);
}

.daily-task-copy {
  grid-area: copy;
}

.daily-task-copy h3,
.daily-task-copy p,
.task-reward-label,
.task-progress-copy {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.daily-task-copy h3 {
  margin-bottom: 3px;
  color: #fff;
}

.daily-task-copy p {
  color: rgb(255 255 255 / 74%);
}

.task-progress {
  grid-area: progress;
  height: 18px;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 24%);
  border-radius: 999px;
  background: #17131c;
}

.task-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d44891, #ffd65f);
  transition: width 220ms ease;
}

.task-progress-copy {
  grid-area: progress-copy;
  color: #ffe283;
  font-weight: 800;
}

.task-reward-label {
  grid-area: reward;
  color: #fff;
  font-weight: 750;
}

.task-claim-button {
  grid-area: button;
  align-self: stretch;
  min-width: 0;
  min-height: 54px;
  padding: 8px;
  border: 1px solid #ffe287;
  border-radius: 10px;
  color: #2a1b21;
  background: linear-gradient(145deg, #ffe17c, #d99b30);
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
}

.task-claim-button:disabled {
  border-color: rgb(255 255 255 / 19%);
  color: rgb(255 255 255 / 68%);
  background: #3b323c;
  cursor: not-allowed;
  opacity: .72;
}

.is-claimed .task-claim-button:disabled {
  color: #d9ffe4;
  background: #31543c;
}

.weekly-event-card {
  min-height: 610px;
  display: grid;
  grid-template-rows: minmax(245px, 1fr) auto;
  overflow: hidden;
  border: 1px solid #e6b958;
  border-radius: 16px;
  background: linear-gradient(160deg, #6e2858, #17131d 72%);
  box-shadow: 0 12px 30px rgb(0 0 0 / 32%);
}

.weekly-character {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 26%, rgb(255 151 206 / 78%), transparent 18%),
    linear-gradient(145deg, #732b5c, #231628 72%);
}

.weekly-character::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -12%;
  width: 44%;
  height: 72%;
  border-radius: 46% 46% 15% 15%;
  background: linear-gradient(180deg, rgb(255 255 255 / 50%), #c44d8e);
  transform: translateX(-50%);
  opacity: .7;
}

.weekly-character span {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 100px;
  height: 100px;
  border: 3px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: #bd4d88;
  font-size: 52px;
  font-weight: 900;
  box-shadow: 0 9px 24px rgb(0 0 0 / 38%);
}

.weekly-event-copy {
  position: relative;
  padding: 18px;
}

.weekly-event-status {
  display: inline-flex;
  padding: 5px 11px;
  border-radius: 999px;
  color: #1d251b;
  background: #82dc8e;
  font-size: 20px;
  font-weight: 900;
}

.weekly-event-status.is-paused {
  color: #fff;
  background: #6e626d;
}

.weekly-event-copy h2 {
  margin: 12px 0 4px;
  color: #fff;
  font-size: 26px;
  line-height: 1.2;
}

.weekly-event-bonus {
  display: block;
  color: #ffe061;
  font-size: 64px;
  line-height: 1;
  text-shadow: 0 4px 18px rgb(255 185 47 / 38%);
}

.weekly-event-copy p {
  margin: 10px 0 0;
  color: #fff;
  font-size: 20px;
  line-height: 1.35;
}

.weekly-event-copy .weekly-event-period {
  color: rgb(255 255 255 / 70%);
}

.task-reward-toast {
  position: absolute;
  z-index: 12;
  left: 50%;
  bottom: 18px;
  max-width: calc(100% - 30px);
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  color: #2a1b20;
  background: transparent;
  font-size: 20px;
  font-weight: 900;
  text-align: center;
  transform: translate(-50%, 8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.task-reward-toast.is-visible {
  border-color: #ffe58a;
  opacity: 1;
  background: linear-gradient(145deg, #fff09b, #e8aa38);
  box-shadow: 0 7px 20px rgb(0 0 0 / 38%);
  transform: translate(-50%, 0);
}

.task-dev-panel {
  position: absolute;
  z-index: 16;
  right: 8px;
  bottom: 8px;
  width: 212px;
  padding: 9px;
  border: 1px dashed #83dbff;
  border-radius: 10px;
  background: rgb(12 23 31 / 94%);
  box-shadow: 0 8px 20px rgb(0 0 0 / 45%);
}

.task-dev-panel > strong {
  display: block;
  margin-bottom: 6px;
  color: #9fe8ff;
  font-size: 14px;
}

.task-dev-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.task-dev-grid button {
  min-height: 32px;
  border: 1px solid rgb(159 232 255 / 48%);
  border-radius: 6px;
  color: #fff;
  background: #244351;
  font-size: 12px;
  cursor: pointer;
}

@media (max-width: 430px) {
  .task-header {
    padding: 15px 48px 10px 12px;
  }

  .task-scroll {
    padding: 7px;
  }

  .daily-task-card {
    grid-template-columns: minmax(0, 1fr) 88px;
    gap: 6px 7px;
    padding: 10px;
  }

  .daily-task-copy h3,
  .daily-task-copy p,
  .task-reward-label,
  .task-progress-copy,
  .task-claim-button {
    font-size: 18px;
  }

  .weekly-event-card {
    min-height: 575px;
    grid-template-rows: minmax(225px, 1fr) auto;
  }

  .weekly-event-copy {
    padding: 15px;
  }
}

/* Step 6 gold-bean exchange and half-price coupon */
.bean-shop[hidden],
.shop-confirm[hidden],
.shop-character-options[hidden] {
  display: none !important;
}

.member-game {
  grid-template-rows: 64px minmax(0, 1fr) 136px;
}

.game-actions {
  min-height: 136px;
  height: 136px;
  grid-template-rows: 28px 50px 40px;
  grid-template-areas:
    "coupon coupon"
    "modes modes"
    "points start";
}

.coupon-use-option {
  grid-area: coupon;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  padding: 0 4px;
  color: #ffe28a;
  font-size: 20px;
  font-weight: 850;
  line-height: 1;
  cursor: pointer;
}

.coupon-use-option input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: #e1aa36;
}

.coupon-use-option:has(input:disabled) {
  cursor: not-allowed;
  opacity: .5;
}

.bean-shop {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: 64px 68px minmax(0, 1fr);
  overflow: hidden;
  color: #fff;
  background: linear-gradient(180deg, rgb(47 18 42 / 96%), rgb(16 12 23 / 98%));
}

.shop-header {
  min-height: 64px;
  padding: 15px 58px 10px 16px;
  border-bottom: 1px solid rgb(255 255 255 / 16%);
  background: linear-gradient(90deg, rgb(102 29 78 / 92%), rgb(31 19 36 / 88%));
}

.shop-header h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.shop-balance {
  margin: 8px 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgb(255 218 111 / 45%);
  border-radius: 12px;
  background: linear-gradient(135deg, rgb(125 39 91 / 76%), rgb(35 22 38 / 86%));
  font-size: 20px;
  line-height: 1;
}

.shop-balance strong {
  color: #ffe17b;
  font-size: 26px;
}

.shop-product-list {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 6px 10px 12px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #b95a91 transparent;
}

.shop-product-card {
  min-width: 0;
  min-height: 190px;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 102px;
  align-items: center;
  gap: 10px;
  padding: 13px;
  border: 1px solid rgb(255 224 126 / 34%);
  border-radius: 15px;
  background: linear-gradient(145deg, rgb(111 38 85 / 70%), rgb(24 17 28 / 96%));
  box-shadow: 0 9px 22px rgb(0 0 0 / 24%);
}

.shop-product-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 2px solid #ffe088;
  border-radius: 18px;
  color: #fff4b0;
  background: radial-gradient(circle at 35% 28%, #fa77ba, #72265b 68%);
  box-shadow: inset 0 0 14px rgb(255 255 255 / 18%), 0 5px 12px rgb(0 0 0 / 35%);
  font-size: 22px;
  font-weight: 950;
}

.fragment-product-icon {
  border-radius: 50%;
  color: #5b3310;
  background: radial-gradient(circle at 35% 30%, #fff6a8, #e2a632 62%, #8d5414);
  font-size: 38px;
}

.shop-product-copy {
  min-width: 0;
}

.shop-product-copy h2,
.shop-product-copy p,
.shop-product-copy small {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.shop-product-copy h2 {
  color: #fff;
}

.shop-product-copy p {
  margin-top: 7px;
  color: rgb(255 255 255 / 78%);
}

.shop-product-copy small {
  display: block;
  margin-top: 8px;
  color: #ffe18a;
}

.shop-product-action {
  min-width: 0;
  display: grid;
  gap: 9px;
  text-align: center;
}

.shop-product-action strong {
  color: #ffe17b;
  font-size: 20px;
  line-height: 1.15;
}

.shop-product-action button,
.shop-confirm-actions button,
.shop-character-choice {
  min-height: 48px;
  border: 1px solid #ffe287;
  border-radius: 10px;
  color: #2a1b21;
  background: linear-gradient(145deg, #ffe17c, #d99b30);
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
}

.shop-product-action button:disabled,
.shop-confirm-actions button:disabled {
  border-color: rgb(255 255 255 / 18%);
  color: rgb(255 255 255 / 64%);
  background: #3d343e;
  cursor: not-allowed;
}

.shop-toast {
  position: absolute;
  z-index: 12;
  left: 50%;
  bottom: 18px;
  max-width: calc(100% - 28px);
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  color: #2b1c20;
  background: transparent;
  font-size: 20px;
  font-weight: 900;
  text-align: center;
  transform: translate(-50%, 8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.shop-toast.is-visible {
  border-color: #fff0a4;
  opacity: 1;
  background: linear-gradient(145deg, #fff09b, #e8aa38);
  box-shadow: 0 7px 20px rgb(0 0 0 / 38%);
  transform: translate(-50%, 0);
}

.shop-confirm {
  position: absolute;
  z-index: 14;
  inset: 0;
  padding: 18px;
  display: grid;
  place-items: center;
  background: rgb(4 3 6 / 78%);
}

.shop-confirm-card {
  width: min(100%, 400px);
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 20px;
  border: 1px solid #eac966;
  border-radius: 16px;
  background: linear-gradient(155deg, #552044, #17121c 75%);
  box-shadow: 0 18px 45px rgb(0 0 0 / 56%);
}

.shop-confirm-card h2,
.shop-confirm-copy p,
.shop-confirm-copy small {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

.shop-confirm-card h2 {
  margin-bottom: 10px;
  color: #ffe18a;
  font-size: 24px;
}

.shop-confirm-copy small {
  display: block;
  margin-top: 8px;
  color: rgb(255 255 255 / 72%);
}

.shop-character-options {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.shop-character-choice {
  min-width: 0;
  min-height: 66px;
  padding: 5px;
  border-color: rgb(255 255 255 / 25%);
  color: #fff;
  background: #3e2b3e;
}

.shop-character-choice span,
.shop-character-choice strong {
  display: block;
  font-size: 20px;
}

.shop-character-choice.selected {
  border-color: #ffe17b;
  color: #2a1b21;
  background: linear-gradient(145deg, #ffe17c, #d99b30);
  box-shadow: 0 0 0 2px rgb(255 225 123 / 24%);
}

.shop-confirm-actions {
  margin-top: 15px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

#shop-confirm-cancel {
  border-color: rgb(255 255 255 / 28%);
  color: #fff;
  background: #4b3a4c;
}

@media (max-width: 430px) {
  .member-game {
    grid-template-rows: 64px minmax(0, 1fr) 136px;
  }

  .game-actions {
    min-height: 136px;
    height: 136px;
    grid-template-rows: 28px 50px 40px;
  }

  .coupon-use-option {
    font-size: 18px;
  }

  .shop-header {
    padding: 15px 48px 10px 12px;
  }

  .shop-product-list {
    gap: 9px;
    padding: 5px 7px 9px;
  }

  .shop-product-card {
    min-height: 204px;
    grid-template-columns: 62px minmax(0, 1fr) 88px;
    gap: 7px;
    padding: 10px 8px;
  }

  .shop-product-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    font-size: 20px;
  }

  .fragment-product-icon {
    border-radius: 50%;
    font-size: 34px;
  }

  .shop-product-copy h2,
  .shop-product-copy p,
  .shop-product-copy small,
  .shop-product-action strong,
  .shop-product-action button {
    font-size: 18px;
  }

  .shop-product-action button {
    min-height: 58px;
    padding: 5px;
  }

  .shop-confirm {
    padding: 10px;
  }

  .shop-confirm-card {
    padding: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
}
