/* Pop-ups, from spec 02. Affiliates and Profile: 800 wide, 2px border, radius 6,
   160 from the top. Free Coins: 480 wide, 1px border, radius 4, 150 from the top. */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  overflow-y: auto; padding: 0 16px 40px;
  background: rgba(0, 0, 0, 0.5);
  animation: fade-in 0.2s ease-out;
}
.overlay.is-leaving { animation: fade-out 0.2s ease-in forwards; }
.overlay.is-leaving .modal { animation: modal-out 0.2s ease-in forwards; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes modal-out { to { opacity: 0; transform: translateY(10px) scale(0.98); } }

.modal {
  position: relative; overflow: hidden;
  margin: clamp(24px, calc(var(--top) - 116px + 8vh), var(--top)) auto 0;
  padding: 32px;
  background: #171717;
  border: 2px solid var(--line); border-radius: 6px;
  animation: modal-in 0.4s var(--ease-back);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(24px) scale(0.96); } }
.modal:focus { outline: none; }
.modal--wide { width: min(800px, 100%); }
.modal--narrow { width: min(480px, 100%); border-width: 1px; border-color: #3f3f3f; border-radius: 4px; }
.modal__head { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.modal__head h2 { display: flex; align-items: center; gap: 8px; margin: 0; font: 500 24px/36px var(--f-head); text-transform: uppercase; }
.modal__close { padding: 4px; margin: -4px; transition: transform 0.25s var(--ease-back), filter 0.2s; }
.modal__close:hover { transform: rotate(90deg); filter: brightness(1.6); }
.mpanel { margin-top: 24px; }
.mpanel.is-shown { animation: panel-in 0.35s var(--ease-out); }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } }

