/* ============================================================
   ファームズ千代田 売店コミュニケーションアプリ
   CSS スタイルシート
   ============================================================ */

/* --- リセット & 基盤 --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --green-dark: #2d5a27;
    --green-main: #4a8c3f;
    --green-light: #7bc96f;
    --green-pale: #e8f5e4;
    --brown-dark: #5c3d2e;
    --brown-main: #8b6914;
    --cream: #fdf8ef;
    --cream-dark: #f5ecd8;
    --white: #ffffff;
    --text-dark: #2c2c2c;
    --text-mid: #555555;
    --text-light: #888888;
    --blue-accent: #2c7be5;
    --red-alert: #e74c3c;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.18);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 50px;
}

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

body {
    font-family: 'Noto Sans JP', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--cream);
    color: var(--text-dark);
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

/* --- ヘッダー --- */
.app-header {
    background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-main) 100%);
    color: var(--white);
    padding: 14px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.header-inner {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-area > i {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.logo-text h1 {
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    line-height: 1.3;
}

.logo-text p {
    font-size: 0.7rem;
    opacity: 0.85;
    font-weight: 400;
}

/* --- タブナビゲーション --- */
.tab-nav {
    display: flex;
    max-width: 800px;
    margin: 0 auto;
    background: var(--white);
    border-bottom: 3px solid var(--green-pale);
    position: sticky;
    top: 62px;
    z-index: 99;
    box-shadow: var(--shadow-sm);
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-light);
    transition: all 0.3s ease;
    position: relative;
}

.tab-btn i {
    font-size: 1.3rem;
}

.tab-btn small {
    font-size: 0.65rem;
    font-weight: 500;
    color: inherit;
    opacity: 0.8;
}

.tab-btn.active {
    color: var(--green-dark);
    background: var(--green-pale);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 10%;
    width: 80%;
    height: 3px;
    background: var(--green-main);
    border-radius: 3px 3px 0 0;
}

.tab-btn:hover:not(.active) {
    background: #f7f7f7;
    color: var(--text-mid);
}

/* --- メインコンテンツ --- */
.main-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 0 120px 0;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- カテゴリフィルター --- */
.category-filter {
    display: flex;
    gap: 8px;
    padding: 14px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: var(--white);
    border-bottom: 1px solid #eee;
}

.category-filter::-webkit-scrollbar {
    display: none;
}

.cat-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-full);
    background: var(--white);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-mid);
    transition: all 0.25s ease;
    white-space: nowrap;
}

.cat-btn i {
    font-size: 0.9rem;
}

.cat-btn:hover {
    border-color: var(--green-light);
    color: var(--green-dark);
}

.cat-btn.active {
    background: var(--green-main);
    color: var(--white);
    border-color: var(--green-main);
    box-shadow: 0 2px 8px rgba(74,140,63,0.3);
}

/* --- フレーズリスト --- */
.phrase-list {
    padding: 12px 16px;
}

.phrase-category {
    margin-bottom: 20px;
}

.phrase-category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0 8px 0;
    border-bottom: 2px solid var(--green-pale);
    margin-bottom: 10px;
}

.phrase-category-header i {
    font-size: 1.1rem;
    color: var(--green-main);
    width: 28px;
    text-align: center;
}

.phrase-category-header span {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--green-dark);
}

/* --- フレーズカード --- */
.phrase-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 4px solid var(--green-light);
    position: relative;
    overflow: hidden;
}

.phrase-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(74,140,63,0.04));
    pointer-events: none;
}

.phrase-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    border-left-color: var(--green-main);
}

.phrase-card:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-sm);
}

.phrase-jp {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.5;
    margin-bottom: 6px;
}

.phrase-en {
    font-size: 1rem;
    font-weight: 500;
    color: var(--blue-accent);
    line-height: 1.5;
    margin-bottom: 4px;
}

.phrase-kana {
    font-size: 0.85rem;
    font-weight: 500;
    color: #888;
    line-height: 1.4;
    font-style: italic;
}

.phrase-card .tap-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--green-light);
    font-size: 1rem;
    opacity: 0.5;
}

