:root {
  --bg-dark: #0f1115;
  --bg-card: rgba(255, 255, 255, 0.05);
  --accent-gold: #c5a059;
  --accent-bronze: #8b4513;
  --text-main: #e0e0e0;
  --text-muted: #a0a0a0;
  --glass-border: rgba(255, 255, 255, 0.1);
  --error: #ff4d4d;
  --success: #00c853;
  --font-main: 'Noto Sans TC', sans-serif;
  --font-title: 'Playfair Display', serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Background Decoration */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 10% 20%, rgba(197, 160, 89, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(139, 69, 19, 0.05) 0%, transparent 40%);
  pointer-events: none;
  z-index: -1;
}

header {
  width: 100%;
  padding: 2rem 1rem;
  text-align: center;
  z-index: 10;
}

h1 {
  font-family: var(--font-title);
  font-size: 2.5rem;
  color: var(--accent-gold);
  letter-spacing: 2px;
  text-shadow: 0 0 20px rgba(197, 160, 89, 0.3);
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 4px;
}

main {
  width: 100%;
  max-width: 800px;
  padding: 0 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Glassmorphism Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.form-group {
  margin-bottom: 1.5rem;
}

label,
summary {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--accent-gold);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

summary {
  list-style: none;
  /* Hide default arrow */
  display: flex;
  align-items: center;
  justify-content: space-between;
}

summary::-webkit-details-marker {
  display: none;
  /* Hide default arrow in Safari */
}

summary::after {
  content: '▼';
  font-size: 0.7rem;
  transition: transform 0.3s ease;
  margin-left: 0.5rem;
}

details[open] summary::after {
  transform: rotate(180deg);
}

.hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: normal;
  margin-left: auto;
}

.birth-grid {
  margin-top: 1rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px rgba(197, 160, 89, 0.1);
}

.birth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 0.75rem;
}

.purpose-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.chip-input {
  display: none;
}

.chip-label {
  display: block;
  padding: 0.5rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip-input:checked+.chip-label {
  background: var(--accent-gold);
  color: var(--bg-dark);
  border-color: var(--accent-gold);
  font-weight: 600;
}

button {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-bronze));
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(139, 69, 19, 0.4);
  transition: transform 0.2s ease, filter 0.2s ease;
}

button:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

button:active {
  transform: translateY(0);
}

/* Divination Section */
.divination-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s ease;
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}

.divination-area.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
  position: relative;
  visibility: visible;
}

.coins-container {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin: 2rem 0;
}

.coin {
  width: 80px;
  height: 80px;
  perspective: 1000px;
  background: transparent;
}

.coin-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-style: preserve-3d;
}

.coin-front,
.coin-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6), inset 0 0 10px rgba(0, 0, 0, 0.3);
  background: radial-gradient(circle, #f0c040 0%, #d4a017 70%, #8b6b13 100%);
  border: 2px solid #b8860b;
}

/* Front face (乾隆通寶) */
.coin-front::before,
.coin-back::before {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  background: #2a2a2a;
  border: 2px solid #8b6b13;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.8);
  z-index: 10;
}

.coin-front span,
.coin-back span {
  position: absolute;
  font-weight: bold;
  color: #5d4037;
  font-family: 'Noto Sans TC', serif;
  text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.2);
  z-index: 11;
}

.coin-char-top {
  top: 5px;
  font-size: 14px;
}

.coin-char-bottom {
  bottom: 5px;
  font-size: 14px;
}

.coin-char-right {
  right: 5px;
  font-size: 14px;
}

.coin-char-left {
  left: 5px;
  font-size: 14px;
}

/* Back face (Manchu characters) */
.coin-back {
  transform: rotateY(180deg);
}

/* Stylized Manchu characters using triangles and lines */
.manchu-left,
.manchu-right {
  width: 10px;
  height: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.manchu-left {
  left: 8px;
}

.manchu-right {
  right: 8px;
}

.manchu-left::before {
  content: 'ᠪᠣᠣ';
  font-size: 12px;
  transform: rotate(90deg);
}

.manchu-right::before {
  content: 'ᠴᡳᠶᠠᠨ';
  font-size: 12px;
  transform: rotate(90deg);
}

/* Animations will be added via JS */

.hexagram-visual {
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  margin: 2rem 0;
}

.yao {
  height: 12px;
  width: 120px;
  display: flex;
  gap: 12px;
}

.yao.yin div {
  flex: 1;
  background: var(--text-muted);
}

.yao.yang {
  background: var(--accent-gold);
  box-shadow: 0 0 10px rgba(197, 160, 89, 0.5);
}

/* Hidden steps */
.step-hidden {
  display: none;
}

/* Progress Indicators */
.progress-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  margin: 1.5rem 0;
  border: 1px solid var(--glass-border);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--accent-gold);
  margin-bottom: 0.5rem;
  font-family: var(--font-main);
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-bronze));
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(197, 160, 89, 0.3);
}

/* Pulse animation for loading bar */
.progress-bar.loading {
  width: 100%;
  animation: loading-pulse 2s infinite linear;
  background: linear-gradient(90deg,
      var(--accent-gold) 0%,
      var(--accent-bronze) 50%,
      var(--accent-gold) 100%);
  background-size: 200% 100%;
}

@keyframes loading-pulse {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* Brand Signature */
.brand-signature {
  margin-bottom: 1rem;
  font-family: var(--font-title);
  color: var(--accent-gold);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  opacity: 0.9;
}

.brand-name {
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 1px;
  text-shadow: 0 0 10px rgba(197, 160, 89, 0.2);
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-separator {
  color: var(--glass-border);
  font-size: 0.8rem;
}

.brand-slogan {
  font-size: 0.75rem;
  letter-spacing: 3px;
  font-weight: 400;
  text-transform: uppercase;
  color: var(--text-muted);
}

footer {
  margin-top: auto;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}