@charset "utf-8";

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    /* viewportに対して100%。bodyの高さを少なくとも、表示領域と同じにする。 */
    min-height: 100vh;
    /* 上下2rem、左右1rem */
    padding: 2rem 1rem;
}

/* 全体包含ブロック */
.container {
    max-width: 90vw;
    /* 90vwの中の100％ */
    width: 100%;
    margin: 0 auto;
    display: flex;
    /* 子要素を縦に並べて配置 */
    flex-direction: column;
    /* 子要素を左右中央に配置 */
    align-items: center;
    gap: 2rem;
}

/* 入力フォームとリセットボタン包含ブロック。上段の白背景角丸。 */
.input-group {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    /* 使いづらいので601px以上は広げない */
    max-width: 600px;
    /* 最大600px幅の中で幅100％ */
    width: 100%;
    /* 背景にブラー効果を追加 */
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    /* 最小幅を設定 */
    min-width: 280px;
}

/* 入力フォーム */
.search-input {
    /* flex-grow（伸ばす比率）: 1; flex-shrink（縮む比率）: 1; flex-basis（基準となる幅）: 0;と同じ意味。 */
    flex: 1;
    /* リセットボタンと余白を統一 */
    padding: 12px 16px;
    /* リセットボタンとボタンの最小高さを統一 */
    min-height: 48px;
    height: auto;
    line-height: 1.2;
    box-sizing: border-box;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    /* iOS Safari は16px未満のフォントサイズで自動拡大されるので、iOS Safariの自動拡大を防ぐ。max(16px, 1rem)で最低16pxを保証。レスポンシブスケーリングも維持。 */
    font-size: max(16px, 1rem);
    transition: all 0.3s ease;
    outline: none;
    min-width: 0;
    appearance: none;
    /* iOS のデフォルト入力フィールドスタイルを無効化 */
    -webkit-appearance: none;
}

    .search-input:focus {
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        transform: translateY(-2px);
    }

/* リセットボタン */
.reset-button {
    padding: 12px 24px;
    font-size: 16px;
    min-height: 48px;
    height: auto;
    line-height: 1.2;
    -webkit-appearance: none;
    appearance: none;
    /* スクロールとズームのみ可（ダブルタップでの拡大を無効化） */
    touch-action: manipulation;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-weight: 500;
    /* ボタンが縮まないようにする */
    flex-shrink: 0;
}

    .reset-button:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    }

    .reset-button:active {
        transform: translateY(0);
    }

/* 検索結果表示エリア */
.results-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.match-item {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

    .match-item:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    }

/* 問題文章の検索結果 */
.question {
    font-weight: 500;
    color: #2d3748;
    margin-bottom: 0.75rem;
    font-size: 1.5rem;
    line-height: 1.5;
}

/* 解答の検索結果 */
.answer {
    color: #667eea;
    font-weight: 600;
    font-size: 2rem;
    padding: 0.5rem;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 6px;
}

/* 該当する検索結果が無い場合 */
.no-results {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
    color: #718096;
    font-style: italic;
    font-size: 1.5rem;
}

/* 正規表現エラー */
.error-message {
    background: #fed7d7;
    color: #c53030;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #c53030;
}



/* レスポンシブ対応 - サイズに応じて相対的にスケール */
@media (max-width: 1200px) {
    html {
        font-size: 0.875rem;
    }
}

@media (max-width: 900px) {
    html {
        font-size: 0.75rem;
    }
}

@media (max-width: 600px) {
    html {
        font-size: 0.625rem;
    }
    .container {
        padding: 1rem;
    }
    .reset-button {
        padding: 14px 20px;
        font-size: 15px;
        min-height: 50px;
    }
    .search-input {
        padding: 14px 16px;
        font-size: 15px;
        min-height: 50px;
    }
}

@media (max-width: 400px) {
    html {
        font-size: 0.5rem;
    }
    .reset-button {
        padding: 16px 18px;
        font-size: 14px;
        min-height: 52px;
    }
    .search-input {
        padding: 16px 16px;
        font-size: 14px;
        min-height: 52px;
    }
}


/* 上下余白のカスタムクラス例 */
.margin-small {
    padding: 1rem 1rem;
}

.margin-medium {
    padding: 3rem 1rem;
}

.margin-large {
    padding: 5rem 1rem;
}