:root {
  --bg-color: #050505;
  --text-color: #e0e0e0;
  --accent-color: #7b2cbf; /* Deep purple */
  --accent-hover: #9d4edd;
  --secondary-color: #240046;
  --input-bg: #101010;
  --input-border: #333;
  --card-bg: rgba(255, 255, 255, 0.05);
  --border-radius: 12px;
  --font-heading: "Cormorant Garamond", serif;
  --font-body: "Montserrat", sans-serif;
  --transition-speed: 0.2s;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-body);
  line-height: 1.6;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.app-container {
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

header {
  text-align: center;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.contract-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.4rem 1rem;
  border-radius: 50px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9rem;
  width: fit-content;
  max-width: 90vw;
}

.contract-label {
  color: var(--accent-color);
  font-weight: 700;
}

.contract-address {
  font-family: monospace;
  color: #ccc;
  user-select: all;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.btn-icon {
  background: transparent;
  border: none;
  color: #a0a0a0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
}

.btn-icon:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.logo {
  font-size: 4rem;
  font-weight: 500;
  font-family: var(--font-heading);
  /* color: #ffffff; */
  background: linear-gradient(135deg, #fff, #aaa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0px;
}

.hero {
  text-align: center;
  margin-bottom: 1rem;
}

.hero h2 {
  font-size: 1.2rem;
  font-weight: 400;
  color: #a0a0a0;
}

.input-section {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--card-bg);
  padding: 2rem;
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin: 0 auto;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

input[type="text"] {
  width: 100%;
  padding: 1rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--border-radius);
  color: white;
  font-size: 1rem;
  transition: border-color var(--transition-speed);
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-color);
}

.error-message {
  color: #ff4d4d;
  font-size: 0.85rem;
  height: 1.2rem; /* Reserve space */
}

.button-group {
  display: flex;
  gap: 1rem;
}

.btn {
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-speed);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--accent-color),
    var(--secondary-color)
  );
  color: white;
  flex: 2;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(123, 44, 191, 0.3);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--input-border);
  color: #a0a0a0;
  flex: 1;
}

.btn-secondary:hover {
  border-color: #fff;
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e0e0e0;
  font-size: 0.9rem;
  padding: 0.6rem 1rem;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Loading Indicator */
.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top-color: var(--accent-color);
  animation: spin 1s ease-in-out infinite;
}

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

/* Result Area */
.result-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  animation: fadeIn 0.5s ease-out;
  margin-top: 3rem;
}

#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  opacity: 0.8;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.canvas-container {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.details-card {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
}

.details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.constellation-name {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-heading);
  color: white;
  letter-spacing: 1px;
}

.rarity-badge {
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  color: #ccc;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.rarity-common {
  background: rgba(150, 150, 150, 0.2);
  color: #ccc;
}
.rarity-uncommon {
  background: rgba(46, 204, 113, 0.2);
  color: #2ecc71;
}
.rarity-rare {
  background: rgba(52, 152, 219, 0.2);
  color: #3498db;
}
.rarity-legendary {
  background: linear-gradient(135deg, #f1c40f, #e67e22);
  color: #000;
  border: none;
}

.display-username {
  color: #a0a0a0;
  font-family: monospace;
  font-size: 1.1rem;
}

.actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.toast {
  position: absolute;
  bottom: -50px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}

.toast.visible {
  bottom: 20px;
  opacity: 1;
}

.hidden {
  display: none !important;
}

footer {
  margin-top: auto;
  color: #555;
  font-size: 0.8rem;
  text-align: center;
  padding-bottom: 1rem;
}

@media (max-width: 600px) {
  .logo {
    font-size: 2.5rem;
  }
  .button-group {
    flex-direction: column;
  }
  .btn-primary,
  .btn-secondary {
    width: 100%;
  }
  .actions {
    flex-direction: column;
  }
  .actions button {
    width: 100%;
  }
}
