/**
 * NFT Twin Finder — visual language aligned with Dope or Nope (dopeornope/)
 * Scoped to .ntf-* / .screen--ntf; does not modify global site styles.
 */

:root {
  --lo-blue-deep: #2d6fd4;
  --lo-blue-mid: #4a8df3;
  --lo-blue-light: #7bb9f9;
  --lo-blue-primary: #1e73ff;
  --lo-yellow: #ffd84d;
  --lo-yellow-bright: #ffdf66;
  --lo-navy: #0f2f6e;
  --text-on-light: #0f172a;
  --text-on-lo: #ffffff;
  --muted-on-lo: rgba(255, 255, 255, 0.88);
  --glass: rgba(255, 255, 255, 0.22);
  --glass-border: rgba(255, 255, 255, 0.4);
  --shadow-soft: 0 8px 24px rgba(15, 47, 110, 0.18);
  --radius-lg: 24px;
  --radius-md: 20px;
  --tap: 0.95;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
}

body {
  font-family: "Fredoka", ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Arial, sans-serif;
  color: var(--text-on-light);
  background: linear-gradient(180deg, var(--lo-blue-light) 0%, var(--lo-blue-mid) 42%, var(--lo-blue-deep) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(closest-side at 50% 36%, rgba(255, 255, 255, 0.09), transparent 68%);
  mix-blend-mode: soft-light;
  opacity: 0.9;
}

button,
input,
select {
  font: inherit;
}

.ntf-page {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.ntf-screen {
  display: none;
  max-width: 520px;
  margin: 0 auto;
}

.ntf-screen.is-active {
  display: block;
}

.ntf-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.18);
  color: var(--text-on-lo);
  font-family: inherit;
  font-weight: 900;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button.ntf-back {
  appearance: none;
}

.ntf-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  padding: 8px 8px 16px;
}

.ntf-hero__mascot {
  width: min(360px, 72vw);
  height: auto;
  filter: drop-shadow(0 10px 20px rgba(15, 47, 110, 0.35));
}

.ntf-hero__title {
  margin: 0;
  font-size: clamp(1.35rem, 5vw, 1.85rem);
  font-weight: 1000;
  letter-spacing: 0.06em;
  color: var(--text-on-lo);
  text-shadow: 0 2px 8px rgba(15, 47, 110, 0.35);
}

.ntf-hero__sub {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted-on-lo);
  letter-spacing: 0.03em;
}

.ntf-panel {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 55px rgba(15, 47, 110, 0.28);
}

.ntf-field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.ntf-field__label {
  font-weight: 900;
  font-size: 12px;
  color: var(--muted-on-lo);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ntf-input,
.ntf-select {
  width: 100%;
  height: 54px;
  border-radius: var(--radius-md);
  border: 2px solid rgba(255, 255, 255, 0.45);
  padding: 0 14px;
  outline: none;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text-on-light);
  box-shadow: var(--shadow-soft);
  font-family: "Fredoka", ui-rounded, system-ui, sans-serif;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.03em;
}

.ntf-select {
  text-transform: none;
  cursor: pointer;
}

.ntf-select-wrap {
  position: relative;
}

.ntf-select__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
}

.ntf-select__trigger::after {
  content: "▾";
  flex: 0 0 auto;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--lo-navy);
  opacity: 0.7;
}

.ntf-select__trigger:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.ntf-select-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.98);
  border: 2px solid rgba(255, 255, 255, 0.45);
  box-shadow: var(--shadow-soft);
  max-height: min(42vh, 280px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ntf-select-menu__option {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  background: transparent;
  color: var(--text-on-light);
  font-family: "Fredoka", ui-rounded, system-ui, sans-serif;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.03em;
  text-align: left;
  cursor: pointer;
}

.ntf-select-menu__option:hover,
.ntf-select-menu__option.is-active {
  background: rgba(30, 115, 255, 0.12);
}

.ntf-input:focus,
.ntf-select:focus {
  border-color: var(--lo-yellow);
  box-shadow: 0 0 0 4px rgba(255, 216, 77, 0.35);
}

.ntf-btn {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 16px 14px;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 140ms ease, filter 120ms ease;
  -webkit-tap-highlight-color: transparent;
}

.ntf-btn--accent {
  background: linear-gradient(180deg, var(--lo-yellow-bright) 0%, var(--lo-yellow) 100%);
  color: var(--lo-navy);
  border: 2px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 7px 0 rgba(180, 140, 0, 0.4), 0 10px 28px rgba(15, 47, 110, 0.18);
}

.ntf-btn--ghost {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-on-lo);
  border: 2px solid rgba(255, 216, 77, 0.65);
  font-size: 15px;
  padding: 14px;
}

