:root {
  --wood-dark: #523018;
  --wood-mid: #7b4b27;
  --wood-light: #a66c3a;
  --cream: #f8eed7;
  --cream-card: #fff7e6;
  --ink: #382211;
  --green: #58b842;
  --green-dark: #3b8a29;
  --gold: #f5b935;
  --gold-dark: #c58511;
  --brown: #9c6230;
  --brown-dark: #6d411c;
}

* {
  box-sizing: border-box;
  user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  background: #5fb5f5;
  color: var(--ink);
}

.hidden {
  display: none !important;
}

.game-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

/* Floating Top HUD over 3D Sky & Scenery */
.top-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: transparent;
  pointer-events: none;
  z-index: 7;
  flex-wrap: wrap;
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.field-badge {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--cream);
  border: 4px solid var(--wood-mid);
  box-shadow: 0 3px 0 var(--wood-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink);
  flex-shrink: 0;
}

.field-badge:hover {
  transform: translateY(-1px);
}

.field-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.field-num {
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.progress-card {
  background: var(--wood-mid);
  border: 3px solid var(--wood-dark);
  border-radius: 12px;
  padding: 5px 8px;
  min-width: 195px;
  box-shadow: 0 3px 0 var(--wood-dark);
}

.progress-track {
  position: relative;
  height: 20px;
  background: #3d2412;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #2c180a;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(180deg, #74dc58 0%, #48ad32 100%);
  transition: width 0.25s ease;
}

.progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 1px 2px #000;
}

.field-sub {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 700;
  color: #fff2d3;
  text-align: center;
}

.resource-pill, .wallet-pill, .icon-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--cream);
  border: 3px solid var(--wood-mid);
  box-shadow: 0 3px 0 var(--wood-dark);
  border-radius: 999px;
  padding: 5px 12px;
  font-weight: 800;
  font-size: 13px;
  color: var(--ink);
}

.token-pill {
  background: #fff3cf;
}

.res-val {
  font-size: 15px;
  font-weight: 900;
}

.res-unit {
  font-size: 11px;
  opacity: 0.8;
}

.wallet-pill, .icon-pill {
  cursor: pointer;
}

.wallet-pill {
  display: inline-block;
  max-width: 155px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-pill.connected {
  background: #e5f9dc;
  border-color: var(--green-dark);
}

.icon-pill {
  padding: 5px 9px;
}

/* Main Stage */
.stage-area {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#gameCanvas:active {
  cursor: grabbing;
}

.stage-badges {
  position: static;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
  padding-right: 78px;
  pointer-events: none;
}

.stage-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  border: 2px solid var(--wood-dark);
  box-shadow: 0 2px 0 rgba(0,0,0,0.25);
}

.boss-pill {
  background: #ffd34e;
  color: #631b04;
}

.rain-pill {
  background: #d8f1ff;
  color: #10496e;
}

.rank-tracker-pill {
  pointer-events: auto;
  cursor: pointer;
  background: rgba(255, 247, 224, 0.94);
  color: #4d2c0f;
}

.rank-tracker-pill:hover {
  background: #ffffff;
  transform: translateY(-1px);
}

.weather-pill {
  background: rgba(242, 250, 255, 0.94);
  color: #214a6b;
}

.quest-pill {
  pointer-events: auto;
  cursor: pointer;
  background: #fff2cc;
  color: #5c3309;
  font-family: inherit;
}

.quest-pill:hover {
  transform: translateY(-1px);
  background: #fff8de;
}

.quest-pill.has-claim {
  background: linear-gradient(180deg, #ffe26b 0%, #f5b324 100%);
  color: #4a1e03;
  border-color: #7d4805;
  box-shadow: 0 2px 10px rgba(255, 198, 52, 0.65);
}

.quest-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quest-row {
  background: var(--cream-card);
  border: 3px solid #cbb183;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.quest-row.is-ready {
  border-color: #4f9e3c;
  background: #f5ffef;
}

.quest-row.is-claimed {
  opacity: 0.72;
}

.quest-info {
  flex: 1;
  min-width: 210px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.quest-title {
  font-size: 15px;
  font-weight: 900;
}

.quest-bar {
  position: relative;
  height: 16px;
  background: #462a15;
  border-radius: 8px;
  overflow: hidden;
}

.quest-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #58b842, #85e36b);
}

.quest-bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 1px 2px #000;
}

.skill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 2px 0;
}

.skill-chip {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  background: #efe1c2;
  border: 1px solid #c5a673;
  color: #4f3116;
}

