/* ============================================
   NEKO ORACLE - Stylesheet
   Color palette derived from Pinterest template:
   Blue-grey watercolor + clean typography
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400&family=Noto+Sans+JP:wght@300;400;500&display=swap');

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-base: #dfe5e9;
  --bg-light: #eaf0f3;
  --panel-bg: #ffffff;
  --text-primary: #2d3436;
  --text-secondary: #5a6c72;
  --text-muted: #8a9da3;
  --accent: #4a7c7e;
  --accent-light: #6b9a9c;
  --accent-soft: #a3c4c6;
  --border: #c5d3d7;
  --border-light: #dce6e9;
  --shadow: rgba(45, 52, 54, 0.08);
  --shadow-strong: rgba(45, 52, 54, 0.15);
  --font-display: 'Cormorant Garamond', 'Georgia', serif;
  --font-body: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-weight: 300;
  color: var(--text-primary);
  background-color: var(--bg-base);
  line-height: 1.8;
  font-size: 15px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* --- Background Pattern --- */
.bg-pattern {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.08;
  background-image: url('../images/bg-pattern.png');
  background-size: 600px;
  background-repeat: repeat;
}

/* --- Layout --- */
.container {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Language Toggle --- */
.lang-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  gap: 0;
  background: var(--panel-bg);
  border-radius: 20px;
  box-shadow: 0 2px 12px var(--shadow);
  overflow: hidden;
}

.lang-btn {
  padding: 6px 14px;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.05em;
}

.lang-btn.active {
  background: var(--accent);
  color: #fff;
}

/* --- Header --- */
.header {
  text-align: center;
  padding: 80px 0 40px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.brand-sub {
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
  margin-bottom: 32px;
}

.header-line {
  width: 40px;
  height: 1px;
  background: var(--border);
  margin: 0 auto 32px;
}

.header-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 2;
  margin-bottom: 36px;
}

/* --- Mode Tabs --- */
.mode-tabs {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: 48px;
  background: var(--panel-bg);
  border-radius: 28px;
  padding: 4px;
  box-shadow: 0 2px 12px var(--shadow);
  display: inline-flex;
}

.mode-tabs-wrapper {
  text-align: center;
  margin-bottom: 48px;
}

.mode-tab {
  padding: 10px 28px;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 24px;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.mode-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(74, 124, 126, 0.3);
}

/* --- Draw Section --- */
.draw-section {
  text-align: center;
  padding-bottom: 40px;
}

.draw-intro {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 2;
  margin-bottom: 36px;
}

.draw-btn {
  display: inline-block;
  padding: 16px 48px;
  border: 1.5px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.1em;
  border-radius: 40px;
  cursor: pointer;
  transition: all 0.4s ease;
}

.draw-btn:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 20px rgba(74, 124, 126, 0.25);
}

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

/* --- Card Drawing Animation --- */
.card-drawing {
  display: none;
  text-align: center;
  padding: 60px 0;
}

.card-drawing.show {
  display: block;
  animation: fadeIn 0.5s ease;
}

.card-back {
  width: 160px;
  height: 220px;
  margin: 0 auto 24px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(74, 124, 126, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: cardPulse 1.5s ease-in-out infinite;
}

.card-back-text {
  font-family: var(--font-display);
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.2em;
}

.drawing-text {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

@keyframes cardPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 8px 32px rgba(74, 124, 126, 0.3); }
  50% { transform: scale(1.03); box-shadow: 0 12px 40px rgba(74, 124, 126, 0.4); }
}

/* --- Result Section --- */
.result-section {
  display: none;
  padding-bottom: 60px;
}

.result-section.show {
  display: block;
  animation: slideUp 0.8s ease;
}

.result-card {
  background: var(--panel-bg);
  border-radius: 20px;
  padding: 48px 32px 40px;
  box-shadow: 0 4px 24px var(--shadow);
  text-align: center;
}

.result-number {
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.15em;
  margin-bottom: 20px;
}

.result-image-wrapper {
  width: 160px;
  height: auto;
  margin: 0 auto 24px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 16px var(--shadow-strong);
  /* Image protection */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  pointer-events: none;
}

.result-image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  -webkit-user-drag: none;
  user-drag: none;
}

.result-no-image {
  width: 160px;
  height: 200px;
  margin: 0 auto 24px;
  background: linear-gradient(135deg, var(--bg-light) 0%, var(--border-light) 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

.result-name-en {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.result-name-jp {
  font-size: 18px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.result-category {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--accent);
  border: 1px solid var(--accent-soft);
  border-radius: 16px;
  padding: 4px 16px;
  margin-bottom: 28px;
}

.result-divider {
  width: 32px;
  height: 1px;
  background: var(--border);
  margin: 0 auto 28px;
}

.result-message {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  font-style: italic;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.6;
}

.result-message-jp {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.8;
}

.result-section-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-align: left;
  margin-bottom: 8px;
  position: relative;
  padding-left: 0;
}

.result-section-label::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--border-light);
  left: 100px;
}

.result-deep {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 2.1;
  text-align: left;
  margin-bottom: 36px;
  font-weight: 300;
}

.redraw-btn {
  display: inline-block;
  padding: 12px 36px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.08em;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 8px;
}

.redraw-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --- List Section --- */
.list-section {
  display: none;
  padding-bottom: 60px;
}

.list-section.show {
  display: block;
  animation: fadeIn 0.5s ease;
}

.list-search-wrapper {
  margin-bottom: 32px;
}

.list-search {
  width: 100%;
  padding: 12px 20px 12px 44px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--panel-bg);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.3s ease;
  box-shadow: 0 2px 8px var(--shadow);
}

.list-search:focus {
  border-color: var(--accent);
}

.list-search-wrapper {
  position: relative;
}

.list-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
}

.category-group {
  margin-bottom: 36px;
}

.category-title {
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.card-item {
  background: var(--panel-bg);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px var(--shadow);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

.card-item:hover {
  border-color: var(--accent-soft);
  box-shadow: 0 4px 16px var(--shadow-strong);
  transform: translateY(-1px);
}

.card-item-number {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.card-item-name-en {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
  letter-spacing: 0.05em;
}

.card-item-name-jp {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.card-item-message {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Card detail modal */
.card-detail-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(45, 52, 54, 0.5);
  z-index: 200;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.card-detail-overlay.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}

.card-detail {
  background: var(--panel-bg);
  border-radius: 20px;
  padding: 40px 28px 32px;
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  animation: slideUp 0.4s ease;
}

.card-detail-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-light);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.card-detail-close:hover {
  background: var(--border);
  color: var(--text-primary);
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 40px 0 60px;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* --- Responsive --- */
@media (max-width: 480px) {
  .header {
    padding: 60px 0 32px;
  }

  .brand-name {
    font-size: 32px;
  }

  .result-card {
    padding: 36px 24px 32px;
  }

  .result-name-en {
    font-size: 26px;
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .card-item {
    padding: 12px;
  }

  .mode-tab {
    padding: 8px 20px;
    font-size: 13px;
  }

  .lang-toggle {
    top: 12px;
    right: 12px;
  }
}

/* --- Right-click protection overlay for images --- */
.image-protect {
  position: relative;
}

.image-protect::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  pointer-events: auto;
}

/* --- Utility --- */
.hidden {
  display: none !important;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
