:root {
  --ink-black: #2b2b2b;
  --paper-white: #f7f4ed;
  --shrine-red: #bc2d2d;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Shippori Mincho', 'Noto Serif JP', serif;
  background-color: var(--paper-white);
  color: var(--ink-black);
  /* Washi Paper Noise Texture */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
}

/* --- Vertical Writing Logic --- */
.tategaki {
  writing-mode: vertical-rl;
  text-orientation: upright;
  /* Critical for centering vertical text inside a flex container */
  display: inline-block;
  margin: auto; 
  max-height: 80%; /* Prevent overflow */
}

/* --- 3D Flip Logic --- */
.perspective-container {
  perspective: 1500px;
}

.preserve-3d {
  transform-style: preserve-3d;
}

.backface-hidden {
  backface-visibility: hidden;
  /* Fixes flickering in some browsers */
  -webkit-backface-visibility: hidden; 
}

.rotate-y-180 {
  transform: rotateY(180deg);
}

/* Utility to hide elements */
.hidden {
  display: none !important;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #dcd9d0;
  border-radius: 3px;
}

/* --- List View Styles --- */
.vocab-list-item {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  background: white;
  border: 1px solid #e7e5e0;
  transition: all 0.2s ease;
  position: relative;
}

.vocab-list-item:hover {
  border-color: var(--shrine-red);
  box-shadow: 0 2px 8px rgba(188, 45, 45, 0.08);
}

.vocab-list-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--shrine-red);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.vocab-list-item:hover::before {
  opacity: 1;
}

.vocab-list-item .item-number {
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  color: #a8a29e;
  min-width: 2rem;
  font-family: 'Shippori Mincho', serif;
}

.vocab-list-item .item-jp {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink-black);
  flex: 0 0 auto;
  min-width: 4rem;
}

.vocab-list-item .item-reading {
  font-size: 0.75rem;
  color: var(--shrine-red);
  font-style: italic;
  margin-left: 0.5rem;
  flex: 0 0 auto;
}

.vocab-list-item .item-divider {
  width: 1px;
  height: 1.5rem;
  background: #e7e5e0;
  margin: 0 1rem;
  flex-shrink: 0;
}

.vocab-list-item .item-en {
  font-size: 0.875rem;
  color: #57534e;
  flex: 1;
  text-align: left;
}

/* List scroll container */
#list-container {
  scrollbar-width: thin;
  scrollbar-color: #dcd9d0 transparent;
}