/* ============================================================
   THOTH TAROT — Main Stylesheet
   Theme: Dark mystical, deep purple/navy, gold accents
   ============================================================ */

:root {
  --bg-base:       #07060f;
  --bg-surface:    #100d22;
  --bg-elevated:   #1a1535;
  --bg-hover:      #221d42;
  --sidebar-w:     280px;
  --gold:          #c9a050;
  --gold-light:    #e8c472;
  --gold-dim:      #7a5e28;
  --text-primary:  #e8dff5;
  --text-secondary:#9d8dbf;
  --text-dim:      #5a5075;
  --border:        #2a1f4a;
  --border-light:  #3d2f6a;
  --accent-purple: #7c5cbf;
  --accent-blue:   #3b6ea5;
  --danger:        #c04040;
  --success:       #3a8a5a;
  --card-w:        110px;
  --card-h:        170px;
  --card-w-sm:     80px;
  --card-h-sm:     123px;
  --radius:        8px;
  --radius-sm:     4px;
  --transition:    0.3s ease;
  --shadow:        0 4px 20px rgba(0,0,0,0.6);
  --glow:          0 0 20px rgba(201,160,80,0.15);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Georgia', 'Times New Roman', serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); }
input, textarea, select {
  font-family: inherit;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
input:focus, textarea:focus { outline: none; border-color: var(--gold-dim); }

/* ===== LAYOUT ===== */
#app {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 20px 16px 14px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.sidebar-logo h1 {
  font-size: 1.2rem;
  color: var(--gold);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: normal;
}
.sidebar-logo .logo-sub {
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 2px;
}

/* PHP page header lang nav */
.seo-lang-nav {
  margin-left: auto;
  display: flex;
  gap: 4px;
}
.seo-lang-btn {
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 0.68rem;
  letter-spacing: 1px;
  color: var(--text-dim);
  border: 1px solid transparent;
  text-decoration: none;
  transition: all var(--transition);
}
.seo-lang-btn:hover { color: var(--gold); border-color: var(--border-light); }
.seo-lang-btn.active { color: var(--gold); border-color: var(--gold-dim); background: rgba(201,160,80,0.08); }

/* Language switcher */
.lang-switcher {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}
.lang-btn {
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 0.7rem;
  font-family: 'Georgia', serif;
  color: var(--text-dim);
  letter-spacing: 1px;
  border: 1px solid transparent;
  transition: all var(--transition);
}
.lang-btn:hover { color: var(--gold); border-color: var(--border-light); }
.lang-btn.active {
  color: var(--gold);
  border-color: var(--gold-dim);
  background: rgba(201,160,80,0.08);
}

/* Search */
.sidebar-search {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-search input {
  width: 100%;
  font-size: 0.82rem;
  padding: 7px 10px;
  background: var(--bg-elevated);
}
.sidebar-search input::placeholder { color: var(--text-dim); }

/* Sidebar sections */
.sidebar-inner {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar-inner::-webkit-scrollbar { width: 4px; }
.sidebar-inner::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.sidebar-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 6px;
  font-size: 0.68rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-dim);
  cursor: pointer;
  user-select: none;
}
.sidebar-section-title .arrow {
  font-size: 0.6rem;
  transition: transform var(--transition);
}
.sidebar-section-title.collapsed .arrow { transform: rotate(-90deg); }
.sidebar-section-content.collapsed { display: none; }

/* Menu items */
.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
}
.menu-item:hover { background: var(--bg-elevated); color: var(--text-primary); }
.menu-item.active {
  background: rgba(201,160,80,0.08);
  color: var(--gold-light);
  border-left-color: var(--gold);
}
.menu-item .icon { font-size: 0.9rem; flex-shrink: 0; opacity: 0.8; }