.ntf-btn--after-match {
  margin-top: 14px;
}

.ntf-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ntf-btn--export {
  display: block;
  width: min(100%, 420px);
  margin: 0 auto 10px;
  font-size: 15px;
  padding: 14px;
}

.ntf-results-actions {
  display: flex;
  gap: 10px;
  align-items: stretch;
  justify-content: center;
  margin-top: 14px;
  padding: 0 4px;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.ntf-results-actions__btn,
.ntf-results-actions__form {
  flex: 1 1 0;
  min-width: 0;
}

.ntf-results-actions__btn {
  width: 100%;
}

.ntf-results-actions__form {
  display: flex;
}

.ntf-results-actions__input {
  width: 100%;
  margin: 0;
  text-align: center;
}

.ntf-results-error {
  margin-top: 10px;
}

.ntf-btn:active:not(:disabled) {
  transform: scale(var(--tap));
}

.ntf-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ntf-error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 77, 77, 0.2);
  border: 1px solid rgba(255, 120, 120, 0.55);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  text-align: center;
}

.ntf-loading {
  text-align: center;
  padding: 72px 16px 48px;
}

.ntf-loading__mascot {
  display: block;
  width: min(240px, 68vw);
  height: auto;
  margin: 0 auto 28px;
}

/* Twin reveal — NFTs stay fixed; rotating gold line sweeps the visible wedge */
@property --reveal-angle {
  syntax: "<angle>";
  initial-value: 42deg;
  inherits: false;
}

.ntf-reveal {
  margin: 0 auto 24px;
  max-width: min(92vw, 340px);
}

.ntf-reveal__frame {
  --ntf-reveal-size: min(88vw, 320px);
  position: relative;
  width: var(--ntf-reveal-size);
  height: var(--ntf-reveal-size);
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(165deg, var(--lo-yellow-bright), var(--lo-yellow));
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.45),
    0 16px 44px rgba(15, 47, 110, 0.35);
}

