/* Base styles */
body {
  font-family: 'Inter', sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f5f5f5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

header {
  font-family: 'Inter', sans-serif;
  justify-content: space-between;
  background-color: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  padding: 1rem 1rem;
  gap: 1rem 1rem 1rem 1rem;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 1000;
  width: 100%;
  height: auto;
  border-bottom: 10px solid var(--border-color);
  margin-bottom: 0.5rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}
/* Hamburger menu styles */
.hamburger-menu {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 40px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10;
  z-index: 1001;
}

.hamburger-menu span {
  width: 100%;
  height: 3px;
  background-color: #333;
  border-radius: 3px;
  transition: all 0.3s ease;
}

.hamburger-menu.active span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.hamburger-menu.active span:nth-child(2) {
  opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* Navigation menu styles */
.nav-menu {
  position: fixed;
  top: 0;
  left: -250px;
  width: 250px;
  height: 100vh;
  background-color: white;
  box-shadow: 2px 0 4px rgba(0,0,0,0.1);
  transition: left 0.3s ease;
  z-index: 999;
}

.nav-menu.active {
  left: 0;
}

.nav-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
  padding-top: 80px;
}

.nav-menu li {
  padding: 0;
}

.nav-menu a {
  display: block;
  padding: 1rem 2rem;
  color: #333;
  text-decoration: none;
  font-size: 1.1rem;
  transition: background-color 0.2s ease;
}

.nav-menu a:hover {
  background-color: #f5f5f5;
}
.margin-div {
  margin: 20px;
}
/* Overlay for mobile menu */
.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 998;
}

.menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

.logo {
  height: auto;
  width: 150px;
  align-items: center;
}

/* Auth buttons */
.auth-container {
  display: flex;
  gap: 1rem;
}

.auth-button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  background-color: black;
  color: white;
  cursor: pointer;
  font-size: 0.7rem;
  transition: background-color 0.2s;
  margin-right: 1rem;
}

.auth-button:hover {
  background-color: #357abd;
}

/* Study container */
.study-container {
  max-width: 800px;
  margin: 0rem 0;
  padding: 0 1rem;
  flex: 1;
}

/* Card styles */
.card-container {
  margin-bottom: 1rem;
}

.card {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-bottom: 0;
}

.card h2 {
  margin: 0 0 0rem 0;
  font-size: 2rem;
  /*color: #333;*/
}

.card p {
  margin: 0.5rem 0;
  font-size: 1.1rem;
  /*color: #666;*/
}

.hidden-on-start {
  display: none;
}

/* Button styles */
.show-answer-container {
  text-align: center;
 margin: 1rem 0;
}

.action-button {
  margin: auto;
  padding: 0.8rem 2rem;
  font-size: 1.1rem;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.action-button:hover {
  background-color: #45a049;
}

.srs-button-container {
  display: flex;
  justify-content: center;
  gap: 5rem;
  margin: 0;
}

.srs-button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0rem;
  transition: transform 0.2s;
}

.srs-button:hover {
  transform: scale(1.1);
}

.srs-button img {
  width: 100px;
  height: auto;
}

/* Progress styles */
.srs-progress-container {
  margin: 1rem 0;
  padding: 1rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.progress-stats {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

#srs-progress {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background-color: #f0f0f0;
}

#srs-progress::-webkit-progress-bar {
  background-color: #f0f0f0;
  border-radius: 4px;
}

#srs-progress::-webkit-progress-value {
  background-color: #4CAF50;
  border-radius: 4px;
}

/* Navigation */
.navigation-container {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
}

.nav-button {
  padding: 0.8rem 1.5rem;
  background-color: #666;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.nav-button:hover {
  background-color: #555;
}

/* JLPT Level buttons */
.button-container {
  background: none;
  display: block;
  align-items: center;
  justify-content: center;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0;
  padding: 0;
  max-width: 300px;
  margin: 0 auto;
}

.jlpt-button {
  background: none;
  border: none;
  border-radius: 0px;
  padding: 0px;
  margin: 10px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  justify-content: center;
  align-items: center;
}

