* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { overflow-x: hidden; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #06040d;
  color: #e8e6f0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* ===== ANIMATED BACKGROUND ===== */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(120, 80, 220, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 80, 220, 0.05) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: gridMove 20s linear infinite;
  z-index: 0;
  pointer-events: none;
}

@keyframes gridMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(60px, 60px); }
}

/* Floating orbs */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}

.orb-1 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #7850dc, transparent 70%);
  top: -100px; left: -100px;
  animation: float1 15s ease-in-out infinite;
}

.orb-2 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, #d4af37, transparent 70%);
  bottom: -100px; right: -100px;
  animation: float2 18s ease-in-out infinite;
  opacity: 0.35;
}

.orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #b847ff, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: float3 22s ease-in-out infinite;
  opacity: 0.25;
}

@keyframes float1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(80px, 60px) scale(1.1); }
  66% { transform: translate(-40px, 100px) scale(0.95); }
}

@keyframes float2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-100px, -80px) scale(1.15); }
}

@keyframes float3 {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.25; }
  50% { transform: translate(-30%, -70%) scale(1.2); opacity: 0.4; }
}

.container {
  width: 100%;
  max-width: 820px;
  position: relative;
  z-index: 1;
  animation: cardEntry 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardEntry {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Rotating glow ring behind card */
.container::before {
  content: '';
  position: absolute;
  inset: -3px;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    #7850dc 90deg,
    #d4af37 180deg,
    #7850dc 270deg,
    transparent 360deg
  );
  border-radius: 28px;
  opacity: 0.5;
  filter: blur(14px);
  z-index: -1;
  animation: rotate 6s linear infinite;
}

@keyframes rotate {
  to { transform: rotate(360deg); }
}

.card {
  background: linear-gradient(160deg, rgba(22, 18, 31, 0.95) 0%, rgba(14, 10, 24, 0.98) 100%);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-radius: 26px;
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 30px 100px rgba(0, 0, 0, 0.6),
    0 10px 40px rgba(120, 80, 220, 0.25),
    0 0 80px rgba(212, 175, 55, 0.08);
  position: relative;
}

/* Shimmer top line */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #d4af37, #7850dc, #d4af37, transparent);
  animation: shimmerTop 4s linear infinite;
  z-index: 5;
}

@keyframes shimmerTop {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* ===== HEADER ===== */
.header {
  padding: 32px 40px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, #7850dc, #d4af37);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow:
    0 6px 24px rgba(120, 80, 220, 0.5),
    0 0 30px rgba(212, 175, 55, 0.25);
  position: relative;
  animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.logo::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 14px;
  background: linear-gradient(135deg, #7850dc, #d4af37);
  opacity: 0.5;
  filter: blur(8px);
  z-index: -1;
  animation: logoPulse 2.5s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.08); }
}

.brand-text h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #ffffff, #d4af37, #7850dc, #ffffff);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: textShimmer 5s ease-in-out infinite;
}

@keyframes textShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.brand-text p {
  font-size: 11px;
  color: #8a8499;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  margin-top: 3px;
  font-weight: 500;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 100px;
  font-size: 11px;
  color: #d4af37;
  font-weight: 700;
  letter-spacing: 1.2px;
  position: relative;
  overflow: hidden;
}

.status::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.2), transparent);
  animation: statusSweep 3s linear infinite;
}

@keyframes statusSweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.status-dot {
  width: 6px;
  height: 6px;
  background: #d4af37;
  border-radius: 50%;
  box-shadow: 0 0 10px #d4af37;
  animation: pulse 1.5s infinite;
  position: relative;
  z-index: 1;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* ===== TABS ===== */
.tabs {
  display: flex;
  padding: 22px 40px 0;
  gap: 10px;
  position: relative;
}

.tab {
  flex: 1;
  padding: 15px 20px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  color: #8a8499;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.2px;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.tab::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(120, 80, 220, 0.2), rgba(212, 175, 55, 0.1));
  opacity: 0;
  transition: opacity 0.3s;
}

.tab:hover {
  color: #c9c3d8;
  border-color: rgba(212, 175, 55, 0.25);
}

.tab:hover::before { opacity: 1; }

.tab.active {
  border-color: rgba(212, 175, 55, 0.5);
  color: #ffffff;
  box-shadow:
    0 0 30px rgba(120, 80, 220, 0.4),
    0 0 20px rgba(212, 175, 55, 0.2),
    inset 0 0 20px rgba(212, 175, 55, 0.05);
  transform: translateY(-1px);
}

.tab.active::before { opacity: 1; }

.tab span, .tab { position: relative; z-index: 1; }

/* ===== BODY ===== */
.body {
  padding: 28px 40px 32px;
}

.section {
  margin-bottom: 22px;
}

.label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: #8a8499;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
  font-weight: 700;
}

.label-badge {
  color: #d4af37;
  font-weight: 700;
  font-size: 10px;
  padding: 3px 10px;
  background: rgba(212, 175, 55, 0.08);
  border-radius: 100px;
  border: 1px solid rgba(212, 175, 55, 0.15);
}

