:root {
  --bg: #FFF9F3;
  --surface: #FFFFFF;
  --panel: #F6EFE6;
  --ink: #2B2622;
  --muted: #7C7269;
  --border: #E8DDD0;
  --coral: #FF7A45;
  --coral-dark: #E35D27;
  --coral-tint: #FFF0E8;
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans JP", "Noto Sans KR", "PingFang TC", sans-serif;
  min-height: 100vh;
}

.app-shell {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ==================== TOPBAR & NAVIGATION ==================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(255, 249, 243, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.brand-link:hover .brand-name {
  color: var(--coral-dark);
}

.brand-logo {
  flex-shrink: 0;
  border-radius: 8px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brand-sub {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.home-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.home-link-btn:hover {
  border-color: var(--coral);
  color: var(--coral-dark);
}

.lang-select {
  height: 30px;
  padding: 0 8px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
}

.main-content {
  flex: 1;
  padding: 12px 14px 86px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.view { display: none; flex-direction: column; gap: 12px; }
.view.active { display: flex; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 4px 16px rgba(43, 38, 34, 0.04);
}

.stage-card {
  padding: 16px 14px;
}

.inst-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quota-strip {
  display: flex;
  justify-content: flex-end;
  padding: 0 2px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  background: var(--panel);
  padding: 4px;
  border-radius: 14px;
}

.segmented.cols-2 { grid-template-columns: repeat(2, 1fr); }

.segmented button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 4px;
  border-radius: 10px;
  cursor: pointer;
}

.segmented button.active {
  background: var(--surface);
  color: var(--coral-dark);
  box-shadow: 0 2px 6px rgba(43, 38, 34, 0.08);
}

.widget-stage-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.stage-hint {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 10px;
  text-align: center;
}

/* ==================== 1. WHEEL ==================== */
.wheel-stage {
  position: relative;
  width: 236px;
  height: 236px;
  border-radius: 50%;
  padding: 7px;
  background: #FFFFFF;
  border: 3px solid var(--coral);
  box-shadow: 0 12px 32px rgba(255, 122, 69, 0.2), 0 4px 14px rgba(43, 38, 34, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.wheel-pointer {
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 18px solid var(--ink);
  z-index: 15;
}

.wheel-rotor {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transition: transform 2.4s cubic-bezier(0.12, 0.88, 0.16, 1.0);
}

.wheel-center-cap {
  position: absolute;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--coral);
  color: #FFFFFF;
  border: 4px solid #FFFFFF;
  box-shadow: 0 6px 16px rgba(255, 122, 69, 0.42);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.cap-main {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
}

.cap-sub {
  font-size: 9px;
  opacity: 0.92;
  margin-top: 1px;
}

/* ==================== 2. DICE (TWO-STAGE 3D) ==================== */
.dice-arena-tray {
  width: 248px;
  height: 168px;
  background: radial-gradient(circle at 50% 50%, #2A4D35 0%, #1A3323 100%);
  border: 4px solid #6E4E37;
  border-radius: 18px;
  box-shadow: inset 0 6px 14px rgba(0, 0, 0, 0.45), 0 6px 16px rgba(43, 38, 34, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  perspective: 600px;
  user-select: none;
}

.dice-floor-shadow {
  position: absolute;
  width: 34px;
  height: 12px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 70%);
  border-radius: 50%;
  animation: diceShadowFollow 1.3s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  pointer-events: none;
}

.dice-3d-box {
  position: absolute;
  width: 34px;
  height: 34px;
  transform-style: preserve-3d;
  animation: dice3DTumble 1.3s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

.dice-face-3d {
  position: absolute;
  width: 34px;
  height: 34px;
  background: #FFFDF9;
  border: 1px solid #D6C7B2;
  border-radius: 6px;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.95), inset 0 -1px 2px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.face-f { transform: translateZ(17px); }
.face-b { transform: rotateY(180deg) translateZ(17px); }
.face-r { transform: rotateY(90deg) translateZ(17px); }
.face-l { transform: rotateY(-90deg) translateZ(17px); }
.face-t { transform: rotateX(90deg) translateZ(17px); }
.face-d { transform: rotateX(-90deg) translateZ(17px); }

.pip-grid { width: 100%; height: 100%; position: relative; }
.pip { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #2B2622; }
.pip.red { background: #E03131; width: 8px; height: 8px; }
.pip.c { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.pip.tl { top: 4px; left: 4px; }
.pip.tr { top: 4px; right: 4px; }
.pip.bl { bottom: 4px; left: 4px; }
.pip.br { bottom: 4px; right: 4px; }
.pip.ml { top: 50%; left: 4px; transform: translateY(-50%); }
.pip.mr { top: 50%; right: 4px; transform: translateY(-50%); }

@keyframes dice3DTumble {
  0% { transform: translate3d(-85px, -65px, 70px) rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
  24% { transform: translate3d(30px, 20px, 0px) rotateX(360deg) rotateY(180deg) rotateZ(270deg); }
  46% { transform: translate3d(-20px, -10px, 35px) rotateX(540deg) rotateY(360deg) rotateZ(450deg); }
  68% { transform: translate3d(15px, 10px, 0px) rotateX(720deg) rotateY(540deg) rotateZ(630deg); }
  84% { transform: translate3d(-5px, 0px, 12px) rotateX(810deg) rotateY(630deg) rotateZ(720deg); }
  94% { transform: translate3d(2px, 4px, 0px) rotateX(880deg) rotateY(700deg) rotateZ(750deg); }
  100% { transform: translate3d(0, 3px, 0) rotateX(900deg) rotateY(720deg) rotateZ(720deg); }
}

@keyframes diceShadowFollow {
  0% { transform: translate3d(-85px, 15px, 0) scale(0.5); opacity: 0.2; }
  24% { transform: translate3d(30px, 25px, 0) scale(1.15); opacity: 0.75; }
  46% { transform: translate3d(-20px, 18px, 0) scale(0.65); opacity: 0.35; }
  68% { transform: translate3d(15px, 24px, 0) scale(1.05); opacity: 0.7; }
  84% { transform: translate3d(-5px, 21px, 0) scale(0.85); opacity: 0.5; }
  94% { transform: translate3d(2px, 24px, 0) scale(1.0); opacity: 0.7; }
  100% { transform: translate3d(0, 24px, 0) scale(1.0); opacity: 0.65; }
}

.big-dice-stage {
  width: 146px;
  height: 118px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.big-dice-pop {
  animation: diceBigPopIn 280ms cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

@keyframes diceBigPopIn {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.big-dice-3d {
  width: 144px;
  height: 110px;
  background: #FFFDF9;
  border-radius: 16px;
  border: 2px solid #EFE4D6;
  box-shadow: 0 8px 0 #D0BCA6, 0 12px 24px rgba(43, 38, 34, 0.25), inset 0 2px 4px rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  text-align: center;
}

.dice-top-pips { margin-bottom: 4px; }

.dice-pip-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--coral);
  background: #FFEFE7;
  padding: 2px 9px;
  border-radius: 99px;
}

.dice-winner-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
  word-break: break-word;
  max-height: 40px;
  overflow: hidden;
}

.dice-winner-sub {
  font-size: 9.5px;
  color: #9C8F82;
  margin-top: 3px;
}

/* ==================== 3. SLOT MACHINE (RETRO 3-DRUM + LEVER) ==================== */
.slot-machine-body {
  width: calc(100% - 28px);
  max-width: 304px;
  margin-right: 16px;
  background: linear-gradient(180deg, #3A322C 0%, #24201D 100%);
  border-radius: 18px;
  border: 3px solid #E88E64;
  box-shadow: 0 12px 28px rgba(43, 38, 34, 0.26);
  padding: 10px 14px 14px;
  position: relative;
  transition: all 300ms ease;
}

.slot-machine-body.machine-jackpot-glow {
  border-color: #FFB300;
  box-shadow: 0 0 24px rgba(255, 122, 69, 0.65), 0 12px 28px rgba(43, 38, 34, 0.3);
}

.slot-marquee {
  background: linear-gradient(90deg, #FF7A45 0%, #FFA940 50%, #FF7A45 100%);
  border-radius: 8px;
  padding: 4px 6px;
  text-align: center;
  margin-bottom: 8px;
  border: 1px solid #FFF3E8;
}

.slot-marquee-text {
  font-size: 10.5px;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: 0.5px;
}

.slot-viewport-frame {
  display: flex;
  align-items: center;
  background: #1B1715;
  border-radius: 10px;
  border: 2px solid #63574E;
  box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.6);
  padding: 6px 4px;
}

.slot-drum-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 2px;
}

.drum-fixed-window {
  width: 100%;
  height: 60px;
  background: linear-gradient(180deg, #D4C7BA 0%, #FFFFFF 48%, #D4C7BA 100%);
  border-radius: 7px;
  border: 1px solid #8C7F72;
  box-shadow: inset 0 7px 7px rgba(43, 38, 34, 0.32), inset 0 -7px 7px rgba(43, 38, 34, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  overflow: hidden;
  position: relative;
}

.drum-roll-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  transition: transform 140ms ease;
}

.drum-roll-strip.drum-spinning {
  animation: drumSpinFast 120ms linear infinite;
}

@keyframes drumSpinFast {
  0% { transform: translateY(-6px); filter: blur(1px); }
  50% { transform: translateY(6px); filter: blur(1px); }
  100% { transform: translateY(-6px); filter: blur(1px); }
}

.drum-roll-strip.fx-settle-bounce {
  animation: drumSettleBounce 680ms cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

@keyframes drumSettleBounce {
  0% { transform: translateY(-20px); }
  52% { transform: translateY(12px); }
  78% { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}

.drum-roll-strip.fx-settle-roll {
  animation: drumSettleRoll 620ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

@keyframes drumSettleRoll {
  0% { transform: translateY(-28px); opacity: 0.6; }
  68% { transform: translateY(5px); opacity: 1; }
  100% { transform: translateY(0); }
}

.drum-text {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
}

.slot-reel-divider {
  width: 2px;
  height: 48px;
  background: #4D423A;
  flex-shrink: 0;
}

.slot-arm-lever {
  position: absolute;
  right: -23px;
  top: 32px;
  width: 26px;
  height: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: bottom center;
  transition: transform 220ms ease;
  cursor: pointer;
}

.slot-arm-lever.lever-pulled {
  transform: rotate(45deg);
}

.lever-pivot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #A6978A;
  border: 1px solid #2B2622;
}

.lever-shaft {
  width: 6px;
  height: 40px;
  background: linear-gradient(90deg, #EFE4D6 0%, #B8A898 100%);
  border-radius: 99px;
}

.lever-knob {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, #FF9166 0%, #FF5511 100%);
  border: 2px solid #FFFFFF;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

/* ==================== 4. COIN (3D AERIAL FLIP) ==================== */
.coin-stage {
  width: 170px;
  height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  perspective: 650px;
  user-select: none;
}

.coin-disc {
  width: 142px;
  height: 142px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #FFE6A3 0%, #D9A045 65%, #9C6B28 100%);
  border: 4px solid #7C531E;
  box-shadow: 0 8px 0 #684414, 0 14px 28px rgba(43, 38, 34, 0.28);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 600ms cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.coin-disc.side-tails {
  background: radial-gradient(circle at 30% 30%, #F7D488 0%, #C68A35 65%, #845419 100%);
}

.coin-disc.coin-flipping {
  animation: coinFlip3D 750ms cubic-bezier(0.4, 0.2, 0.2, 1) forwards;
}

@keyframes coinFlip3D {
  0% { transform: translateY(0) rotateY(0deg) scale(1); }
  50% { transform: translateY(-24px) rotateY(900deg) scale(1.18); }
  100% { transform: translateY(0) rotateY(1800deg) scale(1); }
}

.coin-outer-ring {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  border: 2px dashed #7C531E;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.coin-minted-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 5px;
}

.coin-side-indicator {
  font-size: 10px;
  font-weight: 800;
  color: #5C3C12;
  background: rgba(255, 255, 255, 0.45);
  padding: 2px 8px;
  border-radius: 99px;
}

.coin-minted-text {
  font-size: 12.5px;
  font-weight: 900;
  color: #4A2E0A;
  line-height: 1.2;
  word-break: break-word;
  max-width: 92px;
}

/* ==================== DEDICATED RESULT & OPTIONS CARDS ==================== */
.result-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.result-info {
  min-width: 0;
  flex: 1;
}

.result-label {
  font-size: 11.5px;
  color: var(--muted);
}

.result-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
  margin-top: 2px;
  word-break: break-word;
}

.result-title.text-coral {
  color: var(--coral-dark);
}

.result-action-btn {
  width: 100%;
}

.options-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.options-head-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink);
}

/* ==================== BUTTONS, INPUTS, CHIPS & PILLS ==================== */
.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: 12px;
  height: 40px;
  padding: 0 14px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  border-color: var(--coral);
  background: var(--coral);
  color: #FFFFFF;
}

.btn-danger {
  border-color: #DC2626;
  background: #FEF2F2;
  color: #B91C1C;
}

.btn-sm {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
}

.row { display: flex; gap: 8px; align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 99px;
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
}

.chip.active-tag {
  background: var(--coral-tint);
  color: var(--coral-dark);
  border-color: var(--coral);
}

.chip button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font-weight: 800;
}

.chip.chip-active-btn {
  background: var(--coral);
  color: #FFFFFF;
  border-color: var(--coral);
}

.muted { color: var(--muted); font-size: 12px; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--coral-tint);
  color: var(--coral-dark);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.pill.pill-winner {
  background: var(--coral);
  color: #FFFFFF;
}

/* ==================== ACCOUNT, PLANS & FOOTER ==================== */
.plans-guest-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--coral-tint);
  border: 1px solid var(--coral);
  font-size: 12px;
  font-weight: 600;
  color: var(--coral-dark);
}

.plan-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--surface);
}

.plan-card.recommended {
  border-color: var(--coral);
  background: #FFFDFB;
}

.plan-highlight-active {
  outline: 2px solid var(--coral);
  box-shadow: 0 0 0 4px rgba(255, 122, 69, 0.22);
  transition: box-shadow 0.25s ease;
}

.app-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 8px 4px 12px;
  font-size: 11.5px;
  color: var(--muted);
}

.app-footer a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.app-footer a:hover {
  color: var(--coral-dark);
  text-decoration: underline;
}

/* ==================== TABBAR & TOAST ==================== */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 460px;
  height: 62px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  z-index: 30;
}

.tabbar button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.tabbar button.active { color: var(--coral-dark); }

.toast {
  position: fixed;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(43, 38, 34, 0.92);
  color: #FFFFFF;
  padding: 8px 14px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 120;
  max-width: 90vw;
  text-align: center;
}

.toast.show { opacity: 1; }

/* ==================== SAFE MODALS ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 100;
}

.modal-backdrop.open { display: flex; }

.modal-card {
  max-width: 410px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 88vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.modal-close-x {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-close-x:hover {
  border-color: var(--coral);
  color: var(--coral-dark);
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.modal-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.quota-summary-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

/* ==================== GROUP / COOP LOBBY, DETAIL & CLONE ==================== */
.coop-groups-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.coop-group-card {
  padding: 12px 14px;
}

.coop-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 2px 0;
}

.coop-group-tag {
  background: #FFE8DC;
  color: #C84B1B;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 99px;
}

.coop-group-body {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.coop-room-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 160ms ease;
}

.coop-room-card:hover {
  border-color: var(--coral);
}

.coop-room-card.decided {
  background: #FAF7F2;
  border-color: #E2D9CE;
}

.coop-room-meta-line {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.coop-detail-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.coop-back-btn {
  color: #C84B1B;
  background: #FFE8DC;
  border-color: var(--coral);
  border-radius: 99px;
}

.coop-detail-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
  justify-content: flex-end;
}

.coop-detail-title {
  font-size: 14px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coop-code-pill {
  border: 1px solid var(--coral);
  cursor: pointer;
}

.coop-guest-banner {
  background: #FFF6EB;
  border: 1px solid #F7D4AD;
  color: #9A5513;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 12px;
}

.coop-cutoff-banner {
  background: #FEF0C7;
  color: #B45309;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 99px;
  text-align: center;
}

.coop-kpi-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.coop-kpi-cell {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.coop-kpi-clickable {
  cursor: pointer;
  border-color: #FFD4C2;
  background: linear-gradient(180deg, #FFFFFF 0%, #FFFBF8 100%);
}

.coop-kpi-hint {
  font-size: 11px;
  color: var(--coral-dark);
  font-weight: 700;
}

.coop-kpi-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
}

.coop-kpi-val small {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 4px;
}

.avatar-badge {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

.avatar-badge.hue-1 { background: #FFE8DC; color: #C84B1B; }
.avatar-badge.hue-2 { background: #DCF5EA; color: #16794F; }
.avatar-badge.hue-3 { background: #E0F2FE; color: #0369A1; }
.avatar-badge.hue-4 { background: #F3E8FF; color: #7E22CE; }

.members-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.member-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 4px 10px 4px 4px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}

.host-tag {
  font-size: 10px;
  background: var(--coral);
  color: #FFFFFF;
  padding: 1px 7px;
  border-radius: 99px;
  font-weight: 700;
}

.coop-opt-row {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 120ms ease, background-color 120ms ease;
}

.coop-opt-row.highlight-active {
  background: #FFF3EB;
  border-color: var(--coral);
  transform: scale(1.01);
}

.coop-opt-row.winner-row {
  background: #FFF8F3;
  border: 2px solid var(--coral);
}

.my-opt-tag {
  font-size: 10.5px;
  color: var(--muted);
  background: #F4ECE1;
  padding: 1px 7px;
  border-radius: 99px;
  font-weight: 600;
}

.vote-stepper {
  display: inline-flex;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 2px 4px;
  gap: 6px;
}

.step-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.step-btn.plus-btn.active {
  background: var(--coral);
  color: #FFFFFF;
}

.step-btn.minus-btn.active {
  background: #FFE8DC;
  color: #C84B1B;
  border: 1px solid var(--coral);
}

.step-btn.disabled {
  background: #EAE0D5;
  color: #B5ABA0;
  cursor: not-allowed;
}

.step-count {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
  min-width: 38px;
  text-align: center;
}

.equal-prob-tag {
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid #2FB67E;
  background: #DCF5EA;
  color: #16794F;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.equal-prob-tag.winner-badge-btn {
  background: var(--coral);
  color: #FFFFFF;
  border-color: var(--coral);
}

.opt-del-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 0;
  background: #FDE8E8;
  color: #B91C1C;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.vote-bar-track {
  height: 6px;
  background: var(--panel);
  border-radius: 99px;
  overflow: hidden;
  width: 100%;
}

.vote-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 240ms ease;
}

.coop-locked-banner {
  padding: 10px 12px;
  text-align: center;
  background: #F4ECE1;
  border: 1px solid #DFD3C5;
  border-radius: 99px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.coop-waiting-banner {
  padding: 10px 12px;
  text-align: center;
  background: var(--panel);
  border-radius: 99px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.coop-dual-actions {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 8px;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 99px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.chip-btn.active {
  background: var(--coral);
  border-color: var(--coral);
  color: #FFFFFF;
}

.clone-opt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}

.clone-opt-card.active {
  border: 2px solid var(--coral);
  background: #FFF5EE;
}

/* ==================== CHECKOUT RETURN, PROFILE EDIT & ORDERS ==================== */
.checkout-return-banner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-width: 1.5px;
}

.checkout-return-banner.confirming {
  background: #FFF8EB;
  border-color: #F59E0B;
}

.checkout-return-banner.succeeded {
  background: #ECFDF5;
  border-color: #2FB67E;
}

.checkout-return-banner.pending {
  background: #FFF6EB;
  border-color: var(--coral);
}

.checkout-return-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.checkout-return-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.45;
}

.account-profile-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid #FFD4C2;
  background: #FFE8DC;
  color: #C84B1B;
  font-size: 20px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
}

.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.account-meta {
  min-width: 0;
  flex: 1;
}

.account-display-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-tier-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.account-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-quota-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.account-quota-cell {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.account-quota-label {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 600;
}

.account-quota-val {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.avatar-badge {
  overflow: hidden;
}

.avatar-badge img.avatar-badge-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.profile-avatar-stage {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-preview-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--coral);
  background: #FFE8DC;
  color: #C84B1B;
  font-size: 26px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.profile-preview-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preset-avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.preset-avatar-btn {
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.preset-avatar-btn.active {
  border-color: var(--coral);
  background: #FFF3EB;
  box-shadow: 0 0 0 2px rgba(255, 122, 69, 0.2);
}

.preset-avatar-btn img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: block;
}

.orders-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.orders-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.order-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.order-item:hover {
  border-color: var(--coral);
}

.order-item-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.order-item-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-item-sub {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.order-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.order-item-amount {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.order-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 700;
  background: #F4ECE1;
  color: var(--muted);
}

.order-status-pill.paid {
  background: #DCF5EA;
  color: #16794F;
}

.order-status-pill.pending {
  background: #FEF0C7;
  color: #B45309;
}

.order-status-pill.refunded {
  background: #E0F2FE;
  color: #0369A1;
}

.order-status-pill.failed {
  background: #FDE8E8;
  color: #B91C1C;
}

.order-detail-hero {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.order-detail-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}

.order-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
}

.order-detail-label {
  color: var(--muted);
  font-weight: 600;
  flex-shrink: 0;
}

.order-detail-val {
  color: var(--ink);
  font-weight: 700;
  text-align: right;
  word-break: break-all;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}
