/* Panel presentation only. Visibility, state, and shared controls belong to the app. */
:where(#panel-wallet, #panel-tasks, #panel-referral, #panel-tournaments,
       #panel-support, #deposit-page, #withdraw-page, .currency-payment-page, #admin-page,
       #axm-deposit-section, #axm-payout-section, #axm-referral-section) {
  --panel-edge: var(--design-border, #78613b);
  --panel-fill: var(--design-panel-gradient, linear-gradient(135deg, #29211099, #0b0a06 75%));
  --panel-gold: var(--gold-400, #f6cd66);
  --panel-highlight: var(--design-gold-edge, #ffdf91);
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.6;
}

/* Artwork stays behind real, translated captions. No generated copy or state. */
:is(#panel-game, #panel-tasks) .promo-banner.gift-banner,
#panel-referral .promo-banner.referral-banner,
#panel-tournaments .tournament-hero {
  min-height: 104px;
  margin-block: 0 16px;
  padding: 18px;
  border: 1px solid var(--design-border, #78613b);
  border-radius: 16px;
  background-color: var(--color-surface-0, #0b0a06);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  box-shadow: inset 0 1px 1px #ffdf911c;
}
:is(#panel-game, #panel-tasks) .promo-banner.gift-banner {
  background-image: linear-gradient(90deg, #0b0a06b8, #0b0a0600), url('/static/art/gift.png');
}
#panel-referral .promo-banner.referral-banner {
  background-image: linear-gradient(90deg, #0b0a06b8, #0b0a0600), url('/static/art/referrals.png');
}
:is(#panel-game, #panel-tasks, #panel-referral) .promo-banner strong,
#panel-tournaments .tournament-hero strong {
  display: block;
  max-width: 68%;
  color: var(--design-gold-edge, #ffdf91);
  font-size: clamp(18px, 5vw, 23px);
  font-weight: 800;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
:is(#panel-game, #panel-tasks, #panel-referral) .promo-banner small {
  display: block;
  max-width: 68%;
  margin-top: 6px;
  color: #dbbc71;
  font-size: 12px;
}

/* Both currencies remain first-class wallet cards. */
#panel-wallet .wallet-currencies {
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
#panel-wallet .wallet-card {
  gap: 14px;
  padding: 18px;
  border-color: var(--panel-edge);
  border-radius: 18px;
  background: var(--panel-fill);
  box-shadow: inset 0 1px 2px #ffdf9118;
}
#panel-wallet .wallet-card {
  --wallet-coin-art: url('/static/coins/ton.svg');
  background: linear-gradient(90deg, #0b0a06f5, #0b0a0670),
    var(--wallet-coin-art) right 18px top 18px / 112px 112px no-repeat,
    radial-gradient(ellipse at right top, #bd8b35aa, transparent 70%), var(--panel-fill);
}
#panel-wallet .wallet-card[aria-labelledby="wallet-axm-title"] {
  --wallet-coin-art: url('/static/coins/axm.svg');
}
#panel-wallet .wallet-card header { align-items: center; }
#panel-wallet .wallet-card h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--panel-highlight);
  font-size: 16px;
}
#panel-wallet .wallet-coin { width: 30px; height: 30px; object-fit: contain; }
#panel-wallet .wallet-total {
  margin: 0;
  color: var(--panel-highlight);
  font-size: clamp(27px, 8vw, 34px);
  line-height: 1.3;
  letter-spacing: -.6px;
}
#panel-wallet .wallet-total .currency { font-size: .65em; }
#panel-wallet .wallet-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
}
#panel-wallet .wallet-breakdown > div { flex-direction: column; gap: 4px; }
#panel-wallet .wallet-breakdown dt,
#panel-wallet :is(.network-badge, .wallet-card header > .muted) {
  color: var(--text-muted, #aaa698);
  font-size: 12px;
}
#panel-wallet .wallet-breakdown dd { color: #f3efdf; font-size: 14px; }
#panel-wallet .wallet-actions { gap: 10px; }
#panel-wallet .wallet-actions button { flex-basis: 100px; }
#panel-wallet .wallet-actions .payment-check:not(:disabled) {
  border-color: var(--panel-edge);
  background: var(--color-surface-0);
  color: var(--text-primary);
  box-shadow: none;
}
#panel-wallet :is(.network-badge, #account-components) { margin-top: 14px; }

/* The medallion is a sibling, not a wrapper around the live level fields. */
#tasks-account {
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 10px 16px;
  padding: 18px;
  border: 1px solid var(--panel-edge);
  border-radius: 19px;
  background: radial-gradient(ellipse at 15% 20%, #9c6d1a26, transparent 65%), var(--panel-fill);
  box-shadow: inset 0 1px 1px #ffdf912b, 0 8px 24px #0003;
}
#tasks-account > .level-art {
  grid-column: 1;
  grid-row: 1 / 4;
  width: 76px;
  max-width: 100%;
  height: 92px;
  object-fit: contain;
  filter: drop-shadow(0 5px 12px #d3972724);
}
#tasks-account > #tasks-level {
  grid-column: 2;
  margin: 0;
  color: var(--panel-highlight);
  font-size: 23px;
  font-weight: 800;
  line-height: 1.3;
}
#tasks-account > :is(#tasks-exp, #tasks-exp-text) { grid-column: 2; margin: 0; }
#tasks-account > #tasks-exp-text { color: #e5cb91; font-size: 12px; }
#tasks-account > #tasks-next-bonus {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  padding-top: 14px;
  border-top: 1px solid #78613b66;
  color: var(--panel-gold);
  font-size: 17px;
  font-weight: 700;
}
#panel-tasks progress, #axm-payout-section progress {
  height: 8px;
  max-width: 100%;
  border: 0;
  border-radius: 8px;
  background: #322510;
  accent-color: var(--panel-gold);
}
#panel-tasks progress::-webkit-progress-bar { background: #322510; border-radius: 8px; }
#panel-tasks progress::-webkit-progress-value {
  background: linear-gradient(90deg, #a37421, #ffdf91);
  border-radius: 8px;
}
#panel-tasks progress::-moz-progress-bar {
  background: linear-gradient(90deg, #a37421, #ffdf91);
  border-radius: 8px;
}
#panel-tasks .tasks-list { display: grid; gap: 12px; }
#panel-tasks .tasks-list li {
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--panel-edge);
  border-radius: 16px;
  background: var(--panel-fill);
}
#panel-tasks .tasks-list h3 { color: #f3efdf; font-size: 15px; line-height: 1.5; }
#panel-tasks .tasks-list p { margin: 0; color: #dfc68d; font-size: 13px; }
#panel-tasks .task-actions > button { flex: 1 1 100px; }

