
:root {
    --board-gap: clamp(3px, 0.5vw, 7px);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    color: #111827;
    font-family: Arial, "Noto Sans JP", sans-serif;

    background-image: url("../images/background.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.page-shell {
    width: 100%;
    min-height: 100vh;
    padding: clamp(5px, 1vw, 14px);
}

/* ヘッダー */
.page-header {
    text-align: center;
}

.page-title {
    margin: 0 auto 5px;
    font-size: clamp(18px, 2.2vw, 34px);
    font-weight: 500;
}

/* 操作パネル */
.control-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: clamp(4px, 0.6vw, 8px);
}

.timer-box,
.score-box {
    min-height: clamp(28px, 3vw, 38px);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d5dbe2;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.88);
    white-space: nowrap;
}

.timer-box {
    width: clamp(110px, 22vw, 310px);
    font-size: clamp(18px, 2vw, 25px);
    font-family: Georgia, serif;
}

.score-box {
    gap: 3px;
    min-width: clamp(130px, 18vw, 210px);
    padding: 0 8px;
    font-size: clamp(13px, 1.5vw, 18px);
    font-family: Georgia, serif;
}

.score-caption {
    align-self: flex-end;
    margin-bottom: 3px;
    font-size: clamp(8px, 0.8vw, 10px);
}

.score-box strong {
    font-weight: 500;
}

.score-divider {
    padding: 0 2px;
    color: #777;
}

/* ボタン */
.btn {
    min-height: clamp(28px, 2.8vw, 36px);
    border: 0;
    border-radius: 4px;
    padding: 5px clamp(7px, 1vw, 14px);
    color: #fff;
    font-size: clamp(11px, 1vw, 14px);
    cursor: pointer;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.btn-muted {
    color: #6b7280;
    border: 1px solid #aaa;
    background: #f8f8f8;
}

.btn-blue {
    background: #5798f5;
}

.btn-green {
    background: #16834b;
}

/* 回答フォーム */
.answer-form {
    display: flex;
    align-items: center;
    gap: 4px;
}

.answer-input {
    width: clamp(100px, 13vw, 170px);
    height: clamp(28px, 2.8vw, 36px);
    padding: 4px 7px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: clamp(12px, 1vw, 15px);
    background-color: rgba(255, 255, 255, 0.5);
}

.answer-input::placeholder {
    color: black;
    opacity: 1;
}

.message {
    min-height: 17px;
    margin: 4px 0 6px;
    color: black;
    font-size: clamp(10px, 1vw, 13px);
}

/* ポケモン一覧の外枠 */
.board-frame {
    height: calc(100dvh - 105px);
    min-height: 250px;
    overflow: auto;
    border: 1px solid #9ca3af;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.3);
    padding: clamp(3px, 0.5vw, 7px);
}

/* ポケモン一覧 */
.pokemon-board {
    display: grid;
    grid-template-columns: repeat(20, minmax(0, 1fr));
    gap: var(--board-gap);
    align-content: start;
    container-type: inline-size;
}

/* 各ポケモンのマス */
.pokemon-cell {
    position: relative;
    aspect-ratio: 1 / 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: transparent;
    border-radius: 0;
}

/* 旧モンスターボールの横線を無効化 */
.pokemon-cell::before {
    display: none;
}

/* ポケモン番号 */
.pokemon-number {
    position: absolute;
    top: 0%;
    z-index: 3;

    max-width: 95%;
    overflow: hidden;

    padding: 0px 5px;
    border-radius: 5px;

    color: #ffffff;

    /* ボードの幅に比例して文字サイズを変更 */
    font-size: 1.2cqw;

    font-weight: bold;
    font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", "YuGothic", Meiryo, sans-serif;

    -webkit-text-stroke: 0.3px #003366;
    text-shadow: 1px 1px 2px #001a33;
}

/* 画像表示領域 */
.pokemon-center {
    position: absolute;
    inset: 0;
    z-index: 1;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0;
    background: transparent;
}

/* ポケモン画像 */
.pokemon-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 正解時 */
.pokemon-cell.is-correct {
    background: transparent;
}

.pokemon-cell.is-correct .pokemon-number {
    color: #fff;
}

/* ポケモン名 */
.pokemon-name {
    position: absolute;
    bottom: 5%;
    z-index: 3;

    max-width: 95%;
    overflow: hidden;

    padding: 2px 5px;
    border-radius: 5px;

    color: #00ffff;
    background: rgba(0, 30, 60, 0.7);

    font-size: clamp(8px, 0.85vw, 14px);
    font-weight: 700;

    -webkit-text-stroke: 0.3px #003366;
    text-shadow: 1px 1px 2px #001a33;

    text-overflow: ellipsis;
    white-space: nowrap;
}

/* タブレット */
@media (max-width: 1000px) {
    .pokemon-board {
        grid-template-columns: repeat(12, minmax(0, 1fr));
    }

    .board-frame {
        height: calc(100dvh - 115px);
    }
}

/* スマートフォン */
@media (max-width: 600px) {
    .page-shell {
        padding: 5px;
    }

    .page-title {
        font-size: clamp(17px, 5vw, 24px);
    }

    .control-panel {
        gap: 5px;
    }

    .timer-box {
        width: 42%;
        font-size: clamp(17px, 5vw, 22px);
    }

    .score-box {
        min-width: 45%;
        font-size: clamp(12px, 3.8vw, 16px);
    }

    .answer-input {
        width: clamp(90px, 30vw, 140px);
    }

    .pokemon-board {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 5px;
    }

    .pokemon-number {
        top: 5%;
        font-size: clamp(8px, 2.5vw, 12px);
    }

    .pokemon-name {
        bottom: 4%;
        max-width: 98%;
        padding: 2px 3px;
        font-size: clamp(8px, 2.5vw, 12px);
    }

    .board-frame {
        height: calc(100dvh - 145px);
        min-height: 250px;
    }
}

/* 小型スマートフォン */
@media (max-width: 360px) {
    .pokemon-board {
        gap: 3px;
    }

    .control-panel {
        gap: 3px;
    }

    .btn {
        padding: 4px 6px;
    }
}

/* 正解後はポケモン名を表示しない */
.pokemon-cell.is-correct .pokemon-name {
    display: none !important;
}

/* 結果表示欄 */
.result-panel {
    margin-top: 20px;
    padding: 20px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.85);
    text-align: center;
}

.result-panel[hidden] {
    display: none !important;
}

.result-panel h2 {
    margin-bottom: 15px;
    font-size: 22px;
}

.result-panel label {
    display: block;
    margin-bottom: 8px;
}

.result-panel .answer-input {
    margin-bottom: 12px;
}

#copy-message {
    margin-top: 10px;
    font-weight: bold;
}