/* ===== SHRINE PAGE STYLES =====
 * Extends theme.css design tokens for the interactive shrine courtyard.
 * Does NOT redefine :root vars — inherits from theme.css.
 */

.particles { position: fixed; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.particle { position: absolute; width: 4px; height: 4px; background: var(--accent-gold); border-radius: 50%; opacity: 0; animation: float-up 8s ease-in-out infinite; }
@keyframes float-up {
  0% { opacity: 0; transform: translateY(100vh) scale(0); }
  10% { opacity: 0.6; }
  90% { opacity: 0.2; }
  100% { opacity: 0; transform: translateY(-10vh) scale(1); }
}

/* ===== NAV ===== */
.shrine-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(10, 10, 18, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(212, 168, 71, 0.08);
}
.nav-back {
  color: var(--fg-dim);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
}
.nav-back:hover { color: var(--accent-gold); }
.nav-title {
  color: var(--accent-gold);
  font-size: 0.9rem;
  letter-spacing: 0.15em;
  opacity: 0.7;
}

/* ===== HEADER ===== */
.shrine-header {
  padding: 8rem 1.5rem 4rem;
  text-align: center;
  position: relative;
  background: linear-gradient(180deg, #0d0d1a 0%, var(--bg-deep) 100%);
}
.mini-torii {
  position: relative;
  width: 140px;
  height: 120px;
  margin: 0 auto 2rem;
}
.mini-torii .torii-top {
  width: 140px;
  height: 10px;
}
.mini-torii .torii-top::before {
  top: -6px;
  left: -10px;
  right: -10px;
  height: 8px;
}
.mini-torii .torii-beam {
  top: 20px;
  width: 120px;
  height: 6px;
}
.mini-torii .torii-pillar-left,
.mini-torii .torii-pillar-right {
  top: 9px;
  width: 9px;
  height: 110px;
}
.mini-torii .torii-pillar-left { left: 30px; }
.mini-torii .torii-pillar-right { right: 30px; }

.shrine-header h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: 0.1em;
  margin-bottom: 0.8rem;
  text-shadow: 0 0 40px rgba(200, 85, 61, 0.15);
}
.shrine-subtitle {
  color: var(--fg-dim);
  font-size: 1.1rem;
  font-weight: 300;
}

/* ===== STATION SECTIONS ===== */
.station-section {
  position: relative;
  padding: 5rem 1.5rem;
  z-index: 1;
}
.station-section:nth-child(odd) {
  background: linear-gradient(180deg, var(--bg-deep) 0%, #0f1a1a 50%, var(--bg-deep) 100%);
}
.station-inner {
  max-width: 900px;
  margin: 0 auto;
}
.station-header {
  text-align: center;
  margin-bottom: 3rem;
}
.station-kanji {
  font-family: 'Zen Antique', serif;
  font-size: 2.5rem;
  color: var(--accent-gold);
  opacity: 0.3;
  display: block;
  margin-bottom: 0.5rem;
  letter-spacing: 0.3em;
}
.station-header h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  margin-bottom: 0.8rem;
}
.station-desc {
  color: var(--fg-dim);
  font-size: 1rem;
  max-width: 500px;
  margin: 0 auto;
  font-weight: 300;
}

/* ===== SHRINE BUTTON ===== */
.shrine-btn {
  background: linear-gradient(135deg, var(--torii-red), var(--torii-dark));
  color: var(--fg);
  border: none;
  padding: 0.75rem 1.8rem;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  letter-spacing: 0.03em;
}
.shrine-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(181, 50, 42, 0.3);
}
.shrine-btn:active { transform: translateY(0); }
.shrine-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ===== EMA STATION ===== */
.ema-area {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
}