.tabs--even { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.tabs--even .tab { padding: 6px 0; white-space: nowrap; }

/* Affiliates: code and link fields */
.aff-row { display: grid; grid-template-columns: 292.8fr 439.2fr; }
.aff-col { display: flex; flex-direction: column; gap: 2px; padding-right: 32px; }
.aff-col > span:first-child { padding-left: 10px; font-size: 16px; line-height: 27px; color: var(--muted-2); }
.aff-input { display: flex; align-items: center; gap: 16px; height: 36px; padding: 0 16px; background: #212121; border-radius: 2px; transition: box-shadow 0.2s; }
.aff-input:focus-within { box-shadow: 0 0 0 1px rgba(255, 199, 1, 0.5); }
.aff-input input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-weight: 700; font-size: 14px; color: #ffffff; }
.aff-input input::placeholder { color: #a6a6a6; text-transform: uppercase; }
.aff-input--link b { flex: 1; min-width: 0; font-size: 13px; line-height: 24px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aff-copy { flex: none; transition: transform 0.2s var(--ease-back); }
.aff-copy:hover { transform: scale(1.15); }
.aff-create { width: 208px; margin-top: 16px; }

.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.mpanel > .stat-row:first-child { margin-top: 0; }

/* The dark art panel shared by Affiliates and Profile */
.artpanel { position: relative; margin-top: 16px; padding: 32px 16px; background: rgba(0, 0, 0, 0.2); overflow: hidden; }
.mpanel > .stat-row + .artpanel { margin-top: 24px; }
.artpanel__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.artpanel__splash { position: absolute; left: 0; bottom: -4px; width: 100%; height: auto; opacity: 0.5; pointer-events: none; }
.artpanel__body { position: relative; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 0 94px; }
.badge-row { display: flex; align-items: center; gap: 12px; }
.badge-row b { display: block; font-size: 14px; line-height: 24px; }
.badge-row small { display: block; font-size: 14px; line-height: 21px; color: var(--muted-2); }
.cap { text-transform: capitalize; }
.badge-ring { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #171717; border: 1px solid var(--gold); }
.badge-ring img { animation: badge-spin 6s ease-in-out infinite; }
@keyframes badge-spin { 0%, 80%, 100% { transform: none; } 90% { transform: rotateY(180deg); } }
.bar { position: relative; width: 100%; height: 64px; }
.bar > i { position: absolute; left: 0; bottom: 0; height: 16px; width: 100%; border-radius: 9999px; background: #232323; }
.bar--level { height: 16px; margin: 32px 0 16px; border-radius: 9999px; background: #232323; overflow: hidden; }
.bar--level i { position: absolute; inset: 0 auto 0 0; width: 0; height: 16px; border-radius: 9999px; background: linear-gradient(to left, #feb442 0%, #df6c37 68.8%); transition: width 1.2s var(--ease-out); }
.bar--level i.is-grown { width: max(var(--w), 3%); }
.bar__mark { position: absolute; right: 0; top: 0; width: 56px; height: 28px; }
.bar__mark img { position: absolute; }
.bar__mark img:nth-child(1) { left: 0; bottom: 8px; }
.bar__mark img:nth-child(2) { right: 20px; top: 0; }
.bar__mark img:nth-child(3) { right: 20px; bottom: 0; }
.bar__mark img:nth-child(4) { right: 0; bottom: 8px; }
.earn { display: flex; flex-direction: column; align-items: center; padding-top: 14px; }
.earn > div { display: flex; align-items: flex-end; gap: 12px; }
.earn b { font: 700 20px/20px var(--f-head); }
.earn small { margin-top: 8px; font-size: 16px; line-height: 24px; color: var(--muted-2); }
.btn-row { display: flex; gap: 16px; }
.btn-row > * { width: 208px; }
.btn-row > .btn-160 { width: 160px; padding: 0 8px; }

/* Affiliates > Tiers (not in the design) */
.tier-list { display: flex; flex-direction: column; gap: 8px; }
.tier { display: grid; grid-template-columns: 40px 1fr auto auto; align-items: center; gap: 12px; padding: 12px 16px; background: #232323; border: 2px solid var(--line); border-radius: 4px; }
.tier b { display: block; font-size: 14px; }
.tier small { color: var(--muted-2); }
.tier strong { font: 700 20px var(--f-head); color: var(--gold); }
.tier.is-current { border-color: rgba(255, 199, 1, 0.45); }

/* Tables and empty states for the undesigned tabs */
.mtable { max-height: 420px; overflow: auto; }
.mtable table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mtable th { position: sticky; top: 0; padding: 10px 12px; text-align: left; font-weight: 400; color: var(--muted-2); background: #171717; }
.mtable td { padding: 10px 12px; white-space: nowrap; }
.mtable td img { display: inline-block; width: 24px; height: auto; margin-right: 8px; vertical-align: -3px; }
.mtable tbody tr:nth-child(odd) { background: #1d1d1d; }
.mtable .up { color: var(--green); }
.mtable .mono { font-family: ui-monospace, Consolas, monospace; }
.mempty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 56px 24px; background: rgba(0, 0, 0, 0.2); color: var(--muted-2); text-align: center; }
.mempty img { opacity: 0.35; filter: grayscale(1); }
.mempty p { margin: 0; max-width: 340px; }

.settings { display: flex; flex-direction: column; gap: 8px; }
.toggle, .seed { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; background: #232323; border: 2px solid var(--line); border-radius: 4px; cursor: pointer; }
.toggle b, .seed b { display: block; font-size: 14px; }
.toggle small, .seed small { color: var(--muted-2); }
.toggle input { position: absolute; opacity: 0; }
.toggle span { flex: none; position: relative; width: 40px; height: 22px; border-radius: 999px; background: #121212; transition: background 0.2s; }
.toggle span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform 0.25s var(--ease-back), background 0.2s; }
.toggle input:checked + span { background: rgba(255, 199, 1, 0.25); }
.toggle input:checked + span::after { transform: translateX(18px); background: var(--gold); }
.seed { cursor: default; }
.seed .field { width: 280px; padding-right: 4px; }
.seed input { font-family: ui-monospace, Consolas, monospace; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }
.reset { align-self: flex-start; margin-top: 8px; font-size: 13px; color: var(--muted-2); text-decoration: underline; }
.reset:hover { color: var(--red); }

/* Free Coins */
.modal--free { padding: 32px; }
.fc-rain { position: absolute; top: 0; left: 0; width: 100%; height: 208.62px; object-fit: fill; pointer-events: none; animation: rain 6s ease-in-out infinite alternate; }
@keyframes rain { to { transform: translateY(6px); opacity: 0.8; } }
.modal--free .modal__head { margin-bottom: 24px; }
.fc-form { position: relative; display: flex; flex-direction: column; gap: 20px; }
.fc-group { display: flex; flex-direction: column; gap: 8px; }
.fc-group > span:first-child { display: flex; align-items: center; gap: 6px; font-size: 14px; line-height: 21px; color: var(--muted-2); }
.fc-group:nth-child(2) > span:first-child { font-size: 13px; padding-left: 8px; }
.fc-help { cursor: help; }
.fc-field { padding-right: 16px; }
.fc-field input { font: 500 14px var(--f-head); text-transform: uppercase; }
.fc-claim { flex: none; width: 96px; height: 24px; background: #3f3f3f; font-weight: 700; font-size: 9px; line-height: 21px; color: #5e5e5e; transition: background 0.2s, color 0.2s, transform 0.15s; }
.fc-claim--wide { font-size: 12px; }
.fc-claim:not(:disabled) { color: var(--ink-on-gold); background: #ffc239 url("../assets/ui/button-stripes.jpg") left center / auto 100%; }
.fc-claim:not(:disabled):hover { transform: scale(1.04); }
.fc-claim:disabled { cursor: not-allowed; }
.fc-card { position: relative; display: flex; align-items: center; height: 119px; margin-top: 8px; padding: 0 20px; background: center / 100% 100% no-repeat; overflow: hidden; transition: transform 0.25s var(--ease-out), filter 0.25s; }
.fc-form + .fc-card { margin-top: 20px; }
.fc-card--daily { background-image: url("../assets/modals/fc-daily-card-bg.png"); }
.fc-card--flash { background-image: url("../assets/modals/fc-flash-card-bg.png"); }
.fc-card:hover { transform: translateY(-2px); filter: brightness(1.12); }
.fc-card b { display: block; font: 700 16px/24px var(--f-head); text-transform: uppercase; }
.fc-card small { display: block; margin-top: 8px; font-size: 12px; line-height: 18px; color: var(--muted-2); }
.fc-card--daily img { position: absolute; left: 300px; top: 24px; width: 93.5px; height: auto; transition: transform 0.35s var(--ease-back); }
.fc-card--daily:hover img { transform: rotate(-6deg) scale(1.08); }
.fc-gems { position: absolute; left: 244px; top: 17px; display: flex; gap: 4px; }
.fc-gems img { animation: gem-bob 2.6s ease-in-out infinite; }
.fc-gems img:last-child { animation-delay: -1.3s; }
@keyframes gem-bob { 50% { transform: translateY(-5px); } }
.fc-req { margin-top: 24px; }
.fc-req p { margin: 0 0 0; font-size: 14px; line-height: 21px; }
.fc-req div { display: flex; align-items: center; gap: 8px; height: 29px; font-size: 12px; line-height: 18px; }
.fc-req em { font-style: normal; color: var(--gold); }
.fc-req .discord { color: #a6a6a6; text-decoration: underline; }
.fc-req .this { color: var(--gold); text-decoration: underline; }

/* Deposit and About (not in the design) */
.mnote { margin: 0 0 16px; color: var(--muted-2); }
.packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pack { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 8px; background: #232323; border: 2px solid var(--line); border-radius: 4px; animation: panel-in 0.4s var(--ease-out) backwards; animation-delay: var(--d); transition: border-color 0.2s, transform 0.2s var(--ease-back); }
.pack b { font: 700 20px/1 var(--f-head); }
.pack small { color: var(--muted-2); }
.pack:hover { border-color: var(--gold); transform: translateY(-3px); }
.about p { margin: 0 0 12px; color: #d0d0d0; font-size: 15px; }
.about b { color: #ffffff; }

@media (max-width: 799.98px) {
  .modal { padding: 20px; }
  .aff-row { grid-template-columns: 1fr; gap: 12px; }
  .aff-col { padding-right: 0; }
  .stat-row { grid-template-columns: 1fr; }
  .artpanel__body { padding: 0; }
  .btn-row { flex-direction: column; width: 100%; }
  .btn-row > *, .btn-row > .btn-160 { width: 100%; }
  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs--even { display: flex; }
  .tabs--even .tab { padding: 6px 12px; }
  .packs { grid-template-columns: repeat(2, 1fr); }
  .fc-card--daily img { left: auto; right: 12px; }
  .fc-gems { left: auto; right: 8px; }
  .seed { flex-direction: column; align-items: stretch; }
  .seed .field { width: 100%; }
}
