.nftl-game {
  --nftl-bg: #080d18;
  --nftl-panel: #101827;
  --nftl-panel-2: #172236;
  --nftl-line: rgba(205, 222, 255, 0.14);
  --nftl-text: #f3f7ff;
  --nftl-muted: #8d9bb5;
  --nftl-mint: #53f5c5;
  --nftl-purple: #8a6cff;
  --nftl-yellow: #ffd45c;
  --nftl-red: #ff5c7e;
  width: 100%;
  margin: 32px auto;
  color: var(--nftl-text);
  font-family: Pretendard, "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

.nftl-game,
.nftl-game * {
  box-sizing: border-box;
}

.nftl-game button,
.nftl-game select {
  font: inherit;
}

.nftl-shell {
  position: relative;
  max-width: 920px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--nftl-line);
  border-radius: 30px;
  background:
    radial-gradient(circle at 14% -10%, rgba(83, 245, 197, 0.16), transparent 34%),
    radial-gradient(circle at 95% 10%, rgba(138, 108, 255, 0.18), transparent 36%),
    var(--nftl-bg);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.38);
}

.nftl-shell::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 34px 34px;
  content: "";
  mask-image: linear-gradient(to bottom, #000, transparent 70%);
}

.nftl-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 34px 22px;
  border-bottom: 1px solid var(--nftl-line);
}

.nftl-kicker {
  margin: 0 0 4px !important;
  color: var(--nftl-mint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
}

.nftl-header h2 {
  margin: 0 !important;
  color: var(--nftl-text) !important;
  font-size: clamp(27px, 4vw, 42px) !important;
  font-weight: 900 !important;
  letter-spacing: -0.055em;
  line-height: 1.05 !important;
}

.nftl-wallet {
  display: flex;
  min-width: 300px;
  overflow: hidden;
  border: 1px solid var(--nftl-line);
  border-radius: 16px;
  background: rgba(13, 21, 36, 0.84);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
}

.nftl-wallet > div {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
}

.nftl-wallet > div + div {
  border-left: 1px solid var(--nftl-line);
}

.nftl-wallet span,
.nftl-wallet strong {
  display: block;
}

.nftl-wallet span {
  margin-bottom: 3px;
  color: var(--nftl-muted);
  font-size: 11px;
  font-weight: 700;
}

.nftl-wallet strong {
  overflow: hidden;
  color: var(--nftl-text);
  font-size: 17px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nftl-machine {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) 58px minmax(0, 1.18fr);
  align-items: center;
  gap: 18px;
  padding: 38px 48px 34px;
}

.nftl-machine-glow {
  position: absolute;
  top: 44%;
  left: 50%;
  width: 330px;
  height: 330px;
  border-radius: 50%;
  background: rgba(83, 245, 197, 0.07);
  filter: blur(70px);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.nftl-reference-section,
.nftl-result-section {
  position: relative;
  z-index: 2;
  min-width: 0;
}

.nftl-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 13px !important;
  color: #b9c5da;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.nftl-section-label span {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid rgba(83, 245, 197, 0.35);
  border-radius: 8px;
  color: var(--nftl-mint);
  font-size: 10px;
}

.nftl-reference-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--nftl-line);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(30, 43, 65, 0.94), rgba(13, 21, 34, 0.96));
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
}

.nftl-reference-card::after {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(83, 245, 197, 0.14);
  border-radius: inherit;
  pointer-events: none;
  content: "";
}

.nftl-reference-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  background: var(--nftl-panel-2);
  object-fit: cover;
}

.nftl-reference-card > div {
  padding: 14px 16px 16px;
}

.nftl-reference-card span,
.nftl-reference-card strong {
  display: block;
}

.nftl-reference-card span {
  margin-bottom: 3px;
  color: var(--nftl-mint);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.nftl-reference-card strong {
  overflow: hidden;
  color: var(--nftl-text);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nftl-flow-line {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 58px;
  margin-top: 30px;
}

.nftl-flow-line::before {
  position: absolute;
  top: 50%;
  right: 3px;
  left: 3px;
  height: 1px;
  background: linear-gradient(90deg, rgba(83, 245, 197, 0.25), rgba(138, 108, 255, 0.7));
  content: "";
}

.nftl-flow-line i {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--nftl-mint);
  box-shadow: 0 0 12px rgba(83, 245, 197, 0.65);
}

.nftl-flow-line i:nth-child(2) { opacity: 0.65; }
.nftl-flow-line i:nth-child(3) { background: var(--nftl-purple); }

.nftl-result-card {
  position: relative;
  width: min(100%, 350px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(138, 108, 255, 0.35);
  border-radius: 24px;
  aspect-ratio: 1;
  background: var(--nftl-panel-2);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.36), 0 0 0 6px rgba(138, 108, 255, 0.04);
  isolation: isolate;
}

.nftl-result-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nftl-result-card canvas {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.nftl-result-card.is-win {
  border-color: var(--nftl-mint);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.36), 0 0 34px rgba(83, 245, 197, 0.28);
  animation: nftl-win-pop 0.58s cubic-bezier(0.2, 1.45, 0.4, 1) both;
}

.nftl-result-card.is-loss {
  border-color: rgba(255, 255, 255, 0.2);
  filter: saturate(0.62);
}

.nftl-scan-beam {
  position: absolute;
  z-index: 4;
  top: -18%;
  right: 0;
  left: 0;
  height: 17%;
  opacity: 0;
  background: linear-gradient(to bottom, transparent, rgba(83, 245, 197, 0.66), transparent);
  filter: blur(2px);
  pointer-events: none;
}

.nftl-game.is-revealing .nftl-scan-beam {
  opacity: 1;
  animation: nftl-scan 1s linear infinite;
}

.nftl-game.is-revealing .nftl-result-card {
  animation: nftl-machine-pulse 0.42s ease-in-out infinite alternate;
}

.nftl-result-stamp {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: 50%;
  padding: 9px 15px;
  opacity: 0;
  border: 4px solid currentColor;
  border-radius: 9px;
  font-size: clamp(19px, 5vw, 30px);
  font-weight: 950;
  letter-spacing: 0.03em;
  line-height: 1;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-8deg) scale(1.5);
}

