:root {
  --bg: #090d16;
  --panel: #111827;
  --panel-2: #171f2f;
  --border: rgba(114, 76, 232, 0.34);
  --accent: #724ce8;
  --accent-2: #8b6cff;
  --text: #eef2ff;
  --muted: #a7aec4;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top, rgba(114, 76, 232, 0.25), transparent 28%), var(--bg);
  color: var(--text);
  font-family: Inter, Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Noto Sans JP", "Noto Sans SC", "Noto Sans Devanagari", "Segoe UI", sans-serif;
  min-height: 100%;
}

body {
  min-height: 100vh;
}

body.auth-required .app-shell,
body.auth-required .tabbar {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 18%, rgba(34, 197, 94, 0.16), transparent 28%),
    linear-gradient(135deg, rgba(9, 13, 22, 0.96), rgba(17, 24, 39, 0.94));
}

.login-overlay.hidden {
  display: none;
}

.login-panel {
  width: min(420px, 100%);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  padding: 28px;
  background: rgba(17, 24, 39, 0.94);
  box-shadow: var(--shadow);
}

.login-kicker {
  color: #86efac;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-panel h1 {
  margin: 10px 0 8px;
  font-size: 30px;
  line-height: 1.12;
}

.login-panel p {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.6;
}

.google-signin-button {
  min-height: 44px;
}

.login-error {
  margin-top: 14px;
  color: #fecaca;
  font-size: 13px;
  line-height: 1.45;
}

.sign-out-button {
  min-height: 42px;
  padding-inline: 14px;
  white-space: nowrap;
}

body.rule-notice-open {
  overflow: hidden;
}

button {
  font: inherit;
}

select {
  font: inherit;
}

input,
textarea {
  caret-color: #ffffff !important;
  color: var(--text) !important;
}

input:focus,
textarea:focus {
  caret-color: #ffffff !important;
  outline: none;
}

.app-shell {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 18px 16px 100px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

body.admin-tab-active .topbar {
  display: none;
}

.topbar h1 {
  margin: 4px 0 0;
  font-size: clamp(24px, 4vw, 34px);
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lang-toggle {
  position: relative;
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(114, 76, 232, 0.1);
  overflow: hidden;
}

.lang-toggle::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 12px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  pointer-events: none;
  transform: translateY(-65%) rotate(45deg);
}

.lang-select {
  min-width: 142px;
  max-width: 164px;
  min-height: 42px;
  padding: 0 34px 0 14px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  outline: none;
  appearance: none;
}

.lang-select option {
  color: #111827;
  background: #ffffff;
}

.lang-toggle:focus-within,
.lang-toggle:hover {
  border-color: rgba(139, 108, 255, 0.9);
  background: linear-gradient(180deg, rgba(114, 76, 232, 0.24), rgba(38, 22, 87, 0.22));
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
  width: 90%;
  max-width: 360px;
}

.toast {
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 16px;
  border: 1px solid rgba(160, 120, 255, 0.5);
  background: #1a1040;
  box-shadow: var(--shadow);
  color: #ffffff;
  font-size: 14px;
  line-height: 1.5;
  pointer-events: auto;
  animation: toast-in 0.3s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}

.toast-indicator {
  flex-shrink: 0;
  width: 4px;
  align-self: stretch;
  border-radius: 4px;
}

.toast-success .toast-indicator {
  background: #16a34a;
}

.toast-error .toast-indicator {
  background: #dc2626;
}

.toast.toast-out {
  animation: toast-out 0.22s ease-in forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)      scale(1); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0)      scale(1); }
  to   { opacity: 0; transform: translateY(-8px)   scale(0.97); }
}

.hidden {
  display: none !important;
}

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(9, 13, 22, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.tabbar .tab-button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  background: transparent;
  border: none;
  border-radius: 12px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.02em;
  min-width: 0;
  transition: color 0.15s ease;
}

.tabbar .tab-button svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.tabbar .tab-button.active {
  color: var(--accent-2);
  background: transparent;
  box-shadow: none;
}

.tabbar .tab-button:hover:not(.active) {
  color: var(--text);
  transform: none;
  border-color: transparent;
}

.tab-button,
.ghost-button,
.secondary-button,
.primary-button {
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.tab-button,
.ghost-button,
.secondary-button {
  background: rgba(114, 76, 232, 0.1);
  padding: 10px 14px;
}


.primary-button {
  width: 100%;
  background: linear-gradient(180deg, #8b6cff, #5d3fd3);
  padding: 16px;
  font-size: 17px;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(114, 76, 232, 0.3);
}

.primary-button:disabled,
.ghost-button:disabled,
.secondary-button:disabled,
.tab-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tab-button:hover,
.ghost-button:hover,
.secondary-button:hover,
.primary-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(139, 108, 255, 0.9);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.panel {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.95), rgba(11, 16, 28, 0.98));
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}

.panel h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.panel-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.panel-header-centered {
  justify-content: center;
  text-align: center;
}

.muted {
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.user-panel {
  display: flex;
  gap: 14px;
  align-items: center;
}

.user-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(139, 108, 255, 0.85), rgba(57, 32, 143, 0.95));
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
  box-shadow: 0 12px 30px rgba(114, 76, 232, 0.28);
}

.user-main {
  flex: 1;
}

.user-name {
  font-size: 22px;
  font-weight: 700;
}

.user-meta {
  color: var(--muted);
  margin-top: 4px;
  word-break: break-all;
}

.user-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.status-chip,
.code-chip,
.upline-level,
.summary-pill,
.count-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(114, 76, 232, 0.15);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.bottom-stats-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stat-card {
  min-height: 104px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: rgba(114, 76, 232, 0.09);
  border: 1px solid rgba(114, 76, 232, 0.22);
  border-radius: 18px;
  padding: 16px;
}

.compact-stat-card {
  min-height: 92px;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.stat-value {
  margin-top: 8px;
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 800;
  word-break: break-all;
}

.chest-panel {
  text-align: center;
}

.chest-visual {
  width: 152px;
  height: 152px;
  border-radius: 32px;
  margin: 10px auto 18px;
  display: grid;
  place-items: center;
  font-size: 76px;
  background: radial-gradient(circle at top, rgba(139, 108, 255, 0.45), rgba(31, 17, 69, 0.95));
  border: 1px solid rgba(139, 108, 255, 0.45);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.chest-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.bonus-offerwall-button {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  font-weight: 750;
  text-decoration: none;
}

.info-box {
  background: rgba(114, 76, 232, 0.11);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
}

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

.info-value {
  margin-top: 8px;
  font-size: 18px;
  font-weight: 700;
}

.action-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.action-row > * {
  flex: 1;
}

.reward-result {
  min-height: 74px;
  border-radius: 16px;
  border: 1px dashed var(--border);
  padding: 14px;
  line-height: 1.6;
}

.reward-result.empty {
  color: var(--muted);
}

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

.reward-summary-card {
  background: rgba(114, 76, 232, 0.09);
  border: 1px solid rgba(114, 76, 232, 0.22);
  border-radius: 14px;
  padding: 12px;
}

.reward-summary-card strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.reward-list-title {
  margin: 16px 0 8px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.reward-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.reward-line:last-child {
  border-bottom: 0;
}

.reward-line-label {
  color: var(--text);
}

.reward-line-meta {
  color: var(--muted);
  text-align: right;
}

.rank-summary {
  padding: 14px;
  border-radius: 16px;
  background: rgba(114, 76, 232, 0.11);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.ranking-mode-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
  padding: 6px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(9, 13, 22, 0.38);
}

.ranking-mode-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.ranking-mode-button.active {
  color: var(--text);
  border-color: rgba(139, 108, 255, 0.55);
  background: linear-gradient(180deg, rgba(114, 76, 232, 0.55), rgba(38, 22, 87, 0.88));
}

.referral-website-link {
  margin: 10px 0 12px;
}

.referral-website-link .secondary-button {
  width: 100%;
}

.tree-mode-control {
  margin: 0 0 14px;
}

.ranking-list,
.upline-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rank-item {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 18px;
  background: rgba(15, 22, 35, 0.9);
  border: 1px solid rgba(114, 76, 232, 0.22);
}

.rank-item.me {
  border-color: rgba(139, 108, 255, 0.85);
  box-shadow: 0 10px 25px rgba(114, 76, 232, 0.15);
}

.rank-no {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(114, 76, 232, 0.18);
  border: 1px solid var(--border);
  font-weight: 700;
}

.rank-user-name,
.tree-node-name {
  font-weight: 700;
}

.rank-user-meta,
.tree-node-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
  word-break: break-all;
}

.rank-score {
  text-align: right;
  font-weight: 800;
}

.rank-score-detail {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.upline-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(15, 22, 35, 0.92);
  border: 1px solid rgba(114, 76, 232, 0.22);
}

.tree-summary-text {
  font-size: 18px;
  margin-bottom: 14px;
}

.summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.summary-money {
  margin-top: 16px;
  font-size: 16px;
}

.tree-wrap {
  max-height: 680px;
  overflow: auto;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(114, 76, 232, 0.35);
  background: radial-gradient(circle at top, rgba(114, 76, 232, 0.18), rgba(12, 18, 30, 0.98));
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-top: 8px;
  border-radius: 14px;
  background: #070b12;
  border: 1px solid rgba(114, 76, 232, 0.25);
  cursor: pointer;
}

.tree-row:hover {
  border-color: rgba(139, 108, 255, 0.8);
}

.tree-arrow {
  width: 22px;
  text-align: center;
  color: var(--accent-2);
  font-size: 18px;
}

.tree-node-main {
  flex: 1;
  min-width: 0;
}

.tree-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tree-children {
  margin-left: 26px;
  border-left: 1px dashed rgba(114, 76, 232, 0.5);
  padding-left: 12px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.25s ease;
}

.tree-children.open {
  max-height: 4000px;
  opacity: 1;
}

.loading-overlay,
.reward-animation-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 6, 12, 0.66);
  backdrop-filter: blur(6px);
  z-index: 1000;
}

.reward-animation-overlay {
  z-index: 1200;
  background: radial-gradient(circle at center, rgba(114, 76, 232, 0.18), rgba(3, 6, 12, 0.92));
}

.loading-box,
.reward-animation-panel {
  border-radius: 22px;
  border: 1px solid rgba(114, 76, 232, 0.35);
  background: rgba(10, 13, 24, 0.95);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.loading-box {
  min-width: 180px;
  text-align: center;
  padding: 16px 18px;
}

.reward-animation-panel {
  width: min(500px, calc(100vw - 28px));
  padding: 28px 20px 24px;
  text-align: center;
  overflow: hidden;
}

.reward-stage-label {
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 12px;
}

.reward-chest-stage {
  position: relative;
  height: 210px;
  display: grid;
  place-items: center;
}

.reward-halo {
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 241, 175, 0.42), rgba(139, 108, 255, 0.18) 45%, transparent 70%);
  filter: blur(6px);
  opacity: 0.45;
}