/* Card list items */
.card-list-item {
  display: block;
  padding: 6px 14px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
}
.card-list-item:hover { background: var(--bg-elevated); color: var(--text-primary); }
.card-list-item.active {
  color: var(--gold);
  border-left-color: var(--gold-dim);
  background: rgba(201,160,80,0.06);
}
.card-list-item .arcana-badge {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-right: 4px;
}

/* ===== MAIN CONTENT ===== */
#main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 100vh;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
#main-content::-webkit-scrollbar { width: 6px; }
#main-content::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ===== TOP BAR ===== */
#topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
#menu-toggle {
  display: none;
  padding: 6px 8px;
  color: var(--text-secondary);
  font-size: 1.2rem;
}
#menu-toggle:hover { color: var(--gold); }
.topbar-title {
  font-size: 0.85rem;
  color: var(--text-dim);
  flex: 1;
}
.topbar-admin-btn {
  font-size: 0.72rem;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-dim);
  transition: all var(--transition);
}
.topbar-admin-btn:hover { color: var(--gold); border-color: var(--gold-dim); }

/* ===== VIEWS ===== */
.view { display: none; padding: 24px; max-width: 1100px; margin: 0 auto; }
.view.active { display: block; }

/* ===== HOME VIEW ===== */
#view-home {
  text-align: center;
  padding: 60px 24px;
}
.home-logo-area { margin-bottom: 40px; }
.home-logo-area h1 {
  font-size: 2.4rem;
  color: var(--gold);
  letter-spacing: 6px;
  text-transform: uppercase;
  font-weight: normal;
  margin-bottom: 8px;
}
.home-logo-area .subtitle {
  font-size: 0.9rem;
  color: var(--text-dim);
  letter-spacing: 3px;
}
.home-divider {
  width: 80px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
  margin: 20px auto;
}
.home-intro {
  max-width: 600px;
  margin: 0 auto 48px;
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
}
.home-cards-preview {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 48px;
}
.home-card-thumb {
  width: 70px;
  height: 108px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.home-card-thumb:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.5), var(--glow);
}
.home-card-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ===== CARD DETAIL VIEW ===== */
#view-card {
  max-width: 800px;
}
.card-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 28px;
  margin-bottom: 32px;
}
.card-detail-image {
  width: 160px;
  min-width: 160px;
  height: 246px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow), var(--glow);
}
.card-detail-image img { width: 100%; height: 100%; object-fit: cover; }
.card-detail-image.reversed img { transform: rotate(180deg); }
.card-detail-info { flex: 1; }
.card-detail-info h1 {
  font-size: 1.5rem;
  color: var(--gold);
  font-weight: normal;
  margin-bottom: 6px;
}
.card-detail-info .card-num {
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.card-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.keyword-tag {
  padding: 3px 10px;
  background: rgba(201,160,80,0.1);
  border: 1px solid var(--gold-dim);
  border-radius: 20px;
  font-size: 0.72rem;
  color: var(--gold-light);
}
.card-detail-content {
  font-size: 0.92rem;
  line-height: 1.8;
  color: var(--text-secondary);
}
.card-detail-content p { margin-bottom: 16px; }
.card-detail-content h3 {
  font-size: 0.85rem;
  color: var(--gold);
  font-weight: normal;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 24px 0 10px;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-bottom: 24px;
  transition: all var(--transition);
}
.back-btn:hover { color: var(--gold); border-color: var(--gold-dim); }

/* ===== CARD MODAL (desktop) ===== */
.card-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 6, 15, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: cardModalFade 0.18s ease-out;
}
.card-modal {
  position: relative;
  width: 33vw;
  min-width: 460px;
  max-width: 720px;
  max-height: 86vh;
  background: var(--bg-surface);
  border: 1px solid var(--gold-dim);
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(201,160,80,0.08), var(--glow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: cardModalIn 0.22s ease-out;
}
.card-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--gold);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.15s;
  z-index: 2;
  font-weight: 300;
}
.card-modal-close:hover { color: var(--gold-light); background: rgba(201,160,80,0.12); }
.card-modal-body {
  padding: 28px 28px 24px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dim) transparent;
}
.card-modal-body::-webkit-scrollbar { width: 8px; }
.card-modal-body::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 4px; }
.card-modal-body .card-detail-header { gap: 20px; margin-bottom: 22px; }
.card-modal-body .card-detail-image { width: 130px; min-width: 130px; height: 200px; }
.card-modal-body .card-detail-info h1 { font-size: 1.3rem; }
.card-modal-body .card-detail-content { font-size: 0.88rem; line-height: 1.7; }
@keyframes cardModalFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cardModalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 899px) {
  .card-modal { width: 92vw; min-width: 0; max-height: 92vh; }
  .card-modal-body { padding: 20px 18px 18px; }
  .card-modal-body .card-detail-header { flex-direction: column; align-items: center; }
}