.jlpt-button:hover {
  transform: translateY(-2px);
  border-radius: 15px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.jlpt-button img {
  max-width: 100%;
  height: auto;
}

/* Sync Status Styles */
#sync-status {
    font-size: 0.9rem;
    margin: 0;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

#sync-status.synced {
    color: #4CAF50;
    background-color: rgba(76, 175, 80, 0.1);
}

#sync-status.syncing {
    color: #2196F3;
    background-color: rgba(33, 150, 243, 0.1);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Review Queue Status */
.review-status {
    display: flex;
    justify-content: space-around;
    margin: 1rem 0 2rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.review-count {
    text-align: center;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    color: #666;
}

.review-count span {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 0.25rem;
}

#overdue-count {
    color: #e74c3c;
}

#due-today-count {
    color: #f39c12;
}

#upcoming-count {
    color: #2ecc71;
}

/* Loading and Error States */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    display: none;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff4444;
    color: white;
    padding: 15px 30px;
    border-radius: 5px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translate(-50%, -100%); }
    to { transform: translate(-50%, 0); }
}

/* Sync Status */
.sync-status {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 20px;
    border-radius: 5px;
    color: white;
    font-size: 14px;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.sync-status.syncing { background: #3498db; }
.sync-status.synced { background: #2ecc71; }
.sync-status.error { background: #e74c3c; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Enhanced Card Animations */
.feature-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.feature-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.feature-card:hover::after {
    transform: translateX(100%);
}

/* Progress Indicators */
.progress-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: #f0f0f0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: #3498db;
    width: 0;
    transition: width 0.3s ease;
}

/* Enhanced Navigation */
.nav-menu {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-menu.active {
    transform: translateX(0);
    opacity: 1;
}

/* Responsive Improvements */
@media (max-width: 768px) {
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
    }

    .feature-card {
        margin: 0;
    }

    .sync-status {
        bottom: 10px;
        right: 10px;
        font-size: 12px;
        padding: 8px 15px;
    }
}

/* Accessibility Improvements */
.feature-card:focus {
    outline: 3px solid #3498db;
    outline-offset: 2px;
}

.feature-card:focus:not(:focus-visible) {
    outline: none;
}

.feature-card:focus-visible {
    outline: 3px solid #3498db;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .loading-overlay,
    .error-message,
    .sync-status,
    .nav-menu {
        display: none !important;
    }

    .feature-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* JLPTレベルボタンアニメーション */
#jlpt-level-buttons, #custom-mode-buttons {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#jlpt-level-buttons.show, #custom-mode-buttons.show {
    opacity: 1;
    max-height: 500px; /* 十分大きな値 */
}

/* ユーザーステータス表示 */
.user-stats-container {
    background: #f8fafc;
    border-radius: 30px;
    padding: 16px 8px 8px 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    margin: 0 auto 16px auto;
    max-width: 300px;
}
body.dark-mode .user-stats-container {
    background-color: #2d2d2d;
    color: #ffffff;
}
.user-stats-container strong {
    font-weight: 600;
}
.streak-matrix {
    display: flex;
    justify-content: center;
    gap: 3px;
    margin-top: 20px;
    margin-bottom: 20px;
}
.streak-cell {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: #e0e0e0;
    transition: background 0.2s;
}
.streak-cell.active {
    background: #34d399;
}

/* Inline style overrides from index.html */
#user-stats {
    margin-bottom: 16px;
    text-align: center;
    margin-left: 8px;
    margin-right: 8px;
}
#greeting {
    font-family: 'Inter', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 8px;
    margin-bottom: 12px;
}
#user-progress-summary {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    margin-top: 4px;
}
#user-streak {
    margin-top: 4px;
    margin-bottom: 8px;
}
.margin-div {
    margin-top: 18px;
}

/* Dark mode styles */
body.dark-mode {
    background-color: #1a1a1a;
    color: #ffffff;
}

body.dark-mode .card {
      background-color: #3d3d3d;
    color: #ffffff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode .srs-button-container button {
    background-color: #3d3d3d;
    color: #ffffff;
}