.nftl-result-stamp.is-win,
.nftl-result-stamp.is-loss {
  opacity: 1;
  animation: nftl-stamp 0.4s cubic-bezier(0.16, 1.3, 0.4, 1) both;
}

.nftl-result-stamp.is-win {
  color: #071c16;
  border-color: var(--nftl-mint);
  background: rgba(83, 245, 197, 0.92);
  box-shadow: 0 0 28px rgba(83, 245, 197, 0.55);
}

.nftl-result-stamp.is-loss {
  color: #f2f5fb;
  border-color: rgba(242, 245, 251, 0.8);
  background: rgba(17, 24, 39, 0.78);
}

.nftl-status {
  min-height: 48px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--nftl-line);
  border-radius: 14px;
  background: rgba(12, 19, 32, 0.84);
  color: #c3cde0;
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

.nftl-status[data-state="loading"] { color: var(--nftl-yellow); }
.nftl-status[data-state="win"] { color: var(--nftl-mint); border-color: rgba(83, 245, 197, 0.28); }
.nftl-status[data-state="loss"] { color: #c3cde0; }
.nftl-status[data-state="error"] { color: #ff94aa; border-color: rgba(255, 92, 126, 0.3); }

.nftl-burst {
  position: absolute;
  z-index: 10;
  top: 56%;
  left: 50%;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.nftl-burst i {
  position: absolute;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  animation: nftl-particle 1.3s var(--delay) cubic-bezier(0.12, 0.62, 0.27, 1) both;
}

.nftl-controls {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(260px, 1.2fr);
  gap: 14px;
  padding: 24px 34px 30px;
  border-top: 1px solid var(--nftl-line);
  background: rgba(8, 13, 24, 0.7);
}

.nftl-buy-row {
  display: flex;
  align-items: flex-end;
  gap: 9px;
}

.nftl-buy-row label {
  flex: 1;
}

.nftl-buy-row label > span {
  display: block;
  margin: 0 0 7px;
  color: var(--nftl-muted);
  font-size: 11px;
  font-weight: 750;
}

.nftl-buy-row select {
  width: 100%;
  min-height: 51px;
  margin: 0;
  padding: 0 38px 0 14px;
  border: 1px solid var(--nftl-line);
  border-radius: 13px;
  color: var(--nftl-text);
  background-color: var(--nftl-panel);
  box-shadow: none;
  cursor: pointer;
}

.nftl-button {
  min-height: 51px;
  margin: 0 !important;
  padding: 0 19px !important;
  border: 0 !important;
  border-radius: 13px !important;
  box-shadow: none !important;
  cursor: pointer;
  transition: transform 0.18s ease, filter 0.18s ease, opacity 0.18s ease;
}

.nftl-button:not(:disabled):hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
}

.nftl-button:not(:disabled):active {
  transform: translateY(0);
}

.nftl-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.6);
  opacity: 0.48;
}

.nftl-button-secondary {
  color: #dce5f5 !important;
  background: #202c42 !important;
  font-size: 13px !important;
  font-weight: 800 !important;
}