/* ===== SPREADS VIEW ===== */
#view-spread { padding: 0; max-width: 100%; }
.spread-header {
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--border);
}
.spread-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}
.spread-header h1 {
  font-size: 1.3rem;
  color: var(--gold);
  font-weight: normal;
  margin-bottom: 0;
}
.spread-header p { font-size: 0.85rem; color: var(--text-secondary); }
.spread-repeat-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  background: rgba(201,160,80,0.08);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-sm);
  color: var(--gold);
  font-size: 0.78rem;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.spread-repeat-btn:hover {
  background: rgba(201,160,80,0.18);
  color: var(--gold-light);
  border-color: var(--gold);
}
@media (max-width: 600px) {
  .spread-header-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .spread-repeat-btn { font-size: 0.72rem; padding: 5px 10px; }
}

.spread-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-top: 10px;
}
.deck-mode-selector {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.deck-mode-label {
  font-size: 0.7rem;
  letter-spacing: 1px;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-right: 2px;
}
.deck-mode-btn {
  padding: 4px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 0.74rem;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.deck-mode-btn:hover:not(:disabled) {
  color: var(--gold);
  background: rgba(201,160,80,0.08);
}
.deck-mode-btn.active {
  color: var(--gold);
  border-color: var(--gold-dim);
  background: rgba(201,160,80,0.14);
}
.deck-mode-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
@media (max-width: 600px) {
  .deck-mode-selector { padding: 4px 6px; gap: 4px; }
  .deck-mode-btn { font-size: 0.68rem; padding: 3px 7px; }
  .deck-mode-label { font-size: 0.62rem; }
}

.spread-layout-area {
  padding: 24px;
  min-height: 400px;
  position: relative;
}

/* ===== DECK ===== */
#tarot-deck {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  cursor: pointer;
  margin: 20px auto;
  z-index: 200;
  transition: transform 0.2s, box-shadow 0.2s;
}
#tarot-deck:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(0,0,0,0.6); }
#tarot-deck.done { cursor: default; opacity: 0.3; pointer-events: none; }
.deck-stack {
  position: absolute;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.deck-stack:nth-child(1) { top: -4px; left: -4px; }
.deck-stack:nth-child(2) { top: -2px; left: -2px; }
.deck-card {
  position: absolute;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-light);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.deck-card img { width: 100%; height: 100%; object-fit: cover; }
#deck-hint {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 1px;
  pointer-events: none;
}

/* ===== SPREAD CONTAINER ===== */
.spread-container {
  position: relative;
  margin: 0 auto;
}

/* Card slot — positioned absolutely within spread container */
.card-slot {
  position: absolute;
  width: var(--card-w);
  height: var(--card-h);
  perspective: 1000px;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}
.card-slot.sm {
  width: var(--card-w-sm);
  height: var(--card-h-sm);
}
.card-slot-label {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.62rem;
  color: var(--gold);
  letter-spacing: 0.5px;
  pointer-events: none;
  text-align: center;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 300;
  background: rgba(7,6,15,0.78);
  padding: 2px 6px;
  border-radius: 3px;
}

/* Card flip */
.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.55s ease;
  border-radius: 6px;
}
.card-slot.flipped .card-inner { transform: rotateY(180deg); }
.card-slot.reversed-card.flipped .card-face img {
  transform: rotate(180deg) translateZ(0);
  backface-visibility: visible;
  -webkit-backface-visibility: visible;
}
.card-face, .card-back-face {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 6px;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.card-back-face {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
}
.card-back-face img { width: 100%; height: 100%; object-fit: cover; }
.card-face {
  transform: rotateY(180deg);
  border: 1px solid var(--border-light);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  cursor: pointer;
}
.card-face img { width: 100%; height: 100%; object-fit: cover; }
.card-slot.flipped .card-face { cursor: pointer; }
.card-face:hover .card-face-overlay {
  opacity: 1;
}
.card-face-overlay {
  position: absolute;
  inset: 0;
  background: rgba(201,160,80,0.12);
  opacity: 0;
  transition: opacity 0.2s;
}

/* Crosswise card (position 2 in Celtic cross) */
.card-slot.crosswise .card-inner {
  transform: rotate(90deg);
}
.card-slot.crosswise.flipped .card-inner {
  transform: rotate(90deg) rotateY(180deg);
}

/* ===== RESULT PANEL ===== */
.spread-result-panel {
  position: fixed;
  right: 0;
  top: 0;
  width: 320px;
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform var(--transition);
  z-index: 300;
  display: flex;
  flex-direction: column;
}
.spread-result-panel.open { transform: translateX(0); }
.spread-result-close {
  align-self: flex-end;
  padding: 4px 8px;
  font-size: 1.2rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.spread-result-close:hover { color: var(--text-primary); }
.result-pos-name {
  font-size: 0.72rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}
.result-card-name {
  font-size: 1.1rem;
  color: var(--gold);
  margin-bottom: 4px;
  font-weight: normal;
}
.result-orientation {
  font-size: 0.75rem;
  color: var(--gold);
  margin-bottom: 16px;
}
.result-meaning {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-secondary);
}
.result-meaning p { margin-bottom: 12px; }
.result-detail-btn {
  margin-top: 16px;
  padding: 8px 16px;
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-sm);
  color: var(--gold);
  font-size: 0.8rem;
  transition: all var(--transition);
}
.result-detail-btn:hover { background: rgba(201,160,80,0.1); }