.reward-chest {
  position: relative;
  z-index: 1;
  width: 152px;
  height: 152px;
  border-radius: 30px;
  display: grid;
  place-items: center;
  font-size: 78px;
  background: radial-gradient(circle at top, rgba(139, 108, 255, 0.55), rgba(31, 17, 69, 0.95));
  border: 1px solid rgba(139, 108, 255, 0.5);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  transform-origin: center bottom;
}

.reward-chest.is-shaking {
  animation: chestShake 0.55s ease-in-out infinite;
}

.reward-chest.is-opening {
  animation: chestOpen 1.2s ease forwards;
}

.reward-chest.is-open {
  animation: chestPulse 1s ease-in-out infinite;
}

.reward-chest.is-finished {
  animation: chestFinish 0.6s ease forwards;
}

.reward-counter-prefix {
  color: var(--muted);
  font-size: 15px;
}

.reward-counter-value {
  margin-top: 10px;
  font-size: clamp(44px, 10vw, 72px);
  font-weight: 900;
  letter-spacing: -0.04em;
}

.reward-counter-meta {
  margin-top: 10px;
  color: #d7d9ff;
  min-height: 24px;
}

.reward-particles {
  position: relative;
  height: 40px;
  margin-top: 14px;
}

.reward-particles span {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fef08a, #8b6cff);
  opacity: 0.8;
  animation: particleFloat 1.6s ease-in-out infinite;
}

.reward-particles span:nth-child(1) { left: 12%; animation-delay: 0s; }
.reward-particles span:nth-child(2) { left: 26%; animation-delay: 0.2s; }
.reward-particles span:nth-child(3) { left: 41%; animation-delay: 0.35s; }
.reward-particles span:nth-child(4) { left: 58%; animation-delay: 0.15s; }
.reward-particles span:nth-child(5) { left: 74%; animation-delay: 0.28s; }
.reward-particles span:nth-child(6) { left: 88%; animation-delay: 0.42s; }

.reward-skip-button {
  margin-top: 8px;
}

.ad-guard-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(3, 6, 12, 0.72);
  backdrop-filter: blur(8px);
}

.ad-guard-panel {
  width: min(520px, 100%);
  padding: 22px;
  border-radius: 22px;
  border: 1px solid rgba(114, 76, 232, 0.38);
  background: linear-gradient(180deg, rgba(16, 22, 36, 0.98), rgba(8, 12, 22, 0.98));
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.52);
  text-align: center;
}

.ad-guard-visual {
  width: 78px;
  height: 78px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  border: 1px solid rgba(139, 108, 255, 0.42);
  background: radial-gradient(circle at top, rgba(254, 240, 138, 0.25), rgba(114, 76, 232, 0.28) 42%, rgba(11, 16, 28, 0.95));
  font-size: 38px;
}

.ad-guard-kicker {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ad-guard-panel h2 {
  margin: 8px 0 10px;
  font-size: 22px;
  line-height: 1.25;
}

.ad-guard-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.ad-guard-safe-note {
  margin-top: 14px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(22, 163, 74, 0.35);
  background: rgba(22, 163, 74, 0.12);
  color: #dcfce7;
  line-height: 1.5;
}

.ad-guard-help {
  margin-top: 14px;
  padding: 14px;
  text-align: left;
  border-radius: 16px;
  border: 1px solid rgba(114, 76, 232, 0.28);
  background: rgba(114, 76, 232, 0.08);
}

.ad-guard-help-title {
  margin-bottom: 8px;
  font-weight: 800;
}

.ad-guard-help ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.ad-guard-help li + li {
  margin-top: 7px;
}

.ad-guard-actions {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr;
  gap: 10px;
  margin-top: 16px;
}

.ad-guard-actions .primary-button,
.ad-guard-actions .secondary-button,
.ad-guard-actions .ghost-button {
  width: 100%;
}

.rule-notice-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 1320 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 18px;
  background: rgba(3, 6, 12, 0.74);
  backdrop-filter: blur(8px);
  overflow: auto;
}

.rule-notice-backdrop.hidden {
  display: none !important;
}

.rule-notice-panel {
  width: min(480px, 100%);
  padding: 22px;
  border-radius: 22px;
  border: 1px solid rgba(114, 76, 232, 0.42);
  background: linear-gradient(180deg, rgba(16, 22, 36, 0.98), rgba(8, 12, 22, 0.98));
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.52);
}

.rule-notice-kicker {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rule-notice-panel h2 {
  margin: 8px 0 10px;
  font-size: 22px;
  line-height: 1.25;
}

.rule-notice-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.rule-notice-date {
  margin-top: 14px;
  padding: 11px 12px;
  border-radius: 16px;
  border: 1px solid rgba(139, 108, 255, 0.34);
  background: rgba(114, 76, 232, 0.11);
  color: var(--text);
  font-weight: 800;
}

.rule-notice-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.rule-notice-actions .primary-button,
.rule-notice-actions .secondary-button {
  width: 100%;
}

@keyframes chestShake {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  20% { transform: rotate(-5deg) translateY(2px); }
  40% { transform: rotate(5deg) translateY(-1px); }
  60% { transform: rotate(-3deg) translateY(1px); }
  80% { transform: rotate(3deg) translateY(-2px); }
}

@keyframes chestOpen {
  0% { transform: scale(1) rotate(0deg); filter: brightness(1); }
  45% { transform: scale(1.04) rotate(-4deg); filter: brightness(1.05); }
  60% { transform: scale(1.08) rotate(5deg); filter: brightness(1.2); }
  100% { transform: scale(1.18) rotate(0deg); filter: brightness(1.4); }
}

@keyframes chestPulse {
  0%, 100% { transform: scale(1.14); box-shadow: 0 0 0 rgba(139, 108, 255, 0.18), 0 18px 40px rgba(0, 0, 0, 0.42); }
  50% { transform: scale(1.22); box-shadow: 0 0 28px rgba(139, 108, 255, 0.38), 0 18px 40px rgba(0, 0, 0, 0.42); }
}

@keyframes chestFinish {
  0% { transform: scale(1.18); }
  100% { transform: scale(1.24); box-shadow: 0 0 40px rgba(254, 240, 138, 0.35), 0 18px 42px rgba(0, 0, 0, 0.44); }
}

@keyframes particleFloat {
  0% { transform: translateY(0) scale(0.9); opacity: 0.3; }
  50% { transform: translateY(-16px) scale(1.2); opacity: 1; }
  100% { transform: translateY(-2px) scale(0.85); opacity: 0.35; }
}

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

@media (max-width: 860px) {
  .chest-info-grid,
  .reward-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .action-row {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 14px 12px 100px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-controls {
    justify-content: space-between;
  }

  .bottom-stats-grid,
  .chest-info-grid,
  .reward-summary-grid {
    grid-template-columns: 1fr;
  }

  .rank-item {
    grid-template-columns: 46px 1fr;
  }

  .rank-score {
    grid-column: 1 / -1;
    text-align: left;
  }

  .upline-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .tree-row {
    flex-wrap: wrap;
  }

  .tree-badges {
    width: 100%;
  }

  .reward-animation-panel {
    padding: 24px 16px 20px;
  }

  .ad-guard-panel {
    padding: 20px 16px;
  }

  .ad-guard-actions {
    grid-template-columns: 1fr;
  }

  .rule-notice-panel {
    padding: 20px 16px;
  }

  .rule-notice-actions {
    grid-template-columns: 1fr;
  }

  .reward-chest-stage {
    height: 180px;
  }

  .reward-chest {
    width: 136px;
    height: 136px;
    font-size: 68px;
  }
}


.shop-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.voucher-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.voucher-ticket {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 16px;
  background:
    radial-gradient(circle at top right, rgba(139, 108, 255, 0.24), transparent 48%),
    linear-gradient(180deg, rgba(20, 28, 44, 0.97), rgba(8, 12, 20, 0.99));
  border: 1px solid rgba(114, 76, 232, 0.45);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.3);
}

.voucher-ticket::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  top: 56%;
  /* border-top: 1px dashed rgba(167, 174, 196, 0.36); */
}

.voucher-ticket-notch {
  position: absolute;
  top: 56%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid rgba(114, 76, 232, 0.38);
}

.voucher-ticket-notch.left {
  left: -8px;
}

.voucher-ticket-notch.right {
  right: -8px;
}

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

.voucher-ticket-title {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.voucher-status-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(114, 76, 232, 0.2);
  border: 1px solid rgba(114, 76, 232, 0.45);
  font-size: 12px;
  font-weight: 700;
}

.voucher-status-chip.pending{
  background: rgba(22, 162, 74, 0.2);
  border-color: rgba(22, 162, 74, 0.45);
}

.voucher-status-chip.redeemed {
  background: rgba(220, 38, 38, 0.2);
  border-color: rgba(220, 38, 38, 0.45);
}

.voucher-code-row {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.voucher-code {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.05em;
  word-break: break-all;
  color: #f2f6ff;
}

.voucher-copy-button {
  white-space: nowrap;
  padding: 8px 12px;
}

.voucher-metrics {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.voucher-metric-card {
  background: rgba(114, 76, 232, 0.12);
  border: 1px solid rgba(114, 76, 232, 0.28);
  border-radius: 14px;
  padding: 12px;
}

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

.voucher-metric-value {
  margin-top: 8px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
}

.voucher-allowed-email {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 13px;
}

.voucher-allowed-email strong {
  color: var(--text);
  text-align: right;
  word-break: break-all;
}

.voucher-created-at {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  color: var(--muted);
  font-size: 13px;
}

.voucher-created-at strong {
  color: var(--text);
  text-align: right;
}

.shop-summary-card,
.shop-note-box,
.about-section-panel,
.about-hero-panel,
.shop-convert-panel,
.shop-hero-panel {
  background: rgba(114, 76, 232, 0.08);
  border: 1px solid rgba(114, 76, 232, 0.22);
}

.shop-summary-card {
  border-radius: 18px;
  padding: 16px;
}

.shop-summary-label,
.shop-field-label,
.shop-note-title {
  color: var(--muted);
  font-size: 13px;
}

.shop-summary-value {
  margin-top: 8px;
  font-size: clamp(24px, 4vw, 30px);
  font-weight: 800;
}

.shop-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 12px;
}

.shop-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(114, 76, 232, 0.26);
  background: rgba(9, 13, 22, 0.72);
  color: var(--text);
  outline: none;
  caret-color: white !important;
  color: var(--text) !important;
}

.shop-input:focus {
  border-color: rgba(139, 108, 255, 0.9);
  box-shadow: 0 0 0 3px rgba(114, 76, 232, 0.18);
}

.shop-input::placeholder {
  color: rgba(167, 174, 196, 0.75);
}

.shop-max-button {
  min-width: 112px;
}

.shop-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.shop-primary-button {
  width: auto;
}

.shop-note-box {
  border-radius: 18px;
  padding: 16px;
  margin-top: 18px;
}

.shop-domain-value {
  margin-top: 8px;
  font-size: 18px;
  font-weight: 700;
}

.shop-note-text {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.wallet-panel {
  display: grid;
  gap: 14px;
}

.wallet-header-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 12px;
}