.ntf-reveal__merged {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.ntf-reveal__half {
  --reveal-angle: 42deg;
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
}

.ntf-reveal__half--a {
  -webkit-mask-image: conic-gradient(
    from var(--reveal-angle) at 50% 50%,
    #000 0deg,
    #000 180deg,
    transparent 180deg
  );
  mask-image: conic-gradient(
    from var(--reveal-angle) at 50% 50%,
    #000 0deg,
    #000 180deg,
    transparent 180deg
  );
}

.ntf-reveal__half--b {
  -webkit-mask-image: conic-gradient(
    from var(--reveal-angle) at 50% 50%,
    transparent 0deg,
    transparent 180deg,
    #000 180deg
  );
  mask-image: conic-gradient(
    from var(--reveal-angle) at 50% 50%,
    transparent 0deg,
    transparent 180deg,
    #000 180deg
  );
}

.ntf-reveal__lightning {
  --reveal-angle: 42deg;
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  width: min(14%, 56px);
  height: 155%;
  transform: translate(-50%, -50%) rotate(var(--reveal-angle)) scaleY(1.04);
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(255, 255, 255, 0.15) 15%,
    #fff 28%,
    #fef08a 50%,
    #fff 72%,
    rgba(255, 255, 255, 0.12) 85%,
    transparent 100%
  );
  filter: drop-shadow(0 0 10px #fef08a) drop-shadow(0 0 22px #fff)
    drop-shadow(0 0 36px rgba(250, 204, 21, 0.85));
}

.ntf-reveal__flash {
  position: absolute;
  inset: -8%;
  z-index: 5;
  border-radius: 24px;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

.ntf-reveal--active ~ .ntf-spinner {
  display: none;
}

.ntf-reveal--active .ntf-reveal__half--a,
.ntf-reveal--active .ntf-reveal__half--b,
.ntf-reveal--active .ntf-reveal__lightning {
  animation: ntf-reveal-angle var(--reveal-duration, 1.6s) linear forwards;
}

.ntf-reveal--active .ntf-reveal__lightning {
  opacity: 0.95;
  animation:
    ntf-reveal-angle var(--reveal-duration, 1.6s) linear forwards,
    ntf-reveal-glow 0.22s ease-in-out infinite alternate;
}

.ntf-reveal--active .ntf-reveal__frame {
  animation: ntf-reveal-pulse 0.55s ease-in-out infinite alternate;
}

.ntf-reveal--flash .ntf-reveal__flash {
  animation: ntf-reveal-flash 0.38s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes ntf-reveal-angle {
  from {
    --reveal-angle: 42deg;
  }
  to {
    --reveal-angle: 402deg;
  }
}

@keyframes ntf-reveal-glow {
  from {
    filter: drop-shadow(0 0 12px #fef08a) drop-shadow(0 0 26px #fff);
  }
  to {
    filter: drop-shadow(0 0 22px #fbbf24) drop-shadow(0 0 48px rgba(254, 240, 138, 0.95));
  }
}

@keyframes ntf-reveal-pulse {
  from {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.45);
  }
  to {
    box-shadow: inset 0 0 0 3px rgba(255, 221, 85, 0.75);
  }
}

@keyframes ntf-reveal-flash {
  0% {
    opacity: 0;
  }
  42% {
    opacity: 0.72;
  }
  100% {
    opacity: 0;
  }
}

.ntf-loading__msg {
  margin: 20px 0 0;
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--text-on-lo);
  letter-spacing: 0.04em;
  min-height: 1.5em;
}

.ntf-loading-bar {
  --progress: 0%;
  width: min(300px, 88vw);
  height: 12px;
  margin: 12px auto 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.4);
  box-shadow: inset 0 2px 6px rgba(15, 47, 110, 0.2);
  overflow: hidden;
}

.ntf-loading-bar__fill {
  display: block;
  height: 100%;
  width: var(--progress);
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    #e74c3c 0%,
    #f39c12 45%,
    #2ecc71 100%
  );
  box-shadow: 0 0 12px rgba(46, 204, 113, 0.45);
  transition: width 0.28s ease-out;
}

.ntf-spinner {
  width: 56px;
  height: 56px;
  margin: 0 auto;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--lo-yellow);
  animation: ntf-spin 0.9s linear infinite;
}

.ntf-spinner[hidden] {
  display: none;
}

@keyframes ntf-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Side-by-side hero: your NFT + #1 twin */
.ntf-duo-hero {
  margin-bottom: 18px;
  text-align: center;
}

.ntf-duo-hero__grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: stretch;
}

.ntf-duo-hero__vs {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  font-size: 1.6rem;
  font-weight: 1000;
  color: var(--lo-yellow);
  text-shadow: 0 2px 8px rgba(15, 47, 110, 0.45);
  line-height: 1;
}

.ntf-duo-hero__match {
  display: inline-block;
  margin: 14px auto 0;
  padding: 8px 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--lo-yellow-bright) 0%, var(--lo-yellow) 100%);
  border: 2px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 4px 0 rgba(180, 140, 0, 0.35);
  color: var(--lo-blue-primary);
  font-size: 0.95rem;
  font-weight: 1000;
  letter-spacing: 0.04em;
  text-align: center;
}

.ntf-duo-hero__summary {
  margin: 10px 0 0;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--muted-on-lo);
  letter-spacing: 0.02em;
}

.ntf-duo-card .ntf-nft-stage {
  border-radius: 14px;
}

.ntf-duo-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px;
  border-radius: var(--radius-md);
  background: linear-gradient(
    180deg,
    rgba(255, 236, 150, 0.96) 0%,
    rgba(255, 216, 77, 0.94) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 12px 32px rgba(15, 47, 110, 0.2);
}

.ntf-duo-card--accent {
  background: linear-gradient(180deg, rgba(255, 248, 210, 0.98) 0%, rgba(255, 228, 120, 0.96) 100%);
  box-shadow:
    0 12px 32px rgba(15, 47, 110, 0.22),
    0 0 0 2px rgba(255, 216, 77, 0.75);
}

