/* ==========================================================================
   Access components
   - Holder Access Terminal   [data-terminal]
   - Allocation Booster       [data-booster]
   - Holder Access Key        [data-access-key]
   Every visual state is driven by data attributes set in js/access/*.
   ========================================================================== */

/* ---------- Holder Access Terminal ---------- */

.terminal {
  --term-pad: 20px;
  position: relative;
  z-index: 2;
  width: 100%;
  border-radius: var(--r-panel);
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(244, 122, 56, 0.07), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 30%),
    #121318;
  box-shadow:
    0 40px 90px -36px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(255, 255, 255, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  outline: none;
}

.terminal::before {
  /* Ambient orange rim that brightens as the state progresses. */
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(160deg, rgba(244, 122, 56, 0.55), rgba(244, 122, 56, 0) 38%, rgba(255, 255, 255, 0) 70%, rgba(100, 154, 241, 0.25));
  opacity: 0.45;
  transition: opacity var(--dur-slow);
}

.terminal[data-state="REGISTRATION_AVAILABLE"]::before,
.terminal[data-state="REGISTERED"]::before,
.terminal[data-state="ALREADY_REGISTERED"]::before {
  opacity: 0.95;
}

.terminal[data-state="NOT_ELIGIBLE"]::before,
.terminal[data-state="ERROR"]::before {
  opacity: 0.25;
}

.terminal__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px var(--term-pad);
  border-bottom: 1px solid var(--line);
}

.terminal__brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.terminal__brand img {
  width: 12px;
  height: auto;
}

.terminal__brand small {
  color: var(--dim);
  font-weight: 450;
  font-size: 12px;
  letter-spacing: -0.01em;
}

.terminal__team {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.terminal__team-dots {
  display: inline-flex;
  gap: 4px;
}

.terminal__team-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c);
  opacity: 0.35;
  animation: hb-team-dot 3.2s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.32s);
}

.terminal[data-team="ready"] .terminal__team-dots i,
.terminal[data-team="queued"] .terminal__team-dots i {
  opacity: 1;
  animation: none;
  box-shadow: 0 0 8px var(--c);
}

.terminal[data-team="checking"] .terminal__team-dots i {
  animation-duration: 1.1s;
}

@keyframes hb-team-dot {
  0%, 100% { opacity: 0.3; }
  45% { opacity: 1; }
}

.terminal__head {
  padding: 16px var(--term-pad) 8px;
}

.terminal__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.14em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.terminal__state-chip {
  flex-shrink: 0;
}

.terminal__log {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  min-height: 18px;
  color: #7f8a7f;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.terminal__log [data-field="log"] {
  overflow: hidden;
  text-overflow: ellipsis;
  color: #9fb59f;
}

.terminal__log::after {
  content: "";
  flex-shrink: 0;
  width: 7px;
  height: 13px;
  background: #9fb59f;
  opacity: 0.8;
  animation: hb-caret 1.1s steps(1) infinite;
}

@keyframes hb-caret {
  50% { opacity: 0; }
}

.terminal__rows {
  margin: 6px var(--term-pad) 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.trow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 37px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.trow dt {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  white-space: nowrap;
}

.trow dd {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 520;
  letter-spacing: -0.01em;
  text-align: right;
}

.trow dd > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trow[data-tone="idle"] dd {
  color: var(--muted);
}

.trow[data-tone="ok"] dd {
  color: #c9f2dc;
}

.trow[data-tone="bad"] dd {
  color: #ffc2c7;
}

.trow[data-tone="pending"] dd {
  color: #ffe0a6;
}

.trow[data-tone="brand"] dd {
  color: var(--brand-soft);
}

.trow__lock {
  width: 13px;
  height: 13px;
  color: var(--dim);
}

.trow[data-tone="ok"] .trow__lock {
  color: var(--tone-ok);
}

.trow[data-tone="pending"] .trow__lock,
.trow[data-tone="brand"] .trow__lock {
  color: var(--brand);
}

.trow[data-mono] dd > span {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.terminal__body {
  padding: 16px var(--term-pad) 0;
}

.terminal__actions {
  display: grid;
  gap: 8px;
}

.terminal__message {
  margin-top: 12px;
  color: var(--muted-2);
  font-size: 13px;
  line-height: 1.55;
}

.terminal__notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: 12px;
  background: rgba(244, 122, 56, 0.08);
  box-shadow: inset 0 0 0 1px rgba(244, 122, 56, 0.25);
  color: #ffd9bf;
  font-size: 13px;
  line-height: 1.5;
}

.terminal__notice:empty {
  display: none;
}

.terminal__notice .icon {
  margin-top: 2px;
  color: var(--brand);
  font-size: 15px;
}

.terminal__notice a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.terminal__trust {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 12px;
  color: var(--dim);
  font-size: 11.5px;
  line-height: 1.4;
}

.terminal__trust span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.terminal__trust .icon {
  color: var(--tone-ok);
  font-size: 12px;
}

.terminal__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  margin-top: 16px;
  padding: 12px var(--term-pad) 14px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 12px;
}

.terminal__foot a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-soft);
  font-weight: 550;
  transition: color var(--dur-fast);
}

.terminal__foot a:hover {
  color: var(--brand-soft);
}

/* Checking: scanning line across the rows (only when the backend sets CHECKING). */
.terminal[data-state="CHECKING"] .terminal__rows {
  position: relative;
  overflow: hidden;
}

.terminal[data-state="CHECKING"] .terminal__rows::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -30%;
  height: 30%;
  background: linear-gradient(180deg, transparent, rgba(244, 122, 56, 0.12), transparent);
  animation: hb-scan 1.6s linear infinite;
  pointer-events: none;
}