.skill-chip.is-gold {
  background: linear-gradient(180deg, #fff5cc 0%, #ffe07d 100%);
  border-color: #c98812;
  color: #5c3104;
}

.skill-chip.is-clickable {
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.12s ease;
}

.skill-chip.is-clickable:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.14);
}

.skill-chip.is-locked {
  border: 2px solid #9e5a04;
  box-shadow: 0 0 0 1px rgba(245, 185, 53, 0.55);
  background: #ffe8a3;
}

.cosmetic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.cosmetic-card {
  background: var(--cream-card);
  border: 3px solid #cbb183;
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cosmetic-card.is-equipped {
  border-color: #3f962d;
  background: #f5ffef;
}

.cosmetic-preview-box {
  position: relative;
  height: 126px;
  border-radius: 10px;
  border: 2px solid #b59461;
  background: radial-gradient(circle at 50% 44%, #a6ddff 0%, #5caef0 68%, #478a2d 69%, #33661f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cosmetic-preview-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.cosmetic-perk-badge {
  position: absolute;
  top: 6px;
  right: 6px;
}

.cosmetic-title-row {
  font-size: 14px;
}

.scope-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: #efe1c2;
  border: 2px solid #cbb183;
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 800;
}

.scope-btns {
  display: flex;
  gap: 6px;
}

.btn-reroll {
  background: #7b4cb8 !important;
  color: #ffffff;
}

.rewards-banner {
  margin-bottom: 10px;
  background: #fff5d6;
  border: 2px solid #d99b26;
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 12px;
  line-height: 1.45;
}

.clear-banner {
  position: absolute;
  top: 44%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--cream);
  border: 5px solid var(--wood-mid);
  box-shadow: 0 8px 0 var(--wood-dark), 0 18px 36px rgba(0,0,0,0.35);
  border-radius: 18px;
  padding: 16px 34px;
  text-align: center;
  z-index: 8;
  pointer-events: none;
}

.clear-title {
  font-size: 28px;
  font-weight: 900;
  color: var(--green-dark);
}

.clear-sub {
  font-size: 16px;
  font-weight: 800;
  color: var(--wood-dark);
  margin-top: 4px;
}

/* Right Action Rail */
.right-rail {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 6;
}

.rail-btn {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 14px;
  background: var(--cream);
  border: 4px solid var(--wood-mid);
  box-shadow: 0 4px 0 var(--wood-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  color: var(--ink);
  transition: transform 0.08s ease;
}

.rail-btn:hover {
  transform: translateY(-2px);
  background: #fffaf0;
}

.rail-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--wood-dark);
}

.rail-svg, .rail-portrait {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.rail-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e13b2d;
  border: 2px solid #ffffff;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.rail-text {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.4px;
}

/* Bottom Squad Dock */
.bottom-dock {
  background: var(--wood-mid);
  border-top: 4px solid var(--wood-dark);
  padding: 6px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 5;
  position: relative;
}

.dock-label {
  position: absolute;
  top: -15px;
  left: 16px;
  background: var(--wood-light);
  border: 3px solid var(--wood-dark);
  border-radius: 8px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 900;
  color: #fff6e0;
}

.dock-cards {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  background: rgba(42, 22, 9, 0.55);
  border: 2px solid #3f220e;
  border-radius: 12px;
  padding: 5px 8px 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--wood-light) #3d2412;
}

.dock-cards::-webkit-scrollbar {
  height: 6px;
}

.dock-cards::-webkit-scrollbar-track {
  background: #3d2412;
  border-radius: 999px;
}

.dock-cards::-webkit-scrollbar-thumb {
  background: var(--wood-light);
  border-radius: 999px;
}

.dock-card {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--cream);
  border: 3px solid var(--wood-dark);
  border-radius: 11px;
  padding: 4px 6px;
  min-width: 114px;
  flex-shrink: 0;
}

.dock-card.is-working {
  border-color: #3f962d;
  background: #f5ffef;
}

.dock-card.is-resting {
  border-color: #82542d;
  background: #f3e4cb;
}

.dock-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #e9dec2;
  border: 2px solid var(--wood-light);
  object-fit: contain;
}