/* Referrals retain the actual totals and all native filters. */
#panel-referral .referral-content {
  gap: 22px;
  padding: 17px;
  border: 1px solid var(--panel-edge);
  border-radius: 18px;
  background: var(--panel-fill);
}
#panel-referral .referral-total {
  margin-block: 6px;
  color: var(--panel-gold);
  font-size: 33px;
  line-height: 1.3;
  letter-spacing: -.7px;
}
#panel-referral .referral-list li { border-color: #78613b66; align-items: center; }
#panel-referral .referral-list p { margin-block: 3px; font-size: 13px; }
#panel-referral .referral-list .avatar { flex-shrink: 0; }
#panel-referral .referral-list li > div { flex: 1; }

#panel-tournaments .tournament-hero {
  min-height: 156px;
  background-image: linear-gradient(90deg, #0b0a06dd, #0b0a0620), url('/static/art/tournament.png');
}
#panel-tournaments .tournament-hero :is(p, small, span) {
  max-width: 68%;
  color: #cdbd9b;
  font-size: 12px;
}
:is(#panel-tournaments, #admin-page) .tournament-card {
  padding: 17px;
  border: 1px solid var(--panel-edge);
  border-radius: 17px;
  background: var(--panel-fill);
}
:is(#panel-tournaments, #admin-page) .tournament-card h3 {
  color: var(--panel-highlight);
  font-size: 19px;
  line-height: 1.4;
}
#panel-tournaments .tournament-prizes { color: #e5cb91; }

/* Keep native disclosure markers and open/closed behavior intact. */
#panel-support .support-intro { padding: 18px 12px 26px; }
#panel-support .support-intro > svg {
  width: 76px;
  height: 76px;
  color: var(--panel-gold);
  filter: drop-shadow(0 0 12px #bb791d33);
}
#panel-support .support-intro :is(h2, h3) { color: var(--panel-highlight); margin-block: 12px; }
#panel-support .support-intro p { color: #c8bfac; font-size: 15px; }
#panel-support .support-link { width: 100%; margin: 0 0 24px; min-height: 50px; }
#panel-support .support-faq { text-align: start; }
#panel-support .support-faq details {
  margin-block: 9px;
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  background: var(--panel-fill);
}
#panel-support .support-faq summary { min-height: 48px; padding: 12px; font-size: 14px; }
#panel-support .support-faq details p { padding: 0 14px 14px; color: #c8bfac; }