.ema-plaque {
  background: linear-gradient(135deg, #3d2b1a 0%, #2a1f0f 100%);
  border: 1px solid rgba(212, 168, 71, 0.15);
  border-radius: 12px;
  padding: 2rem;
  position: relative;
  max-width: 500px;
  margin: 0 auto;
}
.plaque-rope {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 24px;
  border: 3px solid var(--accent);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
}
.plaque-body { display: flex; flex-direction: column; gap: 0.8rem; }
#ema-text {
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(212, 168, 71, 0.15);
  border-radius: 8px;
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  padding: 0.8rem;
  resize: none;
  transition: border-color 0.3s;
}
#ema-text:focus {
  outline: none;
  border-color: var(--accent-gold);
}
#ema-text::placeholder { color: var(--fg-dim); opacity: 0.5; }
#ema-author {
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(212, 168, 71, 0.1);
  border-radius: 8px;
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  padding: 0.6rem 0.8rem;
}
#ema-author:focus {
  outline: none;
  border-color: var(--accent-gold);
}
#ema-author::placeholder { color: var(--fg-dim); opacity: 0.4; }
.ema-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.char-count {
  color: var(--fg-dim);
  font-size: 0.8rem;
  opacity: 0.5;
}

/* Ema wall */
.ema-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  min-height: 100px;
}
.wall-loading {
  color: var(--fg-dim);
  text-align: center;
  grid-column: 1 / -1;
  opacity: 0.5;
}
.ema-card {
  background: linear-gradient(135deg, #3d2b1a 0%, #2a1f0f 100%);
  border: 1px solid rgba(212, 168, 71, 0.1);
  border-radius: 10px;
  padding: 1.2rem;
  position: relative;
  animation: ema-appear 0.5s ease-out;
}
.ema-card::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 16px;
  border: 2px solid var(--accent);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
}
.ema-card-text {
  color: var(--fg);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 0.5rem;
}
.ema-card-author {
  color: var(--accent-gold);
  font-size: 0.75rem;
  opacity: 0.6;
  font-family: 'Zen Antique', serif;
}
@keyframes ema-appear {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== OMAMORI STATION ===== */
.omamori-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}
@media (max-width: 700px) {
  .omamori-grid { grid-template-columns: 1fr; max-width: 320px; margin: 0 auto; }
}
.omamori-card {
  background: var(--bg-card);
  border: 1px solid rgba(212, 168, 71, 0.1);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  text-align: center;
  transition: border-color 0.3s, transform 0.3s;
}
.omamori-card:hover {
  border-color: rgba(212, 168, 71, 0.25);
  transform: translateY(-4px);
}
.omamori-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.omamori-card p {
  color: var(--fg-dim);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 1.2rem;
}