.dock-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dock-name {
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.mini-sta-track {
  height: 7px;
  background: #462a15;
  border-radius: 4px;
  overflow: hidden;
}

.mini-sta-fill {
  height: 100%;
  transition: width 0.2s ease;
}

.pill-toggle {
  border: 2px solid #2b1a0c;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 10px;
  font-weight: 900;
  color: #fff;
  cursor: pointer;
  align-self: flex-start;
}

.pill-toggle.work {
  background: var(--green);
}

.pill-toggle.rest {
  background: #8a7f74;
}

.dock-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.action-btn {
  border-radius: 12px;
  border: 3px solid var(--wood-dark);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 900;
  color: #fff;
  cursor: pointer;
  text-shadow: 0 1px 1px rgba(0,0,0,0.45);
}

.action-btn:active {
  transform: translateY(2px);
}

.btn-green {
  background: var(--green);
  box-shadow: 0 4px 0 var(--green-dark);
}

.btn-brown {
  background: var(--brown);
  box-shadow: 0 4px 0 var(--brown-dark);
}

.btn-gold {
  background: var(--gold);
  color: #492808;
  text-shadow: none;
  box-shadow: 0 4px 0 var(--gold-dark);
}

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

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 14, 8, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 20;
}

.modal-window {
  width: min(860px, 100%);
  max-height: 90vh;
  background: var(--cream);
  border: 6px solid var(--wood-mid);
  box-shadow: 0 10px 0 var(--wood-dark), 0 24px 48px rgba(0,0,0,0.45);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  background: var(--wood-mid);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 4px solid var(--wood-dark);
}

.modal-title {
  margin: 0;
  color: #fff5db;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.6px;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #d94a3d;
  border: 3px solid #6b1d16;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  background: #ebdcb9;
  border-top: 3px solid #cfb98c;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* Squad Modal Grid */
.squad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}

.kwai-card {
  display: flex;
  gap: 12px;
  background: var(--cream-card);
  border: 3px solid #c9af82;
  border-radius: 14px;
  padding: 10px;
}

.kwai-card.is-deployed {
  border-color: #4f9e3c;
  background: #f6ffef;
}

.field-status-pill {
  font-size: 9px;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.4px;
}

.field-status-pill.on {
  background: #dff5d7;
  color: #2f751f;
  border: 1px solid #82c76e;
}

.field-status-pill.off {
  background: #ebe4d5;
  color: #6b5b4a;
  border: 1px solid #c9b99c;
}

.btn-blue {
  background: #2b7de9;
  box-shadow: 0 4px 0 #1b56a8;
}

.kwai-card-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 102px;
  flex-shrink: 0;
}

.kwai-portrait {
  width: 92px;
  height: 92px;
  border-radius: 12px;
  background: #efe2c4;
  border: 2px solid #cbb384;
  object-fit: contain;
}

.kwai-card-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.kwai-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.kwai-name {
  font-size: 15px;
  font-weight: 900;
}

.rarity-badge {
  font-size: 10px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1.5px solid rgba(0,0,0,0.18);
}

.trait-line {
  font-size: 11px;
  color: #664a2f;
  line-height: 1.25;
}

.stat-row {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
}

.stat-bar-bg {
  height: 8px;
  background: #53361d;
  border-radius: 4px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f3a826, #ffd252);
}

.stat-bar-fill.sta {
  background: linear-gradient(90deg, #4db337, #7ae262);
}

.card-btn-row {
  display: flex;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
}

.max-badge {
  display: inline-block;
  vertical-align: middle;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffd84d 0%, #f0a718 100%);
  color: #4a2304;
  border: 1.5px solid #9e6508;
  margin-left: 4px;
}

.card-btn {
  flex: 1;
  border: 2px solid var(--wood-dark);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  color: #fff;
}

/* Summon & Info panels */
.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.panel-box {
  background: var(--cream-card);
  border: 3px solid #cbb183;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-box.is-maxed {
  border-color: #d9a036;
  background: #fffbeb;
}

.panel-box h3 {
  margin: 0;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.panel-box > .action-btn {
  margin-top: auto;
  width: 100%;
}

.odds-list {
  margin: 6px 0 2px;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.45;
}

.odds-details {
  background: #f3e6ca;
  border: 1.5px solid #d4b988;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
}

.odds-details summary {
  cursor: pointer;
  font-weight: 800;
  color: #6b411c;
  outline: none;
}

@keyframes gachaShake {
  0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
  20% { transform: translate(-5px, -2px) rotate(-5deg) scale(1.05); }
  40% { transform: translate(5px, 2px) rotate(5deg) scale(1.08); }
  60% { transform: translate(-4px, 1px) rotate(-4deg) scale(1.1); }
  80% { transform: translate(4px, -2px) rotate(4deg) scale(1.06); }
}

@keyframes gachaPop {
  0% { transform: scale(0.76); opacity: 0; }
  65% { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.gacha-stage {
  border: 4px solid var(--wood-mid);
  border-radius: 18px;
  padding: 18px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: radial-gradient(circle at 50% 30%, #fffdf5 0%, #f5e5c0 100%);
  box-shadow: 0 6px 0 #caa972;
}

.gacha-stage.is-rolling {
  min-height: 250px;
  justify-content: center;
}

.gacha-crate {
  font-size: 64px;
  line-height: 1;
  animation: gachaShake 0.42s ease-in-out infinite;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.22));
}

.gacha-mascot-img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 4px solid var(--wood-dark);
  box-shadow: 0 5px 0 var(--wood-dark), 0 8px 18px rgba(0, 0, 0, 0.25);
  object-fit: cover;
  background: #7bc7ff;
  display: block;
}

.gacha-crate.is-golden .gacha-mascot-img {
  border-color: #d48806;
  box-shadow: 0 5px 0 #8a5600, 0 0 24px rgba(255, 198, 52, 0.78);
}

.inline-mascot-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--wood-dark);
  object-fit: cover;
  vertical-align: -3px;
  margin-right: 4px;
}

