:root {
  --color-bg: #FDFBF7;
  --color-text: #0B2545;
  --color-text-light: #4A5A6D;
  --color-accent: #C89B3C;
  --color-accent-light: rgba(200, 155, 60, 0.15);
  
  --font-heading: 'Playfair Display', serif;
  --font-body: 'Inter', sans-serif;
  
  --shadow-sm: 0 2px 8px rgba(11, 37, 69, 0.05);
  --shadow-md: 0 8px 24px rgba(11, 37, 69, 0.08);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Sticky Header */
.app-header {
  background: white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  padding: 0.8rem 1rem;
  z-index: 100;
  flex-shrink: 0;
}

.header-content {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

@media (min-width: 500px) {
  .header-content {
    flex-direction: row;
    gap: 1.5rem;
  }
}

.header-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}

.header-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
}

.lang-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.lang-selector select {
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: white;
  font-family: var(--font-body);
  font-weight: 600;
}

.download-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-icon {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.4rem 0.8rem;
  background: var(--color-bg);
  border-radius: 20px;
  transition: background 0.2s;
  border: none;
  cursor: pointer;
}

#btn-play-audio {
  background: transparent;
  padding: 0.4rem;
}

.btn-icon:hover {
  background: var(--color-accent-light);
}

/* Main Content */
.app-main {
  flex-grow: 1;
  position: relative;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
  background-image: radial-gradient(var(--color-accent-light) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* Steps Containers */
.step-container {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 500px;
  animation: fadeIn 0.4s ease-out forwards;
}

.step-container.active {
  display: flex;
}

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

.title {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  margin-bottom: 0.2rem;
}

.subtitle {
  color: var(--color-accent);
  font-weight: 600;
  margin-bottom: 2rem;
  text-align: center;
}

/* Cards */
.card {
  background: white;
  width: 100%;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
  position: relative;
  border-top: 4px solid var(--color-accent);
}

.step-number {
  position: absolute;
  top: -1.2rem;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--color-text);
  color: white;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.1rem;
  box-shadow: 0 4px 10px rgba(11, 37, 69, 0.2);
}

.card h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
  margin-top: 0.5rem;
}

.instruction {
  color: var(--color-text-light);
  font-size: 0.95rem;
  text-align: center;
  margin-bottom: 0.5rem;
}

.quote {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--color-text);
  text-align: center;
  font-weight: 600;
}

/* Invocacion List */
.invocation-list {
  list-style: none;
}

.invocation-list li {
  margin-bottom: 1rem;
  font-size: 1.05rem;
  text-align: center;
}

.invocation-list strong {
  color: var(--color-text);
  display: block;
}

.invocation-list i {
  color: var(--color-text-light);
  font-family: var(--font-heading);
}

/* Mysteries Section */
.mystery-type {
  display: block;
  font-size: 1rem;
  color: var(--color-accent);
  font-family: var(--font-body);
  font-weight: 400;
}

.mystery-navigation {
  text-align: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.mystery-indicator {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-light);
  margin-bottom: 0.5rem;
}

.mystery-title {
  font-size: 1.2rem;
  color: var(--color-text);
}

/* Counter */
.counter-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.quotes-display {
  background: var(--color-bg);
  padding: 1rem;
  border-radius: 8px;
  width: 100%;
  text-align: center;
}

.quotes-display p {
  font-family: var(--font-heading);
  font-style: italic;
  color: var(--color-text);
  margin: 0.3rem 0;
}

.counter-btn {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent) 0%, #D4AF37 100%);
  border: none;
  color: white;
  font-size: 2.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(200, 155, 60, 0.4);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s, background 0.3s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.counter-btn:active {
  transform: scale(0.95);
  box-shadow: 0 4px 10px rgba(200, 155, 60, 0.3);
}

.counter-btn.completed {
  background: linear-gradient(135deg, #2E8B57 0%, #3CB371 100%);
  box-shadow: 0 8px 20px rgba(46, 139, 87, 0.4);
}

.counter-max {
  font-size: 1.2rem;
  opacity: 0.8;
  margin-left: 2px;
}

/* Buttons */
.button-group {
  display: flex;
  gap: 1rem;
  width: 100%;
}

.btn-primary, .btn-secondary {
  width: 100%;
  padding: 1rem;
  border-radius: 30px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-align: center;
}

.btn-primary {
  background-color: var(--color-text);
  color: white;
  box-shadow: 0 4px 15px rgba(11, 37, 69, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--color-accent);
}

.btn-primary:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-text);
}

.btn-secondary:hover {
  background-color: var(--color-bg);
}

@media (max-width: 400px) {
  .btn-text { display: none; }
  .title { font-size: 2rem; }
}

/* Audio Player */
#audio-player {
  display: none;
}

/* Mode Selector */
.mode-selector {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 2rem;
  background: white;
  padding: 0.5rem;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 500px) {
  .mode-selector {
    flex-direction: row;
    border-radius: 30px;
  }
}

.btn-mode {
  padding: 0.8rem 1.2rem;
  border-radius: 20px;
  border: none;
  background: transparent;
  color: var(--color-text-light);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
}

.btn-mode.active {
  background: var(--color-accent);
  color: white;
  box-shadow: 0 2px 8px rgba(200, 155, 60, 0.4);
}

/* Accessibility */
html {
  transition: font-size 0.3s;
}

body.high-contrast {
  --color-bg: #000000;
  --color-text: #FFFFFF;
  --color-text-light: #CCCCCC;
  --color-accent: #FFD700;
  --color-accent-light: rgba(255, 215, 0, 0.3);
}

body.high-contrast .card {
  background: #111111;
  border-top-color: var(--color-accent);
}

body.high-contrast .app-header {
  background: #111111;
}

body.high-contrast .lang-selector select,
body.high-contrast .mode-selector {
  background: #222222;
  color: #FFFFFF;
}

body.high-contrast .quotes-display {
  background: #222222;
}

body.high-contrast .btn-secondary {
  border-color: #FFFFFF;
  color: #FFFFFF;
}

body.high-contrast .btn-secondary:hover {
  background-color: #333333;
}

body.high-contrast .btn-primary {
  color: #000000;
}

body.high-contrast .btn-primary:disabled {
  color: #555555;
  background-color: #999999;
}

body.high-contrast .btn-mode.active {
  color: #000000;
}

body.high-contrast .counter-btn {
  color: #000000;
}

body.high-contrast .counter-btn.completed {
  color: #FFFFFF;
}

body.high-contrast .step-number {
  color: #000000;
}