.wallet-status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(167, 174, 196, 0.22);
  background: rgba(167, 174, 196, 0.1);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  min-height: 30px;
  white-space: nowrap;
}

.wallet-status-chip.verified {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

.wallet-status-chip.missing {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.12);
  color: #facc15;
}

.wallet-current {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(114, 76, 232, 0.22);
  background: rgba(9, 13, 22, 0.46);
}

.wallet-current span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.wallet-current code {
  color: var(--text);
  font-family: "Space Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-all;
}

.wallet-web-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(114, 76, 232, 0.22);
  background: rgba(114, 76, 232, 0.12);
}

.wallet-web-panel p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
}

.wallet-web-button {
  width: 100%;
}

.wallet-provider-button {
  min-width: 164px;
}

.wallet-actions {
  margin-top: 0;
}

.wallet-help-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.about-section-panel h3,
.about-hero-panel h2 {
  margin-top: 0;
}

.about-section-panel p,
.about-hero-panel p {
  color: var(--text);
  line-height: 1.7;
  margin: 10px 0 0;
}

.about-list {
  margin: 12px 0 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text);
}

.about-list li {
  line-height: 1.6;
}

@media (max-width: 860px) {
  .shop-summary-grid,
  .shop-actions {
    grid-template-columns: 1fr;
  }

  .voucher-list {
    grid-template-columns: 1fr;
  }

  .voucher-metrics {
    grid-template-columns: 1fr;
  }

  .voucher-code-row {
    grid-template-columns: 1fr;
  }

  .voucher-copy-button {
    width: 100%;
  }

  .shop-field-row {
    grid-template-columns: 1fr;
  }

  .shop-max-button,
  .wallet-provider-button {
    width: 100%;
  }

  .wallet-header-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .wallet-status-chip {
    width: fit-content;
    justify-self: start;
  }
}

/* Mobile app shell base layer.
   Functional markup stays unchanged; this remaps the existing UI to a compact H5 app shell. */
:root {
  --bg: #08060f;
  --panel: #130d20;
  --panel-2: #1a1226;
  --panel-3: #241834;
  --border: rgba(91, 73, 137, 0.72);
  --border-strong: rgba(148, 113, 214, 0.68);
  --accent: #a855f7;
  --accent-2: #2fd3c2;
  --accent-3: #f7c948;
  --text: #f3eefc;
  --muted: #a79bbc;
  --success: #2fd3c2;
  --danger: #f2565f;
  --warning: #f7c948;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
  --mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  --app-width: 452px;
  --grad-brand: linear-gradient(135deg, #c13aff 0%, #a855f7 48%, #1ec8bc 100%);
  --grad-button: linear-gradient(135deg, #a855f7 0%, #7c3aed 62%, #2563eb 100%);
}

html,
body {
  min-height: 100%;
  background:
    linear-gradient(180deg, rgba(18, 12, 30, 0.94), rgba(5, 4, 9, 1)),
    #050409;
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: stretch;
  color: var(--text);
  overflow-x: hidden;
}

body::before {
  content: "TG REWARD";
  position: fixed;
  inset: 12vh 0 auto;
  z-index: 0;
  pointer-events: none;
  text-align: center;
  font-size: 140px;
  line-height: 1;
  font-weight: 900;
  font-style: italic;
  color: rgba(168, 85, 247, 0.035);
  white-space: nowrap;
}

body.auth-required .app-shell,
body.auth-required .tabbar {
  filter: blur(5px) saturate(0.8);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(var(--app-width), 100%);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 16px calc(86px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-left: 1px solid rgba(91, 73, 137, 0.56);
  border-right: 1px solid rgba(91, 73, 137, 0.56);
  box-shadow: 0 0 86px rgba(124, 58, 237, 0.22);
}

body.admin-tab-active .app-shell {
  width: min(1100px, 100%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  min-height: 64px;
  margin: 0 -16px 14px;
  padding: 13px 16px 12px;
  border-bottom: 1px solid rgba(91, 73, 137, 0.72);
  background: rgba(8, 6, 15, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.topbar h1 {
  margin: 3px 0 0;
  font-size: 18px;
  line-height: 1.15;
  font-style: italic;
}

.eyebrow,
.login-kicker,
.ad-guard-kicker,
.rule-notice-kicker {
  color: var(--accent-2);
  font-size: 10.5px;
  letter-spacing: 0.08em;
}

.topbar-controls {
  gap: 7px;
  flex-wrap: nowrap;
}

.sign-out-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 11px;
}

.lang-toggle,
.admin-language-control {
  border-color: var(--border);
  border-radius: 999px;
  background: var(--panel-2);
}

.lang-select {
  min-width: 96px;
  max-width: 112px;
  min-height: 34px;
  padding: 0 28px 0 10px;
  color: var(--accent-2);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 800;
}

.tabbar {
  left: 50%;
  right: auto;
  width: min(var(--app-width), 100%);
  transform: translateX(-50%);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  border: 1px solid rgba(91, 73, 137, 0.72);
  border-bottom: 0;
  background: rgba(12, 8, 20, 0.96);
  box-shadow: 0 -18px 38px rgba(0, 0, 0, 0.28);
}

body.admin-tab-active .tabbar {
  width: min(1100px, 100%);
}

.tabbar .tab-button {
  min-height: 48px;
  padding: 4px 2px;
  border-radius: 8px;
  color: #766c8d;
  font-size: 9.5px;
  line-height: 1.2;
}

.tabbar .tab-button svg {
  width: 21px;
  height: 21px;
}

.tabbar .tab-button.active {
  color: var(--accent);
  background: transparent;
}

.tabbar .tab-button.active span {
  color: #d7b8ff;
}

.panel,
.login-panel,
.loading-box,
.reward-animation-panel,
.ad-guard-panel,
.rule-notice-panel,
.admin-modal {
  border-radius: 8px;
  border-color: var(--border);
  background: linear-gradient(180deg, rgba(26, 18, 38, 0.98), rgba(19, 13, 32, 0.98));
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
  margin-bottom: 12px;
}

.panel h2,
.panel h3,
.ad-guard-panel h2,
.rule-notice-panel h2 {
  font-size: 17px;
  line-height: 1.25;
}

.muted,
.panel p,
.wallet-help-text,
.shop-note-text {
  color: var(--muted);
}

.primary-button,
.secondary-button,
.ghost-button,
.ranking-mode-button,
.shop-input,
.admin-input {
  border-radius: 8px;
}

.primary-button {
  min-height: 46px;
  padding: 13px 14px;
  border: 0;
  background: var(--grad-button);
  box-shadow: 0 12px 30px rgba(168, 85, 247, 0.22);
  font-size: 14px;
}

.secondary-button,
.ghost-button,
.tab-button {
  background: rgba(26, 18, 38, 0.95);
  border-color: var(--border);
}

.secondary-button:hover,
.ghost-button:hover,
.primary-button:hover:not(:disabled),
.ranking-mode-button:hover {
  border-color: var(--border-strong);
  box-shadow: 0 8px 22px rgba(124, 58, 237, 0.18);
}

.user-panel {
  align-items: flex-start;
}

.user-avatar,
.rank-no,
.coin {
  border-radius: 8px;
}

.user-avatar {
  width: 48px;
  height: 48px;
  background: var(--grad-brand);
  font-size: 17px;
}

.user-name {
  font-size: 18px;
}

.user-meta,
.rank-user-meta,
.tree-node-meta {
  font-size: 12px;
}

.status-chip,
.code-chip,
.upline-level,
.summary-pill,
.count-pill,
.wallet-status-chip {
  border-radius: 999px;
  border-color: var(--border);
  background: rgba(36, 24, 52, 0.92);
  font-family: var(--mono);
  font-size: 11px;
}

.chest-visual,
.reward-chest,
.ad-guard-visual {
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(193, 58, 255, 0.22), rgba(30, 200, 188, 0.12)),
    var(--panel-2);
  border-color: var(--border-strong);
}

.chest-visual {
  width: 132px;
  height: 132px;
  font-size: 64px;
}

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

.chest-info-grid .wide {
  grid-column: 1 / -1;
}

.info-box,
.stat-card,
.reward-summary-card,
.rank-summary,
.rank-item,
.upline-item,
.tree-row,
.tree-wrap,
.shop-summary-card,
.shop-note-box,
.wallet-current,
.wallet-web-panel,
.voucher-card,
.admin-menu-card,
.admin-stat-card,
.admin-conversion-display,
.admin-help-box,
.admin-result-box {
  border-radius: 8px;
  border-color: rgba(91, 73, 137, 0.66);
  background: rgba(19, 13, 32, 0.78);
}

.bottom-stats-grid,
.shop-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-card,
.shop-summary-card {
  min-height: 86px;
  padding: 12px;
}

.stat-label,
.info-label,
.shop-summary-label,
.shop-field-label {
  color: var(--muted);
  font-size: 11px;
}

.stat-value,
.info-value,
.shop-summary-value,
.rank-score,
.tree-summary-text,
.reward-summary-card strong {
  font-family: var(--mono);
  font-size: 20px;
  line-height: 1.2;
}

.stat-value,
.shop-summary-value,
.rank-score {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.reward-result {
  border-radius: 8px;
  border-color: rgba(91, 73, 137, 0.72);
  background: rgba(8, 6, 15, 0.46);
}

.ranking-mode-control {
  border-radius: 8px;
  border-color: rgba(91, 73, 137, 0.66);
  background: rgba(8, 6, 15, 0.52);
}

.ranking-mode-button.active {
  border-color: rgba(168, 85, 247, 0.72);
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.24), rgba(30, 200, 188, 0.08));
}

.rank-item {
  grid-template-columns: 44px minmax(0, 1fr) auto;
  padding: 12px;
}

.rank-no {
  width: 38px;
  height: 38px;
  background: rgba(36, 24, 52, 0.92);
}

.tree-wrap {
  background:
    linear-gradient(180deg, rgba(36, 24, 52, 0.88), rgba(8, 6, 15, 0.7));
}

.tree-row:hover,
.rank-item.me {
  border-color: var(--accent);
}

.shop-field-row,
.shop-actions {
  grid-template-columns: 1fr;
}

.shop-input,
.admin-input {
  min-height: 44px;
  background: rgba(8, 6, 15, 0.78);
  border-color: rgba(91, 73, 137, 0.72);
}

.shop-input:focus,
.admin-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.14);
}

.wallet-current code {
  font-family: var(--mono);
}

.toast {
  border-radius: 8px;
  border-color: rgba(91, 73, 137, 0.72);
  background: var(--panel-2);
}

.login-overlay {
  left: 0;
  right: auto;
  width: 100vw;
  max-width: 100vw;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(18, 12, 30, 0.82), rgba(5, 4, 9, 0.96)),
    #050409;
}

.login-panel {
  flex: 0 1 auto;
  width: calc(100vw - 32px);
  max-width: 420px;
  min-width: 0;
  padding: 26px;
}

.login-panel h1 {
  font-size: 30px;
  line-height: 1.12;
}

.google-signin-button {
  overflow: hidden;
  border-radius: 8px;
}

.login-error {
  color: #fecaca;
}