/* ===== SPREAD ACTIONS ===== */
.spread-actions {
  padding: 16px 24px;
  display: flex;
  gap: 10px;
  border-top: 1px solid var(--border);
}
.action-btn {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  transition: all var(--transition);
}
.action-btn-primary {
  background: rgba(201,160,80,0.12);
  border: 1px solid var(--gold-dim);
  color: var(--gold);
}
.action-btn-primary:hover { background: rgba(201,160,80,0.22); }
.action-btn-secondary {
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.action-btn-secondary:hover { border-color: var(--border-light); color: var(--text-primary); }

/* ===== ADMIN VIEW ===== */
#view-admin { max-width: 900px; }
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.admin-header h1 { font-size: 1.4rem; color: var(--gold); font-weight: normal; }
.admin-card-select {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  margin-bottom: 24px;
}
.admin-card-btn {
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-align: left;
  transition: all var(--transition);
}
.admin-card-btn:hover { border-color: var(--border-light); color: var(--text-primary); }
.admin-card-btn.selected {
  border-color: var(--gold-dim);
  color: var(--gold);
  background: rgba(201,160,80,0.08);
}
.admin-editor {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.admin-editor-title {
  font-size: 1rem;
  color: var(--gold);
  margin-bottom: 16px;
  font-weight: normal;
}
.lang-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}
.lang-tab {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 3px 3px 0 0;
  font-size: 0.78rem;
  color: var(--text-dim);
  transition: all var(--transition);
  border-bottom: none;
}
.lang-tab.active {
  color: var(--gold);
  border-color: var(--border-light);
  background: var(--bg-surface);
}
.admin-field { margin-bottom: 14px; }
.admin-field label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.admin-field input { width: 100%; }
.admin-field textarea {
  width: 100%;
  height: 300px;
  font-size: 0.82rem;
  line-height: 1.6;
  resize: vertical;
  padding: 10px 12px;
}
.admin-save-btn {
  padding: 10px 24px;
  background: var(--gold-dim);
  border-radius: var(--radius-sm);
  color: var(--bg-base);
  font-size: 0.85rem;
  font-weight: bold;
  transition: all var(--transition);
}
.admin-save-btn:hover { background: var(--gold); }
.admin-login-form {
  max-width: 340px;
  margin: 60px auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}
.admin-login-form h2 {
  font-size: 1rem;
  color: var(--gold);
  font-weight: normal;
  margin-bottom: 20px;
  letter-spacing: 2px;
}
.admin-login-form input { width: 100%; margin-bottom: 12px; }
.admin-login-btn {
  width: 100%;
  padding: 10px;
  background: var(--gold-dim);
  border-radius: var(--radius-sm);
  color: var(--bg-base);
  font-size: 0.9rem;
  transition: all var(--transition);
}
.admin-login-btn:hover { background: var(--gold); }
.admin-error {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 8px;
}

/* ===== YES/NO RESULT ===== */
.yesno-result {
  text-align: center;
  padding: 40px 20px;
}
.yesno-answer {
  font-size: 4rem;
  font-weight: bold;
  margin: 20px 0;
  animation: fadeInUp 0.5s ease;
}
.yesno-yes { color: var(--success); }
.yesno-no { color: var(--danger); }
.yesno-maybe { color: var(--gold); }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== SPREAD GRID LAYOUTS ===== */
/* These use CSS Grid for each specific spread */

/* Year ahead - responsive grid */
.year-grid {
  display: grid;
  grid-template-columns: repeat(6, var(--card-w));
  grid-template-rows: repeat(2, var(--card-h));
  gap: 32px 16px;
  padding: 20px;
  justify-content: center;
}
.month-label {
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 6px;
}

/* ===== ANIMATIONS ===== */
@keyframes cardDeal {
  from {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
}
@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(201,160,80,0.15); }
  50% { box-shadow: 0 0 20px rgba(201,160,80,0.4); }
}
.card-slot.clickable .card-inner {
  animation: pulse-glow 2s ease infinite;
  cursor: pointer;
}

