* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

::selection {
  background: black;
  color: white;
}

@font-face {
    font-family: "edo";
    src: url("edosz.ttf");
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1300px;
  margin: 0 auto;
  background: rgba(110, 110, 110, 0.767);
  border-radius: 20px;
  padding: 30px;
  backdrop-filter: blur(10px);
}

.header {
  text-align: center;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

.header h1 {
  font-family: edo;
  font-weight: normal;
  font-size: 4rem;
  margin-bottom: 10px;
  background: rgb(0, 0, 0);
  text-shadow: #ffffff 2px 2px 1px;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.chapter-info {
  color: #7f8c8d;
  font-size: 1.2rem;
}

.chapter-select {
    margin: 20px auto;
    padding: 10px 20px;
    font-size: 1.2rem;
    font-family: edo;
    background: white;
    border: 2px solid #000;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chapter-select:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.chapter-select option {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.pages-grid {
  display: flex;
  flex-direction: column;
  gap: 25px;
  margin-top: 30px;
}

.page-card {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
  border: 2px solid transparent;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  width: 100%;
}

.page-card:hover {
  transform: translateY(-5px);
  animation: shadowRainbow 10s linear infinite;
}

@keyframes shadowRainbow {
  0% {
    border: #ff0000 2px solid;
  }
  20% {
    border: #ffa500 2px solid;
  }
  40% {
    border: #ffff00 2px solid;
  }
  60% {
    border: #00ff00 2px solid;
  }
  80% {
    border: #0000ff 2px solid;
  }
  100% {
    border: #ff0000 2px solid;
  }
}

.page-number {
  font-size: 1.5rem;
  font-family: edo;
  color: #000000;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.text-content {
  line-height: 1.8;
}

.text-line-wrapper {
  margin-bottom: 12px;
}

.text-line-wrapper:last-child {
  margin-bottom: 0;
}

.text-line {
  letter-spacing: 5px;
  font-size: 1.5rem;
  padding: 10px 15px;
  background: rgba(102, 126, 234, 0.05);
  border-radius: 8px;
  border-left: 3px solid #000000;
  transition: all 0.2s ease;
  cursor: pointer;
  font-weight: bold;
  position: relative;
}

.text-line:hover {
  background: rgba(102, 126, 234, 0.1);
  transform: translateX(5px);
}

.text-line.expanded {
  background: rgba(102, 126, 234, 0.15);
  border-left-color: #ff0000;
}

.text-line.expanded::after {
  content: "▼";
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #ff00009d;
  font-size: 0.8em;
}

.text-line:not(.expanded)::after {
  content: "▶";
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  font-size: 0.8em;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.text-line:hover:not(.expanded)::after {
  opacity: 1;
}

.translation-dropdown {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 0 0 8px 8px;
  margin-top: -1px;
  padding: 20px;
  animation: slideDown 0.2s ease-out;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.translation-content {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.translation-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.translation-label {
  font-weight: bold;
  color: #495057;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.translation-text {
  font-size: 1.1rem;
  color: #2c3e50;
  font-style: italic;
  padding: 8px 12px;
  background: white;
  border-radius: 6px;
  border-left: 3px solid #28a745;
}

.reading-text {
  font-size: 1.2rem;
  color: #6c757d;
  font-family: "Yu Gothic", "Hiragino Sans", sans-serif;
  padding: 8px 12px;
  background: white;
  border-radius: 6px;
  border-left: 3px solid #17a2b8;
}

.word-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
  background: white;
  border-radius: 6px;
}

.word-item {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 8px 10px;
  min-width: 80px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.word-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.word-japanese {
  font-weight: bold;
  font-size: 1rem;
  color: #2c3e50;
  margin-bottom: 2px;
}

.word-reading {
  font-size: 0.8rem;
  color: #6c757d;
  font-family: "Yu Gothic", "Hiragino Sans", sans-serif;
  margin-bottom: 2px;
}

.word-meaning {
  font-size: 0.75rem;
  color: #28a745;
  font-weight: 500;
}

.loading {
  text-align: center;
  color: #6c757d;
  font-style: italic;
  padding: 20px;
}

.empty-page {
  color: #bdc3c7;
  font-style: italic;
  text-align: center;
  padding: 20px;
}

.navigation {
  display: flex;
  justify-content: center;
  margin-top: 40px;
  gap: 15px;
}

.nav-button {
  background: linear-gradient(45deg, #667eea, #764ba2);
  color: white;
  border: none;
  padding: 12px 25px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.nav-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.nav-button:active {
  transform: translateY(0);
}

@media (max-width: 768px) {
  .container {
    padding: 20px;
    margin: 10px;
  }

  .header h1 {
    font-size: 2rem;
  }

  .pages-grid {
    gap: 20px;
  }

  .word-breakdown {
    justify-content: center;
  }

  .word-item {
    min-width: 70px;
    font-size: 0.9rem;
  }

  .translation-dropdown {
    padding: 15px;
  }
}

.scroll-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: black;
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  font-size: 1.2rem;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  transition: all 0.3s ease;
  opacity: 0.8;
}

.scroll-to-top:hover {
  transform: translateY(-3px);
  opacity: 1;
}