/* --- General Styling --- */
body {
    font-family: 'Roboto', 'Noto Sans JP', sans-serif;
    background-color: #1E1E1E;
    color: #000000;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
}
.container {
    max-width: 80%;
    margin: 0 auto;
    background-color: #595959;
    padding: 30px;
    border-radius: 40px;
    box-shadow: 0 4px 15px rgba(56, 16, 16, 0.08);
}
header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 20px;
}
header h1 {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 7rem;
    color: #000000;
    margin: 0;
}
header h2 {
    font-size: 1.2rem;
    color: #7f8c8d;
    font-weight: 400;
    margin: 5px 0 0;
}
/* Home Button */
.home-btn {
    display: inline-block;
    padding: 10px 20px;
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    font-size: 30px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

/* Hover effect */
.home-btn:hover {
    transform: translateY(-1px) scale(3);
}

/* --- Main Menu --- */
.main-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}
.menu-item {
    background-color: #3bb99a;
    color: #000000;
    text-decoration: none;
    padding: 30px;
    border-radius: 60px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.3s ease;
}
.menu-item:hover {
    transform: translateY(-30px) scale(1.3);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    background-color: #c0146a;
}
.menu-item .emoji {
    display: block;
    font-size: 5rem;
    margin-bottom: 10px;
}
.menu-item.disabled {
    background-color: #686375;
    color: #bdc3c7;
    cursor: not-allowed;
}
.menu-item.disabled:hover {
    transform: none;
    box-shadow: none;
}

/* --- Forms & Inputs --- */
.form-container {
    background-color: #A6A6A6;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #000000;
    border-radius: 40px;
}
.form-container h3 {
    text-align: center;
    margin-top: 0;
}
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}
.checkbox-options, .radio-group {
    display: flex;
    flex-direction: row;
    gap: 10px;
}
.checkbox-option, .radio-option {
    background: #D0D0D0;
    padding: 15px;
    border-radius: 40px;
    border: 0px solid #ddd;
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 10px;
}
.checkbox-option input, .radio-option input {
    margin-right: 12px;
    transform: scale(1.2);
}
.number-input {
    width: 10%;
    padding: 10px;
    font-size: 1rem;
    border-radius: 40px;
    border: 1px solid #ccc;
}

/* --- Quiz Page --- */
.question-card {
    background: #A6A6A6;
    border: 1px solid #ddd;
    border-radius: 40px;
    padding: 20px;
    margin-bottom: 20px;
}
.question-prompt {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    display: block;
    text-align: center;
}
.question-number {
    color: #28c6d1;
    margin-right: 10px;
}
.answer-input {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 5px solid #D0D0D0;
    border-radius: 40px;
    box-sizing: border-box;
    margin-top: 15px;
}
.answer-input:focus {
    outline: none;
    border-color: #3498db;
}