.reward-counter-value {
  font-size: 56px;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.reward-particles span {
  background: linear-gradient(180deg, var(--accent-3), var(--accent-2));
}

.ad-guard-safe-note {
  border-color: rgba(47, 211, 194, 0.36);
  background: rgba(47, 211, 194, 0.1);
}

.rule-notice-date,
.ad-guard-help {
  border-radius: 8px;
  border-color: rgba(91, 73, 137, 0.66);
  background: rgba(8, 6, 15, 0.42);
}

@media (max-width: 640px) {
  body::before {
    display: none;
  }

  .login-overlay {
    justify-content: flex-start;
  }

  .login-panel {
    width: calc(100vw - 48px);
    max-width: 342px;
    padding: 24px;
  }

  .app-shell {
    padding: 0 12px calc(84px + env(safe-area-inset-bottom));
  }

  .topbar {
    flex-direction: row;
    align-items: center;
    margin-inline: -12px;
    padding-inline: 12px;
  }

  .topbar-controls {
    justify-content: flex-end;
  }

  .panel {
    padding: 14px;
  }

  .bottom-stats-grid,
  .shop-summary-grid,
  .chest-info-grid,
  .reward-summary-grid {
    grid-template-columns: 1fr;
  }

  .rank-item {
    grid-template-columns: 38px minmax(0, 1fr);
  }
}

@media (max-width: 380px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-controls {
    width: 100%;
    justify-content: space-between;
  }

  .tabbar .tab-button {
    font-size: 8.5px;
  }
}

/* TG Reward identity refinement.
   This layer moves the app away from the reference style into a distinct reward-vault brand. */
:root {
  --bg: #05090a;
  --panel: #0d1615;
  --panel-2: #111d1d;
  --panel-3: #1a2a28;
  --border: rgba(82, 128, 118, 0.58);
  --border-strong: rgba(41, 215, 183, 0.76);
  --accent: #29d7b7;
  --accent-2: #f6c453;
  --accent-3: #ff7a59;
  --text: #f4f8ef;
  --muted: #9fb0aa;
  --success: #29d7b7;
  --danger: #ff5b6b;
  --warning: #f6c453;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.48);
  --grad-brand: linear-gradient(135deg, #f6c453 0%, #29d7b7 58%, #56a8ff 100%);
  --grad-button: linear-gradient(135deg, #f6c453 0%, #29d7b7 62%, #56a8ff 100%);
}

html,
body {
  background:
    repeating-linear-gradient(90deg, rgba(246, 196, 83, 0.025) 0 1px, transparent 1px 78px),
    repeating-linear-gradient(0deg, rgba(41, 215, 183, 0.02) 0 1px, transparent 1px 78px),
    linear-gradient(130deg, rgba(246, 196, 83, 0.09), transparent 38%),
    linear-gradient(230deg, rgba(41, 215, 183, 0.1), transparent 42%),
    #05090a;
}

body::before {
  content: "REWARD";
  top: 15vh;
  color: transparent;
  -webkit-text-stroke: 1px rgba(246, 196, 83, 0.075);
  text-stroke: 1px rgba(246, 196, 83, 0.075);
  font-style: normal;
  letter-spacing: 0;
}

.app-shell {
  background:
    linear-gradient(180deg, rgba(13, 22, 21, 0.98), rgba(5, 9, 10, 0.98)),
    #05090a;
  border-left-color: rgba(82, 128, 118, 0.5);
  border-right-color: rgba(82, 128, 118, 0.5);
  box-shadow:
    0 0 72px rgba(41, 215, 183, 0.13),
    0 0 120px rgba(246, 196, 83, 0.08);
}

.topbar {
  border-bottom-color: rgba(82, 128, 118, 0.64);
  background:
    linear-gradient(90deg, rgba(246, 196, 83, 0.08), rgba(41, 215, 183, 0.06)),
    rgba(5, 9, 10, 0.92);
}

.topbar h1 {
  font-style: normal;
  letter-spacing: 0;
}

.eyebrow,
.login-kicker,
.ad-guard-kicker,
.rule-notice-kicker {
  color: var(--accent-2);
}

.panel,
.login-panel,
.loading-box,
.reward-animation-panel,
.ad-guard-panel,
.rule-notice-panel,
.admin-modal {
  position: relative;
  overflow: hidden;
  border-color: rgba(82, 128, 118, 0.58);
  background:
    linear-gradient(180deg, rgba(17, 29, 29, 0.98), rgba(9, 15, 15, 0.98)),
    #0d1615;
}

.panel::before,
.login-panel::before,
.reward-animation-panel::before,
.ad-guard-panel::before,
.rule-notice-panel::before,
.admin-modal::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, rgba(246, 196, 83, 0.95), rgba(41, 215, 183, 0.7), transparent 78%);
  pointer-events: none;
}

.panel::after,
.login-panel::after,
.reward-animation-panel::after,
.ad-guard-panel::after,
.rule-notice-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px);
  background-size: 34px 34px;
  opacity: 0.35;
}

.panel > *,
.login-panel > *,
.reward-animation-panel > *,
.ad-guard-panel > *,
.rule-notice-panel > *,
.admin-modal > * {
  position: relative;
  z-index: 1;
}

.primary-button {
  color: #06100e;
  background: var(--grad-button);
  box-shadow:
    0 12px 30px rgba(41, 215, 183, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  font-weight: 900;
}

.secondary-button,
.ghost-button,
.tab-button,
.ranking-mode-button {
  background: rgba(17, 29, 29, 0.9);
  border-color: rgba(82, 128, 118, 0.58);
}

.secondary-button:hover,
.ghost-button:hover,
.primary-button:hover:not(:disabled),
.ranking-mode-button:hover {
  border-color: var(--accent);
  box-shadow: 0 10px 22px rgba(41, 215, 183, 0.16);
}

.lang-toggle,
.admin-language-control,
.wallet-status-chip,
.status-chip,
.code-chip,
.upline-level,
.summary-pill,
.count-pill {
  background: rgba(17, 29, 29, 0.9);
  border-color: rgba(82, 128, 118, 0.62);
}

.lang-select {
  color: var(--accent-2);
}

.tabbar {
  border-color: rgba(82, 128, 118, 0.64);
  background:
    linear-gradient(90deg, rgba(246, 196, 83, 0.07), rgba(41, 215, 183, 0.06)),
    rgba(7, 12, 13, 0.97);
}

.tabbar .tab-button {
  color: rgba(159, 176, 170, 0.7);
}

.tabbar .tab-button.active {
  color: var(--accent-2);
}

.tabbar .tab-button.active span {
  color: #ffe2a3;
}

.tabbar .tab-button.active::before {
  content: "";
  width: 22px;
  height: 2px;
  border-radius: 999px;
  background: var(--grad-brand);
  box-shadow: 0 0 12px rgba(246, 196, 83, 0.42);
}

.user-avatar,
.rank-no {
  background:
    linear-gradient(135deg, rgba(246, 196, 83, 0.96), rgba(41, 215, 183, 0.92));
  color: #06100e;
}

.chest-visual,
.reward-chest,
.ad-guard-visual {
  background:
    linear-gradient(145deg, rgba(246, 196, 83, 0.22), rgba(41, 215, 183, 0.14)),
    #101c1b;
  border-color: rgba(246, 196, 83, 0.54);
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.info-box,
.stat-card,
.reward-summary-card,
.rank-summary,
.rank-item,
.upline-item,
.tree-row,
.tree-wrap,
.shop-summary-card,
.shop-note-box,
.wallet-current,
.wallet-web-panel,
.voucher-card,
.admin-menu-card,
.admin-stat-card,
.admin-conversion-display,
.admin-help-box,
.admin-result-box {
  border-color: rgba(82, 128, 118, 0.55);
  background:
    linear-gradient(180deg, rgba(17, 29, 29, 0.86), rgba(7, 12, 13, 0.76));
}

.stat-value,
.shop-summary-value,
.rank-score,
.reward-counter-value {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ranking-mode-control,
.reward-result,
.rule-notice-date,
.ad-guard-help,
.shop-input,
.admin-input {
  border-color: rgba(82, 128, 118, 0.58);
  background: rgba(5, 9, 10, 0.62);
}

.ranking-mode-button.active {
  border-color: rgba(246, 196, 83, 0.68);
  background:
    linear-gradient(180deg, rgba(246, 196, 83, 0.18), rgba(41, 215, 183, 0.11));
  color: var(--text);
}

.tree-wrap {
  background:
    repeating-linear-gradient(90deg, rgba(246, 196, 83, 0.026) 0 1px, transparent 1px 44px),
    linear-gradient(180deg, rgba(17, 29, 29, 0.82), rgba(5, 9, 10, 0.72));
}

.tree-row:hover,
.rank-item.me {
  border-color: var(--accent-2);
}

.shop-input:focus,
.admin-input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(246, 196, 83, 0.14);
}

.toast {
  border-color: rgba(82, 128, 118, 0.66);
  background: #0d1615;
}

.toast-error .toast-indicator {
  background: var(--danger);
}

.toast-success .toast-indicator {
  background: var(--accent);
}

.login-overlay {
  background:
    repeating-linear-gradient(90deg, rgba(246, 196, 83, 0.022) 0 1px, transparent 1px 76px),
    repeating-linear-gradient(0deg, rgba(41, 215, 183, 0.018) 0 1px, transparent 1px 76px),
    linear-gradient(160deg, rgba(246, 196, 83, 0.1), transparent 36%),
    linear-gradient(250deg, rgba(41, 215, 183, 0.09), transparent 46%),
    #05090a;
}

.login-panel h1 {
  letter-spacing: 0;
}

.login-error {
  color: #ffc9bd;
}

.ad-guard-safe-note {
  border-color: rgba(41, 215, 183, 0.42);
  background: rgba(41, 215, 183, 0.1);
  color: #d8fff6;
}

.reward-particles span {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
}

/* Final selected theme: C3 color system with C1 trust-oriented page composition. */
:root {
  --bg: #f3f6ff;
  --panel: #ffffff;
  --panel-2: #eef3ff;
  --panel-3: #e4eaff;
  --border: rgba(67, 88, 216, 0.16);
  --border-strong: rgba(67, 88, 216, 0.34);
  --accent: #4358d8;
  --accent-2: #14b8a6;
  --accent-3: #6c5ce7;
  --text: #17213b;
  --muted: #66708a;
  --success: #14b8a6;
  --danger: #e14d68;
  --warning: #f3b84d;
  --shadow: 0 22px 54px rgba(46, 65, 130, 0.14);
  --grad-brand: linear-gradient(135deg, #4358d8 0%, #6c5ce7 52%, #14b8a6 100%);
  --grad-button: linear-gradient(135deg, #4358d8 0%, #6c5ce7 48%, #14b8a6 100%);
}

html,
body {
  background:
    radial-gradient(circle at 16% 0%, rgba(67, 88, 216, 0.13), transparent 34%),
    radial-gradient(circle at 86% 8%, rgba(20, 184, 166, 0.12), transparent 32%),
    linear-gradient(180deg, #f8fbff 0%, #edf2ff 52%, #e9f7f4 100%);
  color: var(--text);
}

body::before {
  content: "";
  display: none;
}

body.auth-required .app-shell,
body.auth-required .tabbar {
  filter: blur(5px) saturate(0.88);
}

body.auth-required {
  overflow: hidden;
}

.app-shell {
  width: min(var(--app-width), 100%);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(240, 246, 255, 0.96)),
    #f3f6ff;
  border-left-color: rgba(67, 88, 216, 0.12);
  border-right-color: rgba(67, 88, 216, 0.12);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.52),
    0 28px 88px rgba(46, 65, 130, 0.18);
}

body.admin-tab-active .app-shell {
  width: min(1100px, 100%);
}

.topbar {
  min-height: 66px;
  border-bottom-color: rgba(67, 88, 216, 0.13);
  background: rgba(248, 250, 255, 0.9);
  box-shadow: 0 10px 28px rgba(46, 65, 130, 0.08);
}

.topbar h1 {
  color: var(--text);
  font-style: normal;
  letter-spacing: 0;
}

.eyebrow,
.login-kicker,
.ad-guard-kicker,
.rule-notice-kicker {
  color: var(--accent);
  letter-spacing: 0.08em;
}

.panel,
.login-panel,
.loading-box,
.reward-animation-panel,
.ad-guard-panel,
.rule-notice-panel,
.admin-modal {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  border-color: rgba(67, 88, 216, 0.16);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.96), rgba(238, 243, 255, 0.9)),
    #ffffff;
  box-shadow: var(--shadow);
}

.panel::before,
.login-panel::before,
.reward-animation-panel::before,
.ad-guard-panel::before,
.rule-notice-panel::before,
.admin-modal::before {
  height: 1px;
  background: linear-gradient(90deg, rgba(67, 88, 216, 0.42), rgba(20, 184, 166, 0.36), transparent 78%);
}

.panel::after,
.login-panel::after,
.reward-animation-panel::after,
.ad-guard-panel::after,
.rule-notice-panel::after {
  background:
    radial-gradient(circle at 12% 0%, rgba(67, 88, 216, 0.07), transparent 34%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.54), transparent 52%);
  background-size: auto;
  opacity: 1;
}

