:root {
  --ink: #1a2332;
  --muted: #5a6a7e;
  --line: rgba(26, 35, 50, 0.12);
  --surface: rgba(255, 255, 255, 0.72);
  --accent: #0d7a6f;
  --accent-deep: #085a52;
  --warn: #b45309;
  --code: #0b3d38;
  --glow: rgba(13, 122, 111, 0.18);
  --radius: 18px;
  --shadow: 0 24px 60px rgba(26, 35, 50, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
}

body {
  font-family: "Sora", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(13, 122, 111, 0.22), transparent 55%),
    radial-gradient(ellipse 60% 40% at 95% 10%, rgba(180, 140, 60, 0.16), transparent 50%),
    radial-gradient(ellipse 70% 50% at 50% 110%, rgba(13, 122, 111, 0.12), transparent 55%),
    linear-gradient(165deg, #f3f6f4 0%, #e8eee9 45%, #f7f4ee 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

body::after {
  content: "";
  position: fixed;
  width: 42vmax;
  height: 42vmax;
  left: -12vmax;
  top: -8vmax;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(13, 122, 111, 0.16), transparent 68%);
  pointer-events: none;
  animation: drift 18s ease-in-out infinite alternate;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  width: min(440px, calc(100% - 2rem));
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.5rem 0;
  animation: rise 0.75s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(18vw, 10vh) scale(1.15); }
}

@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 0 var(--glow); }
  50% { box-shadow: 0 0 0 10px transparent; }
}

@keyframes brand-in {
  from { opacity: 0; letter-spacing: 0.08em; transform: translateY(8px); }
  to { opacity: 1; letter-spacing: -0.03em; transform: translateY(0); }
}

@keyframes underline {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes code-pop {
  0% { opacity: 0.35; transform: translateY(6px) scale(0.96); filter: blur(2px); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

@keyframes check-pop {
  0% { transform: scale(0.92); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

header {
  margin-bottom: 1.75rem;
  animation: brand-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}

.brand {
  position: relative;
  display: inline-block;
  font-family: "Fraunces", serif;
  font-optical-sizing: auto;
  font-size: clamp(2.1rem, 6vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
}

.brand::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.35rem;
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), rgba(180, 140, 60, 0.55), transparent);
  transform-origin: left;
  animation: underline 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.35s both;
}

.panel {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.35rem 1.5rem;
  box-shadow: var(--shadow);
  transition:
    padding 0.35s ease,
    transform 0.35s ease,
    box-shadow 0.35s ease,
    border-color 0.35s ease;
}

.panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 28px 70px rgba(26, 35, 50, 0.14);
}

.panel.expanded {
  border-color: rgba(13, 122, 111, 0.22);
}

.panel:not(.expanded) {
  padding-bottom: 1.35rem;
}

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.55rem;
  max-height: 2rem;
  opacity: 1;
  overflow: hidden;
  transition: opacity 0.25s ease, max-height 0.3s ease, margin 0.3s ease;
}

.panel:not(.expanded) label {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
}

.field {
  position: relative;
}

.input-shell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.5rem 0.45rem 0.75rem;
  background: #eef1f4;
  border: 1px solid #e3e7ec;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(26, 35, 50, 0.04);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.input-shell:focus-within {
  border-color: rgba(13, 122, 111, 0.45);
  background: #eef5f3;
  box-shadow: 0 0 0 4px rgba(13, 122, 111, 0.12);
}

.input-icon {
  flex-shrink: 0;
  display: flex;
  color: #8b97a8;
  transition: color 0.25s ease, transform 0.25s ease;
}

.input-shell:focus-within .input-icon {
  color: var(--accent);
  transform: scale(1.06);
}

.input-icon svg {
  width: 22px;
  height: 22px;
}

.input-box {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: #fff;
  border: 1px solid #d5dbe3;
  border-radius: 10px;
  padding: 0 0.35rem 0 0.7rem;
  transition: border-color 0.25s ease;
}

.input-shell:focus-within .input-box {
  border-color: rgba(13, 122, 111, 0.35);
}

.input-box input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  padding: 0.7rem 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.88rem;
  color: var(--ink);
}

.input-box input::placeholder {
  color: #9aa8b8;
  font-family: "Sora", sans-serif;
  font-size: 0.88rem;
  transition: opacity 0.2s ease;
}

.input-box input:focus::placeholder {
  opacity: 0.45;
}

.clear {
  appearance: none;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #8b97a8;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.clear:hover {
  background: #f0f3f6;
  color: #5a6a7e;
  transform: rotate(90deg);
}

.clear svg {
  width: 16px;
  height: 16px;
}

.clear[hidden] {
  display: none;
}

.error {
  margin-top: 0.65rem;
  font-size: 0.85rem;
  color: #b91c1c;
}

.error:not(:empty) {
  animation: shake 0.35s ease;
}

.error:empty {
  display: none;
}

.result {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition:
    grid-template-rows 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.35s ease,
    margin-top 0.4s ease,
    padding-top 0.4s ease,
    border-color 0.35s ease;
  margin-top: 0;
  padding-top: 0;
  border-top: 1px solid transparent;
  pointer-events: none;
}

.result > .result-inner {
  overflow: hidden;
  min-height: 0;
}

.result.visible {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 1.35rem;
  padding-top: 1.35rem;
  border-top-color: var(--line);
  pointer-events: auto;
}

.result-inner {
  display: grid;
  gap: 1rem;
}

.meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.issuer {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  word-break: break-word;
}

.account {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.code-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.timer {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  transition: transform 0.3s ease;
}

.timer.urgent {
  animation: pulse-ring 1.2s ease-in-out infinite;
  border-radius: 50%;
}

.timer svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer circle {
  fill: none;
  stroke-width: 3.5;
}

.timer .track {
  stroke: rgba(13, 122, 111, 0.15);
}

.timer .progress {
  stroke: var(--accent);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.25s linear, stroke 0.25s ease;
}

.timer.urgent .progress {
  stroke: var(--warn);
}

.code-block {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.code {
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(1.85rem, 7vw, 2.35rem);
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--code);
  line-height: 1;
  animation: pulse-ring 2.4s ease-in-out infinite;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.25s ease;
}

.code.tick {
  animation: code-pop 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.code:hover {
  color: var(--accent-deep);
}

.code.urgent {
  color: var(--warn);
}

.copy {
  appearance: none;
  border: none;
  background: linear-gradient(160deg, #129285, var(--accent-deep));
  color: #fff;
  font-family: "Sora", sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(13, 122, 111, 0.22);
}

.copy:hover {
  background: linear-gradient(160deg, var(--accent), #064840);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(13, 122, 111, 0.28);
}

.copy:active {
  transform: scale(0.97);
}

.copy.copied {
  background: linear-gradient(160deg, #0f8a5f, #086b48);
  animation: check-pop 0.35s ease;
}

.remain {
  font-size: 0.82rem;
  color: var(--muted);
  transition: color 0.25s ease;
}

.remain strong {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: color 0.25s ease;
}

.remain.urgent strong {
  color: var(--warn);
}

@media (max-width: 420px) {
  .code-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .code-block {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
