/* ============================================
   N4試験対策サイト スタイルシート
   ============================================ */

/* リセットと基本設定 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 18px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Meiryo', sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.8;
    min-height: 100vh;
}

/* ヘッダー */
.header {
    background: linear-gradient(135deg, #4fc3f7 0%, #0288d1 100%);
    color: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header h1 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.header-exam-title {
    flex: 1;
    text-align: center;
    font-size: 0.88rem;
    font-weight: 500;
    color: rgba(255,255,255,0.92);
    padding: 0 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-right .user-name {
    font-size: 0.85rem;
    opacity: 0.9;
}

.btn-logout {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.4);
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
}

/* コンテナ */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* ============================================
   ログインページ
   ============================================ */
.login-container {
    max-width: 420px;
    margin: 80px auto;
    padding: 0 16px;
}

.login-box {
    background: white;
    border-radius: 16px;
    padding: 40px 32px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.login-box h2 {
    text-align: center;
    font-size: 1.4rem;
    margin-bottom: 8px;
    color: #0288d1;
}

.login-box .subtitle {
    text-align: center;
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 28px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.2s;
    outline: none;
}

.form-group input:focus {
    border-color: #0288d1;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #4fc3f7 0%, #0288d1 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    margin-top: 8px;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-primary:active {
    transform: scale(0.98);
}

.login-toggle {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
    color: #888;
}

.login-toggle a {
    color: #0288d1;
    cursor: pointer;
    text-decoration: underline;
}

.error-msg {
    background: #ffe0e0;
    color: #c00;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: none;
}

/* ============================================
   試験一覧ページ
   ============================================ */
.exam-list {
    display: grid;
    gap: 16px;
}

.exam-card {
    background: white;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 5px solid #0288d1;
}

.exam-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.exam-card h3 {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 6px;
}

.exam-card p {
    font-size: 0.85rem;
    color: #888;
}

.exam-card .score-badge {
    display: inline-block;
    background: #e8f5e9;
    color: #2e7d32;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 8px;
}

.page-title {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.nav-tab {
    padding: 8px 18px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-tab:hover {
    border-color: #0288d1;
    color: #0288d1;
}

.nav-tab.active {
    background: #0288d1;
    border-color: #0288d1;
    color: white;
}

/* ============================================
   問題ページ
   ============================================ */
.section-header {
    background: white;
    border-radius: 14px;
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border-top: 4px solid #0288d1;
}

.section-header h2 {
    font-size: 1.15rem;
    color: #333;
    margin-bottom: 6px;
}

.section-header .instruction {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.7;
}

/* 問題カード */
.question-card {
    background: white;
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: border-color 0.3s;
    border-left: 4px solid #e0e0e0;
}

.question-card.answered-correct {
    border-left-color: #4caf50;
}

.question-card.answered-wrong {
    border-left-color: #f44336;
}

.question-number {
    font-size: 0.8rem;
    font-weight: 700;
    color: #0288d1;
    margin-bottom: 8px;
}

.question-text {
    font-size: 1.05rem;
    line-height: 1.9;
    margin-bottom: 16px;
    color: #333;
}

/* 振り仮名（ルビ）表示 */
ruby {
    ruby-align: center;
    ruby-position: over;
}

rt {
    font-size: 0.55em;
    color: #888;
    text-align: center;
    font-weight: 400;
    letter-spacing: 0;
}

.question-text ruby,
.passage-box ruby,
.notice-box ruby,
.choice-btn ruby {
    ruby-align: center;
}

.question-text rt,
.passage-box rt,
.notice-box rt,
.choice-btn rt {
    font-size: 0.55em;
    color: #888;
}

/* 下線付きテキスト */
.underline {
    text-decoration: underline;
    text-decoration-color: #0288d1;
    text-underline-offset: 3px;
    text-decoration-thickness: 2px;
}

/* 読解パッセージ */
.passage-box {
    background: #fafbfc;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    font-size: 1rem;
    line-height: 2;
    white-space: pre-wrap;
}

.passage-box .blank {
    display: inline-block;
    min-width: 80px;
    border-bottom: 2px dashed #0288d1;
    text-align: center;
    color: #0288d1;
    font-weight: 700;
    padding: 0 8px;
}

/* 表・掲示板スタイル */
.notice-box {
    background: #fffde7;
    border: 2px solid #ffd54f;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 16px;
    font-size: 0.95rem;
    line-height: 1.9;
}

.notice-box h4 {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: #f57f17;
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    font-size: 0.9rem;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}

.schedule-table th {
    background: #0288d1;
    color: white;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
}

.schedule-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

.schedule-table tr:last-child td {
    border-bottom: none;
}

.schedule-table tr:hover td {
    background: #f5f7ff;
}

/* 4択ボタン */
.choices {
    display: grid;
    gap: 10px;
}

.choice-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 18px;
    background: #f8f9fb;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    font-size: 1rem;
    line-height: 1.6;
    transition: all 0.2s;
}

.choice-btn:hover:not(.disabled) {
    border-color: #0288d1;
    background: #f0f2ff;
}

.choice-btn .choice-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #666;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: all 0.2s;
}

.choice-btn:hover:not(.disabled) .choice-label {
    background: #0288d1;
    color: white;
}

.choice-btn.selected {
    border-color: #0288d1;
    background: #eef0ff;
}

.choice-btn.selected .choice-label {
    background: #0288d1;
    color: white;
}

.choice-btn.correct {
    border-color: #4caf50;
    background: #e8f5e9;
}

.choice-btn.correct .choice-label {
    background: #4caf50;
    color: white;
}

.choice-btn.wrong {
    border-color: #f44336;
    background: #ffebee;
}

.choice-btn.wrong .choice-label {
    background: #f44336;
    color: white;
}

.choice-btn.disabled {
    cursor: default;
    opacity: 0.7;
}

.choice-btn.disabled:not(.correct):not(.wrong) {
    opacity: 0.5;
}

/* 正解表示 */
.result-msg {
    margin-top: 12px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    display: none;
}

.result-msg.correct {
    display: block;
    background: #e8f5e9;
    color: #2e7d32;
}

.result-msg.wrong {
    display: block;
    background: #ffebee;
    color: #c62828;
}

/* YouTube埋め込み */
.youtube-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    margin-bottom: 16px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.youtube-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* 進捗バー */
.progress-bar {
    background: #e0e0e0;
    border-radius: 10px;
    height: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.progress-bar .fill {
    background: linear-gradient(90deg, #4fc3f7, #0288d1);
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
}

/* スコアサマリー */
.score-summary {
    background: white;
    border-radius: 14px;
    padding: 28px;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 24px;
}

.score-summary .big-score {
    font-size: 3rem;
    font-weight: 800;
    color: #0288d1;
}

.score-summary .big-score span {
    font-size: 1.2rem;
    color: #888;
}

.score-summary .score-detail {
    font-size: 0.9rem;
    color: #888;
    margin-top: 4px;
}

/* セクション別スコア */
.section-score-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.section-score-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 14px 18px;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}

.section-score-item .name {
    font-size: 0.9rem;
    color: #555;
}

.section-score-item .score {
    font-weight: 700;
    font-size: 0.95rem;
}

.section-score-item .score.good {
    color: #4caf50;
}

.section-score-item .score.ok {
    color: #ff9800;
}

.section-score-item .score.bad {
    color: #f44336;
}

.mini-bar {
    flex: 1;
    max-width: 120px;
    height: 6px;
    background: #eee;
    border-radius: 3px;
    margin: 0 12px;
    overflow: hidden;
}

.mini-bar .fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s;
}

.mini-bar .fill.good { background: #4caf50; }
.mini-bar .fill.ok { background: #ff9800; }
.mini-bar .fill.bad { background: #f44336; }

/* ナビゲーションボタン */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    gap: 12px;
}

.btn-nav {
    padding: 12px 28px;
    border: 2px solid #0288d1;
    background: white;
    color: #0288d1;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-nav:hover {
    background: #0288d1;
    color: white;
}

.btn-nav.primary {
    background: #0288d1;
    color: white;
}

.btn-nav.primary:hover {
    background: #5568d3;
}

.btn-nav:disabled {
    opacity: 0.4;
    cursor: default;
}

.btn-nav.submit {
    background: #ff9800;
    color: white;
    border-color: #ff9800;
}
.btn-nav.submit:hover:not(:disabled) {
    background: #f57c00;
    border-color: #f57c00;
}

.choice-btn.selected {
    background: #e3f2fd;
    border-color: #0288d1;
    color: #0288d1;
    font-weight: 700;
}

/* 文法3 並べ替え専用 */
.reorder-area {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    min-height: 50px;
    padding: 12px;
    background: #f0f2ff;
    border: 2px dashed #c0c8f0;
    border-radius: 10px;
}

.reorder-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    padding: 8px 14px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.reorder-slot:hover {
    border-color: #0288d1;
}

.reorder-slot.star {
    border-color: #ff9800;
    background: #fff8e1;
}

.reorder-slot.placed {
    background: #e8eaf6;
    border-color: #0288d1;
}

/* ローディング */
.loading {
    text-align: center;
    padding: 40px;
    color: #888;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top-color: #0288d1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 非表示 */
.hidden {
    display: none !important;
}

/* バック矢印 */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #0288d1;
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 16px;
    padding: 6px 0;
}

.back-link:hover {
    text-decoration: underline;
}

/* レスポンシブ */
@media (max-width: 600px) {
    html {
        font-size: 16px;
    }

    .header {
        padding: 12px 16px;
    }

    .header h1 {
        font-size: 1.1rem;
    }

    .container {
        padding: 16px 12px;
    }

    .question-card {
        padding: 18px 16px;
    }

    .choice-btn {
        padding: 12px 14px;
        font-size: 0.95rem;
    }

    .login-box {
        padding: 28px 20px;
    }

    .nav-tabs {
        gap: 6px;
    }

    .nav-tab {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    .passage-box {
        padding: 14px;
        font-size: 0.95rem;
    }

    .notice-box {
        padding: 14px;
    }
}

/* ============================================
   管理画面スタイル
   ============================================ */

/* 管理画面レイアウト */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
}

.admin-layout {
    display: flex;
    min-height: calc(100vh - 60px);
}

/* サイドバー */
.admin-sidebar {
    width: 220px;
    background: white;
    border-right: 1px solid #e8e8e8;
    padding: 20px 0;
    flex-shrink: 0;
}

.sidebar-section {
    margin-bottom: 20px;
}

.sidebar-label {
    padding: 0 20px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: #555;
    text-decoration: none;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: #f5f7ff;
    color: #0288d1;
}

.sidebar-link.active {
    background: #f0f2ff;
    color: #0288d1;
    font-weight: 600;
    border-left-color: #0288d1;
}

.sidebar-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

/* メインエリア */
.admin-main {
    flex: 1;
    padding: 24px 28px;
    background: #f5f7fa;
    overflow-y: auto;
}

.admin-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.admin-page-header h2 {
    font-size: 1.2rem;
    color: #333;
}

/* 管理画面ボタン */
.btn-admin-primary {
    padding: 10px 20px;
    background: linear-gradient(135deg, #4fc3f7 0%, #0288d1 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-admin-primary:hover {
    opacity: 0.9;
}

.btn-admin-secondary {
    padding: 10px 20px;
    background: #e8e8e8;
    color: #555;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-admin-secondary:hover {
    background: #d0d0d0;
}

.btn-admin-danger {
    padding: 10px 20px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-admin-danger:hover {
    opacity: 0.9;
}

.btn-admin-sm {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-admin-sm:hover { opacity: 0.8; }

.btn-admin-sm.edit {
    background: #e3f2fd;
    color: #1976d2;
}

.btn-admin-sm.delete {
    background: #ffebee;
    color: #c62828;
}

.btn-admin-sm.copy {
    background: #e8f5e9;
    color: #2e7d32;
}

/* セレクトボックス */
.admin-select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    background: white;
    cursor: pointer;
}

.admin-select:focus {
    border-color: #0288d1;
}

/* テキストエリア */
.admin-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    resize: vertical;
    font-family: inherit;
    line-height: 1.7;
}

.admin-textarea:focus {
    border-color: #0288d1;
}

/* テーブル */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}

.admin-table th {
    background: #f5f7fa;
    padding: 12px 16px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 700;
    color: #666;
    border-bottom: 2px solid #e8e8e8;
}

.admin-table td {
    padding: 12px 16px;
    font-size: 0.85rem;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: #fafbff;
}

.admin-table .actions {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

/* カード一覧 */
.admin-card-list {
    display: grid;
    gap: 12px;
}

.admin-card {
    background: white;
    border-radius: 10px;
    padding: 16px 20px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.admin-card .card-info {
    flex: 1;
    min-width: 0;
}

.admin-card .card-info h4 {
    font-size: 0.95rem;
    margin-bottom: 4px;
    color: #333;
}

.admin-card .card-info p {
    font-size: 0.8rem;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-card .card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* 問題カード（管理用） */
.admin-question-card {
    background: white;
    border-radius: 10px;
    padding: 16px 20px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    margin-bottom: 12px;
    border-left: 4px solid #0288d1;
}

.admin-question-card .q-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.admin-question-card .q-num {
    font-size: 0.8rem;
    font-weight: 700;
    color: #0288d1;
}

.admin-question-card .q-text {
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: 10px;
    color: #333;
}

.admin-question-card .q-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    font-size: 0.8rem;
}

.admin-question-card .q-choice {
    padding: 6px 10px;
    background: #f8f9fb;
    border-radius: 6px;
    color: #555;
}

.admin-question-card .q-choice.correct {
    background: #e8f5e9;
    color: #2e7d32;
    font-weight: 600;
}

.admin-question-card .q-passage-indicator {
    display: inline-block;
    font-size: 0.7rem;
    background: #fff3e0;
    color: #e65100;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
}

.admin-question-card .q-youtube-indicator {
    display: inline-block;
    font-size: 0.7rem;
    background: #fce4ec;
    color: #c62828;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
}

/* バッジ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge.active {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge.inactive {
    background: #ffebee;
    color: #c62828;
}

.badge.admin {
    background: #e3f2fd;
    color: #1565c0;
}

.badge.student {
    background: #f3e5f5;
    color: #7b1fa2;
}

/* モーダル */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-box {
    background: white;
    border-radius: 14px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}

.modal-box.modal-wide {
    max-width: 720px;
}

.modal-box.modal-small {
    max-width: 400px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 1rem;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid #eee;
}

/* エディタツールバー */
.editor-toolbar {
    display: flex;
    gap: 4px;
    padding: 6px 8px;
    background: #f5f7fa;
    border: 2px solid #e0e0e0;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    flex-wrap: wrap;
    align-items: center;
}

.editor-toolbar.small {
    padding: 4px 6px;
}

.editor-toolbar + .admin-textarea,
.editor-toolbar + .editor-textarea {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.toolbar-btn {
    padding: 4px 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 600;
    color: #555;
}

.toolbar-btn:hover {
    background: #0288d1;
    color: white;
    border-color: #0288d1;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: #ddd;
    margin: 0 4px;
}

/* エディタプレビュー */
.editor-preview {
    padding: 14px;
    background: #fffde7;
    border: 2px solid #ffd54f;
    border-radius: 0 0 8px 8px;
    font-size: 0.9rem;
    line-height: 1.9;
}

.editor-preview ruby rt {
    font-size: 0.55em;
    color: #888;
}

/* ヒント */
.hint {
    font-size: 0.7rem;
    color: #999;
    font-weight: 400;
    margin-left: 8px;
}

/* 空メッセージ */
.empty-msg {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 0.9rem;
}

/* トースト通知 */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #333;
    color: white;
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 0.85rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 300;
    animation: toast-in 0.3s ease;
}

.toast.success { background: #2e7d32; }
.toast.error { background: #c62828; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 管理画面レスポンシブ */
@media (max-width: 768px) {
    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e8e8e8;
        padding: 12px 0;
    }

    .sidebar-section {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        padding: 0 12px;
        margin-bottom: 8px;
    }

    .sidebar-label {
        width: 100%;
        padding: 0;
        margin-bottom: 4px;
    }

    .sidebar-link {
        padding: 8px 14px;
        border-radius: 20px;
        border-left: none;
        font-size: 0.8rem;
    }

    .sidebar-link.active {
        background: #0288d1;
        color: white;
        border-left: none;
    }

    .admin-main {
        padding: 16px;
    }

    .admin-question-card .q-choices {
        grid-template-columns: 1fr;
    }

    .modal-box.modal-wide {
        max-width: 100%;
    }
}