/* --- Score Page --- */
.score-summary {
    text-align: center;
    padding: 20px;
    background-color: #a6a6a6;
    border-radius: 40px;
    margin-bottom: 30px;
}
.score-display {
    font-size: 2.5rem;
    font-weight: 700;
    color: #00510f;
    margin: 10px 0;
}
.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}
.results-table th, .results-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #D0D0D0;
    border-radius: 30px;
}
.results-table tr.correct { background-color: #d0fdd1; }
.results-table tr.incorrect { background-color: #fad5d5; }
.status-icon { font-size: 1.5rem; text-align: center; }

/* --- Buttons & Utilities --- */
.button-primary, .button-secondary {
    display: inline-block;
    border: none;
    padding: 12px 25px;
    border-radius: 40px;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    text-decoration: none;
    width: 100%;
    box-sizing: border-box;
    margin-top: 10px;
}
.button-primary { background-color: #3498db; color: white; }
.button-primary:hover { background-color: #2980b9; transform: translateY(-2px); }
.button-secondary { background-color: #95a5a6; color: white; }
.button-secondary:hover { background-color: #7f8c8d; }
.error { color: #e74c3c; background-color: #fbeae5; padding: 10px; border-radius: 5px; text-align: center; }
.placeholder { text-align: center; padding: 40px 0; }


/* Quiz Page Prompt Styling */
.question-prompt .japanese-word {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: #2c3e50;
    display: block;
    text-align: center;
    line-height: 1.2;
    margin-bottom: 10px;
}

.question-prompt .kana-reading {
    font-size: 1.1rem;
    color: #7f8c8d;
    text-align: center;
    display: block;
    margin-top: 2px;
}

.question-prompt .english-word {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    display: block;
    text-align: center;
}

/* Score Page - Correct Answer Column Styling */
.correct-answer-jp {
    margin-bottom: 5px;
}

.correct-answer-jp .jp-kanji {
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: bold;
    font-size: 1.1rem;
    display: block;
    line-height: 1.1;
}

.correct-answer-jp .jp-kana {
    font-size: 0.9rem;
    color: #555;
    display: block;
}

.correct-answer-en {
    font-weight: bold;
    color: #3498db;
}

/* Kanji Quiz Page */
.kanji-prompt {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 6rem;
    font-weight: bold;
    color: #2c3e50;
    display: block;
    text-align: center;
    line-height: 1;
    margin-bottom: 10px;
}

/* Kanji Score Page */
.kanji-results-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.kanji-result-card {
    display: flex;
    border-radius: 40px;
    padding: 15px;
    gap: 20px;
    align-items: center;
    border: 1px solid #ddd;
}
.kanji-result-card.correct { background-color: #e8f5e9; }
.kanji-result-card.incorrect { background-color: #ffebee; }

.kanji-prompt-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 100px;
}
.kanji-prompt-large {
    font-size: 4rem;
    font-family: 'Noto Sans JP', sans-serif;
}
.kanji-details {
    flex-grow: 1;
    border-left: 2px solid #ccc;
    padding-left: 20px;
}
.kanji-details p {
    margin: 8px 0;
}
.kanji-details hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 10px 0;
}
.reading-tag {
    display: inline-block;
    background-color: #34495e;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Noto Sans JP', sans-serif;
    margin-right: 5px;
    font-size: 0.9rem;
}
.reading-tag.kunyomi {
    background-color: #2980b9;
}




/* Writing Page Container */
.writing-container {
    max-width: 900px;
    margin: 0 auto;
}
.writing-container h3, .writing-container p {
    text-align: center;
}
#japanese-text {
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    font-family: 'Noto Sans JP', sans-serif;
    border: 2px solid #030303;
    border-radius: 40px;
    box-sizing: border-box;
    margin-bottom: 15px;
    resize: vertical;
}

/* Spinner */
.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    color: #555;
}
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Feedback Cards */
#feedback-container {
    margin-top: 30px;
}
.feedback-card {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 40px;
    padding: 20px;
    margin-bottom: 20px;
}
.feedback-card h4 {
    margin-top: 0;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    margin-bottom: 15px;
}
.error-card {
    background-color: #ffebee;
    border-color: #e57373;
}

/* AI Grading Progress Bars */
.grade-item { margin-bottom: 15px; }
.grade-header { display: flex; justify-content: space-between; margin-bottom: 5px; }
.progress-bar { width: 100%; background-color: #e0e0e0; border-radius: 5px; height: 15px; overflow: hidden; }
.progress-bar-fill { height: 100%; background-color: #3498db; border-radius: 5px; }
.grade-comment { font-size: 0.9em; color: #555; margin-top: 5px; font-style: italic; }

/* Corrections */
.correction-item {
    border-bottom: 1px dashed #ccc;
    padding-bottom: 10px;
    margin-bottom: 10px;
}
.correction-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.original-text { background-color: #ffebee; padding: 5px; border-radius: 4px; }
.corrected-text { background-color: #e8f5e9; padding: 5px; border-radius: 4px; }
.explanation { font-size: 0.9em; color: #333; margin-top: 8px; }

/* Grid layout for smaller cards */
.grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 768px) {
    .grid-container { grid-template-columns: 1fr; }
}

/* Kanji Tags */
.kanji-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.kanji-tag {
    background-color: #34495e;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 1.2rem;
    font-family: 'Noto Sans JP', sans-serif;
}




/* --- Add these styles for Listening/Reading Sections --- */

.activity-passage-card {
    background: #fdfdfd;
    border: 1px solid #ddd;
    border-radius: 40px;
    padding: 25px;
    margin-bottom: 30px;
}
.activity-passage-card h3 {
    margin-top: 0;
}
.audio-player-container {
    text-align: center;
    margin: 20px 0;
}
.audio-player-container audio {
    width: 100%;
    max-width: 500px;
    margin-bottom: 10px;
}
.speed-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
}
.speed-btn {
    border: 1px solid #ccc;
    background-color: #f0f0f0;
    padding: 5px 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.speed-btn:hover {
    background-color: #e0e0e0;
}
.speed-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}
.paragraph-container {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    line-height: 1.8;
}
.transcript-toggle {
    display: block;
    margin: 0 auto;
}
.questions-container h4 {
    margin-top: 0;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    margin-bottom: 15px;
}




/* --- Add these styles for the Grammar Section --- */

.grammar-sentence {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    font-size: 1.7rem;
    font-family: 'Noto Sans JP', sans-serif;
    line-height: 2;
    text-align: center;
    justify-content: center;
}
.sentence-part {
    margin: 0 0.1em;
}
.blank-input {
    font-size: 1.4rem;
    font-family: 'Noto Sans JP', sans-serif;
    border: none;
    border-bottom: 2px solid #3498db;
    width: 100px;
    text-align: center;
    margin: 0 0.2em;
    padding: 2px;
}
.blank-input:focus {
    outline: none;
    border-bottom-color: #2980b9;
}

.grammar-results-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.grammar-result-card {
    border-radius: 8px;
    padding: 20px;
    border-left: 5px solid #ddd;
}
.grammar-result-card.correct {
    background-color: #e8f5e9;
    border-left-color: #4caf50;
}
.grammar-result-card.incorrect {
    background-color: #ffebee;
    border-left-color: #f44336;
}
.result-status {
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 10px;
}
.result-sentence {
    font-size: 1.1rem;
}
.result-user-answer {
    background-color: rgba(0,0,0,0.05);
    padding: 5px;
    border-radius: 4px;
    display: inline-block;
}
.rule-explanation {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(0,0,0,0.1);
}
.rule-title {
    font-weight: bold;
}




/* --- Add these styles for the Study/Review Section --- */

.lesson-list-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    display: grid;
    /* Create as many columns as can fit, with a minimum width of 250px */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px; /* The space between the grid items */
}
.lesson-list-item {
    display: block;
    background-color: #A6A6A6;
    padding: 15px 20px;
    border-radius: 40px;
    text-decoration: none;
    color: #333;
    font-weight: bold;
    border: 1px solid #ddd;
    transition: background-color 0.2s, transform 0.2s;
}
.lesson-list-item:hover {
    background-color: #6ac279;
    transform: translateX(5px);
}

.lesson-options {
    display: grid;
    /* Create as many columns as can fit, with a minimum width of 250px */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px; /* The space between the grid items */
}

.study-container {
    margin-top: 20px;
}

/* Vocab Table Styling */
.vocab-review-table {
    width: 100%;
    border-collapse: collapse;
}
.vocab-review-table th, .vocab-review-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}
.vocab-review-table th {
    background-color: #A6A6A6;
    font-weight: bold;
}
.vocab-review-table tr:nth-child(even) {
    background-color: #595970;
}
.jp-text {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1.2rem;
    font-weight: bold;
}

/* Kanji Study Card Styling */
.kanji-study-container {
    display: grid;
    flex-direction: column;
    gap: 15px;

    /* Create as many columns as can fit, with a minimum width of 250px */
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 15px; /* The space between the grid items */
}
.kanji-study-card{
    display: flex;
    border-radius: 40px;
    padding: 15px;
    gap: 20px;
    align-items: center;
    border: 1px solid #a09393;
    background-color: #8b8888;
    transition: transform 0.2s, box-shadow 0.2s;
}
.kanji-study-card:hover {
    transform: translateY(-15px) scale(1.3); /* 👈 grows 10% bigger */
    box-shadow: 0 10px 30px #eb0202;
    background-color: #ce9797;
}


/* Grammar Study Card Styling */
.grammar-study-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.grammar-study-card {
    background-color: #8b8888;
    border: 1px solid #ddd;
    border-left: 5px solid #9b59b6; /* A distinct purple color for grammar */
    border-radius: 40px;
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.grammar-study-card:hover{
    transform: translateY(-1px) scale(1.2); /* 👈 grows 10% bigger */
    box-shadow: 0 10px 30px #eb0202;
    background-color: #ce9797;
}
.grammar-study-card .rule-title {
    margin-top: 0;
    font-size: 1.4rem;
    color: #8e44ad;
}
.rule-explanation-study {
    font-style: italic;
    color: #333;
    margin-bottom: 15px;
}
.example-sentences {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #ccc;
}
.example-sentences strong {
    display: block;
    margin-bottom: 5px;
}
.example-sentences ul {
    list-style-type: '✓  ';
    padding-left: 20px;
    margin: 0;
}
.example-sentences li {
    padding: 5px 0;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1.1rem;
}

/* Shared styles from Kanji Score page needed for Kanji Study */
.kanji-prompt-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 100px;
}
.kanji-prompt-large {
    font-size: 4rem;
    font-family: 'Noto Sans JP', sans-serif;
}
.kanji-details {
    flex-grow: 1;
    border-left: 2px solid #6e6666;
    padding-left: 20px;
}
.kanji-details p {
    margin: 8px 0;
}
.kanji-details hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 10px 0;
}
.reading-tag {
    display: inline-block;
    background-color: #34495e;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Noto Sans JP', sans-serif;
    margin-right: 5px;
    font-size: 0.9rem;
}
.reading-tag.kunyomi {
    background-color: #2980b9;
}
.example-words {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(0,0,0,0.1);
}
.example-words p {
    font-weight: bold;
    margin-bottom: 5px;
}
.example-words ul {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}
.example-words li {
    background-color: rgba(0,0,0,0.03);
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 5px;
    border-left: 3px solid #8abcdd;
}
.ex-word {
    font-weight: bold;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1.1rem;
}



/* Toggle container */
.toggle-container {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

/* Hide the checkbox */
.toggle-container input {
  display: none;
}

/* The toggle track */
.toggle-slider {
  position: relative;
  width: 50px;
  height: 28px;
  background-color: #ccc;
  border-radius: 50px;
  transition: background-color 0.3s;
  margin-right: 12px; /* space between toggle and label */
}

/* The round knob */
.toggle-slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  transition: transform 0.3s;
}

/* ON state */
.toggle-container input:checked + .toggle-slider {
  background-color: #4caf50;
}

.toggle-container input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* Label styling */
.toggle-label {
  font-size: 16px;
  color: #333;
}


/* --- Add these styles for the Study Search Bar --- */

.search-container {
    margin-bottom: 25px;
    margin-top: 15px;
}

#global-search-bar {
    width: 100%;
    padding: 12px 15px;
    font-size: 1.1rem;
    border: 1px solid #ccc;
    border-radius: 40px;
    box-sizing: border-box; /* Ensures padding doesn't affect width */
    transition: border-color 0.2s, box-shadow 0.2s;
}

#global-search-bar:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

#no-results-message {
    text-align: center;
    padding: 40px;
    background-color: #f9f9f9;
    border-radius: 40px;
    color: #777;
    font-style: italic;
    border: 1px dashed #ddd;
}



/* --- Add these styles for the Unified Global Search --- */

.results-count-text {
    text-align: center;
    color: #555;
    font-style: italic;
    margin-top: -10px;
    margin-bottom: 20px;
}
.search-results-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.search-result-card {
    border-radius: 40px;
    border: 1px solid #ddd;
    overflow: hidden; /* Ensures the header corners are rounded */
    background-color: #fff;
}
.card-header {
    padding: 8px 15px;
    font-weight: bold;
    color: white;
    font-size: 0.9rem;
}
.vocab-header { background-color: #3498db; }
.kanji-header { background-color: #e74c3c; }
.grammar-header { background-color: #9b59b6; }

.vocab-card-body, .kanji-card-body, .grammar-card-body {
    padding: 15px;
}
.vocab-card-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.vocab-main {
    text-align: left;
}
.vocab-main .jp-text {
    font-size: 1.8rem;
}
.kana-reading-small {
    display: block;
    color: #555;
    margin-top: -5px;
}
.vocab-meaning {
    font-size: 1.1rem;
    font-weight: bold;
    text-align: right;
    color: #2c3e50;
}
.kanji-card-body {
    align-items: center;
    gap: 20px;
}
.grammar-card-body .rule-title {
    margin-top: 0;
    font-size: 1.4rem;
    color: #8e44ad;
}
.grammar-card-body .rule-explanation-study {
    font-style: italic;
    color: #333;
}



/* --- Styles for the Book Browser & Deep Search --- */

/* Breadcrumb Navigation */
.breadcrumb-nav {
    margin-bottom: 25px;
    padding: 10px;
    background-color: #f1f8f8;
    border-radius: 40px;
    font-size: 1rem;
}
.breadcrumb-nav a {
    text-decoration: none;
    color: #ff0000;
}
.breadcrumb-nav a:hover {
    text-decoration: underline;
}
.breadcrumb-nav span {
    margin: 0 8px;
    color: #6c757d;
}

/* Search Form Styling */
.search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}
#library-search-bar {
    flex-grow: 1; /* Allows the input to take up available space */
    width: 100%;
    padding: 12px 15px;
    font-size: 1.1rem;
    background-color: #afc9ca;
    border: 1px solid #d88282;
    border-radius: 40px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
#library-search-bar:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}
.search-button {
    border: none;
    background-color: #3498db;
    color: rgb(57, 61, 65);
    padding: 0 20px;
    border-radius: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}
.search-button:hover {
    background-color: #2980b9;
}

/* File Browser Styling */
.browser-section {
    margin-bottom: 30px;
}
.browser-section h4 {
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}
.browser-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}
.browser-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: #c283db;
    border: 5px solid #a547ca;
    border-radius: 40px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
}
.browser-item:hover {
    transform: translateY(-15px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.05);
    background-color: #76bddf;
    border: solid #25a9e6;
}
.item-icon {
    font-size: 1.8rem;
    margin-right: 15px;
}
.item-name {
    font-weight: bold;
    word-break: break-word; /* Prevents long names from overflowing */
}
.empty-folder-message {
    text-align: center;
    color: #777;
    padding: 40px;
    font-style: italic;
}

/* Search Results List */
.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.search-result-item .browser-item {
    width: 100%;
    box-sizing: border-box;
}
.item-details {
    display: flex;
    flex-direction: column;
}
.item-path {
    font-size: 0.8rem;
    color: #777;
    margin-top: 4px;
}



/* PDF Reader Page */
.reader-container {
    max-width: 900px;
    margin: 0 auto;
}
/* Style for the header to align title and button */
.reader-header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative; /* For positioning the button */
}
.book-title {
    text-align: center;
    font-family: 'Noto Sans JP', sans-serif;
    margin-bottom: 30px;
    flex-grow: 1; /* Allow title to take up space */
}
/* Fullscreen Button Style */
.fullscreen-button {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: 1px solid #ccc;
    border-radius: 5px;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #423535;
    transition: background-color 0.2s, color 0.2s;
}
.fullscreen-button:hover {
    background-color: #f0f0f0;
    color: #000;
}
/* Styles for when the container is in fullscreen mode */
.pdf-viewer-container:fullscreen {
    border: none;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    padding: 0;
    /* Ensure it covers the entire screen */
    width: 100vw;
    height: 100vh;
}
.pdf-viewer-container {
    width: 100%;
    height: 70vh; /* A tall container for a good reading experience */
    border: 1px solid #ddd;
    border-radius: 40px;
    overflow: hidden; /* Hides any overflow from the iframe */
    margin: 20px 0;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.pdf-viewer {
    width: 100%;
    height: 100%;
    border: none; /* Remove default iframe border */
}
.reader-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}
.reader-nav a {
    width: auto;
    margin: 0;
}


/* --- Styles for Both Hiragana & Katakana Charts --- */

.chart-section {
    margin-bottom: 40px;
}
.chart-section h4 {
    text-align: center;
    font-size: 2rem;
    color: #080808;
    margin-bottom: 20px;
}

.kana-grid {
    display: grid;
    gap: 10px;
}
.gojuon-grid {
    /* 5 columns for the main chart */
    grid-template-columns: repeat(5, 1fr);
}
.dakuten-grid {
    /* 5 columns for g, z, d, b, p sounds */
    grid-template-columns: repeat(5, 1fr);
}
.yoon-grid {
    /* 3 columns for ya, yu, yo combinations */
    grid-template-columns: repeat(3, 1fr);
}

.kana-card {
    background-color: #7e7b7b;
    border: 1px solid #ddd;
    border-radius: 40px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}
.kana-card:hover {
    transform: translateY(-15px) scale(1.5);
    box-shadow: 0 10px 30px #eb0202;
    background-color: #ce9797;
}
.kana-card.empty {
    background: none;
    border: none;
    box-shadow: none;
}
.kana-char {
    font-family: 'Kosugi Maru', 'Noto Sans JP', 'Hiragino Maru Gothic Pro', sans-serif;
    font-size: 3rem;
    font-weight: bold;
    display: block;
    color: #181818;
}
.kana-romaji {
    font-family: 'Kosugi Maru', sans-serif;
    font-size: 1rem;
    color: #282929;
    font-weight: bold;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 600px) {
    .kana-char {
        font-size: 2.2rem;
    }
    .kana-romaji {
        font-size: 0.9rem;
    }
    .kana-card {
        padding: 10px;
    }
}


/* Navigation Button */
.nav-btn {
    display: inline-block;
    padding: 10px 20px;
    color: #0066ff;
    text-decoration: underline;
    font-weight: bold;
    font-size: 20px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

/* Hover effect */
.nav-btn:hover {
    transform: translateY(-1px) scale(1.1);
}


/* Lesson Navigation Styling */
.search-container {
    margin-bottom: 25px;
}
#study-search-bar {
    width: 100%;
    padding: 12px 15px;
    font-size: 1.1rem;
    border: 1px solid #ccc;
    border-radius: 40px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
#study-search-bar:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}
#no-results-message {
    text-align: center;
    padding: 40px;
    background-color: #f9f9f9;
    border-radius: 8px;
    color: #777;
    font-style: italic;
    border: 1px dashed #ddd;
}
.study-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}
.study-nav a {
    width: auto;
    margin: 0;
}


/* --- Add these styles for the JLPT Section --- */
.level-selection-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 20px; }
.level-card { display: block; padding: 40px 20px; background-color: #f8f9fa; border: 1px solid #ddd; border-radius: 8px; text-align: center; font-size: 2rem; font-weight: bold; color: #3498db; text-decoration: none; transition: all 0.2s; }
.level-card:hover { background-color: #3498db; color: white; transform: translateY(-5px); box-shadow: 0 8px 15px rgba(0,0,0,0.1); }
.jlpt-intro-container .intro-card { background-color: #f9f9f9; border: 1px solid #e0e0e0; border-radius: 8px; padding: 20px; margin-bottom: 20px; }
.section-list { list-style-type: none; padding-left: 0; }
.section-list li { padding: 8px 0; border-bottom: 1px solid #eee; }
.section-list li:last-child { border-bottom: none; }
.start-test-button { margin-top: 20px; }
.test-container { display: grid; grid-template-columns: 200px 1fr; grid-template-areas: "header header" "sidebar main"; gap: 20px; }
.test-header { grid-area: header; display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #ddd; padding-bottom: 10px; }
.test-timer { font-size: 1.5rem; font-weight: bold; color: #e74c3c; }
.test-sidebar { grid-area: sidebar; background: #f8f9fa; padding: 15px; border-radius: 8px; }
.test-sidebar ul { list-style-type: none; padding-left: 0; }
.test-sidebar a { text-decoration: none; color: #2c3e50; display: block; padding: 8px; border-radius: 4px; }
.test-sidebar a:hover { background-color: #e9ecef; }
.test-main-content { grid-area: main; }
.test-section { margin-bottom: 40px; }
.daimon-block { border: 1px solid #eee; border-radius: 8px; padding: 20px; margin-bottom: 20px; }
.question-block { padding: 15px 0; border-bottom: 1px dashed #ccc; }
.question-block:last-child { border-bottom: none; }
.question-text u { text-decoration-color: #3498db; text-decoration-thickness: 2px; }

/* --- Add these styles for the JLPT Interface --- */
.reading-passage {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
    line-height: 1.8;
}
.audio-player-container.jlpt-audio {
    margin-bottom: 20px;
}
.question-text strong {
    margin-right: 10px;
    color: #34495e;
}


/* --- Styles for the Book Login Page --- */
.login-container {
    max-width: 400px;
    margin: 40px auto; /* Adds some space from the top */
}

.login-form {
    background-color: #d6d4d4;
    padding: 30px;
    border: 1px solid #b65151;
    border-radius: 40px;
}

.login-form h3, .login-form p {
    text-align: center;
}

.login-form .form-group {
    margin-bottom: 20px;
}

/* Re-using the .answer-input class for consistency */
.login-form .answer-input {
    width: 100%;
}