* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Zen Maru Gothic', sans-serif;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom, 20px));
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-20px); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* スタート画面 */
.start-screen { text-align: center; animation: fadeIn 0.8s ease-out; padding-top: 30px; }
.cat-emoji { font-size: clamp(80px, 20vw, 120px); animation: bounce 2s ease-in-out infinite; filter: drop-shadow(0 10px 30px rgba(0,0,0,0.2)); }
.catchcopy { color: rgba(255,255,255,0.9); font-size: clamp(14px, 3.5vw, 16px); font-weight: 500; margin-top: 15px; letter-spacing: 0.5px; }
.title { font-size: clamp(36px, 10vw, 52px); font-weight: 900; color: var(--white); margin-top: 10px; text-shadow: 0 4px 20px rgba(0,0,0,0.2); letter-spacing: 2px; }
.subtitle { color: rgba(255,255,255,0.85); font-size: clamp(14px, 3.5vw, 16px); margin-top: 15px; line-height: 1.8; }
.badges { display: flex; justify-content: center; gap: 10px; margin-top: 25px; flex-wrap: wrap; }
.badge { background: rgba(255,255,255,0.2); color: var(--white); padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 500; backdrop-filter: blur(10px); }
.start-btn { margin-top: 35px; background: var(--white); color: var(--secondary); border: none; padding: 18px 50px; font-size: 18px; font-weight: 700; border-radius: 50px; cursor: pointer; display: inline-flex; align-items: center; gap: 10px; box-shadow: 0 15px 40px rgba(0,0,0,0.25); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); font-family: inherit; -webkit-tap-highlight-color: transparent; }
.start-btn:hover { transform: translateY(-3px); box-shadow: 0 20px 50px rgba(0,0,0,0.3); }
.start-btn:active { transform: translateY(0); }
.time-note { margin-top: 20px; color: rgba(255,255,255,0.7); font-size: 13px; }
.nav-buttons { display: flex; gap: 10px; margin-top: 25px; flex-wrap: wrap; justify-content: center; }
.nav-btn { background: rgba(255,255,255,0.15); color: var(--white); border: 1px solid rgba(255,255,255,0.3); padding: 10px 20px; border-radius: 10px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; font-family: inherit; -webkit-tap-highlight-color: transparent; }
.nav-btn:hover { background: rgba(255,255,255,0.25); }

/* 質問画面 */
.question-screen { animation: fadeIn 0.5s ease-out; padding-top: 10px; }
.progress-bar { background: rgba(255,255,255,0.3); border-radius: 12px; height: 10px; overflow: hidden; margin-bottom: 12px; }
.progress-fill { background: linear-gradient(90deg, var(--white), rgba(255,255,255,0.8)); height: 100%; border-radius: 12px; transition: width 0.4s ease-out; }
.progress-text { color: rgba(255,255,255,0.95); font-size: 14px; text-align: center; font-weight: 500; margin-bottom: 20px; }
.question-card { background: var(--white); border-radius: 24px; padding: clamp(20px, 5vw, 28px); margin-bottom: 20px; box-shadow: 0 15px 50px rgba(0,0,0,0.12); }
.question-text { font-size: clamp(16px, 4.5vw, 19px); font-weight: 600; color: var(--text); line-height: 1.7; }
.choices { display: flex; flex-direction: column; gap: 12px; }
.choice-btn { background: var(--white); border: none; border-radius: 16px; padding: clamp(16px, 4vw, 20px); display: flex; align-items: center; gap: 14px; cursor: pointer; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 5px 20px rgba(0,0,0,0.08); font-family: inherit; text-align: left; animation: slideIn 0.4s ease-out backwards; -webkit-tap-highlight-color: transparent; }
.choice-btn:nth-child(1) { animation-delay: 0s; }
.choice-btn:nth-child(2) { animation-delay: 0.06s; }
.choice-btn:nth-child(3) { animation-delay: 0.12s; }
.choice-btn:nth-child(4) { animation-delay: 0.18s; }
.choice-btn:hover { transform: translateX(6px); box-shadow: 0 8px 30px rgba(var(--primary-rgb), 0.25); }
.choice-btn:active { transform: scale(0.98); }
.choice-btn.selected { background: linear-gradient(135deg, var(--primary), var(--secondary)); transform: scale(1.02); }
.choice-btn.selected .choice-id { background: var(--white); color: var(--secondary); }
.choice-btn.selected .choice-text { color: var(--white); }
.choice-btn.faded { opacity: 0.4; transform: scale(0.96); pointer-events: none; }
.choice-id { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: var(--white); width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0; }
.choice-text { font-size: clamp(14px, 3.8vw, 16px); color: var(--text); flex: 1; line-height: 1.5; }