@keyframes hb-scan {
  to { transform: translateY(440%); }
}

/* Focus ring when the page sends the user to the terminal. */
.terminal:focus-visible,
.terminal.is-spotlit {
  box-shadow:
    0 40px 90px -36px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(244, 122, 56, 0.6),
    0 0 0 6px rgba(244, 122, 56, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

@media (max-width: 420px) {
  .terminal {
    --term-pad: 16px;
  }

  .trow dt {
    font-size: 10px;
    letter-spacing: 0.08em;
  }

  .trow dd {
    font-size: 13px;
  }
}

/* ---------- Allocation Booster (account + booster module) ---------- */

.booster {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) 34px minmax(0, 1fr);
  align-items: center;
}

.booster__account,
.booster__module {
  position: relative;
  border-radius: 18px;
  background: var(--surface-sunken);
  box-shadow: 0 0 0 1px var(--line-strong), 0 18px 40px -26px rgba(0, 0, 0, 0.9);
  padding: 16px;
}

.booster__label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.booster__label img {
  width: 11px;
}

.booster__account dl {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.booster__account dl > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
}

.booster__account dt {
  color: var(--dim);
}

.booster__account dd {
  color: var(--ink-soft);
  font-weight: 520;
  text-align: right;
}

.booster__rail {
  position: relative;
  height: 44px;
}

.booster__rail::before,
.booster__rail::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  height: 3px;
  border-radius: 3px;
  background: #2a2c33;
}

.booster__rail::before {
  top: 12px;
}

.booster__rail::after {
  bottom: 12px;
}

.booster__rail i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: #24262d;
  box-shadow: 0 0 0 1px var(--line-strong);
  transform: translate(-50%, -50%) rotate(45deg);
}

.booster__module {
  overflow: hidden;
  text-align: left;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 6px, transparent 6px 12px),
    var(--surface-sunken);
}

.booster__status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--muted);
}

.booster__status .icon {
  font-size: 20px;
  color: var(--dim);
}

.booster__hint {
  margin-top: 6px;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.45;
}

.booster__meter {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-top: 14px;
}

.booster__meter i {
  height: 5px;
  border-radius: 3px;
  background: #24262d;
}

/* Ready: eligible, registration available. */
.booster[data-booster="ready"] .booster__module {
  box-shadow: 0 0 0 1px rgba(245, 184, 74, 0.45), 0 18px 40px -26px rgba(0, 0, 0, 0.9);
}

.booster[data-booster="ready"] .booster__status,
.booster[data-booster="ready"] .booster__status .icon {
  color: var(--tone-pending);
}

.booster[data-booster="ready"] .booster__meter i:nth-child(-n + 2) {
  background: var(--tone-pending);
}

/* Qualified: backend confirmed a holder registration. */
.booster[data-booster="qualified"] .booster__module {
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(244, 122, 56, 0.28), transparent 60%),
    var(--surface-sunken);
  box-shadow: 0 0 0 1px rgba(244, 122, 56, 0.6), 0 0 40px -10px rgba(244, 122, 56, 0.45);
}

.booster[data-booster="qualified"] .booster__status,
.booster[data-booster="qualified"] .booster__status .icon {
  color: var(--brand-soft);
}

.booster[data-booster="qualified"] .booster__meter i {
  background: var(--brand);
  box-shadow: 0 0 10px rgba(244, 122, 56, 0.6);
}

.booster[data-booster="qualified"] .booster__rail::before,
.booster[data-booster="qualified"] .booster__rail::after {
  background: var(--brand);
  box-shadow: 0 0 12px rgba(244, 122, 56, 0.55);
}

.booster[data-booster="qualified"] .booster__rail i {
  background: var(--brand);
}

.booster__status [data-when] {
  display: none;
}

.booster[data-booster="locked"] [data-when="locked"],
.booster[data-booster="ready"] [data-when="ready"],
.booster[data-booster="qualified"] [data-when="qualified"] {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.booster__hint[data-when] {
  display: none;
}

.booster[data-booster="locked"] .booster__hint[data-when="locked"],
.booster[data-booster="ready"] .booster__hint[data-when="ready"],
.booster[data-booster="qualified"] .booster__hint[data-when="qualified"] {
  display: block;
}

@media (max-width: 560px) {
  .booster {
    grid-template-columns: 1fr;
  }

  .booster__rail {
    height: 30px;
    width: 44px;
    margin-inline: auto;
  }

  .booster__rail::before,
  .booster__rail::after {
    top: -2px;
    bottom: -2px;
    left: auto;
    right: auto;
    width: 3px;
    height: auto;
  }

  .booster__rail::before {
    left: 12px;
  }

  .booster__rail::after {
    right: 12px;
  }
}

/* ---------- Holder Access Key (benefit 01 visual) ---------- */

.access-key {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border-radius: 18px;
  background:
    radial-gradient(90% 120% at 0% 0%, rgba(244, 122, 56, 0.16), transparent 55%),
    linear-gradient(135deg, #191a20, #111216);
  box-shadow: 0 0 0 1px var(--line-strong), 0 24px 50px -30px rgba(0, 0, 0, 0.9);
}

.access-key::after {
  /* Card notch, like a physical key card. */
  content: "";
  position: absolute;
  top: 50%;
  right: -11px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  transform: translateY(-50%);
}

.access-key__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.access-key__top .booster__label {
  color: var(--brand-soft);
}

.access-key__title {
  margin-top: 16px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.access-key__team {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  margin-top: 14px;
}

.access-key__team img {
  width: 40px;
  height: 40px;
}

.access-key__team img.is-lead {
  width: 50px;
  height: 50px;
}

.access-key__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: var(--dim);
}

.access-key__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-weight: 550;
}