.gacha-stage.is-reveal {
  animation: gachaPop 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.gacha-stage.rarity-rare {
  border-color: #2b7de9;
  background: radial-gradient(circle at 50% 25%, #f2f8ff 0%, #dcebfa 100%);
  box-shadow: 0 6px 0 #1f5bb0, 0 0 22px rgba(43, 125, 233, 0.3);
}

.gacha-stage.rarity-super_rare {
  border-color: #8e44ad;
  background: radial-gradient(circle at 50% 25%, #fbf5ff 0%, #edd9fa 100%);
  box-shadow: 0 6px 0 #622b7a, 0 0 24px rgba(142, 68, 173, 0.35);
}

.gacha-stage.rarity-epic {
  border-color: #d48806;
  background: radial-gradient(circle at 50% 25%, #fffcf0 0%, #ffeab3 100%);
  box-shadow: 0 6px 0 #945d03, 0 0 28px rgba(245, 185, 53, 0.5);
}

.gacha-stage.rarity-legend {
  border-color: #c0392b;
  background: radial-gradient(circle at 50% 25%, #fff7f0 0%, #ffd7cf 100%);
  box-shadow: 0 6px 0 #822017, 0 0 32px rgba(231, 76, 60, 0.55);
}

.gacha-portrait-lg {
  width: 112px;
  height: 112px;
  border-radius: 16px;
  border: 4px solid #fff7e0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.28);
  object-fit: cover;
}

.gacha-stat-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 900;
}

.gacha-stat-pill {
  background: rgba(255, 255, 255, 0.78);
  border: 1.5px solid #cbb183;
  border-radius: 8px;
  padding: 3px 9px;
}

.gacha-actions {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 460px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.gacha-actions .action-btn {
  flex: 1;
  min-width: 150px;
}

.ledger-box {
  margin-top: 12px;
  background: #efe1c2;
  border: 2px dashed var(--wood-light);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
}

.reveal-box {
  margin-top: 12px;
  background: #fff9e6;
  border: 3px solid var(--gold-dark);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.rank-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.rank-table {
  width: 100%;
  min-width: 460px;
  border-collapse: collapse;
  font-size: 13px;
}

.rank-table th, .rank-table td {
  padding: 8px 10px;
  border-bottom: 1.5px solid #decba2;
  text-align: left;
}

.rank-table tr.me-row {
  background: #e6f7dc;
  font-weight: 900;
}

.rank-live-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  background: #f5ead1;
  border: 2px solid #cbb183;
  border-radius: 12px;
  padding: 8px 10px;
  margin-bottom: 10px;
  font-size: 12px;
}

.rank-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.rank-name-input {
  width: 155px;
  max-width: 100%;
  padding: 5px 8px;
  border-radius: 8px;
  border: 2px solid #b59461;
  background: #fffdf7;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  font-family: inherit;
}

.invite-box {
  background: #fff5d9;
  border: 2.5px solid #d4962a;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 12px;
}

.invite-link-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.invite-link-input {
  flex: 1;
  min-width: 170px;
  padding: 5px 8px;
  border-radius: 8px;
  border: 2px solid #b59461;
  background: #ffffff;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 800;
  font-family: monospace;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}

.field-tile-btn {
  padding: 10px 6px;
  border-radius: 10px;
  border: 3px solid var(--wood-mid);
  background: var(--cream-card);
  font-weight: 900;
  cursor: pointer;
  text-align: center;
}

.field-tile-btn.active {
  background: #dff6d4;
  border-color: var(--green-dark);
}

.modal-msg {
  font-size: 13px;
  font-weight: 800;
  color: #a93226;
}

.icon-pill.active-mode {
  background: linear-gradient(180deg, #ffe26b 0%, #f5b324 100%);
  color: #4a1e03;
  border-color: #7d4805;
}

.offline-banner {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #fff8df 0%, #f3dfad 100%);
  border: 3px solid var(--wood-mid);
  box-shadow: 0 4px 0 var(--wood-dark), 0 8px 20px rgba(0, 0, 0, 0.28);
  border-radius: 14px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 900;
  color: var(--ink);
  z-index: 8;
}

.welcome-banner {
  position: absolute;
  top: 98px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #ebfce4 0%, #c6f0b4 100%);
  border: 3px solid #3c8225;
  box-shadow: 0 4px 0 #265717, 0 8px 20px rgba(0, 0, 0, 0.28);
  border-radius: 14px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 900;
  color: #183d0d;
  z-index: 9;
  max-width: min(94vw, 520px);
}

.offline-close {
  border: 2px solid var(--wood-dark);
  background: #c8523d;
  color: #fff;
  border-radius: 7px;
  width: 24px;
  height: 24px;
  font-weight: 900;
  cursor: pointer;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.filter-pill {
  border: 2px solid #bfa06c;
  background: #efe1c2;
  color: #543316;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.filter-pill.active {
  background: #58b842;
  border-color: #2e6d21;
  color: #ffffff;
}

.gacha-btn-row {
  display: flex;
  gap: 8px;
  margin-top: auto;
  width: 100%;
}

.gacha-btn-row .action-btn {
  flex: 1;
  padding: 9px 6px;
  font-size: 12px;
}

.gacha-multi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 8px;
  width: 100%;
  margin: 4px 0 8px;
}

.gacha-mini-card {
  background: #fffdf6;
  border: 2.5px solid #cbb183;
  border-radius: 12px;
  padding: 7px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.gacha-mini-card.rarity-rare { border-color: #2b7de9; background: #eef6ff; }
.gacha-mini-card.rarity-super_rare { border-color: #8e44ad; background: #f8eeff; }
.gacha-mini-card.rarity-epic { border-color: #d48806; background: #fff9e3; }
.gacha-mini-card.rarity-legend { border-color: #c0392b; background: #ffedea; }

.gacha-mini-card img {
  width: 54px;
  height: 54px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
}

.field-jump-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  align-items: center;
}

.help-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.help-card {
  background: var(--cream-card);
  border: 3px solid #cbb183;
  border-radius: 14px;
  padding: 12px;
  font-size: 12.5px;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.help-card h3 {
  margin: 0;
  font-size: 14px;
  color: #543114;
}

.boss-hud-bar {
  position: absolute;
  top: 112px;
  left: 50%;
  transform: translateX(-50%);
  width: min(540px, calc(100% - 170px));
  background: rgba(52, 24, 11, 0.94);
  border: 3px solid #f5b935;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.38);
  border-radius: 14px;
  padding: 7px 12px;
  color: #fff6dc;
  z-index: 6;
  pointer-events: none;
}

.boss-hud-bar.is-enraged {
  border-color: #ff4838;
  box-shadow: 0 0 18px rgba(255, 72, 56, 0.72);
}

.boss-hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.boss-hud-track {
  height: 12px;
  background: #1f0e06;
  border-radius: 6px;
  overflow: hidden;
  border: 1.5px solid #8a5418;
}

.boss-hud-fill {
  height: 100%;
  background: linear-gradient(90deg, #e03c2f 0%, #ff8b2b 100%);
  transition: width 0.16s ease;
}

@media (max-width: 960px) {
  .stage-badges {
    padding-right: 72px;
  }
  .bottom-dock {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 14px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .dock-actions {
    width: 100%;
    gap: 6px;
  }
  .dock-actions .action-btn {
    flex: 1;
  }
}

@media (max-width: 760px) {
  .boss-hud-bar {
    top: auto;
    bottom: 76px;
    left: 8px;
    right: 8px;
    transform: none;
    width: auto;
    padding: 6px 10px;
  }
  .boss-hud-top {
    font-size: 10.5px;
  }
}

@media (max-width: 760px) {
  .hide-sm {
    display: none;
  }
  .top-hud {
    padding: calc(6px + env(safe-area-inset-top, 0px)) 8px 4px;
    gap: 4px;
  }
  .hud-left, .hud-right {
    width: 100%;
    gap: 4px;
  }
  .hud-left {
    flex-wrap: wrap;
  }
  .hud-right {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    gap: 3px;
    justify-content: flex-start;
    align-items: center;
  }
  .hud-right::-webkit-scrollbar {
    display: none;
  }
  .field-badge {
    width: 44px;
    height: 44px;
    border-width: 3px;
  }
  .field-num {
    font-size: 16px;
  }
  .progress-card {
    flex: 1;
    min-width: 130px;
    padding: 4px 6px;
  }
  .field-sub {
    font-size: 10px;
  }
  .resource-pill, .wallet-pill, .icon-pill {
    padding: 2px 5px;
    font-size: 10.5px;
    border-width: 2px;
    gap: 3px;
    flex-shrink: 0;
  }
  .wallet-pill {
    padding: 2px 6px;
    font-size: 10px;
    max-width: 84px;
  }
  .icon-pill {
    width: 28px;
    height: 28px;
    min-width: 28px;
    padding: 0;
    justify-content: center;
    font-size: 12px;
  }
  .res-val {
    font-size: 11px;
  }
  .res-unit {
    font-size: 8.5px;
  }
  .res-icon-img {
    width: 14px;
    height: 14px;
  }
  .right-rail {
    top: auto;
    bottom: 22px;
    left: 8px;
    right: 8px;
    transform: none;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
  }
  .rail-btn {
    width: 100%;
    height: 46px;
    padding: 2px;
    border-width: 2.5px;
    border-radius: 11px;
    box-shadow: 0 3px 0 var(--wood-dark);
  }
  .rail-svg, .rail-portrait {
    width: 20px;
    height: 20px;
  }
  .rail-text {
    font-size: 8.5px;
    letter-spacing: 0.1px;
  }
  .rail-badge {
    top: -5px;
    right: -4px;
    min-width: 17px;
    height: 17px;
    font-size: 9.5px;
  }
  .stage-badges {
    padding-right: 18px;
    margin-top: 1px;
    gap: 5px;
    flex-wrap: nowrap;
    overflow-x: auto;
    pointer-events: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 90%, transparent 100%);
    mask-image: linear-gradient(90deg, #000 0%, #000 90%, transparent 100%);
  }
  .stage-badges::-webkit-scrollbar {
    display: none;
  }
  .stage-pill {
    font-size: 10px;
    padding: 3px 8px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .bottom-dock {
    padding: 14px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .dock-label {
    left: 10px;
    font-size: 10px;
  }
  .dock-cards {
    scrollbar-width: none;
  }
  .dock-cards::-webkit-scrollbar {
    display: none;
  }
  .dock-card {
    min-width: 102px;
    padding: 3px 5px;
  }
  .dock-actions .action-btn {
    padding: 8px 6px;
    font-size: 11px;
  }
  .action-btn {
    padding: 8px 10px;
    font-size: 11px;
  }
  .modal-backdrop {
    padding: 8px;
  }
  .modal-window {
    width: 100%;
    max-height: 92dvh;
    border-radius: 14px;
    border-width: 3px;
  }
  .modal-header {
    padding: 9px 12px;
  }
  .modal-title {
    font-size: 15px;
  }
  .modal-close {
    width: 32px;
    height: 32px;
    font-size: 15px;
  }
  .modal-body {
    padding: 10px;
  }
  .modal-footer {
    padding: 8px 10px;
    gap: 6px;
    font-size: 11px;
  }
  .squad-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .kwai-card {
    padding: 8px;
    gap: 8px;
  }
  .kwai-card-left {
    width: 78px;
  }
  .kwai-portrait {
    width: 72px;
    height: 72px;
  }
  .panel-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .book-grid {
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 8px;
  }
  .streak-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .modal-tab {
    min-width: 92px;
    padding: 7px 6px;
    font-size: 11px;
  }
  .rank-table {
    min-width: 0;
    font-size: 11px;
  }
  .rank-table th, .rank-table td {
    padding: 6px 5px;
  }
  .welcome-banner {
    top: 102px;
    font-size: 11.5px;
    padding: 7px 10px;
  }
}

/* Events Hub & Retention Modals */
.modal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.modal-tab {
  flex: 1;
  min-width: 115px;
  padding: 9px 10px;
  border-radius: 12px;
  border: 2.5px solid #8c5a2c;
  background: #f3e4c3;
  color: #4f2c11;
  font-weight: 900;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.12s ease, background 0.12s ease;
}

.modal-tab:hover {
  transform: translateY(-1px);
  background: #fff2d4;
}

.modal-tab.active {
  background: linear-gradient(180deg, #ffdf6b 0%, #f3a825 100%);
  border-color: #6b3b09;
  color: #361904;
  box-shadow: 0 3px 0 #8a4f0c;
}

.tab-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e6392f;
  box-shadow: 0 0 0 2px #fff;
}

.streak-banner {
  background: #fff4d2;
  border: 2px solid #c99131;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: #4f2c11;
}

.streak-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.streak-day {
  background: #fbf3de;
  border: 2px solid #b9935a;
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
}

.streak-day.is-day7 {
  grid-column: span 2;
  background: linear-gradient(180deg, #fff6cf 0%, #ffe699 100%);
  border-color: #d48806;
}

.streak-day.is-claimed {
  opacity: 0.72;
  background: #e6ecd9;
  border-color: #6f9e44;
}

.streak-day.is-ready {
  border-color: #2f9e36;
  background: #ebfae6;
  box-shadow: 0 0 0 2px rgba(47, 158, 54, 0.25);
}

.streak-day-num {
  font-size: 11px;
  font-weight: 900;
  color: #7c4d18;
}

.streak-day-icon {
  font-size: 24px;
  line-height: 1.1;
}

.streak-day-label {
  font-size: 11.5px;
  font-weight: 800;
  color: #361b08;
  line-height: 1.25;
}

.streak-day-tag {
  font-size: 10px;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 99px;
  margin-top: 2px;
}

.streak-day-tag.done {
  background: #6f9e44;
  color: #fff;
}

.streak-day-tag.ready {
  background: #2f9e36;
  color: #fff;
}

.streak-day-tag.lock {
  background: #dcc79c;
  color: #5c3c1e;
}

.weekly-meta-card {
  background: linear-gradient(135deg, #2d3e66 0%, #1d2847 100%);
  color: #fff;
  border: 2.5px solid #ffd15c;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.weekly-meta-card .meta-sub {
  color: #ffe39b;
  font-size: 12px;
  margin-top: 3px;
}

.season-clock-pill {
  background: rgba(255, 255, 255, 0.14);
  border: 1.5px solid rgba(255, 225, 130, 0.65);
  border-radius: 99px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 900;
  color: #ffea9c;
  white-space: nowrap;
}

.rewards-banner .season-clock-pill {
  background: #3d2209;
  color: #ffdf78;
  border-color: #b5771d;
  display: inline-block;
  margin-left: 8px;
}

/* Collection Book Styles */
.book-summary-bar {
  background: linear-gradient(135deg, #3c2411 0%, #5e391b 100%);
  color: #fff6dc;
  border: 2.5px solid #c99131;
  border-radius: 14px;
  padding: 11px 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.book-buff-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.book-buff-chip {
  background: rgba(255, 255, 255, 0.13);
  border: 1.5px solid rgba(255, 218, 117, 0.55);
  border-radius: 99px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 900;
  color: #ffe38f;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 10px;
}

.book-card {
  background: #fbf3de;
  border: 2.5px solid #b9935a;
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.book-card.is-locked {
  background: #ebe3cf;
  border-color: #afa189;
  opacity: 0.85;
}

.book-card.is-mastered {
  background: linear-gradient(180deg, #fff8d9 0%, #ffe8a3 100%);
  border-color: #d48806;
  box-shadow: 0 2px 10px rgba(212, 136, 6, 0.22);
}

.book-portrait-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.book-portrait-img {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  border: 2px solid #8c5a2c;
  background: #dfd1b0;
  object-fit: cover;
  flex-shrink: 0;
}

.book-card.is-locked .book-portrait-img {
  filter: brightness(0.18) contrast(1.1);
}

.book-buff-line {
  font-size: 11px;
  line-height: 1.35;
  padding: 4px 7px;
  border-radius: 8px;
  background: rgba(140, 90, 44, 0.08);
  color: #5c3a1a;
  font-weight: 700;
}

.book-buff-line.is-active {
  background: #dff5d8;
  color: #1f5c1a;
}

.meta-pill {
  pointer-events: auto;
  cursor: pointer;
  background: linear-gradient(180deg, #2f4373 0%, #1d2847 100%);
  color: #ffe38f;
  border-color: #f0be4a;
  font-family: inherit;
}

.meta-pill:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.meta-tag-badge {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: 99px;
  background: #24365f;
  color: #ffe38f;
  border: 1px solid #f0be4a;
  font-size: 9.5px;
  font-weight: 900;
  vertical-align: middle;
}

.squad-meta-banner {
  background: #223054;
  color: #fff6dc;
  border: 2px solid #e7b848;
  border-radius: 12px;
  padding: 7px 11px;
  margin-bottom: 8px;
  font-size: 11.5px;
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pity-pill {
  margin: 6px 0 8px;
  padding: 4px 9px;
  border-radius: 8px;
  background: #fff2cf;
  border: 1.5px solid #d4942a;
  color: #63390a;
  font-size: 11.5px;
  font-weight: 900;
}

.btn-rain-active {
  background: linear-gradient(180deg, #42b8ff 0%, #1a72bf 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 0 #10497d, 0 0 12px rgba(66, 184, 255, 0.7) !important;
}

/* Loading Splash Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 42%, #5ca8e0 0%, #3a7248 100%);
  transition: opacity 0.35s ease, visibility 0.35s ease;
  padding: 16px;
}

.loading-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-card {
  background: var(--cream);
  border: 4px solid var(--wood-dark);
  box-shadow: 0 8px 0 var(--wood-dark), 0 18px 40px rgba(0, 0, 0, 0.35);
  border-radius: 20px;
  padding: 22px 26px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.loading-mascot {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border: 4px solid var(--wood-dark);
  box-shadow: 0 5px 0 var(--wood-dark), 0 8px 18px rgba(0, 0, 0, 0.28);
  object-fit: cover;
  background: #7bc7ff;
  animation: mascotBob 1.5s ease-in-out infinite alternate;
}

@keyframes mascotBob {
  0% { transform: translateY(0px) scale(1); }
  100% { transform: translateY(-4px) scale(1.03); }
}

.res-icon-img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--wood-dark);
  object-fit: cover;
  flex-shrink: 0;
}

.loading-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--wood-dark);
}

.loading-sub {
  font-size: 12px;
  font-weight: 800;
  color: #6b421c;
}

.loading-bar-track {
  width: 100%;
  height: 12px;
  margin-top: 4px;
  background: #3d2412;
  border-radius: 999px;
  overflow: hidden;
  border: 2px solid #2a170a;
}

.loading-bar-fill {
  width: 55%;
  height: 100%;
  background: linear-gradient(90deg, #ffcf40 0%, #6ee354 100%);
  border-radius: 999px;
  animation: loadingSlide 1.1s ease-in-out infinite alternate;
}

@keyframes loadingSlide {
  0% { transform: translateX(-15%); width: 42%; }
  100% { transform: translateX(65%); width: 65%; }
}

/* Farmer Profile & X Handle UI */
.profile-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
  color: #5c3a1a;
}

.profile-field .rank-name-input {
  width: 100%;
  padding: 6px 9px;
  font-size: 12px;
}

.profile-check-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 800;
  color: #4a2a0f;
  cursor: pointer;
  user-select: none;
}

.profile-check-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #3f9c35;
  flex-shrink: 0;
}

.profile-preview {
  background: #fff6dc;
  border: 1.5px dashed #cfa35a;
  border-radius: 9px;
  padding: 6px 9px;
  font-size: 11.5px;
  font-weight: 800;
  color: #5c390a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.rank-x-link {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: 99px;
  background: #e6f2ff;
  border: 1px solid #8abdf2;
  color: #0e5ca8;
  font-size: 10px;
  font-weight: 900;
  text-decoration: none;
  vertical-align: middle;
}

.rank-x-link:hover {
  background: #d0e7ff;
  text-decoration: underline;
}

@media (max-width: 760px) {
  .wallet-pill {
    max-width: 84px;
  }
  .profile-form-grid {
    grid-template-columns: 1fr;
  }
}

.unranked-banner {
  background: #fff4d6;
  border: 2px solid #d4942a;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: #4f2c0b;
}

.lang-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.lang-option-box {
  background: #fffdf5;
  border: 2px solid #cbb183;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lang-option-box.is-active {
  border-color: #4f9e3c;
  background: #f3fff0;
}

#google_translate_element {
  margin-top: 6px;
}

#google_translate_element .goog-te-gadget {
  font-family: inherit !important;
  font-size: 12px !important;
  color: #5c3a1a !important;
}

#google_translate_element select.goog-te-combo {
  padding: 6px 8px;
  border-radius: 8px;
  border: 2px solid #b59461;
  background: #fffdf7;
  font-weight: 700;
  color: #3a200d;
  max-width: 100%;
}