.field {
  background: rgba(10, 8, 18, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 16px;
  padding: 18px 22px;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.field::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(135deg, #7850dc, #d4af37, #7850dc);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.35s;
  background-size: 200% 200%;
  animation: borderShift 3s linear infinite;
}

@keyframes borderShift {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.field:focus-within {
  background: rgba(10, 8, 18, 0.9);
  box-shadow:
    0 0 0 4px rgba(212, 175, 55, 0.06),
    0 0 40px rgba(120, 80, 220, 0.25);
  transform: translateY(-1px);
}

.field:focus-within::before { opacity: 1; }

textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: #e8e6f0;
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 15px;
  line-height: 1.7;
  resize: none;
  min-height: 100px;
  caret-color: #d4af37;
  position: relative;
  z-index: 1;
}

textarea::placeholder { color: #5a5468; }

/* Output */
.output {
  background: rgba(10, 8, 18, 0.7);
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-radius: 16px;
  padding: 18px 22px;
  min-height: 80px;
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 15px;
  line-height: 1.7;
  word-wrap: break-word;
  white-space: pre-wrap;
  position: relative;
  transition: all 0.35s;
  overflow: hidden;
}

.output.empty {
  color: #5a5468;
  font-style: italic;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
}

.output.has-result {
  border-color: rgba(212, 175, 55, 0.4);
  box-shadow:
    0 0 30px rgba(212, 175, 55, 0.15),
    inset 0 0 30px rgba(120, 80, 220, 0.06);
  animation: resultGlow 2s ease-out;
}

@keyframes resultGlow {
  0% {
    box-shadow:
      0 0 60px rgba(212, 175, 55, 0.6),
      inset 0 0 60px rgba(212, 175, 55, 0.2);
  }
  100% {
    box-shadow:
      0 0 30px rgba(212, 175, 55, 0.15),
      inset 0 0 30px rgba(120, 80, 220, 0.06);
  }
}

.output-value {
  background: linear-gradient(135deg, #d4af37, #f4d87a, #d4af37);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
  animation: goldShimmer 3s ease-in-out infinite;
}

@keyframes goldShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.cursor {
  display: inline-block;
  width: 2px;
  height: 16px;
  background: #d4af37;
  animation: blink 1.1s infinite;
  vertical-align: middle;
  box-shadow: 0 0 10px #d4af37;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ===== CONVERT BUTTON ===== */
.convert-btn {
  width: 100%;
  padding: 19px;
  background: linear-gradient(135deg, #7850dc 0%, #d4af37 100%);
  background-size: 200% 200%;
  color: #0a0812;
  border: none;
  border-radius: 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 3px;
  cursor: pointer;
  margin: 8px 0 26px;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    0 12px 36px rgba(120, 80, 220, 0.4),
    0 4px 15px rgba(212, 175, 55, 0.3),
    0 1px 0 rgba(255, 255, 255, 0.25) inset;
  position: relative;
  overflow: hidden;
  animation: btnBg 4s ease-in-out infinite;
}

@keyframes btnBg {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.convert-btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
  transition: left 0.7s;
}

.convert-btn:hover::before { left: 100%; }

.convert-btn:hover {
  transform: translateY(-3px);
  box-shadow:
    0 18px 48px rgba(120, 80, 220, 0.55),
    0 8px 24px rgba(212, 175, 55, 0.4),
    0 0 60px rgba(212, 175, 55, 0.25);
}

.convert-btn:active {
  transform: translateY(0) scale(0.99);
}

.convert-btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  transform: scale(0);
  animation: rippleAnim 0.6s ease-out;
  pointer-events: none;
}

@keyframes rippleAnim {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ===== ACTION BUTTONS ===== */
.actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.action-btn {
  flex: 1;
  padding: 15px;
  background: rgba(255, 255, 255, 0.03);
  color: #a8a2b8;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.action-btn:hover {
  color: #d4af37;
  border-color: rgba(212, 175, 55, 0.5);
  background: rgba(212, 175, 55, 0.06);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(212, 175, 55, 0.15);
}

.action-btn:active {
  transform: translateY(0) scale(0.97);
}

/* ===== FOOTER ===== */
.footer {
  padding: 18px 40px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #5a5468;
  letter-spacing: 1.2px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.footer-left .dot {
  width: 6px; height: 6px;
  background: #d4af37;
  border-radius: 50%;
  box-shadow: 0 0 10px #d4af37;
  animation: pulse 1.8s infinite;
}

.footer-right {
  font-family: 'SF Mono', monospace;
  color: #8a8499;
  transition: color 0.3s;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 14px 28px;
  background: linear-gradient(135deg, #7850dc, #d4af37);
  color: #0a0812;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.5px;
  box-shadow: 0 20px 50px rgba(120, 80, 220, 0.5);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Responsive */
@media (max-width: 640px) {
  body { padding: 12px; }
  .header { padding: 24px 24px 18px; }
  .tabs { padding: 18px 24px 0; }
  .body { padding: 22px 24px 26px; }
  .footer { padding: 14px 24px; }
  .brand-text h1 { font-size: 16px; }
  .logo { width: 40px; height: 40px; font-size: 19px; }
  textarea, .output { font-size: 14px; }
  .convert-btn { font-size: 12px; letter-spacing: 2px; padding: 17px; }
  .tab { font-size: 12px; padding: 13px; }
  .orb-1, .orb-2 { filter: blur(60px); }
}

@media (max-width: 400px) {
  .status span:last-child { display: none; }
}