/* style.css (2025/10/06 最終調整版) */

body {
    font-family: "Kiwi Maru", sans-serif;
    line-height: 1.6;
    max-width: 85vw;
    margin: 20px auto;
    padding: 0 15px;
    background-color: #222;
    color: #333;
}

h1 {
  font-family: "Plaster", "Dela Gothic One", sans-serif;
  font-weight: 400;
  font-style: normal;
  color:white;
}

h1::first-letter{
	color:yellow;
}

h1, h2 {
    text-align: center;
}

h2{
	font-family: "Dela Gothic One", sans-serif;
	font-weight:100;
	font-size:2em;
}

h2 span.numbers{
	font-size:0.5em;
	font-family: "Kiwi Maru", sans-serif;
}

.search-form-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}
.search-form {
    display: flex;
}
input[type="text"] {
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 5px 0 0 5px;
    width: 250px;
}
button[type="submit"],
.clear-btn {
    width: 45px;
    height: 45px;
    padding: 0;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2em;
}
button[type="submit"] {
    border: 1px solid #333;
    background-color: #333;
    color: white;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
}
button[type="submit"]:hover {
    background-color: #555;
}
.clear-btn {
    border: 1px solid #777;
    background-color: #fff;
    color: #333;
    border-radius: 5px;
    text-decoration: none;
}
.clear-btn:hover {
    background-color: #f2f2f2;
}
.error {
    color: red;
    text-align: center;
}
.result-container {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.pokemon-info {
    text-align: center;
    margin-bottom: 30px;
}

.pokemon-info img {
    width: 100%;
    max-width:480px;
    height:auto;
    max-height: 680px;
}
.pokemon-info h2 {
    margin: 10px 0 0;
}
.relations-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.relation-box {
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 5px;
}

.relation-box h3 {
    margin: 0 0 0 -0.5em;
    border-bottom: 3px solid #333;
    padding:0.5em 0 0.5em 0;
    width:100%;
}

.relation-box h4 {
    margin: 0 0 0 -0.5em;
    padding:0.5em 0 0.5em 0;
    width:100%;
    font-size:1em;
}

.relation-box h4 span.super-effective{
	color:red;
}

.relation-box h4 i{
	margin:0 0.5em 0 0;
	font-size:1.3em;
}

.moves-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 30px;
}
.moves-table th, .moves-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}
.moves-table th {
    background-color: #f2f2f2;
}
.example-pokemon {
    margin-top: 10px;
    font-size: 0.9em;
}
.pokemon-en-name {
    margin: 0;
    font-weight: normal;
    color: #666;
}
.speak-btn {
    cursor: pointer;
    margin-left: 8px;
    font-style: normal;
    vertical-align: left;
    font-size:1.5em;
    color:red;
}
.scrollable-table-container {
    position: relative;
}
.scroll-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.scroll-hint.hidden {
    opacity: 0;
}
.scrollable-table-container::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 30px;
    height: 100%;
    background: linear-gradient(to left, #fff, rgba(255, 255, 255, 0));
    pointer-events: none;
    transition: opacity 0.3s ease;
    opacity: 0;
}
.scrollable-table-container.scrolled::after {
    opacity: 0;
}

.additional-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 30px;
    align-items: start;
}
.stats-container,
.pokedex-entry-container {
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 5px;
}
.pokedex-entry-container h3,
.stats-container h3 {
    margin-top: 0;
    text-align: center;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}
#versionSelector {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border-radius: 5px;
    border: 1px solid #ddd;
}
#pokedexText {
    margin: 0;
    min-height: 100px;
}

.evolution-forms-container {
    margin-top: 30px;
    border-top: 2px solid #f2f2f2;
    padding-top: 20px;
}
.evolution-chain, .other-forms {
    margin-bottom: 20px;
}
.evolution-chain h3, .other-forms h3 {
    text-align: center;
    margin-top: 0;
}
.evolution-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}
.evolution-pokemon, .form-pokemon {
    text-align: center;
}
.evolution-pokemon img, .form-pokemon img {
    width: 96px;
    height: 96px;
    background-color: #f9f9f9;
    border-radius: 50%;
}
.evolution-pokemon p, .form-pokemon p {
    margin: 5px 0 0;
    font-size: 0.9em;
}
.evolution-arrow {
    text-align: center;
}
.evolution-arrow .condition {
    font-size: 0.8em;
    color: #666;
}
.evolution-arrow i {
    font-size: 1.5em;
    color: #ccc;
}
.form-list {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
}

