/* app.css */

body {
    font-family: "Biz UDPGothic", "Noto Sans JP", sans-serif;
}

/* プルトゥリフレッシュ無効化 */
body, html {
    overscroll-behavior-y: contain;
}

/* Vue.js クローク */
[v-cloak] {
    display: none;
}

/* ===========================
   共通コンポーネントスタイル
   =========================== */

/* ヘッダー */
.app-header {
    background-color: white;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 50;
}

/* ベータバッジ */
.beta-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 0.625rem;
    font-weight: bold;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

@media (max-width: 640px) {
    .beta-badge {
        font-size: 0.5625rem;
        padding: 0.125rem 0.3rem;
    }
}

/* ドロップダウンメニュー（シンプル実装） */
.dropdown {
    position: relative;
}

.dropdown-btn {
    padding: 0.5rem 0.75rem;
    background-color: #3b82f6;
    color: white;
    border-radius: 0.375rem;
    font-size: 1.5rem;
    line-height: 1;
    transition: background-color 0.2s;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.dropdown-btn:hover {
    background-color: #2563eb;
}

.dropdown-btn:active {
    background-color: #1d4ed8;
}

/* 背景オーバーレイ */
.dropdown-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: transparent;
    z-index: 40;
}

/* ドロップダウンメニュー本体 */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    width: 200px;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 50;
    overflow: hidden;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 1rem;
    color: #374151;
    background-color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: #f3f4f6;
}

.dropdown-item:active {
    background-color: #e5e7eb;
}

.dropdown-item i {
    width: 1.25rem;
    color: #2563eb;
}