body.dark-mode .srs-button-container button:hover {
    background-color: #4d4d4d;
        color: #ffffff;
}

body.dark-mode .progress-container {
    background-color: #2d2d2d;
    color: #ffffff;
}

body.dark-mode .sync-status {
    background-color: #2d2d2d;
    color: #ffffff;
}


/* Theme toggle button */
#theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #ffffff;
    border: 2px solid #007bff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 1000;
}

#theme-toggle:hover {
    transform: scale(1.1);
}

body.dark-mode #theme-toggle {
    background-color: #2d2d2d;
    border-color: #ffffff;
    color: #ffffff;
}

/* Keyboard shortcuts hint */
.keyboard-shortcuts {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-size: 12px;
    display: none;
}

.keyboard-shortcuts.visible {
    display: block;
}

body.dark-mode .keyboard-shortcuts {
    background-color: rgba(255, 255, 255, 0.1);
}

/* --- Free Mode Feature Buttons --- */
.button-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
  width: 100%;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 600px) {
  .button-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  .review-status {
    flex-direction: row !important;
    align-items: stretch;
    font-size: 1rem;
    padding: 0.5rem !important;
    border-radius: 6px !important;
    margin-bottom: 1rem !important;
    gap: 0.5rem;
  }
  .review-status > div {
    font-size: 1rem;
    padding: 0.5rem 0.25rem;
    flex: 1 1 0;
    min-width: 0;
  }
  .review-status span {
    font-size: 1.2rem !important;
  }
}