.panel {
  padding: 16px;
  margin-bottom: 13px;
}

.panel h2,
.panel h3,
.ad-guard-panel h2,
.rule-notice-panel h2 {
  color: var(--text);
  font-size: 18px;
  line-height: 1.22;
}

.muted,
.panel p,
.wallet-help-text,
.shop-note-text,
.rank-user-meta,
.tree-node-meta,
.user-meta {
  color: var(--muted);
}

.login-overlay {
  background:
    radial-gradient(circle at 16% 0%, rgba(67, 88, 216, 0.13), transparent 34%),
    radial-gradient(circle at 82% 12%, rgba(20, 184, 166, 0.12), transparent 34%),
    linear-gradient(180deg, #f8fbff 0%, #edf2ff 54%, #eefaf7 100%);
}

.login-panel {
  max-width: 420px;
}

.login-panel h1 {
  color: var(--text);
  letter-spacing: 0;
}

.login-panel p {
  color: var(--muted);
}

.login-error {
  color: var(--danger);
}

.lang-toggle,
.admin-language-control,
.status-chip,
.code-chip,
.upline-level,
.summary-pill,
.count-pill,
.wallet-status-chip {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(67, 88, 216, 0.16);
  color: var(--accent);
  box-shadow: 0 8px 18px rgba(46, 65, 130, 0.06);
}

.lang-select {
  color: var(--accent);
}

.primary-button {
  color: #ffffff;
  border: 0;
  border-radius: 16px;
  background: var(--grad-button);
  box-shadow: 0 16px 34px rgba(67, 88, 216, 0.22);
  font-weight: 900;
}

.secondary-button,
.ghost-button,
.tab-button,
.ranking-mode-button {
  color: var(--accent);
  border-color: rgba(67, 88, 216, 0.16);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 22px rgba(46, 65, 130, 0.06);
}

.secondary-button:hover,
.ghost-button:hover,
.primary-button:hover:not(:disabled),
.ranking-mode-button:hover {
  border-color: rgba(67, 88, 216, 0.32);
  box-shadow: 0 14px 28px rgba(67, 88, 216, 0.14);
}

.user-panel {
  border-radius: 24px;
  align-items: center;
  background:
    linear-gradient(90deg, rgba(67, 88, 216, 0.08), rgba(20, 184, 166, 0.07)),
    rgba(255, 255, 255, 0.88);
}

.user-avatar,
.rank-no {
  color: #ffffff;
  border-radius: 15px;
  background: var(--grad-brand);
  box-shadow: 0 12px 28px rgba(67, 88, 216, 0.18);
}

.user-name {
  color: var(--text);
}

.chest-panel {
  min-height: 430px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 78% 12%, rgba(20, 184, 166, 0.12), transparent 34%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.96), rgba(230, 236, 255, 0.9));
}

.chest-panel h2 {
  font-size: 25px;
}

.chest-visual,
.reward-chest,
.ad-guard-visual {
  border-radius: 30px;
  border-color: rgba(67, 88, 216, 0.18);
  background:
    radial-gradient(circle at 30% 18%, rgba(20, 184, 166, 0.22), rgba(67, 88, 216, 0.13) 52%, rgba(255, 255, 255, 0.82)),
    #f7faff;
  box-shadow: 0 24px 46px rgba(67, 88, 216, 0.15);
}

.chest-visual {
  width: 136px;
  height: 136px;
}

.info-box,
.stat-card,
.reward-summary-card,
.rank-summary,
.rank-item,
.upline-item,
.tree-row,
.tree-wrap,
.shop-summary-card,
.shop-note-box,
.wallet-current,
.wallet-web-panel,
.voucher-card,
.admin-menu-card,
.admin-stat-card,
.admin-conversion-display,
.admin-help-box,
.admin-result-box {
  border-radius: 18px;
  border-color: rgba(67, 88, 216, 0.16);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 28px rgba(46, 65, 130, 0.08);
}

.stat-value,
.shop-summary-value,
.rank-score,
.reward-counter-value,
.info-value,
.card-value {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-label,
.info-label,
.shop-summary-label,
.shop-field-label,
.card-label {
  color: var(--muted);
}

.reward-result,
.ranking-mode-control,
.rule-notice-date,
.ad-guard-help,
.shop-input,
.admin-input {
  border-color: rgba(67, 88, 216, 0.16);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
}

.ranking-mode-button.active {
  border-color: rgba(67, 88, 216, 0.32);
  background: linear-gradient(135deg, rgba(67, 88, 216, 0.12), rgba(20, 184, 166, 0.1));
  color: var(--accent);
}

.tree-wrap {
  background:
    linear-gradient(90deg, rgba(67, 88, 216, 0.026) 1px, transparent 1px),
    linear-gradient(0deg, rgba(20, 184, 166, 0.024) 1px, transparent 1px),
    rgba(255, 255, 255, 0.66);
  background-size: 36px 36px;
}

.tree-row:hover,
.rank-item.me {
  border-color: rgba(67, 88, 216, 0.36);
}

.shop-input:focus,
.admin-input:focus {
  border-color: rgba(67, 88, 216, 0.38);
  box-shadow: 0 0 0 3px rgba(67, 88, 216, 0.12);
}

.wallet-status-chip.verified {
  border-color: rgba(20, 184, 166, 0.28);
  background: rgba(20, 184, 166, 0.1);
  color: #0f766e;
}

.wallet-status-chip.missing {
  border-color: rgba(243, 184, 77, 0.3);
  background: rgba(243, 184, 77, 0.12);
  color: #a16207;
}

.tabbar {
  border-color: rgba(67, 88, 216, 0.14);
  background: rgba(248, 250, 255, 0.96);
  box-shadow: 0 -18px 34px rgba(46, 65, 130, 0.08);
}

.tabbar .tab-button {
  color: rgba(102, 112, 138, 0.78);
  background: transparent;
  box-shadow: none;
}

.tabbar .tab-button.active {
  color: var(--accent);
}

.tabbar .tab-button.active span {
  color: var(--accent);
}

.tabbar .tab-button.active::before {
  background: var(--grad-brand);
  box-shadow: 0 0 12px rgba(67, 88, 216, 0.24);
}

.loading-overlay,
.reward-animation-overlay,
.ad-guard-backdrop,
.rule-notice-backdrop {
  background: rgba(23, 33, 59, 0.22);
  backdrop-filter: blur(9px);
}

.ad-guard-safe-note {
  border-color: rgba(20, 184, 166, 0.28);
  background: rgba(20, 184, 166, 0.1);
  color: #0f766e;
}

.toast {
  color: var(--text);
  border-color: rgba(67, 88, 216, 0.16);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.toast-success .toast-indicator {
  background: var(--success);
}

.toast-error .toast-indicator {
  background: var(--danger);
}

@media (max-width: 640px) {
  .login-overlay {
    justify-content: center;
  }

  .login-panel {
    width: calc(100vw - 32px);
    max-width: 370px;
    padding: 24px;
  }

  .topbar {
    background: rgba(248, 250, 255, 0.94);
  }

  .chest-panel {
    min-height: 410px;
  }
}

html,
body {
  overflow-x: hidden;
}

.login-overlay {
  left: 0;
  right: 0;
  width: auto;
  max-width: none;
  align-items: center;
  justify-content: center;
}

.login-panel {
  width: min(420px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  margin-inline: auto;
}

.login-panel > * {
  min-width: 0;
}

.login-panel h1,
.login-panel p,
.login-error {
  overflow-wrap: anywhere;
}

.google-signin-button {
  max-width: 100%;
}

@media (max-width: 640px) {
  .login-panel {
    width: min(360px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
  }
}

@media (max-width: 380px) {
  .login-panel {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    padding: 20px;
  }
}

@media (min-width: 900px) {
  .app-shell {
    width: min(1120px, calc(100% - 64px));
    padding: 0 16px calc(104px + env(safe-area-inset-bottom));
  }

  body.admin-tab-active .app-shell {
    width: min(1120px, calc(100% - 64px));
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 80;
    margin-inline: -16px;
    margin-bottom: 16px;
    padding: 18px 16px;
    border-radius: 0 0 24px 24px;
  }

  .tabbar {
    left: 50%;
    right: auto;
    width: min(1120px, calc(100% - 64px));
    max-width: calc(100% - 64px);
    transform: translateX(-50%);
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
  }

  body.admin-tab-active .tabbar {
    width: min(1120px, calc(100% - 64px));
  }

  .tabbar .tab-button {
    min-height: 54px;
    gap: 5px;
  }

  .panel {
    margin-bottom: 0;
    padding: 20px;
  }

  .panel h2,
  .panel h3,
  .ad-guard-panel h2,
  .rule-notice-panel h2 {
    font-size: 20px;
  }

  #homeTab.active {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
    gap: 16px;
    align-items: start;
  }

  #homeTab .user-panel {
    grid-column: 1 / -1;
  }

  #homeTab .chest-panel {
    grid-row: 2 / span 2;
  }

  #homeTab .reward-panel,
  #homeTab .summary-panel {
    grid-column: 2;
  }

  .chest-panel {
    min-height: 560px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .chest-panel h2 {
    font-size: 30px;
  }

  .chest-visual {
    width: 168px;
    height: 168px;
    font-size: 82px;
  }

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

  .bottom-stats-grid .stat-card:first-child {
    grid-column: 1 / -1;
  }

  #shopTab.active {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 0.78fr);
    gap: 16px;
    align-items: start;
  }

  #shopTab .shop-hero-panel,
  #shopTab .vouchers-panel {
    grid-column: 1 / -1;
  }

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

  .shop-field-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  }

  .shop-actions {
    grid-template-columns: 1fr auto;
  }

  #rankingTab .panel,
  #walletTab .wallet-panel {
    max-width: 900px;
    margin-inline: auto;
  }

  #treeTab.active {
    display: grid;
    grid-template-columns: minmax(300px, 0.86fr) minmax(0, 1.14fr);
    gap: 16px;
    align-items: start;
  }

  #treeModeControl {
    grid-column: 1 / -1;
    margin-bottom: 0;
  }

  #treeTab .tree-summary-panel {
    grid-column: 1;
  }

  #treeTab .panel:last-child {
    grid-column: 2;
    grid-row: 2 / span 2;
  }

  .tree-wrap {
    max-height: 720px;
  }

  #walletTab.active {
    display: grid;
  }

  #aboutTab.active {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
  }

  #aboutTab .about-hero-panel {
    grid-column: 1 / -1;
  }

  #aboutTab .about-section-panel {
    margin-bottom: 0;
  }
}

