/* ==========================================================================
   Amazon Creators API Gacha - デザインシステム & スタイル
   ========================================================================== */

:root {
    --bg-dark: #0b0f19;
    --bg-card: rgba(22, 28, 45, 0.75);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --border-glass: rgba(255, 255, 255, 0.12);
    
    --primary-color: #ff9900; /* Amazon Gold */
    --primary-glow: rgba(255, 153, 0, 0.4);
    --accent-blue: #00d2ff;
    --accent-purple: #9d50bb;
    
    --text-main: #f0f4f8;
    --text-muted: #94a3b8;
    
    /* レア度カラー */
    --ssr-gold: linear-gradient(135deg, #ffe259, #ffa751);
    --ssr-glow: rgba(255, 215, 0, 0.8);
    --sr-purple: linear-gradient(135deg, #b92b27, #1565c0);
    --sr-glow: rgba(185, 43, 39, 0.7);
    --r-blue: linear-gradient(135deg, #00c6ff, #0072ff);
    --r-glow: rgba(0, 198, 255, 0.6);
    --n-silver: linear-gradient(135deg, #8e9eab, #eef2f3);
    --n-glow: rgba(142, 158, 171, 0.4);

    --font-main: 'Zen Kaku Gothic New', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-display: 'Outfit', sans-serif;
}

/* リセット & 全般 */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px 15px 40px;
    overflow-x: hidden;
    position: relative;
}

/* 背景グローアニメーション */
.background-globes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.25;
    animation: floatGlobe 20s ease-in-out infinite alternate;
}

.globe-1 {
    width: 400px;
    height: 400px;
    background: #ff9900;
    top: -100px;
    left: -100px;
}

.globe-2 {
    width: 500px;
    height: 500px;
    background: #7928ca;
    bottom: -150px;
    right: -150px;
    animation-delay: -7s;
}

.globe-3 {
    width: 350px;
    height: 350px;
    background: #00d2ff;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes floatGlobe {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(60px, 40px) scale(1.15); }
}

/* アプリコンテナ */
.app-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 580px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ヘッダー */
.app-header {
    text-align: center;
    margin-top: 10px;
    position: relative;
}

.header-nav {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.guide-nav-btn {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.guide-nav-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.logo-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.logo-icon {
    font-size: 2.2rem;
    animation: pulse 2s ease-in-out infinite;
}

.logo-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #ffffff 0%, #ff9900 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-title span {
    background: linear-gradient(135deg, #ff9900 0%, #ff5500 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-subtitle {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-top: 6px;
}

/* パネル & ガラスモルフィズム */
.gacha-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 28px 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-main);
}

/* チップ選択ラジオボタン */
.chip-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.budget-grid {
    grid-template-columns: repeat(2, 1fr);
}

.chip-item {
    cursor: pointer;
}

.chip-item input[type="radio"] {
    display: none;
}

.chip-label {
    display: block;
    text-align: center;
    padding: 10px 6px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.chip-item input[type="radio"]:checked + .chip-label {
    background: linear-gradient(135deg, rgba(255, 153, 0, 0.2), rgba(255, 100, 0, 0.15));
    border-color: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 0 15px var(--primary-glow);
    transform: translateY(-2px);
}

.chip-item:hover .chip-label {
    border-color: rgba(255, 153, 0, 0.5);
    color: var(--text-main);
}

/* ガチャ実行ボタン */
.action-container {
    margin-top: 30px;
}

.gacha-trigger-btn {
    position: relative;
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #ff9900 0%, #ff5500 100%);
    border: none;
    border-radius: 18px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(255, 85, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.gacha-trigger-btn:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 15px 35px rgba(255, 85, 0, 0.6);
}

.gacha-trigger-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.gacha-trigger-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(40%);
}

.btn-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gacha-trigger-btn:hover .btn-glow {
    opacity: 1;
}

.btn-text {
    font-size: 1.4rem;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.btn-subtext {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 3px;
}

/* トースト & エラーボックス */
.notice-toast, .error-box {
    padding: 12px 18px;
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

.notice-toast {
    background: rgba(0, 210, 255, 0.12);
    border: 1px solid rgba(0, 210, 255, 0.3);
    color: var(--accent-blue);
}

.error-box {
    background: rgba(255, 75, 75, 0.12);
    border: 1px solid rgba(255, 75, 75, 0.3);
    color: #ff6b6b;
}

/* ガチャ演出ステージ */
.gacha-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 380px;
}

/* ローディング演出 */
.gacha-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin: 40px 0;
}

.orb-spinner {
    position: relative;
    width: 90px;
    height: 90px;
}

.ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
}

.ring-1 {
    border-top-color: var(--primary-color);
    animation: spin 1.2s linear infinite;
}

.ring-2 {
    border-right-color: var(--accent-purple);
    animation: spin 1.6s linear infinite reverse;
}

.ring-3 {
    border-bottom-color: var(--accent-blue);
    animation: spin 2s linear infinite;
}

.core-spark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.8rem;
    animation: pulse 1s ease-in-out infinite alternate;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { transform: scale(0.8); opacity: 0.7; }
    100% { transform: scale(1.15); opacity: 1; }
}

.loader-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* 結果カード */
.card-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    perspective: 1000px;
}