/* ユーザー情報入力画面 */
.userinfo-screen { animation: fadeIn 0.5s ease-out; padding-top: 10px; }
.userinfo-header { text-align: center; margin-bottom: 25px; }
.userinfo-title { color: var(--white); font-size: clamp(20px, 5vw, 24px); font-weight: 700; margin-bottom: 8px; }
.userinfo-subtitle { color: rgba(255,255,255,0.8); font-size: 14px; }
.userinfo-card { background: var(--white); border-radius: 24px; padding: clamp(24px, 6vw, 32px); box-shadow: 0 15px 50px rgba(0,0,0,0.12); }
.form-group { margin-bottom: 20px; }
.form-group:last-of-type { margin-bottom: 0; }
.form-label { display: block; font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.form-label .required { color: var(--danger); font-size: 12px; margin-left: 4px; }
.form-input, .form-select { width: 100%; padding: 14px 16px; font-size: 16px; font-family: inherit; border: 2px solid #e0e0e0; border-radius: 12px; transition: all 0.2s; background: #fafafa; }
.form-input:focus, .form-select:focus { outline: none; border-color: var(--primary); background: var(--white); box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.1); }
.form-input.error, .form-select.error { border-color: var(--danger); background: #fff5f5; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 6px; display: none; }
.form-error.show { display: block; }
.x-input-wrapper { position: relative; }
.x-input-wrapper::before { content: '@'; position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 16px; }
.x-input-wrapper .form-input { padding-left: 36px; }
.terms-link-wrapper { text-align: center; margin-top: 20px; margin-bottom: 5px; }
.terms-link { color: var(--primary-text); font-size: 14px; text-decoration: none; font-weight: 500; transition: all 0.2s; }
.terms-link:hover { color: var(--secondary); text-decoration: underline; }
.submit-btn { width: 100%; margin-top: 25px; background: linear-gradient(135deg, var(--primary), var(--secondary)); color: var(--white); border: none; padding: 16px; font-size: 17px; font-weight: 700; border-radius: 12px; cursor: pointer; transition: all 0.3s; font-family: inherit; -webkit-tap-highlight-color: transparent; }
.submit-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(var(--primary-rgb), 0.4); }
.submit-btn:active { transform: translateY(0); }
.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.privacy-note { text-align: center; font-size: 11px; color: rgba(255,255,255,0.7); margin-top: 15px; }

/* 簡易結果画面 */
.simple-result-screen { animation: fadeIn 0.5s ease-out; padding-top: 20px; }
.simple-result-card { background: var(--white); border-radius: 24px; padding: clamp(28px, 7vw, 36px); text-align: center; box-shadow: 0 15px 50px rgba(0,0,0,0.12); }
.simple-result-image { width: 100%; max-width: 280px; height: auto; margin: 0 auto 15px; display: block; border-radius: 16px; }
.simple-result-type { display: inline-block; background: linear-gradient(135deg, var(--primary), var(--secondary)); color: var(--white); padding: 6px 16px; border-radius: 20px; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.simple-result-name { font-size: clamp(22px, 5.5vw, 26px); font-weight: 900; margin-bottom: 10px; line-height: 1.4; }
.simple-result-catch { font-size: 15px; color: var(--text-muted); font-style: italic; margin-bottom: 20px; }
.simple-result-summary { font-size: 14px; color: var(--text); line-height: 1.8; text-align: left; background: #f8f9fa; padding: 16px; border-radius: 12px; }
.dm-message-box { background: linear-gradient(135deg, #f8f9fa, #e9ecef); border-radius: 16px; padding: 20px; text-align: left; }
.dm-message-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 15px; display: flex; align-items: center; gap: 8px; }
.dm-message-list { list-style: none; margin-bottom: 20px; }
.dm-message-list li { font-size: 14px; color: var(--text); padding: 6px 0; display: flex; align-items: flex-start; gap: 8px; }
.dm-message-list li::before { content: attr(data-icon); flex-shrink: 0; }
.dm-divider { border: none; border-top: 1px dashed #ccc; margin: 15px 0; }
.dm-instruction { font-size: 13px; color: var(--text-muted); line-height: 1.7; }
.dm-instruction strong { color: var(--text); }
.dm-send-btn { width: 100%; margin-top: 20px; background: linear-gradient(135deg, var(--primary), var(--secondary)); color: var(--white); border: none; padding: 18px; font-size: 17px; font-weight: 700; border-radius: 14px; cursor: pointer; transition: all 0.3s; font-family: inherit; display: flex; align-items: center; justify-content: center; gap: 10px; -webkit-tap-highlight-color: transparent; }
.dm-send-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(var(--primary-rgb), 0.4); }
.dm-send-btn:active { transform: translateY(0); }

/* DM確認画面 */
.dm-confirm-screen { animation: fadeIn 0.5s ease-out; padding-top: 30px; }
.dm-confirm-card { background: var(--white); border-radius: 24px; padding: clamp(28px, 7vw, 36px); text-align: center; box-shadow: 0 15px 50px rgba(0,0,0,0.12); }
.dm-confirm-icon { font-size: 70px; margin-bottom: 20px; }
.dm-confirm-title { font-size: clamp(20px, 5vw, 24px); font-weight: 700; color: var(--text); margin-bottom: 10px; }
.dm-confirm-account { display: inline-block; background: #e8f4fd; color: #1da1f2; padding: 8px 16px; border-radius: 20px; font-size: 15px; font-weight: 600; margin-bottom: 20px; }
.dm-confirm-message { font-size: 14px; color: var(--text); line-height: 1.8; margin-bottom: 20px; }
.dm-request-notice { background: linear-gradient(135deg, #fff7ed, #fef3c7); border: 1px solid #fed7aa; border-radius: 12px; padding: 16px; margin-bottom: 20px; text-align: left; }
.dm-request-notice-title { font-size: 14px; font-weight: 600; color: #c2410c; margin-bottom: 8px; }
.dm-request-notice-text { font-size: 13px; color: #9a3412; line-height: 1.7; margin: 0; }
.dm-confirm-divider { border: none; border-top: 1px solid #eee; margin: 25px 0; }
.dm-trouble-title { font-size: 14px; font-weight: 600; color: var(--text-muted); margin-bottom: 12px; }
.dm-trouble-text { font-size: 13px; color: var(--text-muted); line-height: 1.7; margin-bottom: 15px; }
.resend-btn { width: 100%; background: var(--white); color: var(--primary); border: 2px solid var(--primary); padding: 14px; font-size: 15px; font-weight: 600; border-radius: 12px; cursor: pointer; transition: all 0.2s; font-family: inherit; -webkit-tap-highlight-color: transparent; }
.resend-btn:hover { background: var(--primary); color: var(--white); }
.resend-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.dm-help-link { display: block; margin-top: 15px; font-size: 13px; color: var(--primary); text-decoration: none; }
.dm-help-link:hover { text-decoration: underline; }

/* 共通UI */
.section-spacing { margin-top: 25px; }
.back-btn { width: 100%; background: rgba(255,255,255,0.2); color: var(--white); border: 1px solid rgba(255,255,255,0.3); padding: 14px; font-size: 15px; font-weight: 500; border-radius: 12px; cursor: pointer; transition: all 0.2s; font-family: inherit; margin-top: 20px; -webkit-tap-highlight-color: transparent; }
.back-btn:hover { background: rgba(255,255,255,0.3); }

/* タイプ一覧画面 */
.types-screen { animation: fadeIn 0.5s ease-out; padding-bottom: 40px; }
.types-header { text-align: center; padding: 25px 0; }
.types-title { font-size: clamp(24px, 6vw, 28px); font-weight: 900; color: var(--white); margin-bottom: 8px; }
.types-subtitle { color: rgba(255,255,255,0.7); font-size: 13px; }
.types-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
@media (max-width: 480px) { .types-grid { grid-template-columns: 1fr; } }
.type-card { background: var(--white); border-radius: 14px; padding: 16px; transition: all 0.2s; box-shadow: 0 5px 20px rgba(0,0,0,0.08); -webkit-tap-highlight-color: transparent; }
.type-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.type-card-image { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.type-card-id { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.type-card-name { font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.3; }
.type-card-catch { font-size: 11px; color: var(--text-muted); font-style: italic; }

/* トースト */
.toast { position: fixed; bottom: max(30px, env(safe-area-inset-bottom, 30px)); left: 50%; transform: translateX(-50%) translateY(100px); background: #333; color: var(--white); padding: 12px 24px; border-radius: 10px; font-size: 13px; opacity: 0; transition: all 0.3s; z-index: 1000; white-space: nowrap; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ローディング */
.loading-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; visibility: hidden; transition: all 0.3s; }
.loading-overlay.show { opacity: 1; visibility: visible; }
.loading-spinner { width: 50px; height: 50px; border: 4px solid rgba(255,255,255,0.3); border-top-color: var(--white); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* DMエラー画面 */
.dm-error-box { background: #fef2f2; border: 1px solid #fecaca; border-radius: 12px; padding: 16px; margin: 16px 0; text-align: left; }
.dm-error-title { font-size: 14px; font-weight: 700; color: #dc2626; margin-bottom: 8px; }
.dm-error-text { font-size: 13px; color: #7f1d1d; line-height: 1.6; }
.dm-error-steps { background: #fff; border-radius: 8px; padding: 12px; margin-top: 12px; }
.dm-error-steps ol { margin: 0; padding-left: 20px; font-size: 13px; color: #374151; line-height: 1.8; }
.dm-error-steps a { color: var(--primary); font-weight: 600; }
.dm-retry-btn { width: 100%; padding: 14px; border-radius: 12px; border: none; background: linear-gradient(135deg, var(--primary), var(--secondary)); color: white; font-size: 15px; font-weight: 700; cursor: pointer; margin-top: 16px; }
.dm-retry-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.dm-retry-btn.dm-secondary-btn { background: transparent; border: 1px solid #d1d5db; color: #6b7280; font-weight: 500; }
.dm-retry-btn.dm-secondary-btn:hover { background: #f3f4f6; border-color: #9ca3af; color: #374151; }

/* 質問画面の戻るボタン */
.question-back-btn {
    width: 100%;
    margin-top: 15px;
    background: transparent;
    color: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.4);
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}
.question-back-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--white);
    border-color: rgba(255,255,255,0.6);
}
.question-back-btn:active {
    transform: scale(0.98);
}

/* ユーザー情報画面の戻るボタン */
.userinfo-back-btn {
    width: 100%;
    margin-top: 12px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid #ddd;
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}
.userinfo-back-btn:hover {
    background: #f5f5f5;
    color: var(--text);
    border-color: #ccc;
}
.userinfo-back-btn:active {
    transform: scale(0.98);
}

/* 非表示 */
.hidden { display: none !important; }