/* Shared styles for all pages to ensure consistent layout */



/* Prevent layout shift/flicker on load */
html, body {
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}
html.loaded, body.loaded {
  opacity: 1;
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  margin: 0;
  padding: 80px 0 0 0;
  background: #000000;
  min-height: 100vh;
  color: #e0e0e0;
  overflow-x: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
}

.header-controls {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(247, 147, 26, 0.1);
}

.app-title {
  color: white;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.5px;
}

.header-controls.center-only {
  justify-content: flex-end;
}

.header, .header-section {
  text-align: center;
  padding: 80px 20px 40px 20px;
  margin-bottom: 30px;
}

.back-btn {
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%),
    rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  color: #e8e8e8;
  text-decoration: none;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 16px;
  font-weight: 500;
  width: 36px;
  height: 36px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}

.back-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.back-btn:hover {
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 100%),
    rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.25);
  text-decoration: none;
  color: #f5f5f5;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.back-btn:hover::before {
  opacity: 1;
}

.language-toggle {
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%),
    rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  color: #e8e8e8;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 12px;
  font-weight: 500;
  width: 36px;
  height: 36px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.language-toggle::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.language-toggle:hover {
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 100%),
    rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.25);
  text-decoration: none;
  color: #f5f5f5;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.language-toggle:hover::before {
  opacity: 1;
}

.title {
  font-size: 2.5rem;
  font-weight: bold;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  margin: 0;
}

.subtitle {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
}