/* Refined authentication entrance. Keeps the Google Sign-In mount intact. */
.login-overlay {
  overflow: auto;
  padding: clamp(18px, 4vw, 48px);
  background:
    linear-gradient(115deg, rgba(67, 88, 216, 0.11) 0 24%, transparent 24% 100%),
    linear-gradient(245deg, rgba(20, 184, 166, 0.12) 0 28%, transparent 28% 100%),
    repeating-linear-gradient(90deg, rgba(67, 88, 216, 0.045) 0 1px, transparent 1px 74px),
    repeating-linear-gradient(0deg, rgba(20, 184, 166, 0.04) 0 1px, transparent 1px 74px),
    linear-gradient(180deg, #f8fbff 0%, #edf2ff 52%, #eefaf7 100%);
}

.login-layout {
  width: min(980px, 100%);
  min-height: min(620px, calc(100vh - 96px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  gap: 18px;
  align-items: stretch;
  margin: auto;
}

.login-visual,
.login-panel {
  border: 1px solid rgba(67, 88, 216, 0.16);
  border-radius: 28px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.98), rgba(238, 243, 255, 0.88)),
    #ffffff;
  box-shadow: 0 28px 70px rgba(46, 65, 130, 0.15);
}

.login-visual {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 30px;
}

.login-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(67, 88, 216, 0.08), transparent 42%),
    linear-gradient(315deg, rgba(20, 184, 166, 0.12), transparent 44%);
  pointer-events: none;
}

.login-visual::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(67, 88, 216, 0.08);
  border-radius: 22px;
  pointer-events: none;
}

.login-visual > * {
  position: relative;
  z-index: 1;
}

.login-visual-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #ffffff;
  background: var(--grad-brand);
  box-shadow: 0 18px 34px rgba(67, 88, 216, 0.22);
  font-weight: 950;
}

.login-brand-lines {
  display: grid;
  gap: 8px;
  width: 132px;
}

.login-brand-lines span {
  height: 10px;
  border-radius: 999px;
  background: rgba(67, 88, 216, 0.14);
}

.login-brand-lines span:last-child {
  width: 72%;
  background: rgba(20, 184, 166, 0.18);
}

.login-device {
  position: relative;
  min-height: 330px;
  display: grid;
  place-items: center;
}

.login-device::before {
  content: "";
  width: 230px;
  height: 304px;
  border: 1px solid rgba(67, 88, 216, 0.18);
  border-radius: 38px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(230, 237, 255, 0.92)),
    #ffffff;
  box-shadow:
    0 30px 70px rgba(46, 65, 130, 0.18),
    inset 0 0 0 12px rgba(67, 88, 216, 0.035);
  transform: rotate(-5deg);
}

.login-device::after {
  content: "";
  position: absolute;
  width: 152px;
  height: 16px;
  bottom: 56px;
  border-radius: 999px;
  background: var(--grad-brand);
  box-shadow: 0 14px 26px rgba(67, 88, 216, 0.22);
  transform: rotate(-5deg);
}

.login-device-glow {
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: conic-gradient(from 140deg, rgba(67, 88, 216, 0.22), rgba(20, 184, 166, 0.22), rgba(108, 92, 231, 0.18), rgba(67, 88, 216, 0.22));
  filter: blur(18px);
  opacity: 0.42;
}

.login-gift {
  position: absolute;
  width: 94px;
  height: 88px;
  display: grid;
  place-items: center;
  transform: rotate(-5deg);
}

.login-gift-box,
.login-gift-lid,
.login-gift-ribbon {
  position: absolute;
  display: block;
}

