/* Zaplays lab — 自然史図鑑をイメージしたデザイン */
:root {
    color-scheme: light;
    --paper: #fffdf7;
    --ink: #303d34;
    --muted: #59675b;
    --green: #345747;
    --line: #ded8c8;
    --sand: #f3efe4;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    min-height: 100vh;
    min-height: 100svh;
    font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
    background: radial-gradient(ellipse at top, #f4f0e4, #dce5d9);
    color: var(--ink);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px 16px;
}
.container { width: 100%; max-width: 500px; margin: auto; }
.screen {
    text-align: center;
    padding: 30px 28px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 12px 40px #344b3520;
    animation: fade-in .3s ease;
}
.hidden { display: none !important; }
.brand { color: var(--green); font-size: 12px; font-weight: bold; letter-spacing: 3px; margin-bottom: 22px; }
h1 { font-size: clamp(28px, 7vw, 40px); line-height: 1.45; margin-bottom: 20px; }
h2 { font-size: 25px; line-height: 1.5; margin: 20px 0; }
.description { color: var(--muted); line-height: 1.8; }
.character-placeholder { width: 140px; height: 140px; margin: 28px auto; border-radius: 50%; background: var(--sand); display: grid; place-items: center; font-size: 65px; border: 1px solid var(--line); }
button { width: 100%; max-width: 340px; min-height: 48px; padding: 16px; border: 1px solid transparent; border-radius: 12px; background: var(--green); color: white; font: inherit; font-weight: bold; cursor: pointer; transition: background .2s, transform .2s; }
button:hover { background: #254638; }
button:active { transform: scale(.98); }
button:focus-visible { outline: 3px solid #9b7444; outline-offset: 3px; }
.note { margin-top: 18px; color: var(--muted); font-size: 13px; }
.progress-info { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.progress-bar { width: 100%; height: 8px; background: #e5e6dc; border-radius: 10px; overflow: hidden; }
#progress-fill { width: 0%; height: 100%; background: #66856b; border-radius: 10px; transition: width .3s ease; }
#question-text { min-height: 90px; display: flex; justify-content: center; align-items: center; font-size: 22px; margin: 24px 0; }
.answer-list { display: flex; flex-direction: column; gap: 12px; }
.answer-button { max-width: none; text-align: left; padding: 16px 18px; background: #f8f6ef; color: var(--ink); border: 1px solid var(--line); font-size: 15px; line-height: 1.6; }
.answer-button:hover { background: #e5ede1; border-color: #78937a; }
/* 診断結果 */
.result-heading { color: var(--muted); font-size: 14px; letter-spacing: 1px; margin: 12px 0; }
.result-character { width: 100%; max-width: 320px; aspect-ratio: 1; margin: 12px auto 18px; border-radius: 50%; background: radial-gradient(circle, #f0eadb 0%, #f7f3e9 65%, var(--paper) 73%); display: flex; align-items: center; justify-content: center; font-size: 85px; }
#result-image { width: 100%; height: 100%; object-fit: contain; }
#result-name { font-size: clamp(22px, 5.8vw, 29px); margin: 8px 0; line-height: 1.45; overflow-wrap: anywhere; }
.result-subtitle { color: #795b39; font-size: 15px; font-weight: bold; margin-bottom: 20px; line-height: 1.6; }
.result-description-box { padding: 20px; background: var(--sand); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 22px; text-align: left; }
#result-description { color: var(--ink); line-height: 1.95; font-size: 15px; }
.traits-area { margin-bottom: 24px; }
.traits-heading { color: var(--green); font-size: 13px; font-weight: bold; margin-bottom: 12px; }
.traits-list { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.trait-tag { display: inline-block; padding: 7px 14px; border-radius: 30px; background: #e7ede2; border: 1px solid #cddbc9; color: #345747; font-size: 13px; }
.result-footer { color: var(--muted); font-size: 12px; line-height: 1.8; border-top: 1px solid var(--line); padding-top: 18px; margin-bottom: 18px; }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 400px) {
    body { padding: 12px; }
    .screen { padding: 24px 18px; }
    #question-text { font-size: 20px; }
    .result-character { max-width: 270px; }
    .result-description-box { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* 保存・共有 */
.share-actions { display: grid; justify-items: center; gap: 10px; margin-bottom: 18px; }
#share-button { background: #202020; }
#share-button:hover { background: #383838; }
#retry-button { background: transparent; color: var(--green); border-color: var(--green); margin-top: 12px; }
#retry-button:hover { background: #e5ede1; }
.share-note, #share-status { font-size: 12px; color: var(--muted); line-height: 1.7; }
#share-status:empty { display: none; }
button:disabled { opacity: .6; cursor: wait; }

/* タイトル画面：動物図鑑 */
.title-animals {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin: 20px auto 24px;
    max-width: 360px;
    padding: 8px;
    background: var(--sand);
    border: 1px solid var(--line);
    border-radius: 16px;
}
.title-animals img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: contain;
    min-width: 0;
}
@media (max-width: 400px) {
    .title-animals { margin: 16px auto 20px; padding: 4px; }
}