.glass-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.02) 100%);
  backdrop-filter: blur(15px) saturate(1.2);
  -webkit-backdrop-filter: blur(15px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 30px;
  margin-bottom: 25px;
  box-shadow: 
    0 4px 16px rgba(0,0,0,0.08),
    0 1px 2px rgba(0,0,0,0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
  pointer-events: none;
}

.content-section {
  max-width: 1200px;
  margin: 0 auto 25px auto;
  padding: 0 20px;
}

.input-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.input-field {
  width: 100%;
  max-width: 600px;
  min-width: 300px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(15px) saturate(1.2);
  -webkit-backdrop-filter: blur(15px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  color: #e0e0e0;
  font-size: 15px;
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    0 4px 16px rgba(0,0,0,0.08),
    0 1px 2px rgba(0,0,0,0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
  position: relative;
}

.input-field:focus {
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 
    0 0 0 3px rgba(255, 255, 255, 0.1),
    0 12px 40px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px) scale(1.02);
}

.input-field::placeholder {
  color: #888;
  font-size: 15px;
}

.is-hidden {
  display: none;
}

.text-center {
  text-align: center;
}

@keyframes glassShimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.btn {
  --btn-accent: 255 255 255;
  --btn-accent-2: 255 255 255;
  --btn-text: #e8e8e8;
  --btn-pad: 12px 20px;
  --btn-font: 15px;
  --btn-radius: 14px;
  --btn-radial: 0.12;
  --btn-grad-1: 0.08;
  --btn-grad-2: 0.06;
  --btn-border: 0.2;
  --btn-radial-hover: 0.18;
  --btn-grad-1-hover: 0.12;
  --btn-grad-2-hover: 0.1;
  --btn-border-hover: 0.35;
  --btn-overlay-radial: 0.15;
  --btn-overlay-1: 0.1;
  --btn-overlay-2: 0.08;
  padding: var(--btn-pad);
  background: 
    radial-gradient(circle at 50% 0%, rgba(var(--btn-accent), var(--btn-radial)) 0%, transparent 50%),
    linear-gradient(135deg, rgba(var(--btn-accent-2), var(--btn-grad-1)) 0%, rgba(var(--btn-accent), var(--btn-grad-2)) 100%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%),
    rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  color: var(--btn-text);
  border: 1px solid rgba(var(--btn-accent), var(--btn-border));
  border-radius: var(--btn-radius);
  font-size: var(--btn-font);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.2px;
  box-shadow: 
    0 8px 32px rgba(var(--btn-accent), 0.08),
    0 1px 2px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(var(--btn-accent), 0.05);
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 50% 0%, rgba(var(--btn-accent), var(--btn-overlay-radial)) 0%, transparent 50%),
    linear-gradient(135deg, rgba(var(--btn-accent-2), var(--btn-overlay-1)) 0%, rgba(var(--btn-accent), var(--btn-overlay-2)) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: inherit;
}

.btn:hover {
  transform: translateY(-2px) scale(1.02);
  background: 
    radial-gradient(circle at 50% 0%, rgba(var(--btn-accent), var(--btn-radial-hover)) 0%, transparent 50%),
    linear-gradient(135deg, rgba(var(--btn-accent-2), var(--btn-grad-1-hover)) 0%, rgba(var(--btn-accent), var(--btn-grad-2-hover)) 100%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 100%),
    rgba(255, 255, 255, 0.05);
  border-color: rgba(var(--btn-accent), var(--btn-border-hover));
  backdrop-filter: blur(25px) saturate(2.2);
  -webkit-backdrop-filter: blur(25px) saturate(2.2);
  box-shadow: 
    0 12px 40px rgba(var(--btn-accent), 0.15),
    0 4px 12px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -1px 0 rgba(var(--btn-accent), 0.1),
    0 0 0 1px rgba(var(--btn-accent), 0.08);
}

.btn:hover::before {
  opacity: 1;
}

.btn:active {
  transform: translateY(0) scale(0.98);
  background: 
    radial-gradient(circle at 50% 0%, rgba(var(--btn-accent), 0.1) 0%, transparent 50%),
    linear-gradient(135deg, rgba(var(--btn-accent-2), 0.06) 0%, rgba(var(--btn-accent), 0.04) 100%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%),
    rgba(255, 255, 255, 0.02);
  box-shadow: 
    0 4px 16px rgba(var(--btn-accent), 0.06),
    inset 0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn:focus {
  outline: none;
  box-shadow: 
    0 0 0 3px rgba(var(--btn-accent), 0.2),
    0 8px 32px rgba(var(--btn-accent), 0.08),
    0 1px 2px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  background-size: 200% 100%;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.btn:hover::after {
  opacity: 0.6;
  animation: glassShimmer 1.5s ease-in-out infinite;
}

/* Responsive design */
@media (max-width: 768px) {
  body {
    padding: 70px 0 0 0;
  }
  
  .header-controls {
    padding: 15px 20px;
  }
  
  .app-title {
    font-size: 16px;
  }
  
  .language-toggle {
    width: 32px;
    height: 32px;
    font-size: 11px;
  }
  
  .title {
    font-size: 2rem;
  }
  .subtitle {
    font-size: 1rem;
  }
  .input-section {
    flex-direction: column;
    gap: 15px;
    align-items: center;
  }
  .input-field {
    min-width: unset;
    width: 100%;
    padding: 18px 22px;
    font-size: 16px;
  }
  .input-field::placeholder {
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 65px 0 0 0;
  }
  
  .container {
    padding: 0 15px;
  }
  
  .header-controls {
    padding: 12px 15px;
  }
  
  .app-title {
    font-size: 14px;
  }
  
  .language-toggle {
    width: 32px;
    height: 32px;
    font-size: 11px;
  }
  
  .header, .header-section {
    padding: 20px 10px 20px 10px;
  }
  .content-section {
    padding: 0 15px;
  }
}

/* ---- Brain Wallet ---- */

/* Page-specific styles for brain wallet */
.generate-btn {
  --btn-accent: 46 139 87;
  --btn-accent-2: 50 205 50;
  width: 100%;
  max-width: 300px;
  height: fit-content;
}

.input-display {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #b0b0b0;
  word-break: break-all;
  line-height: 1.6;
  min-height: 20px;
}

.check-usage-btn {
  --btn-accent: 138 43 226;
  --btn-accent-2: 75 0 130;
  display: block;
  margin: 20px auto;
  width: 100%;
  max-width: 300px;
  font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .wallet-image {
    transition: none;
  }
  .btn::after {
    animation: none;
  }
}

.usage-results {
  text-align: center;
  margin-top: 20px;
}

/* Two-square layout styles */
.two-square-layout {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  justify-content: center;
  align-items: flex-start;
}

.square-container {
  width: 380px;
  height: 380px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(15px) saturate(1.2);
  -webkit-backdrop-filter: blur(15px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 
    0 4px 16px rgba(0,0,0,0.08),
    0 1px 2px rgba(0,0,0,0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
}

.square-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.qr-content {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.mnemonic-content {
  justify-content: flex-start;
}

.input-text-section {
  flex: 0 0 auto;
  margin-bottom: 15px;
}

.section-space-lg {
  margin-bottom: 40px;
}

.main-section {
  padding-top: 40px;
}

.mnemonic-words-section {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.mnemonic-grid-compact {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  flex: 1;
}

.mnemonic-grid-compact .mnemonic-word {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  transition: all 0.3s ease;
  font-size: 12px;
}

.mnemonic-grid-compact .mnemonic-word:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.mnemonic-grid-compact .word-number {
  font-size: 8px;
  color: #64748b;
  margin-bottom: 3px;
}

.mnemonic-grid-compact .word-text {
  font-family: 'Courier New', monospace;
  font-weight: bold;
  color: #334155;
  font-size: 11px;
}



@media (max-width: 768px) {
  .generate-btn {
    width: 100%;
    max-width: 400px;
    padding: 14px 24px;
    font-size: 16px;
  }
  
  .check-usage-btn {
    width: 100%;
    max-width: 400px;
    padding: 14px 24px;
    font-size: 16px;
  }
  
  #generatedImage {
    max-width: 289px !important;
  }
  
  .wallet-image {
    max-width: 289px;
  }
  
  .image-container {
    padding: 0 15px;
  }
  
  /* Mobile layout for two-square layout */
  .two-square-layout {
    flex-direction: column;
    gap: 15px;
  }
  
  .square-container {
    width: 100%;
    height: auto;
    min-height: 300px;
  }
  
  .mnemonic-grid-compact {
    grid-template-columns: repeat(2, 1fr);
  }
}

.action-btn {
  --btn-accent: 255 255 255;
  --btn-accent-2: 255 255 255;
  --btn-pad: 10px 20px;
  --btn-font: 13px;
  --btn-radius: 12px;
  --btn-radial: 0;
  --btn-radial-hover: 0;
  --btn-overlay-radial: 0;
  --btn-grad-1: 0.1;
  --btn-grad-2: 0.05;
  --btn-border: 0.15;
  --btn-border-hover: 0.25;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 180px;
  max-width: 240px;
  justify-content: center;
}

/* 复制按钮特殊样式 */
#copyMnemonic {
  --btn-accent: 0 123 255;
  --btn-accent-2: 0 86 179;
  --btn-radial: 0.1;
  --btn-radial-hover: 0.15;
  --btn-overlay-radial: 0.12;
}

/* 新钱包按钮特殊样式 */
#newWalletBtn {
  --btn-accent: 255 193 7;
  --btn-accent-2: 255 165 0;
  --btn-radial: 0.1;
  --btn-radial-hover: 0.15;
  --btn-overlay-radial: 0.12;
}

/* Action buttons container */
.action-buttons-container {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
  align-items: center;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* Image container and wallet image */
.image-container {
  text-align: center;
  margin-bottom: 25px;
  padding: 0 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.wallet-image {
  display: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  max-width: 306px;
  width: 100%;
  margin: 0 auto;
  box-shadow: 
    0 4px 16px rgba(0,0,0,0.08),
    0 1px 2px rgba(0,0,0,0.15),
    0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: all 0.3s ease;
}

.wallet-image:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.2);
}

@media (max-width: 480px) {
  .input-field {
    padding: 18px 22px;
    font-size: 16px;
  }
  
  .wallet-image {
    max-width: 255px;
  }
  
  .image-container {
    padding: 0 15px;
  }
  
  #generatedImage {
    max-width: 255px !important;
  }
  
  .action-buttons-container {
    gap: 12px;
    margin-top: 20px;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    max-width: 100%;
  }
  
  .action-btn {
    flex: 1;
    max-width: 180px;
    min-width: 140px;
    padding: 12px 16px;
    font-size: 13px;
    justify-content: center;
  }
  .main-section {
    padding-top: 30px !important;
  }
  
  /* Mobile improvements for two-square layout */
  .square-container {
    padding: 15px;
    min-height: 280px;
  }
  
  .mnemonic-grid-compact {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  
  .mnemonic-grid-compact .mnemonic-word {
    padding: 6px;
    font-size: 11px;
  }
  
  .mnemonic-grid-compact .word-number {
    font-size: 7px;
  }
  
  .mnemonic-grid-compact .word-text {
    font-size: 10px;
  }
}