/* --- 指差しモーダル --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.open {
    display: flex;
    animation: modalFadeIn 0.25s ease;
}

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

.modal-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #f0f0f0;
    color: var(--text-mid);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #e0e0e0;
    color: var(--text-dark);
}

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

.modal-lang-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    display: inline-block;
}

.jp-label {
    background: #ffe8e8;
    color: #c0392b;
}

.en-label {
    background: #e3f0ff;
    color: #2c7be5;
}

.modal-jp {
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-dark);
    line-height: 1.5;
    padding: 14px 0 20px;
    word-break: break-word;
}

.modal-en {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--blue-accent);
    line-height: 1.5;
    padding: 14px 0 6px;
    word-break: break-word;
}

.modal-kana {
    font-size: 1.2rem;
    font-weight: 500;
    color: #999;
    line-height: 1.5;
    padding: 0 0 10px;
    font-style: italic;
    word-break: break-word;
    letter-spacing: 0.03em;
}

.modal-divider {
    text-align: center;
    padding: 10px 0;
    color: var(--text-light);
    font-size: 1.2rem;
    position: relative;
}

.modal-divider::before,
.modal-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 24px);
    height: 1px;
    background: #e0e0e0;
}

.modal-divider::before { left: 0; }
.modal-divider::after { right: 0; }

.modal-hint {
    text-align: center;
    padding: 14px;
    background: var(--green-pale);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    color: var(--green-dark);
    font-size: 0.8rem;
    font-weight: 600;
}

.modal-hint i {
    margin-right: 6px;
    animation: pulse 2s infinite;
}

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

/* --- ヒントバナー --- */
.hint-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 700px;
    width: calc(100% - 32px);
    background: linear-gradient(135deg, var(--green-dark), var(--green-main));
    color: var(--white);
    padding: 14px 50px 14px 18px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.5;
    animation: slideUp 0.5s 1s both;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.hint-banner.hidden {
    display: none;
}

.hint-banner i.fa-lightbulb {
    font-size: 1.3rem;
    flex-shrink: 0;
    color: #ffd700;
}

.hint-close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

/* --- レスポンシブ --- */
@media (max-width: 480px) {
    .logo-text h1 {
        font-size: 1rem;
    }

    .logo-area > i {
        font-size: 1.6rem;
    }

    .tab-btn {
        padding: 12px 8px;
        font-size: 0.9rem;
        gap: 8px;
    }

    .tab-btn i {
        font-size: 1.1rem;
    }

    .phrase-jp {
        font-size: 1.1rem;
    }

    .phrase-en {
        font-size: 0.9rem;
    }

    .modal-jp {
        font-size: 1.6rem;
    }

    .modal-en {
        font-size: 1.4rem;
    }

    .modal-kana {
        font-size: 1rem;
    }

    .modal-body {
        padding: 24px 18px 16px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .modal-jp {
        font-size: 1.8rem;
    }
    .modal-en {
        font-size: 1.6rem;
    }
    .modal-kana {
        font-size: 1.1rem;
    }
}

/* iPad横向きなど大画面 */
@media (min-width: 769px) {
    .phrase-list {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0;
    }

    .modal-jp {
        font-size: 2.4rem;
    }

    .modal-en {
        font-size: 2rem;
    }

    .modal-kana {
        font-size: 1.4rem;
    }
}

/* ダークモード対応 (自動) */
@media (prefers-color-scheme: dark) {
    :root {
        --cream: #1a1a1a;
        --cream-dark: #2a2a2a;
        --white: #2c2c2c;
        --text-dark: #e8e8e8;
        --text-mid: #b0b0b0;
        --text-light: #888888;
        --green-pale: #1e3a1a;
    }

    .app-header {
        background: linear-gradient(135deg, #1a3d15 0%, #2d6a27 100%);
    }

    .tab-nav {
        border-bottom-color: #333;
    }

    .phrase-card {
        box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    }

    .modal-card {
        background: #2c2c2c;
    }

    .modal-close {
        background: #3a3a3a;
        color: #ccc;
    }

    .cat-btn {
        border-color: #444;
        color: #b0b0b0;
        background: #2c2c2c;
    }

    .jp-label {
        background: #3a1a1a;
        color: #ff8888;
    }

    .en-label {
        background: #1a2a3a;
        color: #6ab0ff;
    }

    .modal-divider::before,
    .modal-divider::after {
        background: #444;
    }

    .modal-hint {
        background: #1e3a1a;
    }

    .category-filter {
        background: #2c2c2c;
        border-bottom-color: #333;
    }
}
