/* Reset & base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --color-primary: #ffd700;
  --color-accent: #ff6600;
  --color-text-light: #ccc;
  --color-text-dark: #fff;
  --color-background-dark: #0a0a0a;
  --color-panel-background: rgba(0, 0, 0, 0.85);
  --color-input-background: #222;
  --color-border-dark: #555;
  --color-disabled-bg: #333;
  --color-disabled-text: #888;
  --color-popup-bg: #111;

  --font-family-rajdhani: 'Rajdhani', sans-serif;
  --font-family-orbitron: 'Orbitron', monospace;
  --font-family-mono: 'Courier New', monospace;

  --shadow-panel: 0 0 30px rgba(255, 215, 0, 0.3);
  --shadow-button: 0 0 15px rgba(255, 102, 0, 0.5);
  --shadow-button-hover: 0 5px 20px rgba(255, 102, 0, 0.7);
  --shadow-popup: 0 8px 30px rgba(0,0,0,0.3);

  --spacing-unit: 1rem;
}

body {
  font-family: var(--font-family-rajdhani);
  background: var(--color-background-dark);
  min-height: 100vh;
  color: var(--color-text-dark);
  position: relative; 
}

.container {
  position: relative;
  width: 100%;
  min-height: 100vh;
}

.background-scene {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: url('BgD.png');
  background-size: cover;
  background-position: left center;
  background-repeat: no-repeat;
  z-index: 0;
}

@media (max-width: 768px) {
  .background-scene {
    background-image: url('BgM.png');
    background-size: cover;
    background-position: center center;
    left: 0;
  }
}

.main-wrapper {
  position: fixed;
  z-index: 10;
  box-sizing: border-box;
  padding: 1rem;
  left: 9.7vw;
  top: 30vh;
  width: 35vw;
  max-width: 340px;
  height: auto;
  max-height: 80vh;
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch; 
}

.main-wrapper::-webkit-scrollbar {
  display: none;
}

@media (max-width: 768px) {
  .main-wrapper {
    position: fixed;
    left: 46.3%;
    transform: translateX(-50%);
    top: 35vh;
    width: 49%;
    max-width: 400px;
    height: auto;
    max-height: 43vh;
    margin: 0;
    padding: 1px; 
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch; 
  }
  .main-wrapper::-webkit-scrollbar {
    display: none;
  }
}

info-panel {
  border: 2px solid var(--color-primary);
  border-radius: 10px;
  width: 100%;
  box-shadow: var(--shadow-panel);
  padding: clamp(1.2rem, 4vw, 2rem); 
  display: flex;
  flex-direction: column;
  justify-content: space-between; 
  gap: clamp(0.5rem, 1.5vh, 1rem); 
}

.total-raised {
  text-align: center;
  margin-bottom: clamp(0.5rem, 1.5vw, 1rem);
  font-size: clamp(0.9rem, 2.5vw, 1.2rem);   
}

.label {
  color: var(--color-text-light);
  font-size: clamp(0.7rem, 2.2vw, 1rem);
}

.amount .number {
  color: var(--color-accent);
  font-family: var(--font-family-orbitron);
  font-size: clamp(1.4rem, 4.5vw, 2.2rem);
  font-weight: 700;
}

.amount .currency {
  color: var(--color-text-dark);
  font-size: clamp(1rem, 3.2vw, 1.3rem);
  margin-left: 0.5rem;
}

.instructions {
  color: var(--color-text-light);
  font-size: clamp(0.7rem, 2.2vw, 0.95rem);  
  margin-bottom: clamp(0.4rem, 1vw, 0.7rem); 
}

.input-row {
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.5vw, 12px); 
  margin-bottom: clamp(0.6rem, 2vw, 1rem); 
}
.input-row input[type="number"] {
  padding: clamp(0.5rem, 2vw, 0.75rem);
  border-radius: 6px;
  font-size: clamp(0.8rem, 2.5vw, 1rem);
  border: 1px solid #888;
  background: var(--color-input-background);
  color: var(--color-text-dark);
}
.input-row input[type="number"]:hover {
  border-color: var(--color-primary);
}
.input-row input[type="number"]::placeholder {
  color: #999;
  opacity: 1;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

#buyBtn, #connectBtn {
  background: linear-gradient(45deg, var(--color-accent), #ff8c00);
  color: var(--color-text-dark);
  font-family: var(--font-family-orbitron);
  font-weight: 700;
  font-size: clamp(0.7rem, 2.5vw, 1rem);
  padding: clamp(0.5rem, 2vw, 0.75rem) clamp(0.8rem, 3vw, 1.5rem);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-button);
}
#buyBtn:hover, #connectBtn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-button-hover);
}
#buyBtn:disabled, #connectBtn:disabled {
  background: var(--color-disabled-bg);
  color: var(--color-disabled-text);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  opacity: 0.7;
}

#contributeLimits {
  font-size: clamp(0.6rem, 2vw, 0.8rem);
  color: #bbb;
  text-align: center;
  margin-top: 0;
}

.manual-section {
  margin: 0;
}
.manual-label {
  color: var(--color-text-light);
  font-size: clamp(0.65rem, 2.2vw, 0.875rem);
  margin-bottom: clamp(0.2rem, 1vw, 0.5rem);
}
.wallet-address {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-dark);
  font-family: var(--font-family-mono);
  font-size: clamp(0.6rem, 2vw, 0.8rem);
  padding: clamp(0.4rem, 1.5vw, 0.6rem);
  border-radius: 5px;
  border: 1px solid var(--color-border-dark);
  word-break: break-word;
}
.manual-copy-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.copy-btn {
  background-color: transparent;
  border: none;
  color: var(--color-primary);
  cursor: pointer;
  padding: 0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.copy-btn:hover {
  background-color: rgba(255, 255, 255, 0.08);
  transform: scale(1.1);
}

.copy-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #111;
  color: var(--color-text-dark);
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  border: 1px solid var(--color-primary);
  font-size: 0.875rem;
  font-family: var(--font-family-rajdhani);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 9999;
}
.copy-toast.show {
  opacity: 1;
}

.countdown {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: clamp(0.3rem, 1.5vw, 0.7rem);
  border-top: 1px solid var(--color-border-dark);
  padding-top: clamp(0.5rem, 2vw, 1rem);
  margin-top: clamp(0.8rem, 2.5vw, 1.5rem);
  flex-shrink: 1;
  min-height: 0;
}
.time-unit {
  text-align: center;
  min-width: 0;
  flex-basis: 22%;
  flex-grow: 1;
  flex-shrink: 1;
}
.time-unit .number {
  color: var(--color-primary);
  font-family: var(--font-family-orbitron);
  font-size: clamp(1rem, 4vw, 1.4rem);
  font-weight: bold;
}
.time-unit .label {
  color: var(--color-text-light);
  font-size: clamp(0.5rem, 1.8vw, 0.7rem);
  margin-top: 0.3rem;
}

.popup-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease, visibility 0s 0.3s;
}
.popup-overlay.show {
  visibility: visible;
  opacity: 1;
  transition-delay: 0s;
}

.popup-box {
  background: var(--color-popup-bg);
  color: var(--color-text-dark);
  padding: clamp(15px, 4vw, 20px) clamp(20px, 6vw, 30px);
  border-radius: 12px;
  text-align: center;
  max-width: 350px;
  width: 90%;
  box-shadow: var(--shadow-popup);
  animation: popupFade 0.3s ease-out;
}
.popup-box h3 {
  margin-bottom: clamp(5px, 2vw, 10px);
  font-family: var(--font-family-orbitron);
  color: var(--color-primary);
  font-size: clamp(1.2rem, 4vw, 1.5rem);
}
.popup-box p {
  margin-bottom: clamp(10px, 3vw, 15px);
  font-size: clamp(0.85rem, 3vw, 0.95rem);
}
.popup-box button {
  margin-top: clamp(10px, 3vw, 15px);
  background-color: var(--color-primary);
  color: #000;
  border: none;
  padding: clamp(8px, 2.5vw, 10px) clamp(15px, 4vw, 18px);
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.popup-box button:hover {
  background-color: #e6c200;
  transform: translateY(-1px);
}

@keyframes popupFade {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@media screen and (min-width: 1264px) and (max-width: 1300px) and (min-height: 790px) and (max-height: 820px) {
  body {
    transform: scale(0.67);
    transform-origin: top left;
  }
}