/* ===== NOTIFICATION ===== */
.notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 10px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: var(--shadow);
  z-index: 1000;
  animation: slideInRight 0.3s ease;
}
.notification.success { border-color: var(--success); }
.notification.error { border-color: var(--danger); }
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== OVERLAY ===== */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 90;
}

/* ===== SPREAD INFO BOX ===== */
.spread-info {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(201,160,80,0.06);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.spread-info .icon { font-size: 1rem; color: var(--gold); flex-shrink: 0; margin-top: 1px; }

/* ===== LOADING STATE ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.loader-symbol {
  font-size: 2.5rem;
  color: var(--gold);
  animation: rotateSlow 3s linear infinite;
}
@keyframes rotateSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.loader-text {
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* ===== MOBILE TOGGLE ===== */
#menu-toggle {
  display: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  :root {
    --sidebar-w: 260px;
    --card-w: 90px;
    --card-h: 138px;
    --card-w-sm: 70px;
    --card-h-sm: 107px;
  }
  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
  }
  #app.sidebar-open #sidebar { transform: translateX(0); }
  #app.sidebar-open #sidebar-overlay { display: block; }
  #menu-toggle { display: block; }
  .topbar-title { display: none; }
  .spread-result-panel {
    width: 100%;
    height: 60vh;
    top: auto;
    bottom: 0;
    right: 0;
    transform: translateY(100%);
    border-left: none;
    border-top: 1px solid var(--border);
  }
  .spread-result-panel.open { transform: translateY(0); }
  .card-detail-header { flex-direction: column; align-items: center; }
}