.feature-button {
  background-color: var(--background-color, #fff);
  border: 2px solid var(--border-color, #dee2e6);
  border-radius: 24px;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  text-decoration: none;
  color: var(--text-color, #212529);
  height: 110px;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.feature-button:hover {
  transform: translateY(-5px) scale(1.02);
  border-color: var(--primary-color, #007bff);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.feature-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  margin: 0;
  border-radius: 24px;
}

[data-theme="dark"] .feature-button {
  background-color: #23272f;
  border-color: #495057;
  color: #fff;
}

[data-theme="dark"] .feature-button:hover {
  border-color: #0d6efd;
}

.content-container {
            max-width: 800px;
            margin: 2rem auto;
            padding: 0 1rem;
        }
        .section {
            background: white;
            border-radius: 12px;
            padding: 2rem;
            margin-bottom: 2rem;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        .section h2 {
            color: #333;
            margin-bottom: 1rem;
        }
                .section p {
            color: #666;
            line-height: 1.6;
            margin-bottom: 1rem;
        }
        .mission-statement {
            font-size: 1.2rem;
            font-style: italic;
            color: #4CAF50;
            text-align: center;
            margin: 2rem 0;
            padding: 1rem;
            border-left: 4px solid #4CAF50;
            background: #f9f9f9;
        }
        .team-member {
            display: flex;
            align-items: center;
            margin-bottom: 2rem;
        }
        .team-member img {
            width: 100px;
            height: 100px;
            border-radius: 50%;
            margin-right: 1.5rem;
        }
        .team-member-info h3 {
            margin: 0 0 0.5rem 0;
            color: #333;
        }
        .team-member-info p {
            margin: 0;
            color: #666;
        }

/* --- ダークモードの配色を全面的に調整 --- */
body[data-theme="dark"], body.dark-mode {
  background-color: #181a1a !important;
  color: #f1f1f1 !important;
}

body[data-theme="dark"] header,
body.dark-mode header {
  background-color: #23262e !important;
  color: #f1f1f1 !important;
  border-bottom: 1px solid #333a4d !important;
}

body[data-theme="dark"] .review-status,
body.dark-mode .review-status {
  background: #23262e !important;
  color: #f1f1f1 !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4) !important;
}

body[data-theme="dark"] .review-count span,
body.dark-mode .review-count span {
  color: #90caf9 !important;
}
body[data-theme="dark"] #overdue-count,
body.dark-mode #overdue-count { color: #ef9a9a !important; }
body[data-theme="dark"] #due-today-count,
body.dark-mode #due-today-count { color: #ffe082 !important; }
body[data-theme="dark"] #upcoming-count,
body.dark-mode #upcoming-count { color: #a5d6a7 !important; }

body[data-theme="dark"] .card,
body.dark-mode .card{
  background: #23262e !important;
  color: #f1f1f1 !important;
  /*border-color: #333a4d !important;*/
  /*box-shadow: 0 2px 8px rgba(0,0,0,0.5) !important;*/
}

body[data-theme="dark"] .srs-progress-container,
body.dark-mode .srs-progress-container {
  background: #23262e !important;
  color: #f1f1f1 !important;
}
body[data-theme="dark"] .progress-stats p,
body.dark-mode .progress-stats p {
  color: #b0b8c1 !important;
}
body[data-theme="dark"] .progress-bar,
body[data-theme="dark"] #srs-progress,
body.dark-mode .progress-bar,
body.dark-mode #srs-progress {
  background: #333a4d !important;
  color: #4fc3f7 !important;
}
body[data-theme="dark"] #srs-progress::-webkit-progress-value,
body.dark-mode #srs-progress::-webkit-progress-value {
  background-color: #4fc3f7 !important;
}

body[data-theme="dark"] .nav-button,
body[data-theme="dark"] .action-button,
body[data-theme="dark"] .srs-button,
body.dark-mode .nav-button,
body.dark-mode .action-button,
body.dark-mode .srs-button {
  background: #23262e !important;
  color: #f1f1f1 !important;
  border: 1px solid #4fc3f7 !important;
}
body[data-theme="dark"] .nav-button.reset-all-progress,
body.dark-mode .nav-button.reset-all-progress {
  background: #c0392b !important;
  color: #fff !important;
  border: none !important;
}
body[data-theme="dark"] .error-message,
body.dark-mode .error-message {
  background: #c0392b !important;
  color: #fff !important;
}
body[data-theme="dark"] #free-mode-banner,
body.dark-mode #free-mode-banner {
  background: #263859 !important;
  color: #90caf9 !important;
}
body[data-theme="dark"] .keyboard-shortcuts,
body.dark-mode .keyboard-shortcuts {
  background: rgba(30, 34, 45, 0.95) !important;
  color: #f1f1f1 !important;
}
body[data-theme="dark"] .srs-button img,
body.dark-mode .srs-button img {
  filter: brightness(0.9) invert(0.85) !important;
}
body[data-theme="dark"] .show-answer-container button,
body.dark-mode .show-answer-container button {
  background: #4fc3f7 !important;
  color: #23262e !important;
}
body[data-theme="dark"] .show-answer-container button:hover,
body.dark-mode .show-answer-container button:hover {
  background: #0288d1 !important;
  color: #fff !important;
}
body[data-theme="dark"] .srs-button-container button,
body.dark-mode .srs-button-container button {
  background: #333a4d !important;
  color: #f1f1f1 !important;
}
body[data-theme="dark"] .srs-button-container button:hover,
body.dark-mode .srs-button-container button:hover {
  background: #4fc3f7 !important;
  color: #23262e !important;
}
body[data-theme="dark"] .srs-button-container .srs-button img,
body.dark-mode .srs-button-container .srs-button img {
  filter: brightness(0.9) invert(0.85) !important;
}
body[data-theme="dark"] .navigation-container,
body.dark-mode .navigation-container {
  background: none !important;
}
body[data-theme="dark"] .nav-menu,
body.dark-mode .nav-menu {
  background: #23262e !important;
  color: #f1f1f1 !important;
  border-bottom: 1px solid #333a4d !important;
}
body[data-theme="dark"] .auth-button,
body.dark-mode .auth-button {
  background: #23262e !important;
  color: #f1f1f1 !important;
  border: 1px solid #4fc3f7 !important;
}
body[data-theme="dark"] .auth-button:hover,
body.dark-mode .auth-button:hover {
  background: #4fc3f7 !important;
  color: #23262e !important;
}
body[data-theme="dark"] .logo,
body.dark-mode .logo {
  filter: brightness(0.9) invert(0.85) !important;
}