.result-card {
    position: relative;
    width: 100%;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 16px;
    transform-style: preserve-3d;
    animation: cardAppear 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes cardAppear {
    0% {
        opacity: 0;
        transform: rotateY(90deg) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: rotateY(0deg) scale(1);
    }
}

/* レア度バッジ */
.rarity-badge {
    position: absolute;
    top: -14px;
    right: 20px;
    padding: 6px 18px;
    border-radius: 20px;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 900;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    z-index: 2;
}

.rarity-ssr {
    background: var(--ssr-gold);
    box-shadow: 0 0 20px var(--ssr-glow);
    animation: ssrShimmer 2s linear infinite;
}

.rarity-sr {
    background: var(--sr-purple);
    box-shadow: 0 0 15px var(--sr-glow);
}

.rarity-r {
    background: var(--r-blue);
    box-shadow: 0 0 15px var(--r-glow);
}

.rarity-n {
    background: var(--n-silver);
    color: #333333;
}

@keyframes ssrShimmer {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

/* 画像エリア */
.card-image-box {
    position: relative;
    width: 100%;
    height: 220px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.card-image-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.card-image-box:hover img {
    transform: scale(1.05);
}

/* 詳細コンテンツ */
.card-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.brand-tag {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.item-title {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.45;
    color: #ffffff;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rating-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.stars {
    color: #ffb800;
    letter-spacing: 2px;
}

.rating-num {
    font-weight: 800;
    color: #ffffff;
}

.review-count {
    color: var(--text-muted);
}

.price-box {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-top: 4px;
}

.price-currency {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary-color);
}

.price-amount {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 900;
    color: #ffffff;
}

/* Amazonで見るボタン */
.amazon-buy-btn {
    margin-top: 8px;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #ffa726 0%, #fb8c00 100%);
    color: #111111;
    font-weight: 800;
    font-size: 1rem;
    text-decoration: none;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s ease;
    box-shadow: 0 6px 16px rgba(255, 153, 0, 0.3);
}

.amazon-buy-btn:hover {
    background: linear-gradient(135deg, #ffb74d 0%, #ffa726 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(255, 153, 0, 0.4);
}

/* もう一度ボタン */
.retry-btn {
    width: 100%;
    padding: 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.retry-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

/* モーダルウィンドウ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 8, 16, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 540px;
    max-height: 85vh;
    background: #121829;
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 28px 24px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    gap: 20px;
}

.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-close-btn:hover {
    color: #ffffff;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 14px;
}

.modal-header-icon {
    font-size: 1.8rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffffff;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.section-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-main);
}

.step-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.step-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--bg-glass);
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
}

.step-num {
    background: var(--primary-color);
    color: #111111;
    font-family: var(--font-display);
    font-weight: 900;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.step-detail {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.85rem;
}

.step-detail strong {
    color: #ffffff;
}

.step-detail span {
    color: var(--text-muted);
}

.rarity-guide-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 4px;
}

.rarity-chip {
    padding: 6px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 800;
    text-align: center;
    color: #ffffff;
}

.rarity-chip.ssr { background: var(--ssr-gold); color: #111; }
.rarity-chip.sr { background: var(--sr-purple); }
.rarity-chip.r { background: var(--r-blue); }
.rarity-chip.n { background: var(--n-silver); color: #333; }

.section-subtext {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.warning-section {
    background: rgba(255, 153, 0, 0.05);
    border: 1px solid rgba(255, 153, 0, 0.2);
    border-radius: 14px;
    padding: 14px;
}

.warning-list {
    list-style-type: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.84rem;
    line-height: 1.5;

}

.warning-list li {
    position: relative;
    padding-left: 14px;
    color: var(--text-muted);
}

.warning-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

.warning-list strong {
    color: #ffffff;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--border-glass);
    padding-top: 14px;
}

.modal-action-btn {
    padding: 10px 24px;
    background: var(--primary-color);
    color: #111111;
    font-weight: 800;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.modal-action-btn:hover {
    opacity: 0.9;
}

/* SNS シェア・企画セクション */
.sns-section {
    width: 100%;
}

.sns-campaign-box {
    background: linear-gradient(135deg, rgba(29, 161, 242, 0.1), rgba(0, 0, 0, 0.2));
    border: 1px solid rgba(29, 161, 242, 0.3);
    border-radius: 24px;
    padding: 28px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.sns-campaign-emoji {
    font-size: 2.4rem;
    animation: pulse 2s ease-in-out infinite;
}

.sns-campaign-title {
    font-size: 1.2rem;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.sns-campaign-text {
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--text-muted);
}

.x-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #000000;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    margin-top: 4px;
}

.x-share-btn:hover {
    background: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

/* モーダル内SNSアイデアリスト */
.modal-sns-section {
    background: rgba(29, 161, 242, 0.06);
    border: 1px solid rgba(29, 161, 242, 0.2);
    border-radius: 14px;
    padding: 14px;
}

.sns-idea-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.sns-idea-list li {
    font-size: 0.84rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.sns-idea-list li strong {
    color: #ffffff;
    display: block;
    margin-bottom: 2px;
}

.sns-idea-list li span {
    color: var(--text-muted);
}

/* フッター */
.app-footer {

    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.disclaimer {
    opacity: 0.7;
}

/* ユーティリティ */
.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* レスポンシブ調整 */
@media (max-width: 480px) {
    .chip-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .logo-title {
        font-size: 2rem;
    }
    .gacha-panel {
        padding: 20px 16px;
    }
    .card-image-box {
        height: 180px;
    }
    .rarity-guide-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