.status-badges {
    margin-top: 10px;
}
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 0.8em;
    color: white;
    margin: 0 5px;
}
.legendary {
    background: linear-gradient(45deg, #ffd700, #f0e68c);
    border: 1px solid #goldenrod;
}
.mythical {
    background: linear-gradient(45deg, #ff69b4, #ffb6c1);
    border: 1px solid #c71585;
}

.image-display-container {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 10px;
    min-height: 140px;
}
.image-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 15px 0;
}
.image-type-selector {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}
.image-type-selector input[type="radio"] {
    display: none;
}
.image-type-selector label {
    padding: 8px 12px;
    cursor: pointer;
    background-color: #fff;
    transition: background-color 0.2s;
    font-size: 0.9em;
}
.image-type-selector label:not(:last-child) {
    border-right: 1px solid #ddd;
}
.image-type-selector input[type="radio"]:checked + label {
    background-color: #e0e0e0;
    font-weight: bold;
}

.shiny-toggle-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: auto;
    margin:0;
    padding: .7em 1em;
    border: none;
    border-radius: 5px;
    box-shadow: 0 2px 3px rgb(0 0 0 / 25%), 0 2px 3px -2px rgb(0 0 0 / 15%);
    background-color: #2589d0;
    color: #fff;
    font-weight: 600;
    font-size: 0.9em;
    cursor: pointer;
}
.shiny-toggle-btn:hover {
    background-color: #1579c0;
}
.shiny-toggle-btn.active {
    background-color: #ffeb3b;
    border-color: #fbc02d;
    color:#333;
}

.search-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
    font-size:1.0em;
}
.search-result-card {
    text-align: center;
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.search-result-card a {
    text-decoration: none;
    color: #333;
}
.search-result-card img {
    width: 96px;
    height: 96px;
    image-rendering: pixelated;
}
.search-result-card p {
    margin: 5px 0 0;
    font-size: 0.9em;
}
.no-sprite {
    width: 96px;
    height: 96px;
    background-color: #eee;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2em;
    color: #ccc;
}


/* --- ▼▼▼ タイプ別ナビゲーションのスタイル ▼▼▼ --- */
.type-nav-container {
    margin-bottom: 20px; /* PC表示時の下の余白 */
    border-bottom: 1px solid #555;
    padding-bottom: 20px;
}
.type-buttons-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}
.type-buttons-container .type-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 0.2s ease;
}
.type-buttons-container .type-button:hover {
    transform: scale(1.1);
}
.type-buttons-container .type-button .p-icon {
    margin: 0;
}
.p-icon.type-normal   { background-image: url('images/type_normal.png'); }
.p-icon.type-fire     { background-image: url('images/type_fire.png'); }
.p-icon.type-water    { background-image: url('images/type_water.png'); }
.p-icon.type-grass    { background-image: url('images/type_grass.png'); }
.p-icon.type-electric { background-image: url('images/type_electric.png'); }
.p-icon.type-ice      { background-image: url('images/type_ice.png'); }
.p-icon.type-fighting { background-image: url('images/type_fighting.png'); }
.p-icon.type-poison   { background-image: url('images/type_poison.png'); }
.p-icon.type-ground   { background-image: url('images/type_ground.png'); }
.p-icon.type-flying   { background-image: url('images/type_flying.png'); }
.p-icon.type-psychic  { background-image: url('images/type_psychic.png'); }
.p-icon.type-bug      { background-image: url('images/type_bug.png'); }
.p-icon.type-rock     { background-image: url('images/type_rock.png'); }
.p-icon.type-ghost    { background-image: url('images/type_ghost.png'); }
.p-icon.type-dragon   { background-image: url('images/type_dragon.png'); }
.p-icon.type-dark     { background-image: url('images/type_dark.png'); }
.p-icon.type-steel    { background-image: url('images/type_steel.png'); }
.p-icon.type-fairy    { background-image: url('images/type_fairy.png'); }