/* Charm visual — pure CSS omamori */
.charm-visual {
  width: 100px;
  margin: 0 auto 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.charm-loop {
  width: 20px;
  height: 14px;
  border: 3px solid;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  margin-bottom: -2px;
}
.charm-body {
  width: 80px;
  height: 110px;
  border-radius: 6px 6px 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.charm-pattern {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  opacity: 0.15;
}
.charm-kanji {
  font-family: 'Zen Antique', serif;
  font-size: 1rem;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
  position: relative;
  z-index: 1;
  letter-spacing: 0.15em;
  writing-mode: vertical-rl;
}
.charm-tassel {
  width: 4px;
  height: 30px;
  border-radius: 0 0 4px 4px;
  position: relative;
}
.charm-tassel::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

/* Vermilion charm */
.vermilion .charm-loop { border-color: #c8553d; }
.vermilion .charm-body { background: linear-gradient(135deg, #c8553d, #8a2422); }
.vermilion .charm-pattern {
  background: repeating-conic-gradient(rgba(255,255,255,0.08) 0% 25%, transparent 0% 50%) 0 0 / 20px 20px;
}
.vermilion .charm-tassel { background: #c8553d; }
.vermilion .charm-tassel::after { background: #d4a847; }

/* Gold charm */
.gold .charm-loop { border-color: #d4a847; }
.gold .charm-body { background: linear-gradient(135deg, #d4a847, #8a6d1b); }
.gold .charm-pattern {
  background: repeating-linear-gradient(45deg, rgba(255,255,255,0.06) 0px, rgba(255,255,255,0.06) 2px, transparent 2px, transparent 10px);
}
.gold .charm-tassel { background: #d4a847; }
.gold .charm-tassel::after { background: #c8553d; }

/* Indigo charm */
.indigo .charm-loop { border-color: #4a7fb5; }
.indigo .charm-body { background: linear-gradient(135deg, #4a7fb5, #2a4a6b); }
.indigo .charm-pattern {
  background: repeating-conic-gradient(rgba(255,255,255,0.05) 0deg 60deg, transparent 60deg 120deg) 0 0 / 24px 24px;
}
.indigo .charm-tassel { background: #4a7fb5; }
.indigo .charm-tassel::after { background: #d4a847; }

/* ===== OMIKUJI STATION ===== */
.omikuji-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}
.fortune-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}
.box-body {
  width: 120px;
  height: 180px;
  background: linear-gradient(135deg, #3d2b1a 0%, #2a1f0f 100%);
  border: 2px solid rgba(212, 168, 71, 0.2);
  border-radius: 8px 8px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.1s;
}
.box-slot {
  width: 60px;
  height: 6px;
  background: rgba(0,0,0,0.5);
  border-radius: 3px;
  position: absolute;
  top: 12px;
  border: 1px solid rgba(212, 168, 71, 0.1);
}
.box-label {
  font-family: 'Zen Antique', serif;
  font-size: 1.5rem;
  color: var(--accent-gold);
  writing-mode: vertical-rl;
  letter-spacing: 0.3em;
  opacity: 0.7;
}
.fortune-btn { font-size: 1rem; padding: 0.9rem 2.5rem; }

/* Shake animation */
.shaking {
  animation: shake 0.5s ease-in-out 3;
}
@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-5deg) translateX(-4px); }
  75% { transform: rotate(5deg) translateX(4px); }
}

/* Fortune result */
.fortune-result { width: 100%; max-width: 400px; }
.fortune-slip { background: linear-gradient(135deg, #f5f0e8, #e8dfd0); border-radius: 4px; overflow: hidden; animation: slip-appear 0.8s ease-out; box-shadow: 0 8px 32px rgba(0,0,0,0.4); }
.slip-border { height: 8px; background: repeating-linear-gradient(90deg, var(--torii-red) 0px, var(--torii-red) 8px, transparent 8px, transparent 16px); }
.slip-content { padding: 2rem 1.5rem; text-align: center; }
.fortune-rank { font-family: 'Zen Antique', serif; font-size: 2.5rem; color: #1a1a2e; display: block; margin-bottom: 0.3rem; letter-spacing: 0.2em; }
.fortune-rank-en { font-family: 'DM Sans', sans-serif; font-size: 0.8rem; color: #666; text-transform: uppercase; letter-spacing: 0.15em; display: block; margin-bottom: 1.2rem; }
.fortune-message { color: #2a2a2a; font-size: 0.95rem; line-height: 1.8; margin-bottom: 1rem; font-style: italic; }
.fortune-advice { color: #555; font-size: 0.85rem; line-height: 1.6; padding-top: 1rem; border-top: 1px solid rgba(0,0,0,0.08); }
.fortune-advice::before { content: '💡 '; }
@keyframes slip-appear {
  from { opacity: 0; transform: translateY(-30px) rotateX(20deg); }
  to { opacity: 1; transform: translateY(0) rotateX(0); }
}

.shrine-footer { padding: 3rem 1.5rem; text-align: center; background: #08080f; border-top: 1px solid rgba(212, 168, 71, 0.08); }
.shrine-footer p { color: var(--fg-dim); font-size: 0.8rem; opacity: 0.5; letter-spacing: 0.1em; }
.footer-sub { margin-top: 0.3rem; font-size: 0.7rem !important; }
.shrine-btn.downloaded { background: linear-gradient(135deg, var(--accent-teal), #3a7a6b); }

@media (max-width: 600px) {
  .shrine-nav { padding: 0.8rem 1rem; }
  .station-section { padding: 3.5rem 1rem; }
  .ema-plaque { padding: 1.5rem; }
  .ema-wall { grid-template-columns: 1fr; }
}