@media (max-width: 600px) {
  :root {
    --card-w: 76px;
    --card-h: 117px;
    --card-w-sm: 60px;
    --card-h-sm: 92px;
  }
  .view { padding: 16px; }
  .home-logo-area h1 { font-size: 1.6rem; }
  #view-home { padding: 30px 16px; }
  .year-grid {
    grid-template-columns: repeat(4, var(--card-w));
    grid-template-rows: repeat(3, var(--card-h));
    gap: 28px 10px;
  }
}

/* ===== SCROLL TO TOP ===== */
.scroll-top {
  position: fixed;
  bottom: 20px;
  left: calc(var(--sidebar-w) + 20px);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition);
  z-index: 50;
}
.scroll-top.visible { opacity: 1; pointer-events: auto; }
.scroll-top:hover { color: var(--gold); border-color: var(--gold-dim); }

/* ===== SPREAD POSITION NUMBERS ===== */
.pos-number {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  background: rgba(0,0,0,0.7);
  border-radius: 50%;
  font-size: 0.65rem;
  color: var(--gold-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.card-slot.flipped .pos-number { display: none; }

/* ===== CARD READING LAYOUT ===== */
.reading-wrapper {
  display: flex;
  min-height: 500px;
  max-height: calc(100vh - 130px);
}
.reading-main {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 20px;
  min-width: 0;
}
.reading-sidebar {
  flex: 0 0 33%;
  width: 33%;
  min-width: 280px;
  max-width: 520px;
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px;
  background: var(--bg-surface);
}
@media (max-width: 900px) {
  .reading-wrapper { flex-direction: column; max-height: none; height: auto; }
  .reading-sidebar {
    width: 100%;
    min-width: 0;
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 50vh;
  }
}

/* ===== CHAKRA LABELS ===== */
.chakra-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.chakra-1 { color: #EF5350; }
.chakra-2 { color: #FF9800; }
.chakra-3 { color: #FFD600; }
.chakra-4 { color: #4CAF50; }
.chakra-5 { color: #29B6F6; }
.chakra-6 { color: #3F51B5; }
.chakra-7 { color: #CC44FF; }

/* ===== CARD COUNT BADGE ===== */
.spread-card-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(201,160,80,0.1);
  border: 1px solid var(--gold-dim);
  border-radius: 20px;
  font-size: 0.68rem;
  color: var(--gold-dim);
  margin-top: 4px;
}

/* ===== DECORATIVE ===== */
.gold-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim) 20%, var(--gold) 50%, var(--gold-dim) 80%, transparent);
  margin: 24px 0;
}
.section-tag {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--gold-dim);
  border-radius: 2px;
  font-size: 0.65rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 12px;
}

/* ===== SPREAD CONTAINER OVERFLOW FIX ===== */
.reading-main {
  min-width: 0;
}
#spread-area {
  min-width: 0;
  overflow-x: auto;
}
#spread-container {
  flex-shrink: 0;
}

/* ===== CARD FACE IMG FIX ===== */
.card-face img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== DECK CARD SVG FIX ===== */
.deck-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-back-face img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== CARD BACK DEFAULT PATTERN ===== */
.card-back-face {
  background: 
    radial-gradient(ellipse at 50% 50%, #1a0f3a 0%, #0a0818 100%);
}
.card-back-face::after {
  content: '✦';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  color: var(--gold-dim);
  opacity: 0.5;
}

/* ===== SPREAD CONTAINER SCROLLABLE ===== */
.spread-reading-scroll {
  overflow-x: auto;
  padding-bottom: 10px;
}

/* ===== RESULT SIDEBAR STICKY CONTENT ===== */
#reading-sidebar {
  position: sticky;
  top: 0;
  height: calc(100vh - 160px);
  overflow-y: auto;
}
@media (max-width: 900px) {
  #reading-sidebar {
    position: static;
    height: auto;
    max-height: 45vh;
  }
}

/* ===== SLOT LABEL MOBILE ===== */
@media (max-width: 600px) {
  .card-slot-label {
    font-size: 0.55rem;
    max-width: 80px;
  }
}

/* ===== HOVER TOOLTIP ===== */
#card-tooltip-global {
  display: none;
  position: fixed;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  z-index: 9000;
  pointer-events: none;
  max-width: 260px;
  line-height: 1.45;
  box-shadow: 0 4px 14px rgba(0,0,0,0.55);
}