/* 単語カード */
.word-card {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

@media (max-width: 640px) {
    .word-card {
        padding: 1rem;
    }
}

@media (max-width: 375px) {
    .word-card {
        padding: 0.75rem;
    }
}

/* 単語表示 */
.word-display {
    text-align: center;
    margin-bottom: 1.5rem;
}

.word-title {
    font-size: 2.25rem;
    font-weight: bold;
    color: #1f2937;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@media (max-width: 640px) {
    .word-title {
        font-size: 1.5rem;
    }
}

@media (min-width: 641px) and (max-width: 768px) {
    .word-title {
        font-size: 1.875rem;
    }
}

/* CEFRレベルバッジ */
.cefr-badge {
    display: inline-block;
    font-size: 0.875rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    border: 1px solid;
}

/* レベルバッジの色設定（CEFR等） */

@media (max-width: 640px) {
    .cefr-badge {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
    }
}

/* 意味の前に表示する品詞バッジ（インライン） */
.pos-badge-inline {
    display: inline-block;
    background-color: #3b82f6;
    color: white;
    font-size: 0.875rem;
    font-weight: 700;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* 複数品詞グループの間隔 */
.pos-group {
    display: inline-block;
    margin-right: 1rem;
}

.pos-group:last-child {
    margin-right: 0;
}

@media (max-width: 640px) {
    .pos-badge-inline {
        font-size: 0.75rem;
        padding: 0.125rem 0.4rem;
        margin-right: 0.375rem;
    }
    
    .pos-group {
        margin-right: 0.75rem;
    }
}

/* 発音ボタン */
.pronunciation-btn {
    padding: 0.5rem;
    background-color: #3b82f6;
    color: white;
    border-radius: 9999px;
    transition: all 0.2s;
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pronunciation-btn:hover {
    background-color: #2563eb;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.pronunciation-btn:active {
    transform: scale(0.95);
}

@media (max-width: 640px) {
    .pronunciation-btn {
        padding: 0.4rem;
        min-width: 36px;
        min-height: 36px;
    }
}

/* 例文読み上げボタン */
.example-btn {
    padding: 0.5rem;
    background-color: #10b981;
    color: white;
    border-radius: 9999px;
    transition: all 0.2s;
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.example-btn:hover {
    background-color: #059669;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.example-btn:active {
    transform: scale(0.95);
}

@media (max-width: 640px) {
    .example-btn {
        padding: 0.4rem;
        min-width: 36px;
        min-height: 36px;
    }
}

/* 語源パーツ */
.etymology-parts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.etymology-part {
    cursor: pointer;
    transition: all 0.2s;
}

.etymology-part:hover {
    transform: scale(1.05);
}

.etymology-part:active {
    transform: scale(0.95);
}

.etymology-box {
    padding: 0.75rem 0.5rem;
    border-radius: 0.5rem;
    border: 2px solid;
    transition: all 0.2s;
}

@media (min-width: 641px) {
    .etymology-box {
        padding: 0.5rem 0.75rem;
    }
}

.etymology-box:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* アクティブな語源ボックス */
.etymology-active {
    border-width: 4px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.part-text {
    font-size: 1.125rem;
    font-weight: bold;
    text-align: center;
}

@media (min-width: 641px) {
    .part-text {
        font-size: 1.25rem;
    }
}

.part-meaning {
    font-size: 0.75rem;
    text-align: center;
    margin-top: 0.125rem;
    opacity: 0.75;
}

/* 語源の色 */
.etymology-prefix {
    background-color: #dbeafe;
    border-color: #60a5fa;
    color: #1e40af;
}

.etymology-root {
    background-color: #fee2e2;
    border-color: #f87171;
    color: #991b1b;
}

.etymology-suffix {
    background-color: #dcfce7;
    border-color: #4ade80;
    color: #166534;
}

/* 意味と例文 */
.word-meaning {
    text-align: center;
    margin-bottom: 1rem;
}

.meaning-text {
    font-size: 1.25rem;
    color: #374151;
    margin-bottom: 0.5rem;
}

/* すりガラス効果（transitionなし） */
.blur-text {
    filter: blur(8px);
    user-select: none;
    pointer-events: none;
    color: #9ca3af;
}

@media (max-width: 640px) {
    .meaning-text {
        font-size: 1.125rem;
    }
}

.example-container {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0 0.5rem;
}

@media (min-width: 641px) {
    .example-container {
        align-items: center;
        gap: 0.75rem;
    }
}

.example-text {
    font-size: 0.875rem;
    color: #4b5563;
    flex: 1;
    text-align: left;
    line-height: 1.5;
}

@media (min-width: 641px) {
    .example-text {
        font-size: 0.9375rem;
        text-align: center;
    }
}

/* ボタン共通 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 44px;
    min-height: 44px;
}

.btn-primary {
    background-color: #2563eb;
    color: white;
}

.btn-primary:hover {
    background-color: #1d4ed8;
}

.btn-secondary {
    background-color: #10b981;
    color: white;
}

.btn-secondary:hover {
    background-color: #059669;
}

.btn-nav {
    background-color: #3b82f6;
    color: white;
    padding: 0.75rem 1rem;
}

.btn-nav:hover {
    background-color: #2563eb;
}

.btn-nav-disabled {
    background-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    padding: 0.75rem 1rem;
}

.btn-nav-disabled:hover {
    background-color: #e5e7eb;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* リストアイテム */
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.list-item:hover {
    background-color: #f9fafb;
}

/* メモボックス */
.note-box {
    background-color: #eff6ff;
    border-left: 4px solid #3b82f6;
    padding: 1rem;
    border-radius: 0.25rem;
}

/* ===========================
   設定画面スタイル
   =========================== */

.settings-section {
    padding: 1.25rem;
    background-color: #f9fafb;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.settings-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.settings-item {
    margin-bottom: 1rem;
}

.settings-item:last-child {
    margin-bottom: 0;
}

.settings-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
    color: #374151;
}

.settings-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
    cursor: pointer;
    accent-color: #2563eb;
}

.settings-radio {
    width: 1.125rem;
    height: 1.125rem;
    margin-right: 0.75rem;
    cursor: pointer;
    accent-color: #2563eb;
}

.settings-radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9375rem;
    color: #4b5563;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}

.settings-radio-label:hover {
    background-color: #f3f4f6;
}

.settings-description {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
    line-height: 1.5;
}

/* 難易度チェックボックス */
.difficulty-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.difficulty-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
}

.difficulty-checkbox-label:hover {
    background-color: #f3f4f6;
}

.difficulty-badge {
    display: inline-block;
    font-size: 0.875rem;
    font-weight: 700;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    min-width: 3rem;
    text-align: center;
}

.difficulty-A1 {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #4ade80;
}

.difficulty-A2 {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #60a5fa;
}

.difficulty-B1 {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fbbf24;
}

.difficulty-B2 {
    background-color: #fed7aa;
    color: #9a3412;
    border: 1px solid #fb923c;
}

.difficulty-C1 {
    background-color: #fecaca;
    color: #991b1b;
    border: 1px solid #f87171;
}

.difficulty-C2 {
    background-color: #fce7f3;
    color: #9f1239;
    border: 1px solid #f9a8d4;
}

.difficulty-\- {
    background-color: #f3f4f6;
    color: #4b5563;
    border: 1px solid #9ca3af;
}

/* 統計グリッド */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background-color: white;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: bold;
    color: #2563eb;
}

/* モーダル */
.modal-fade-enter-active,
.modal-fade-leave-active {
    transition: opacity 0.3s ease;
}

.modal-fade-enter,
.modal-fade-leave-to {
    opacity: 0;
}

.modal-fade-enter-active .bg-white,
.modal-fade-leave-active .bg-white {
    transition: transform 0.3s ease;
}

.modal-fade-enter .bg-white {
    transform: scale(0.9);
}

.modal-fade-leave-to .bg-white {
    transform: scale(0.9);
}

/* スムーズスクロール */
html {
    scroll-behavior: smooth;
}

/* カスタムスクロールバー */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* タップ時のハイライト無効化 */
* {
    -webkit-tap-highlight-color: transparent;
}

/* テキスト選択の色 */
::selection {
    background-color: #3b82f6;
    color: white;
}

::-moz-selection {
    background-color: #3b82f6;
    color: white;
}

/* レスポンシブ調整 */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    body {
        font-size: 14px;
    }
    
    h1, h2, h3 {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
}

@media (max-width: 375px) {
    body {
        font-size: 13px;
    }
}

/* ローディングアニメーション */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* パルスアニメーション */
@keyframes pulse-subtle {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

button:active {
    animation: pulse-subtle 0.3s ease;
}

/* 再生中のハイライト */
.playing-highlight {
    background-color: rgba(59, 130, 246, 0.15);
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.word-title.playing-highlight {
    color: #2563eb;
}

.example-text.playing-highlight {
    color: #2563eb;
    font-weight: 500;
}