.nftl-button-primary {
  display: flex !important;
  min-height: 78px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #061b15 !important;
  background: linear-gradient(135deg, var(--nftl-mint), #91ffe0) !important;
  box-shadow: 0 12px 30px rgba(83, 245, 197, 0.15) !important;
}

.nftl-button-primary span {
  font-size: 18px;
  font-weight: 950;
  letter-spacing: -0.02em;
}

.nftl-button-primary small {
  margin-top: 2px;
  color: rgba(6, 27, 21, 0.66);
  font-size: 10px;
  font-weight: 800;
}

.nftl-price {
  grid-column: 1 / -1;
  margin: -4px 0 0 !important;
  color: var(--nftl-muted);
  font-size: 11px;
  text-align: center;
}

.nftl-notice {
  grid-column: 1 / -1;
  margin: 0;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

.nftl-notice[hidden] { display: none; }
.nftl-notice.is-error { color: #ffb2c1; border-color: rgba(255, 92, 126, 0.28); background: rgba(255, 92, 126, 0.08); }
.nftl-notice.is-success { color: #a6ffe4; border-color: rgba(83, 245, 197, 0.28); background: rgba(83, 245, 197, 0.08); }

.nftl-history-panel {
  position: relative;
  z-index: 2;
  padding: 0 34px 32px;
}

.nftl-history-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.nftl-history-title strong {
  font-size: 13px;
}

.nftl-history-title span {
  color: var(--nftl-muted);
  font-size: 10px;
}

.nftl-history-panel ul {
  display: grid;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid var(--nftl-line);
  border-radius: 14px;
  list-style: none !important;
  background: rgba(13, 21, 36, 0.72);
}

.nftl-history-panel li {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 12px;
  align-items: center;
  margin: 0 !important;
  padding: 11px 14px;
  border-bottom: 1px solid var(--nftl-line);
  font-size: 11px;
}

.nftl-history-panel li:last-child { border-bottom: 0; }
.nftl-history-panel li::before { display: none !important; }
.nftl-history-panel li strong { color: #dce5f5; }
.nftl-history-panel li.is-win strong,
.nftl-history-panel li.is-win span { color: var(--nftl-mint); }
.nftl-history-panel li > span { color: var(--nftl-muted); }
.nftl-history-panel time { color: #66758e; }

.nftl-history-panel .nftl-history-empty {
  display: block;
  color: var(--nftl-muted);
  text-align: center;
}

.nftl-game.is-busy .nftl-button-primary span::after {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: 2px;
  content: "";
  animation: nftl-spin 0.7s linear infinite;
}

@keyframes nftl-scan {
  from { transform: translateY(0); }
  to { transform: translateY(700%); }
}

@keyframes nftl-machine-pulse {
  from { transform: translateX(-1px) scale(0.995); }
  to { transform: translateX(1px) scale(1.005); }
}

@keyframes nftl-stamp {
  from { opacity: 0; transform: translate(-50%, -50%) rotate(-8deg) scale(1.5); }
  to { opacity: 1; transform: translate(-50%, -50%) rotate(-8deg) scale(1); }
}

@keyframes nftl-win-pop {
  0% { transform: scale(0.96); }
  65% { transform: scale(1.035); }
  100% { transform: scale(1); }
}

@keyframes nftl-particle {
  0% { opacity: 0; transform: translate(0, 0) rotate(0) scale(0.4); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(1); }
}

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

@media (max-width: 760px) {
  .nftl-shell { border-radius: 22px; }

  .nftl-header {
    align-items: stretch;
    flex-direction: column;
    padding: 24px 20px 20px;
  }

  .nftl-wallet { min-width: 0; }

  .nftl-machine {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding: 28px 20px;
  }

  .nftl-reference-card {
    display: grid;
    grid-template-columns: 116px minmax(0, 1fr);
    align-items: center;
  }

  .nftl-reference-card img {
    width: 116px;
    height: 116px;
    aspect-ratio: auto;
  }

  .nftl-flow-line {
    width: 1px;
    height: 34px;
    margin: -4px auto;
    flex-direction: column;
  }

  .nftl-flow-line::before {
    top: 3px;
    right: auto;
    bottom: 3px;
    left: 50%;
    width: 1px;
    height: auto;
    background: linear-gradient(180deg, rgba(83, 245, 197, 0.25), rgba(138, 108, 255, 0.7));
  }

  .nftl-flow-line i { width: 6px; height: 6px; }
  .nftl-result-card { max-width: 340px; }

  .nftl-controls {
    grid-template-columns: 1fr;
    padding: 22px 20px 26px;
  }

  .nftl-button-primary { min-height: 72px; }
  .nftl-price,
  .nftl-notice { grid-column: 1; }
  .nftl-history-panel { padding: 0 20px 26px; }

  .nftl-history-panel li {
    grid-template-columns: 90px 1fr;
  }

  .nftl-history-panel time {
    display: none;
  }
}

@media (max-width: 430px) {
  .nftl-game { margin: 18px auto; }
  .nftl-header { padding: 20px 16px 16px; }
  .nftl-wallet strong { font-size: 15px; }
  .nftl-machine { padding: 24px 16px; }
  .nftl-controls { padding: 20px 16px 24px; }
  .nftl-buy-row { align-items: stretch; flex-direction: column; }
  .nftl-buy-row label > span { margin-bottom: 5px; }
  .nftl-button-secondary { width: 100%; }
  .nftl-history-panel { padding: 0 16px 22px; }
  .nftl-history-title { align-items: flex-start; flex-direction: column; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .nftl-game *,
  .nftl-game *::before,
  .nftl-game *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

