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

:root {
  --red-deep: #8B1A1A;
  --red-dark: #6B1414;
  --red-card: #A02828;
  --gold: #D4A946;
  --gold-light: #E8C770;
  --cream: #FFF8E7;
  --cream-dim: #F5E6C8;
  --text-gold: #F0D080;
  --green-auspicious: #4A8C3A;
  --green-bg: #E8F0E0;
  --red-inauspicious: #8B2020;
  --red-bg: #F0E0E0;
  --shadow: rgba(0, 0, 0, 0.3);
}

body {
  font-family: 'Noto Serif SC', 'Songti SC', 'STSong', serif;
  background: linear-gradient(180deg, #4A0E0E 0%, #6B1414 50%, #4A0E0E 100%);
  min-height: 100vh;
  color: var(--cream);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  padding: 20px 16px 40px;
}

/* --- Loading --- */

.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  gap: 16px;
}

.loading-screen p {
  color: var(--text-gold);
  font-size: 16px;
  letter-spacing: 4px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(212, 169, 70, 0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-spinner.small {
  width: 24px;
  height: 24px;
  border-width: 2px;
}

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

/* --- Oracle Card --- */

.oracle-card {
  background: linear-gradient(160deg, var(--red-deep) 0%, var(--red-card) 50%, var(--red-dark) 100%);
  border-radius: 20px;
  padding: 28px 22px;
  box-shadow: 0 8px 32px var(--shadow), inset 0 1px 0 rgba(255,255,255,0.1);
  border: 1px solid rgba(212, 169, 70, 0.3);
  position: relative;
  overflow: hidden;
}

.oracle-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.card-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(212, 169, 70, 0.2);
}

.card-date {
  font-size: 13px;
  color: var(--gold-light);
  margin-bottom: 6px;
  letter-spacing: 2px;
}

.card-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 8px;
  text-shadow: 0 2px 8px rgba(212, 169, 70, 0.3);
}

.card-tagline {
  font-size: 12px;
  color: var(--gold-light);
  margin-top: 7px;
  letter-spacing: 3px;
  opacity: 0.92;
}

.card-subtitle {
  font-size: 11px;
  color: var(--cream-dim);
  margin-top: 4px;
  opacity: 0.6;
  letter-spacing: 2px;
}

/* --- Fortune --- */

.card-fortune {
  font-size: 15px;
  line-height: 1.8;
  color: var(--cream);
  text-align: center;
  padding: 12px 8px;
  margin-bottom: 20px;
  font-style: italic;
  opacity: 0.95;
}

/* --- Auspicious / Inauspicious Sections --- */

.card-section {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: flex-start;
}

.section-label {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
}

.auspicious .section-label {
  background: rgba(74, 140, 58, 0.2);
  color: #8FCB6F;
  border: 1px solid rgba(74, 140, 58, 0.4);
}

.inauspicious .section-label {
  background: rgba(139, 32, 32, 0.3);
  color: #E07070;
  border: 1px solid rgba(139, 32, 32, 0.4);
}

.section-list {
  list-style: none;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.section-list li {
  font-size: 14px;
  line-height: 1.5;
  color: var(--cream);
  padding-left: 12px;
  position: relative;
}

.section-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
}

.auspicious .section-list li::before {
  background: #8FCB6F;
}

.inauspicious .section-list li::before {
  background: #E07070;
}

/* --- Lucky Items --- */

.card-lucky {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 24px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  border: 1px solid rgba(212, 169, 70, 0.15);
}

.lucky-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lucky-label {
  font-size: 11px;
  color: var(--gold-light);
  opacity: 0.7;
  letter-spacing: 1px;
}

.lucky-value {
  font-size: 14px;
  color: var(--cream);
  font-weight: 500;
}

/* --- Actions --- */

.card-actions {
  display: flex;
  gap: 12px;
}

.action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.share-btn {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  color: var(--red-dark);
  box-shadow: 0 4px 12px rgba(212, 169, 70, 0.3);
}

.share-btn:active {
  transform: scale(0.97);
}

.ask-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--cream);
  border: 1px solid rgba(212, 169, 70, 0.3);
}

.ask-btn:active {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.15);
}

/* --- Modal --- */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: linear-gradient(160deg, #2A1010 0%, #3A1515 100%);
  border-radius: 20px;
  padding: 28px 22px;
  width: 90%;
  max-width: 400px;
  max-height: 85vh;
  overflow-y: auto;
  border: 1px solid rgba(212, 169, 70, 0.3);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--gold);
  font-size: 28px;
  cursor: pointer;
  opacity: 0.7;
  line-height: 1;
}

.modal-close:hover {
  opacity: 1;
}

.modal-title {
  font-size: 22px;
  color: var(--gold);
  margin-bottom: 8px;
  letter-spacing: 4px;
  text-align: center;
}

.modal-hint {
  font-size: 13px;
  color: var(--cream-dim);
  text-align: center;
  margin-bottom: 20px;
  opacity: 0.7;
}

/* --- Ask Input --- */

.ask-input-wrap {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

#ask-input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(212, 169, 70, 0.3);
  background: rgba(0, 0, 0, 0.3);
  color: var(--cream);
  font-size: 15px;
  font-family: inherit;
  outline: none;
}

#ask-input::placeholder {
  color: var(--cream-dim);
  opacity: 0.4;
}

#ask-input:focus {
  border-color: var(--gold);
}

.ask-submit-btn {
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  color: var(--red-dark);
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.ask-submit-btn:active {
  transform: scale(0.97);
}

.ask-submit-btn:disabled {
  opacity: 0.5;
}

/* --- Ask Answer --- */

.ask-answer {
  padding: 16px;
  background: rgba(212, 169, 70, 0.1);
  border-radius: 12px;
  border: 1px solid rgba(212, 169, 70, 0.2);
}

.answer-oracle {
  font-size: 12px;
  color: var(--gold-light);
  margin-bottom: 8px;
  opacity: 0.7;
}

.answer-text {
  font-size: 16px;
  line-height: 1.7;
  color: var(--cream);
}

.ask-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
}

.ask-loading p {
  color: var(--gold-light);
  font-size: 14px;
}

/* --- Share Preview --- */

.share-modal-content {
  text-align: center;
}

.share-preview-wrap {
  margin: 16px 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

#share-preview {
  width: 100%;
  display: block;
}

.download-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  color: var(--red-dark);
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}

.download-btn:active {
  transform: scale(0.98);
}

/* --- Utility --- */

.hidden {
  display: none !important;
}

/* --- Responsive --- */

@media (max-width: 360px) {
  .card-title {
    font-size: 24px;
    letter-spacing: 6px;
  }
  .card-lucky {
    grid-template-columns: 1fr;
  }
}