.type-buttons-container .type-button:nth-child(19) {
    display: none;
}
.type-menu-toggle {
    display: none; /* PCでは非表示 */
}

/* --- PC表示用のスタイル (画面幅が769px以上) --- */
@media (min-width: 769px) {
    .type-buttons-container .type-button span {
        display: none;
    }
    .type-buttons-container .type-button {
        width: 40px;
        height: 40px;
        border-radius: 50%;
    }
    .type-buttons-container .type-button .p-icon {
        width: 100%;
        height: 100%;
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
    }
}


/* --- ▼▼▼ スマホ表示用のスタイル (画面幅が768px以下) ▼▼▼ --- */
@media (max-width: 768px) {
    
    /* --- 基本レイアウト調整 --- */
    h1 {
        font-size: 1.8em;
    }
    .relations-grid,
    .additional-info-grid {
        grid-template-columns: 1fr;
    }
    .search-form-container,
    .search-form {
        width: 100%;
    }
    input[type="text"] {
        width: 100%;
    }
    .table-container {
        overflow-x: auto;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }
    .scrollable-table-container::after,
    .scroll-hint {
        opacity: 1;
    }
    .pokemon-info img {
        width: 100%;
        max-height: 450px;
    }

    /* --- タイプ別一覧ページのグリッド --- */
    .search-results-grid {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 10px;
    }
    .search-result-card {
        background-color: transparent;
        box-shadow: none;
        padding: 0;
        width: auto;
    }
    .search-result-card a,
    .search-result-card p {
        color: white;
    }
    .search-result-card img {
        width: 100%;
        height: auto;
    }
    
    /* --- タイプアイコンのグリッドスタイル（トップページと詳細ページメニュー共通） --- */
    .type-buttons-container {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr 1fr;
        gap: 12px;
    }
    .type-buttons-container .type-button span {
        display: none;
    }
    .type-buttons-container .type-button {
        width: 100%;
        aspect-ratio: 1 / 1;
        border-radius: 50%;
    }
    .type-buttons-container .type-button .p-icon {
        width: 100%;
        height: 100%;
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
    }

    /* --- 詳細ページの開閉メニュー --- */
    .page-detail .search-form-container {
        margin-bottom: 1em;
    }
    .page-detail .type-nav-container {
        margin-bottom: 1em;
        padding-bottom: 0;
        border-bottom: none;
    }
    .type-menu-toggle {
        display: block;
        width: 100%;
        padding: 0.8em 0;
        font-size: 1.1em;
        font-family: "Kiwi Maru", sans-serif;
        color: #eee;
        background-color: #555;
        border: 1px solid #666;
        border-radius: 8px;
        text-align: center;
        cursor: pointer;
    }
    .type-menu-toggle .bi {
        transition: transform 0.3s ease;
    }
    .page-detail .type-buttons-container {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease-out;
        margin-top: 1em;
    }
    /* トップページではメニューボタンを非表示にする */
    body:not(.page-detail) .type-menu-toggle {
        display: none;
    }
    /* トップページではアイコンを常に表示 */
    body:not(.page-detail) .type-buttons-container {
        max-height: 1000px; /* 十分な高さを確保 */
        margin-top: 0;
    }
    .page-detail .type-nav-container.is-open .type-buttons-container {
        max-height: 500px;
    }
    .page-detail .type-nav-container.is-open .type-menu-toggle .bi {
        transform: rotate(180deg);
    }

    /* --- 詳細ページの画像切り替えUI --- */
    .image-type-selector label {
        font-size: 0;
        padding: 10px 0;
        width: 55px;
        text-align: center;
    }
    .image-type-selector label::before {
        font-size: 1rem;
        vertical-align: middle;
        font-weight: bold;
    }
    label[for="type-artwork"]::before {
        content: '公式';
    }
    label[for="type-home"]::before {
        font-family: 'bootstrap-icons';
        content: '\f425';
        font-size: 1.2rem;
    }
    label[for="type-front"]::before {
        content: 'F';
    }
    label[for="type-back"]::before {
        content: 'B';
    }
    
    .stats-container,
.pokedex-entry-container {
    min-width: 0;
}

}