.referral-page {
  min-height: 760px;
  padding: 42px 24px 64px;
  color: #40230f;
  background: linear-gradient(180deg, #4aa8ed 0%, #a6dafa 38%, #e4f7ff 72%, #d3ebca 100%);
}

.referral-page * { box-sizing: border-box; }
.referral-shell { width: min(100%, 1450px); margin: 0 auto; }
.referral-screenreader { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.referral-topbar { display: flex; align-items: center; justify-content: space-between; gap: 28px; min-height: 170px; margin-bottom: 18px; }
.referral-heading { flex: 1 1 auto; min-width: 0; }
.referral-heading img { display: block; width: min(100%, 680px); height: auto; margin: 0 auto; }
.referral-player { flex: 0 1 350px; min-width: 0; padding: 16px 26px; border: 4px solid transparent; border-radius: 18px; background: linear-gradient(#fff8df, #fff8df) padding-box, linear-gradient(135deg, #f9e08a, #e0a52c, #b97b18) border-box; box-shadow: 0 7px 0 #96551a, 0 13px 22px #325c8750; text-align: center; overflow-wrap: anywhere; }
.referral-player-label { display: block; margin-bottom: 3px; font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #9b6330; }
.referral-player strong { font-size: clamp(22px, 2.3vw, 31px); }

.referral-code-panel { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; margin: 0 0 28px; padding: 15px 21px; border: 3px solid #bd8228; border-radius: 18px; background: #fff8e7; box-shadow: 0 5px 0 #a36a22, 0 9px 20px #325c8738; }
.referral-code-panel > div { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 15px; }
.referral-code-label { font-size: 17px; font-weight: 700; }
.referral-code-value { min-width: 8ch; font-size: 22px; letter-spacing: .035em; user-select: all; }
.referral-code-panel button { padding: 8px 24px; border: 2px solid #bb7a11; border-radius: 10px; background: linear-gradient(#fff172, #ffcf19); color: #4c2808; font: inherit; font-weight: 900; cursor: pointer; box-shadow: 0 3px 0 #a46b12; }
.referral-code-panel button:hover:not(:disabled) { filter: brightness(1.06); }
.referral-code-panel button:focus-visible { outline: 3px solid #176ca3; outline-offset: 3px; }
.referral-code-panel button:disabled { opacity: .5; cursor: not-allowed; }
.referral-copy-status { min-height: 1.2em; font-size: 14px; font-weight: 700; color: #286338; }
.referral-alert, .referral-loading { padding: 12px 16px; margin: 0 0 15px; border-radius: 10px; background: #fff8e7; font-weight: 700; }
.referral-alert { color: #9e261f; }

.referral-table-frame { overflow: hidden; border: 4px solid transparent; border-radius: 18px; background: linear-gradient(#fffaf0, #fffaf0) padding-box, linear-gradient(135deg, #f9e08a, #e0a52c 55%, #b97b18) border-box; box-shadow: 0 7px 0 #925118, 0 16px 28px #3b5d803d; }
.referral-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.referral-table th { padding: 20px 12px; border-right: 2px solid #b87829; background: linear-gradient(#70421e, #5a3216); color: #fff; font-size: clamp(16px, 2vw, 25px); font-weight: 900; line-height: 1.2; text-align: center; text-shadow: -1px -1px #2e1709, 1px -1px #2e1709, -1px 1px #2e1709, 1px 1px #2e1709, 2px 3px #2e1709; }
.referral-table th:last-child, .referral-table td:last-child { border-right: 0; }
.referral-table th span { margin-right: 7px; font-size: 1.22em; vertical-align: middle; }
.referral-table td { height: 84px; padding: 11px 18px; border-right: 2px solid #dec8a7; font-size: clamp(17px, 2vw, 25px); text-align: center; overflow-wrap: anywhere; }
.referral-table tbody tr:nth-child(odd) { background: #f7f1e4; }
.referral-table tbody tr:nth-child(even) { background: #ece3d2; }
.referral-table tbody tr + tr { border-top: 1px solid #e3d5bd; }
.referral-table .referral-empty td { color: #9f917d; }
.referral-rewards { display: flex; justify-content: center; align-items: center; gap: 9px; }
.referral-rewards img { width: 43px; height: 43px; object-fit: contain; }
.referral-reward-locked { filter: grayscale(1); opacity: .45; }

.referral-note { display: flex; align-items: center; gap: 18px; margin-top: 24px; padding: 18px 22px; border: 4px solid transparent; border-radius: 18px; background: linear-gradient(#fff8df, #fff8df) padding-box, linear-gradient(135deg, #f9e08a, #e0a52c, #b97b18) border-box; box-shadow: 0 6px 0 #925118; }
.referral-note-title { flex: none; color: #b5251a; font-size: clamp(20px, 2.4vw, 30px); font-weight: 900; text-shadow: 1px 1px #fff; white-space: nowrap; }
.referral-note p { margin: 0; font-size: clamp(15px, 1.6vw, 19px); font-weight: 700; line-height: 1.4; }

@media (max-width: 759px) {
  .referral-page { min-height: 0; padding: 22px 14px 44px; }
  .referral-topbar { flex-direction: column; min-height: 0; gap: 14px; margin-bottom: 22px; }
  .referral-heading { width: 100%; }
  .referral-heading img { max-width: 440px; }
  .referral-player { flex: none; width: 100%; padding: 11px 18px; }
  .referral-code-panel { padding: 13px; }
  .referral-code-panel > div { width: 100%; }
  .referral-table-frame { border: 0; background: transparent; box-shadow: none; overflow: visible; }
  .referral-table, .referral-table tbody { display: block; width: 100%; }
  .referral-table thead { display: none; }
  .referral-table tbody tr { display: block; margin-bottom: 14px; padding: 8px 14px; border: 4px solid transparent; border-radius: 16px; background: linear-gradient(#f7f1e4, #f7f1e4) padding-box, linear-gradient(135deg, #f9e08a, #e0a52c, #b97b18) border-box !important; box-shadow: 0 4px 0 #925118; }
  .referral-table tbody tr + tr { border-top: 4px solid transparent; }
  .referral-table td { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; height: auto; min-height: 47px; padding: 7px 2px; border: 0; border-bottom: 1px solid #d9c8a9; font-size: 17px; text-align: right; }
  .referral-table td:last-child { border-bottom: 0; }
  .referral-table td::before { content: attr(data-label); flex: 0 0 42%; color: #754219; font-size: 14px; font-weight: 900; text-align: left; }
  .referral-rewards { flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
  .referral-rewards img { width: 34px; height: 34px; }
  .referral-note { align-items: flex-start; flex-direction: column; gap: 5px; margin-top: 18px; padding: 13px 16px; }
}