.login-gift-box {
  bottom: 0;
  width: 74px;
  height: 56px;
  border-radius: 12px;
  background: linear-gradient(180deg, #35d4c6, #4358d8);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.44);
}

.login-gift-lid {
  top: 12px;
  width: 88px;
  height: 22px;
  border-radius: 12px;
  background: linear-gradient(90deg, #6c5ce7, #14b8a6);
  box-shadow: 0 10px 18px rgba(67, 88, 216, 0.2);
}

.login-gift-ribbon {
  bottom: 0;
  width: 18px;
  height: 76px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f8fbff, rgba(255, 255, 255, 0.7));
}

.login-token {
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: var(--grad-brand);
  box-shadow: 0 16px 28px rgba(67, 88, 216, 0.2);
}

.token-one {
  top: 70px;
  right: 86px;
}

.token-two {
  left: 88px;
  bottom: 92px;
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #14b8a6, #6c5ce7);
}

.token-three {
  right: 118px;
  bottom: 116px;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #6c5ce7, #4358d8);
}

.login-preview-bars {
  display: grid;
  gap: 12px;
}

.login-preview-bars span {
  height: 16px;
  border-radius: 999px;
  background: rgba(67, 88, 216, 0.1);
}

.login-preview-bars span:nth-child(2) {
  width: 78%;
  background: rgba(20, 184, 166, 0.14);
}

.login-preview-bars span:nth-child(3) {
  width: 58%;
}

.login-panel {
  width: auto;
  max-width: none;
  min-height: 560px;
  margin: 0;
  padding: 42px 38px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-panel::before {
  background: linear-gradient(90deg, rgba(67, 88, 216, 0.5), rgba(20, 184, 166, 0.38), transparent);
}

.login-panel::after {
  display: none;
}

.login-kicker {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(67, 88, 216, 0.14);
  border-radius: 999px;
  background: rgba(67, 88, 216, 0.07);
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.login-panel h1 {
  max-width: 340px;
  margin: 18px 0 12px;
  font-size: clamp(34px, 5vw, 48px);
  line-height: 1.02;
  color: var(--text);
}

.login-panel p {
  max-width: 340px;
  margin: 0 0 30px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.google-signin-button {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(67, 88, 216, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.68);
}

.google-signin-button.is-loading:empty::before,
.google-signin-button:empty::before {
  content: "";
  width: 64%;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(67, 88, 216, 0.14), rgba(20, 184, 166, 0.18), rgba(67, 88, 216, 0.12));
}

.google-signin-button.is-ready {
  min-height: 44px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.google-signin-button.external-browser-actions {
  min-height: 0;
  padding: 0;
  flex-direction: column;
  gap: 10px;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.google-signin-button > * {
  max-width: 100%;
}

.google-signin-retry-button,
.google-signin-secondary-button {
  width: 100%;
  min-height: 44px;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
}

.google-signin-retry-button {
  border: 0;
  background: var(--grad-button);
  color: #fff;
}

.google-signin-secondary-button {
  border: 1px solid rgba(67, 88, 216, 0.18);
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
}

.login-error {
  margin-top: 16px;
  padding-left: 12px;
  border-left: 3px solid var(--danger);
}

@media (max-width: 760px) {
  .login-overlay {
    padding: 16px;
  }

  .login-layout {
    width: min(390px, 100%);
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .login-visual {
    min-height: 210px;
    padding: 18px;
    border-radius: 24px;
  }

  .login-visual::after,
  .login-preview-bars {
    display: none;
  }

  .login-brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }

  .login-brand-lines {
    width: 100px;
  }

  .login-device {
    min-height: 126px;
  }

  .login-device::before {
    width: 128px;
    height: 152px;
    border-radius: 26px;
  }

  .login-device::after {
    width: 88px;
    height: 10px;
    bottom: 22px;
  }

  .login-device-glow {
    width: 170px;
    height: 170px;
  }

  .login-gift {
    width: 62px;
    height: 58px;
  }

  .login-gift-box {
    width: 48px;
    height: 36px;
    border-radius: 9px;
  }

  .login-gift-lid {
    top: 8px;
    width: 58px;
    height: 15px;
  }

  .login-gift-ribbon {
    width: 12px;
    height: 48px;
  }

  .login-token {
    width: 28px;
    height: 28px;
  }

  .token-one {
    top: 46px;
    right: 72px;
  }

  .token-two {
    left: 76px;
    bottom: 42px;
    width: 22px;
    height: 22px;
  }

  .token-three {
    right: 96px;
    bottom: 54px;
    width: 16px;
    height: 16px;
  }

  .login-panel {
    min-height: auto;
    width: 100%;
    max-width: 100%;
    padding: 28px 24px;
    border-radius: 24px;
  }

  .login-panel h1 {
    max-width: 100%;
    font-size: 34px;
  }

  .login-panel p {
    max-width: 100%;
    margin-bottom: 24px;
    font-size: 15px;
  }
}

@media (min-width: 761px) {
  .login-overlay {
    overflow: hidden;
  }
}

@media (max-width: 380px) {
  .login-layout {
    width: 100%;
  }

  .login-visual {
    min-height: 178px;
  }

  .login-panel {
    padding: 24px 20px;
  }

  .login-panel h1 {
    font-size: 30px;
  }
}

/* PC advertisement slots. Hidden until runtime config provides ad unit IDs. */
.pc-ad-slot,
.pc-ad-rail {
  display: none;
}

.pc-ad-host {
  width: 100%;
  min-width: 0;
}

.pc-custom-ad-host iframe,
.pc-custom-ad-host ins,
.pc-custom-ad-host > div {
  max-width: 100%;
}

.pc-ad-label {
  display: inline-flex;
  width: fit-content;
  color: rgba(102, 112, 138, 0.82);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

@media (min-width: 900px) {
  .pc-ad-slot.is-active {
    display: block;
  }

  .pc-ad-top-banner.is-active {
    min-height: 104px;
    display: grid;
    grid-template-columns: minmax(190px, 0.34fr) minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    margin-bottom: 16px;
    padding: 16px 18px;
    border-radius: 24px;
    border: 1px solid rgba(67, 88, 216, 0.15);
    background:
      linear-gradient(135deg, rgba(67, 88, 216, 0.08), rgba(20, 184, 166, 0.07)),
      rgba(255, 255, 255, 0.82);
    box-shadow: 0 16px 34px rgba(46, 65, 130, 0.09);
    overflow: hidden;
  }

  .pc-ad-copy {
    display: grid;
    gap: 6px;
  }

  .pc-ad-copy strong {
    color: var(--text);
    font-size: 16px;
    line-height: 1.25;
  }

  .pc-ad-top-banner .pc-ad-host {
    min-height: 90px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    overflow: hidden;
  }

  .pc-ad-top-banner ins.adsbygoogle {
    width: 100%;
    min-height: 90px;
  }
}

@media (min-width: 1180px) {
  .app-shell.pc-ads-active {
    width: min(1280px, calc(100% - 56px));
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    column-gap: 16px;
    align-items: start;
  }

  .app-shell.pc-ads-active .topbar,
  .app-shell.pc-ads-active .pc-ad-top-banner {
    grid-column: 1 / -1;
  }

  .app-shell.pc-ads-active main {
    grid-column: 1;
    min-width: 0;
  }

  .app-shell.pc-ads-active .pc-ad-rail.is-active {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 92px;
    align-self: start;
  }

  .app-shell.pc-ads-active .pc-ad-rail-card.is-active {
    display: grid;
    gap: 12px;
    min-height: 280px;
    padding: 16px;
    border-radius: 24px;
    border: 1px solid rgba(67, 88, 216, 0.15);
    background:
      linear-gradient(160deg, rgba(255, 255, 255, 0.96), rgba(238, 243, 255, 0.88)),
      #ffffff;
    box-shadow: 0 16px 34px rgba(46, 65, 130, 0.09);
    overflow: hidden;
  }

  .pc-ad-rail-card .pc-ad-host {
    min-height: 250px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    overflow: hidden;
  }

  .pc-ad-rail-card ins.adsbygoogle {
    width: 100%;
    min-height: 250px;
  }

  .app-shell.pc-ads-active + .tabbar,
  .app-shell.pc-ads-active ~ .tabbar {
    width: min(1280px, calc(100% - 56px));
    max-width: calc(100% - 56px);
  }
}

/* Desktop home should read as one complete first-screen dashboard. */
@media (min-width: 900px) {
  body:not(.admin-tab-active) .app-shell {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  body:not(.admin-tab-active) .topbar {
    margin-bottom: 10px;
    padding: 10px 16px;
    border-radius: 0 0 18px 18px;
  }

  .topbar h1 {
    margin-top: 2px;
    font-size: 20px;
    line-height: 1.15;
  }

  .topbar .eyebrow {
    font-size: 10px;
  }

  .topbar .ghost-button,
  .topbar .lang-select {
    min-height: 34px;
  }

  .topbar .ghost-button {
    padding: 0 12px;
  }

  .topbar .lang-select {
    padding-left: 12px;
  }

  .tabbar {
    padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
  }

  .tabbar .tab-button {
    min-height: 44px;
    gap: 3px;
    font-size: 10px;
  }

  .tabbar .tab-button svg {
    width: 19px;
    height: 19px;
  }

  #homeTab.active {
    grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
    gap: 12px;
    align-items: stretch;
  }

  #homeTab .panel {
    padding: 14px 18px;
    border-radius: 20px;
  }

  #homeTab .panel-header-row {
    margin-bottom: 8px;
  }

  #homeTab .user-panel {
    min-height: 76px;
    gap: 12px;
  }

  #homeTab .user-avatar {
    width: 48px;
    height: 48px;
    font-size: 17px;
  }

  #homeTab .user-name {
    font-size: 19px;
    line-height: 1.15;
  }

  #homeTab .user-meta {
    margin-top: 2px;
    font-size: 12px;
  }

  #homeTab .user-badges {
    gap: 6px;
    margin-top: 6px;
  }

  #homeTab .status-chip,
  #homeTab .code-chip {
    padding: 5px 10px;
    font-size: 11px;
  }

  #homeTab .chest-panel {
    min-height: 0;
    justify-content: flex-start;
  }

  #homeTab .chest-panel h2 {
    margin-bottom: 4px;
    font-size: 28px;
    line-height: 1.12;
  }

  #homeTab .chest-panel .muted {
    max-width: 560px;
    margin: 0 auto;
    font-size: 15px;
    line-height: 1.35;
  }

  #homeTab .chest-visual {
    width: 116px;
    height: 116px;
    margin: 8px auto 12px;
    border-radius: 26px;
    font-size: 56px;
  }

  #homeTab .primary-button,
  #homeTab .bonus-offerwall-button {
    min-height: 40px;
    padding: 8px 14px;
  }

  #homeTab .bonus-offerwall-button {
    margin-top: 8px;
  }

  #homeTab .chest-info-grid {
    gap: 8px;
    margin-top: 10px;
  }

  #homeTab .info-box {
    padding: 8px;
    border-radius: 12px;
  }

  #homeTab .info-label {
    font-size: 11px;
  }

  #homeTab .info-value {
    margin-top: 4px;
    font-size: 15px;
  }

  #homeTab .action-row {
    gap: 8px;
    margin-top: 10px;
  }

  #homeTab .secondary-button {
    min-height: 38px;
    padding: 8px 10px;
  }

  #homeTab .reward-panel,
  #homeTab .summary-panel {
    align-self: stretch;
  }

  #homeTab .reward-panel h2,
  #homeTab .summary-panel h2 {
    font-size: 19px;
    line-height: 1.2;
  }

  #homeTab .reward-panel .muted,
  #homeTab .summary-panel .muted {
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.35;
  }

  #homeTab .reward-result {
    min-height: 58px;
    padding: 10px 12px;
    line-height: 1.35;
  }

  #homeTab .bottom-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  #homeTab .bottom-stats-grid .stat-card:first-child {
    grid-column: auto;
  }

  #homeTab .compact-stat-card {
    min-height: 58px;
    padding: 9px;
    border-radius: 12px;
  }

  #homeTab .stat-label {
    font-size: 10px;
    line-height: 1.25;
  }

  #homeTab .stat-value {
    margin-top: 5px;
    font-size: 16px;
    line-height: 1.15;
  }
}

@media (min-width: 900px) and (max-height: 760px) {
  body:not(.admin-tab-active) .app-shell {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  body:not(.admin-tab-active) .topbar {
    margin-bottom: 8px;
    padding-block: 8px;
  }

  .tabbar .tab-button {
    min-height: 40px;
  }

  #homeTab.active {
    gap: 10px;
  }

  #homeTab .panel {
    padding: 12px 16px;
  }

  #homeTab .user-panel {
    min-height: 70px;
  }

  #homeTab .chest-panel h2 {
    font-size: 25px;
  }

  #homeTab .chest-panel .muted {
    font-size: 14px;
  }

  #homeTab .chest-visual {
    width: 96px;
    height: 96px;
    margin: 6px auto 10px;
    border-radius: 22px;
    font-size: 48px;
  }

  #homeTab .primary-button,
  #homeTab .bonus-offerwall-button,
  #homeTab .secondary-button {
    min-height: 36px;
  }

  #homeTab .chest-info-grid,
  #homeTab .action-row {
    margin-top: 8px;
  }

  #homeTab .info-box {
    padding: 7px;
  }

  #homeTab .info-value {
    font-size: 14px;
  }

  #homeTab .reward-panel .muted,
  #homeTab .summary-panel .muted {
    font-size: 13px;
  }

  #homeTab .compact-stat-card {
    min-height: 52px;
    padding: 8px;
  }
}

/* Second-pass home fit: switch the chest card to a short desktop control panel. */
@media (min-width: 900px) {
  body:not(.admin-tab-active) .app-shell {
    padding-bottom: calc(58px + env(safe-area-inset-bottom));
  }

  body:not(.admin-tab-active) .topbar {
    min-height: 56px;
    padding-block: 7px;
  }

  .tabbar {
    padding-block: 5px;
  }

  .tabbar .tab-button {
    min-height: 38px;
  }

  #homeTab.active {
    grid-template-columns: minmax(0, 1.16fr) minmax(330px, 0.84fr);
    gap: 10px;
  }

  #homeTab .panel {
    padding: 12px 16px;
  }

  #homeTab .user-panel {
    min-height: 66px;
  }

  #homeTab .user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    font-size: 16px;
  }

  #homeTab .chest-panel {
    display: grid;
    grid-template-columns: minmax(128px, 0.42fr) minmax(0, 0.58fr);
    grid-auto-rows: auto;
    column-gap: 16px;
    row-gap: 8px;
    align-items: center;
    text-align: left;
  }

  #homeTab .chest-panel .panel-header-row {
    grid-column: 1 / -1;
    justify-content: flex-start;
    text-align: left;
    margin-bottom: 0;
  }

  #homeTab .chest-panel h2 {
    font-size: 23px;
  }

  #homeTab .chest-panel .muted {
    max-width: none;
    margin: 0;
    font-size: 13px;
    line-height: 1.3;
  }

  #homeTab .chest-visual {
    grid-column: 1;
    grid-row: 2 / 4;
    width: 96px;
    height: 96px;
    margin: 0 auto;
    border-radius: 22px;
    font-size: 48px;
  }

  #homeTab #openChestButton {
    grid-column: 2;
    grid-row: 2;
  }

  #homeTab .bonus-offerwall-button {
    grid-column: 2;
    grid-row: 3;
    margin-top: 0;
  }

  #homeTab .primary-button,
  #homeTab .bonus-offerwall-button,
  #homeTab .secondary-button {
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 12px;
    font-size: 13px;
  }

  #homeTab .chest-info-grid {
    grid-column: 1 / -1;
    grid-row: 4;
    margin-top: 0;
  }

  #homeTab .action-row {
    grid-column: 1 / -1;
    grid-row: 5;
    margin-top: 0;
  }

  #homeTab .info-box {
    min-height: 44px;
  }

  #homeTab .reward-panel h2,
  #homeTab .summary-panel h2 {
    font-size: 18px;
  }

  #homeTab .reward-panel .muted,
  #homeTab .summary-panel .muted {
    margin-bottom: 7px;
    font-size: 12px;
    line-height: 1.28;
  }

  #homeTab .reward-result {
    min-height: 50px;
    padding: 9px 11px;
    font-size: 13px;
  }

  #homeTab .compact-stat-card {
    min-height: 48px;
    padding: 7px 8px;
  }

  #homeTab .stat-value {
    font-size: 15px;
  }
}

@media (min-width: 1100px) {
  #homeTab .bottom-stats-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (min-width: 900px) and (max-height: 700px) {
  #homeTab .panel {
    padding: 10px 14px;
  }

  #homeTab .chest-panel {
    row-gap: 6px;
  }

  #homeTab .chest-panel h2 {
    font-size: 21px;
  }

  #homeTab .chest-visual {
    width: 82px;
    height: 82px;
    border-radius: 20px;
    font-size: 42px;
  }

  #homeTab .primary-button,
  #homeTab .bonus-offerwall-button,
  #homeTab .secondary-button {
    min-height: 32px;
    padding-block: 6px;
  }

  #homeTab .compact-stat-card {
    min-height: 44px;
  }
}