/* ===== SHUFFLE BUTTON ===== */
.shuffle-btn {
  padding: 6px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-family: inherit;
  letter-spacing: 0.5px;
  background: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.shuffle-btn:hover { color: var(--gold); border-color: var(--gold-dim); }
.shuffle-btn:disabled { opacity: 0.35; cursor: default; pointer-events: none; }

/* ===== DECK SHUFFLE ANIMATION ===== */
@keyframes deckShake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  15%  { transform: translateX(-6px) rotate(-3deg); }
  30%  { transform: translateX(6px)  rotate(3deg);  }
  45%  { transform: translateX(-4px) rotate(-2deg); }
  60%  { transform: translateX(4px)  rotate(2deg);  }
  75%  { transform: translateX(-2px) rotate(-1deg); }
  90%  { transform: translateX(2px)  rotate(1deg);  }
}
#tarot-deck.shuffling,
#tarot-deck-single.shuffling {
  animation: deckShake 0.6s ease;
}

/* ===== ADMIN CHANGE PASSWORD ===== */
.admin-change-pw {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.admin-change-pw h3 {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: normal;
  margin-bottom: 10px;
}

/* ============================================================
   MOBILE / TOUCH IMPROVEMENTS
   ============================================================ */

/* Tap targets ≥40px on small screens (44px is iOS Human Interface guideline) */
@media (max-width: 900px) {
  .lang-btn { padding: 8px 12px; font-size: 0.78rem; min-height: 40px; }
  .card-modal-close { width: 40px; height: 40px; font-size: 1.8rem; top: 8px; right: 8px; }
  .menu-item, .card-list-item { padding: 12px 16px; }
  .spread-repeat-btn { padding: 10px 16px; font-size: 0.85rem; min-height: 40px; }
  .deck-mode-btn { padding: 8px 12px; font-size: 0.8rem; min-height: 36px; }
  #menu-toggle { width: 44px; height: 44px; font-size: 1.6rem; }
  .topbar-admin-btn { padding: 10px 14px; min-height: 40px; }
  .seo-lang-btn { padding: 8px 12px; min-height: 36px; }
}

/* Readable spread position labels on phones (was 0.55rem ≈ 8.8px) */
@media (max-width: 600px) {
  .card-slot-label {
    font-size: 0.68rem;
    max-width: 92px;
    padding: 3px 6px;
  }
  .spread-repeat-btn { font-size: 0.8rem; padding: 9px 14px; }
  .deck-mode-btn { font-size: 0.75rem; padding: 7px 11px; }
}

/* Touch-only devices: neutralize sticky hover transforms */
@media (hover: none) {
  #tarot-deck:hover { transform: none; box-shadow: 0 4px 18px rgba(0,0,0,0.5); }
  .home-card-thumb:hover { transform: none; }
  .ref-card:hover { background: transparent; }
  .ref-card:hover .ref-card-name { color: var(--text-secondary); }
  /* Tooltip toggled via tap (JS adds .touch-visible) */
  #card-tooltip-global.touch-visible { display: block !important; }
}