/* AXM rules use section IDs so reparenting does not change their presentation. */
:is(#deposit-form, #withdraw-form, #axm-deposit-form, #axm-payout-form,
    #axm-referrals-form, #axm-finance-form, #axm-instructions) {
  display: grid;
  gap: 14px;
  min-width: 0;
}
#panel-wallet #wallet-axm-details { margin-top: 18px; padding: 0; border: 0; background: none; }
:is(#axm-deposit-section, #axm-payout-section, #axm-referral-section, #axm-admin) {
  margin-block: 16px;
  padding: 16px;
  border: 1px solid var(--panel-edge);
  border-radius: 16px;
  background: var(--panel-fill);
}
:is(#axm-deposit-section, #axm-payout-section, #axm-referral-section, #axm-admin) h2 {
  font-size: 19px;
  line-height: 1.4;
}
.currency-payment-page .withdraw-panel {
  padding: 16px;
  border-color: var(--panel-edge);
  border-radius: 16px;
  background: var(--panel-fill);
}
.currency-payment-page .withdraw-tabs { gap: 6px; }
#withdraw-page .withdraw-amount-header { flex-wrap: wrap; }
#withdraw-page .withdraw-amount-header label { white-space: normal; }
#withdraw-page #withdraw-amount { min-height: 60px; font-size: 25px; font-weight: 700; }
:is(#deposit-instructions, #axm-instructions) {
  padding: 14px;
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  background: var(--color-surface-0, #0b0a06);
}
:is(#deposit-address, #axm-recipient, #axm-memo, #axm-invoice-sender) {
  margin: 0;
  padding: 10px;
  border: 1px solid #78613b66;
  border-radius: 9px;
  background: var(--color-bg, #050403);
  color: #deccaa;
  font-size: 12px;
  overflow-wrap: anywhere;
}
:is(#deposit-qr, #axm-qr) {
  justify-self: center;
  width: 200px;
  max-width: 100%;
  height: auto;
  padding: 12px;
  border-radius: 10px;
  background: #fff;
  object-fit: contain;
  image-rendering: pixelated;
}
:where(#panel-wallet, #panel-tasks, #panel-referral, #panel-tournaments,
       #panel-support, #deposit-page, #withdraw-page, .currency-payment-page, #admin-page,
       #axm-deposit-section, #axm-payout-section, #axm-referral-section, #axm-admin)
:is(button, select, input:not([type="checkbox"]):not([type="radio"]), a[href]) {
  min-width: 0;
  min-height: 44px;
  max-width: 100%;
}
:where(#panel-wallet, #panel-tasks, #panel-referral, #panel-tournaments,
       #deposit-page, #withdraw-page, .currency-payment-page, #admin-page, #axm-deposit-section,
       #axm-payout-section, #axm-referral-section, #axm-admin) label {
  font-size: 13px;
  line-height: 1.5;
}
:where(#deposit-page, #withdraw-page, .currency-payment-page, #admin-page, #panel-wallet,
       #axm-deposit-section, #axm-payout-section, #axm-referral-section, #axm-admin)
:is([role="status"], .payment-result, .payment-error) { overflow-wrap: anywhere; font-size: 13px; }
:where(#deposit-page, #withdraw-page, .currency-payment-page, #admin-page, #panel-wallet) .payment-error:not(:empty) {
  padding: 10px;
  border: 1px solid #9f463b88;
  border-radius: 9px;
  background: #59211b30;
}
:where(#deposit-page, #withdraw-page, .currency-payment-page, #admin-page, #panel-wallet) .payment-history li {
  padding: 15px;
  border-color: var(--panel-edge);
  border-radius: 13px;
  background: var(--panel-fill);
  font-size: 13px;
}

/* Shared payment presentation; native AXM fields and runtime state stay intact. */
.currency-payment-page > .payment-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 44px;
  margin: 0 0 18px;
  transform: none;
}
.currency-payment-page > .payment-page-heading {
  margin-top: 0;
  margin-bottom: 18px;
}
.currency-payment-page .payment-page-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--panel-edge);
  border-radius: 18px;
  background: radial-gradient(ellipse at top left, #bd8b3533, transparent 70%), var(--panel-fill);
  box-shadow: inset 0 1px 2px #ffdf9118;
}
.currency-payment-page .payment-page-heading > img {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px #d3972733);
}
.currency-payment-page .payment-page-heading > div { min-width: 0; }
.currency-payment-page .payment-page-heading h2 {
  margin: 0;
  color: var(--panel-highlight);
  font-size: clamp(22px, 6vw, 28px);
  line-height: 1.3;
}
.currency-payment-page .payment-coin { color: #dbbc71; font-size: 13px; }
.currency-payment-page .payment-page-meta { margin-block: 14px; }
.currency-payment-page .payment-page-meta > * { max-width: 100%; margin-block: 8px; }
.currency-payment-page .payment-page-meta :is(p, [role="status"]) { font-size: 13px; }
.currency-payment-page .withdraw-panel :is(#axm-deposit-section, #axm-payout-section) {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.currency-payment-page :is(#axm-deposit-title, #axm-payout-title) {
  margin: 0 0 10px;
  color: var(--panel-highlight);
  font-size: 17px;
  line-height: 1.4;
}
.currency-payment-page .withdraw-panel :is(p, h3) { margin-block: 10px; }
.currency-payment-page .withdraw-panel .muted { font-size: 13px; }
.currency-payment-page form { margin-top: 16px; }
:is(#deposit-submit, #axm-deposit-submit) {
  box-sizing: border-box;
  width: 100%;
  min-height: 50px;
  padding: 12px 16px;
}
:is(#deposit-submit, #axm-deposit-submit):not(:disabled) {
  border: 1px solid var(--design-gold-edge);
  border-radius: 12px;
  background: var(--gradient-gold) border-box no-repeat;
  color: var(--text-on-gold);
  box-shadow: var(--design-gold-shadow);
  font-weight: 800;
  transform: none;
}
.currency-payment-page :where(input:not([type="checkbox"]):not([type="radio"]), select) {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 11px;
  border: 1px solid var(--color-border-strong);
  border-radius: 11px;
  background: #090804;
  color: var(--text-primary);
  font: inherit;
  font-size: 16px;
}
.currency-payment-page form > label { color: var(--text-secondary); font-weight: 600; }
.currency-payment-page :where(.payment-check, .payment-close) { min-height: 46px; }
.currency-payment-page :is(#withdraw-amount, #axm-payout-amount) {
  min-height: 60px;
  font-size: 25px;
  font-weight: 700;
}
.currency-payment-page .withdraw-panel > h3 {
  color: var(--panel-highlight);
  font-size: 17px;
}
.currency-payment-page :is(#axm-deposit-history, #axm-payout-history) { margin-bottom: 0; }
.currency-payment-page .payment-history button:not(:disabled) {
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  background: var(--color-surface-0);
  color: var(--text-primary);
}

/* Navigation mirrors with the document; financial notation and chain identifiers do not. */
html[dir="rtl"] .tournament-banner-arrow { transform: rotate(-135deg); }
html[dir="rtl"] #panel-wallet .wallet-card {
  background: linear-gradient(270deg, #0b0a06f5, #0b0a0670),
    var(--wallet-coin-art) left 18px top 18px / 112px 112px no-repeat,
    radial-gradient(ellipse at left top, #bd8b35aa, transparent 70%), var(--panel-fill);
}
:is(.payment-address, input[type="number"], input[inputmode="decimal"], input[inputmode="numeric"],
    #withdraw-address, #axm-address, #referral-link, #admin-finance-balance, #admin-finance-earnings,
    .ton-input, .balance, .wallet-total, .wallet-breakdown dd, .currency-option-amount,
    #game-prize, #axm-prize) {
  direction: ltr;
  unicode-bidi: isolate;
}

/* Native AXM invoice: visibility and translated status copy belong to the app. */
#axm-instructions .axm-payment-details {
  display: grid;
  gap: 14px;
  min-width: 0;
  margin: 0;
}
#axm-instructions .axm-payment-detail { min-width: 0; }
#axm-instructions .axm-payment-detail + .axm-payment-detail {
  padding-top: 14px;
  border-top: 1px solid var(--panel-edge, #78613b);
}
#axm-instructions .axm-payment-detail dt {
  margin: 0 0 6px;
  color: var(--text-secondary, #c8bfac);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: .04em;
  text-transform: uppercase;
}
#axm-instructions .axm-payment-detail dd {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  color: var(--text-primary, #f3ead6);
  font-size: 15px;
  line-height: 1.6;
}
#axm-instructions :is(#axm-invoice-summary, #axm-recipient, #axm-memo,
                      #axm-invoice-sender, #axm-invoice-status) { margin: 0; }
#axm-instructions #axm-invoice-summary {
  color: var(--panel-gold, #f6cd66);
  font-size: 32px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
#axm-instructions :is(#axm-recipient, #axm-memo, #axm-invoice-sender) {
  min-width: 0;
  max-width: 100%;
  border-color: var(--panel-edge, #78613b);
  color: var(--text-primary, #f3ead6);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 15px;
  line-height: 1.6;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  overflow: visible;
  text-overflow: clip;
}
#axm-instructions #axm-invoice-due { color: var(--text-primary, #f3ead6); font-size: 15px; }
#axm-instructions :is(#axm-copy-recipient, #axm-copy-memo) {
  justify-self: start;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--panel-edge, #78613b);
  background: var(--color-surface-0, #0b0a06);
  color: var(--text-primary, #f3ead6);
  font-size: 14px;
  box-shadow: none;
}
#axm-instructions #axm-invoice-status:empty { display: none; }
#axm-instructions #axm-invoice-status:not(:empty) {
  padding: 8px 10px;
  border: 1px solid currentColor;
  border-radius: 9px;
  font-size: 13px;
  line-height: 1.5;
}
#axm-instructions[data-state="expired"] #axm-invoice-status { color: var(--danger-text, #ff9b8e); }
#axm-instructions[data-state="settled"] #axm-invoice-status { color: var(--success-text, #9cdbad); }
#axm-instructions[data-state="manual_review"] #axm-invoice-status { color: var(--panel-gold, #f6cd66); }
#axm-instructions .axm-payment-actions:not([hidden]) { display: grid; gap: 10px; }
#axm-instructions .axm-payment-actions button {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  font-size: 15px;
  white-space: normal;
}

/* Admin is a narrow-screen workspace, not a desktop table. */
#admin-page .admin-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
#admin-page .admin-tabs button { white-space: normal; font-size: 13px; }
#axm-finance-summary { white-space: pre-wrap; overflow-wrap: anywhere; }
#admin-page .admin-pagination { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
#admin-page [id^="admin-panel-axm-"] :is(input, select) { max-width: 100%; }
#admin-page [id^="admin-panel-axm-"] .payment-history button { margin: 4px; }
#admin-page :is(.admin-users-summary, .admin-user-card, .admin-finance-editor) {
  padding: 16px;
  border-color: var(--panel-edge);
  border-radius: 16px;
  background: var(--panel-fill);
}
#admin-page :is(.admin-users-list, .admin-finance-fields) { grid-template-columns: minmax(0, 1fr); }
#admin-page :is(.admin-user-actions, .admin-users-toolbar .payment-field) { min-width: 0; }
#admin-page .admin-users-toolbar .payment-field { flex-basis: 100%; }
#admin-page :is(.admin-finance-buttons, .admin-user) { flex-wrap: wrap; }
#admin-page .admin-finance-buttons button { flex: 1 1 120px; }
#admin-page .admin-finance-confirm { min-height: 44px; align-items: center; }
#admin-page .tournament-prize-row { grid-template-columns: 48px minmax(0, 1fr) minmax(0, 1fr); }
#admin-page :is(fieldset, textarea, .payment-history, .admin-user-identity) { min-width: 0; max-width: 100%; }

@media (max-width: 360px) {
  #panel-wallet .wallet-card, #panel-referral .referral-content { padding: 14px; }
  #tasks-account { grid-template-columns: 60px minmax(0, 1fr); gap: 10px; padding: 14px; }
  #tasks-account > .level-art { width: 60px; height: 78px; }
  #tasks-account > #tasks-level { font-size: 20px; }
  #panel-tasks .task-filters, #panel-referral .referral-fields { grid-template-columns: minmax(0, 1fr); }
  #admin-page .tournament-prize-row { grid-template-columns: minmax(0, 1fr); }
  #admin-page .tournament-prize-row button { justify-self: stretch; }
}