/* Fill the remaining desktop viewport instead of leaving an empty band above nav. */
@media (min-width: 900px) {
  #homeTab.active {
    min-height: calc(100dvh - 120px - env(safe-area-inset-bottom));
    grid-template-rows: auto minmax(0, 1.08fr) minmax(0, 0.92fr);
  }

  #homeTab .chest-panel,
  #homeTab .reward-panel,
  #homeTab .summary-panel {
    height: 100%;
  }

  #homeTab .reward-panel,
  #homeTab .summary-panel {
    display: flex;
    flex-direction: column;
  }

  #homeTab .reward-result {
    flex: 1;
    display: flex;
    align-items: center;
  }

  #homeTab .bottom-stats-grid {
    flex: 1;
    align-items: stretch;
  }

  #homeTab .compact-stat-card {
    min-height: 54px;
    height: 100%;
  }
}

@media (min-width: 900px) and (max-height: 700px) {
  #homeTab.active {
    min-height: calc(100dvh - 112px - env(safe-area-inset-bottom));
  }
}

/* Center compact dashboard values for a cleaner desktop scan. */
@media (min-width: 900px) {
  #homeTab .reward-result,
  #homeTab .info-box,
  #homeTab .compact-stat-card {
    text-align: center;
  }

  #homeTab .reward-result {
    justify-content: center;
  }

  #homeTab .info-box,
  #homeTab .compact-stat-card {
    align-items: center;
  }

  #homeTab .info-label,
  #homeTab .info-value,
  #homeTab .stat-label,
  #homeTab .stat-value {
    width: 100%;
    text-align: center;
  }
}

/* Chest action card: keep the gift as the main centered action surface. */
.chest-action-card {
  appearance: none;
  width: min(100%, 430px);
  margin: 10px auto 18px;
  padding: 20px;
  border: 1px solid rgba(67, 88, 216, 0.18);
  border-radius: 30px;
  background:
    radial-gradient(circle at 50% 18%, rgba(20, 184, 166, 0.2), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(238, 244, 255, 0.9));
  box-shadow: 0 20px 48px rgba(67, 88, 216, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--text);
  font: inherit;
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.chest-action-card:disabled {
  cursor: not-allowed;
}

.chest-action-card.is-ready {
  border-color: rgba(20, 184, 166, 0.42);
  box-shadow: 0 24px 54px rgba(20, 184, 166, 0.16), 0 16px 36px rgba(67, 88, 216, 0.13);
}

.chest-action-card.is-ready:hover {
  transform: translateY(-2px);
}

.chest-action-card.is-locked {
  border-color: rgba(148, 163, 184, 0.22);
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.72), rgba(226, 232, 240, 0.86));
  box-shadow: 0 14px 32px rgba(67, 88, 216, 0.08);
}

#homeTab .chest-action-card .chest-visual {
  width: 166px;
  height: 166px;
  margin: 0;
  font-size: 88px;
  position: relative;
  transition: filter 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
}

#homeTab .chest-action-card.is-ready .chest-visual {
  animation: gift-ready-bounce 1.65s ease-in-out infinite;
}

#homeTab .chest-action-card.is-locked .chest-visual {
  filter: grayscale(0.3) saturate(0.78);
  opacity: 0.78;
  transform: scale(0.94);
}

#homeTab .chest-action-card.is-locked .chest-visual::after {
  content: "\1F512";
  position: absolute;
  right: -10px;
  bottom: -10px;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.92));
  border: 2px solid rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.24);
  font-size: 25px;
}

.chest-action-hint {
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
}

.chest-action-card.is-locked .chest-action-hint {
  color: var(--muted);
}

@keyframes gift-ready-bounce {
  0%, 100% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
  22% {
    transform: translateY(-8px) rotate(-3deg) scale(1.03);
  }
  44% {
    transform: translateY(0) rotate(3deg) scale(1);
  }
  62% {
    transform: translateY(-4px) rotate(-2deg) scale(1.02);
  }
  78% {
    transform: translateY(0) rotate(1deg) scale(1);
  }
}

@media (min-width: 900px) {
  #homeTab .chest-panel {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    text-align: center;
  }

  #homeTab .chest-panel .panel-header-row {
    justify-content: center;
    text-align: center;
  }

  #homeTab .chest-panel .muted {
    max-width: 620px;
    margin-inline: auto;
  }

  #homeTab .chest-action-card {
    margin: 0 auto 2px;
    padding: 14px;
    gap: 10px;
  }

  #homeTab .chest-action-card .chest-visual {
    width: 128px;
    height: 128px;
    border-radius: 28px;
    font-size: 68px;
  }

  #homeTab .chest-action-hint {
    font-size: 12px;
  }

  #homeTab .chest-info-grid,
  #homeTab .action-row {
    width: 100%;
  }
}

@media (min-width: 900px) and (max-height: 700px) {
  #homeTab .chest-action-card {
    width: min(100%, 370px);
    padding: 12px;
    gap: 8px;
  }

  #homeTab .chest-action-card .chest-visual {
    width: 108px;
    height: 108px;
    border-radius: 24px;
    font-size: 58px;
  }

  #homeTab .chest-action-hint {
    font-size: 11px;
  }
}

@media (max-width: 720px) {
  #homeTab .chest-action-card {
    padding: 16px;
    border-radius: 24px;
  }

  #homeTab .chest-action-card .chest-visual {
    width: 136px;
    height: 136px;
    font-size: 72px;
  }
}

/* Keep rendered reward results readable inside the compact home dashboard. */
#homeTab .reward-result:not(.empty) {
  display: block;
  align-items: initial;
  justify-content: initial;
  width: 100%;
  min-width: 0;
  overflow: auto;
  text-align: left;
}

#homeTab .reward-result.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

#homeTab .reward-result * {
  min-width: 0;
}

#homeTab .reward-summary-grid {
  width: 100%;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 8px;
}

#homeTab .reward-summary-card {
  padding: 10px;
  text-align: center;
  word-break: keep-all;
  overflow-wrap: break-word;
}

#homeTab .reward-summary-card div {
  font-size: 11px;
  line-height: 1.25;
}

#homeTab .reward-summary-card strong {
  margin-top: 5px;
  white-space: nowrap;
  font-size: 16px;
  line-height: 1.15;
}

#homeTab .reward-list-title {
  word-break: keep-all;
  overflow-wrap: break-word;
}

#homeTab .reward-line {
  align-items: flex-start;
  flex-wrap: wrap;
  text-align: left;
}

#homeTab .reward-line-label {
  flex: 1 1 180px;
  word-break: keep-all;
  overflow-wrap: break-word;
}

#homeTab .reward-line-meta {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 480px) {
  #homeTab .reward-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #homeTab .reward-line-meta {
    width: 100%;
    text-align: left;
  }
}

/* PC AdSense placements: left rail, user-card banner, right rail. */
@media (min-width: 900px) {
  #homeTab .user-panel {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .pc-ad-user-banner.is-active {
    flex: 0 0 468px;
    width: 468px;
    min-width: 468px;
    max-width: 468px;
    height: 108px;
    min-height: 108px;
    max-height: 108px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    align-items: center;
    margin-left: auto;
    padding: 8px;
    border-radius: 18px;
    border: 1px solid rgba(67, 88, 216, 0.15);
    background:
      linear-gradient(135deg, rgba(67, 88, 216, 0.08), rgba(20, 184, 166, 0.07)),
      rgba(255, 255, 255, 0.72);
    overflow: hidden;
  }

  .pc-ad-user-banner .pc-ad-copy {
    display: none;
  }

  .pc-ad-user-banner .pc-ad-copy strong {
    color: var(--text);
    font-size: 13px;
    line-height: 1.25;
  }

  .pc-ad-user-banner .pc-ad-host {
    width: 100%;
    height: 90px;
    min-height: 90px;
    max-height: 90px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.68);
    overflow: hidden;
  }

  .pc-ad-user-banner ins.adsbygoogle {
    width: 100% !important;
    height: 90px !important;
    min-height: 90px !important;
    max-height: 90px !important;
  }
}

@media (min-width: 1180px) {
  .app-shell.pc-ads-active {
    width: min(1360px, calc(100% - 24px));
    display: grid;
    grid-template-columns: minmax(120px, 160px) minmax(0, 1000px) minmax(120px, 160px);
    column-gap: 12px;
    align-items: start;
  }

  .app-shell.pc-ads-active .topbar {
    grid-column: 2;
    grid-row: 1;
  }

  .app-shell.pc-ads-active main {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
  }

  .app-shell.pc-ads-active .pc-ad-left-rail.is-active,
  .app-shell.pc-ads-active .pc-ad-right-rail.is-active {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: sticky;
    top: 96px;
    align-self: start;
    width: 100%;
  }

  .app-shell.pc-ads-active .pc-ad-left-rail.is-active {
    grid-column: 1;
    grid-row: 2;
  }

  .app-shell.pc-ads-active .pc-ad-right-rail.is-active {
    grid-column: 3;
    grid-row: 2;
  }

  .app-shell.pc-ads-active .pc-ad-rail-card.is-active {
    display: grid;
    gap: 10px;
    min-height: 600px;
    padding: 10px;
    border-radius: 20px;
    border: 1px solid rgba(67, 88, 216, 0.15);
    background:
      linear-gradient(160deg, rgba(255, 255, 255, 0.94), rgba(238, 243, 255, 0.84)),
      #ffffff;
    box-shadow: 0 16px 34px rgba(46, 65, 130, 0.09);
    overflow: hidden;
  }

  .app-shell.pc-ads-active .pc-ad-rail-card .pc-ad-host {
    min-height: 560px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    overflow: hidden;
  }

  .app-shell.pc-ads-active .pc-ad-rail-card ins.adsbygoogle {
    width: 100%;
    min-height: 560px;
  }

  .app-shell.pc-ads-active + .tabbar,
  .app-shell.pc-ads-active ~ .tabbar {
    width: min(1000px, calc(100% - 360px));
    max-width: calc(100% - 24px);
  }
}

@media (max-width: 1179px) {
  .pc-ad-left-rail,
  .pc-ad-right-rail {
    display: none !important;
  }
}

@media (max-width: 1080px) {
  .pc-ad-user-banner {
    display: none !important;
  }
}

.ad-guard-panel,
.ad-guard-panel h2,
.ad-guard-text,
.ad-guard-safe-note,
.ad-guard-help,
.ad-guard-actions button {
  word-break: keep-all;
  overflow-wrap: break-word;
}

.ad-guard-panel h2,
.ad-guard-text,
.ad-guard-safe-note {
  text-wrap: pretty;
}

@supports (text-wrap: balance) {
  .ad-guard-panel h2,
  .ad-guard-safe-note {
    text-wrap: balance;
  }
}