.ntf-duo-card__label {
  margin-bottom: 6px;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 1000;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lo-navy);
}

.ntf-duo-card__meta {
  margin-top: 8px;
  text-align: center;
}

.ntf-duo-card__collection {
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--lo-navy);
  line-height: 1.2;
}

.ntf-duo-card__token {
  margin-top: 2px;
  font-size: 0.95rem;
  font-weight: 1000;
  color: rgba(15, 47, 110, 0.8);
}

.ntf-token-link {
  color: inherit;
  text-decoration: none;
}

.ntf-token-link:hover {
  color: var(--lo-blue-primary);
  text-decoration: underline;
}

.ntf-nft-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: linear-gradient(
    165deg,
    var(--lo-yellow-bright) 0%,
    var(--lo-yellow) 42%,
    rgba(255, 200, 60, 0.92) 100%
  );
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.ntf-nft-stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: var(--radius-lg);
}

.ntf-feature-meta {
  margin-top: 12px;
  text-align: center;
}

.ntf-feature-meta__collection {
  font-size: 1.35rem;
  font-weight: 1000;
  color: var(--lo-navy);
  letter-spacing: 0.02em;
}

.ntf-feature-meta__token {
  margin-top: 4px;
  font-size: 1rem;
  font-weight: 900;
  color: rgba(15, 47, 110, 0.75);
}

.ntf-compare-hint {
  margin: 16px 0 4px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted-on-lo);
  line-height: 1.4;
}

.ntf-section-title {
  margin: 16px 0 14px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 1000;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-on-lo);
}

.ntf-twin-list {
  display: grid;
  gap: 12px;
}

.ntf-twin-card {
  background: rgba(255, 255, 255, 0.94);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-soft);
  border: 2px solid rgba(255, 255, 255, 0.65);
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.ntf-twin-card--active {
  border-color: var(--lo-yellow);
  box-shadow:
    var(--shadow-soft),
    0 0 0 2px rgba(255, 216, 77, 0.45);
}

.ntf-twin-card__row {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}

.ntf-twin-card:active:not(:has(.ntf-why-toggle:active)) {
  transform: scale(0.99);
}

.ntf-twin-thumb {
  position: relative;
  flex: 0 0 104px;
  width: 104px;
  height: 104px;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(
    165deg,
    var(--lo-yellow-bright) 0%,
    var(--lo-yellow) 100%
  );
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.ntf-twin-rank {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 1;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(15, 47, 110, 0.82);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.ntf-twin-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ntf-twin-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.ntf-twin-score {
  font-size: 1.15rem;
  font-weight: 1000;
  color: var(--lo-blue-primary);
}

.ntf-twin-token {
  font-size: 0.9rem;
  font-weight: 900;
  color: var(--lo-navy);
  margin-top: 2px;
}

.ntf-twin-summary {
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(15, 47, 110, 0.65);
  line-height: 1.35;
}

.ntf-why-toggle {
  margin-top: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 999px;
  border: 2px solid rgba(30, 115, 255, 0.25);
  background: rgba(30, 115, 255, 0.08);
  color: var(--lo-blue-primary);
  font-weight: 900;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.ntf-why-panel {
  display: none;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(30, 115, 255, 0.06);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.7;
}

.ntf-why-panel.is-open {
  display: block;
}

.ntf-why-row--match {
  color: #1a8f4a;
}

.ntf-why-row--diff {
  color: #c0392b;
}

@media (max-width: 400px) {
  .ntf-duo-hero__grid {
    gap: 4px;
  }

  .ntf-duo-hero__vs {
    font-size: 1.2rem;
  }

  .ntf-duo-card {
    padding: 8px;
  }

  .ntf-twin-thumb {
    flex-basis: 88px;
    width: 88px;
    height: 88px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ntf-reveal--active .ntf-reveal__half--a,
  .ntf-reveal--active .ntf-reveal__half--b,
  .ntf-reveal--active .ntf-reveal__lightning,
  .ntf-reveal--active .ntf-reveal__frame,
  .ntf-reveal--flash .ntf-reveal__flash {
    animation: none !important;
  }
}
