/* ==========================================================================
   ドラクエガチャ - Dragon Quest テーマデザイン
   ========================================================================== */

/* --- CSS変数 --- */
:root {
    --dq-gold:       #f5c518;
    --dq-gold-dark:  #c9980a;
    --dq-blue:       #2a5caa;
    --dq-blue-light: #4a8fff;
    --dq-dark:       #080c18;
    --dq-navy:       #0d1530;
    --dq-panel:      rgba(13, 21, 48, 0.85);
    --dq-border:     rgba(245, 197, 24, 0.25);
    --text-main:     #eef2ff;
    --text-muted:    #7a8baa;
    --ssr-gold:      linear-gradient(135deg, #ffd700, #ff8c00, #ffd700);
    --sr-purple:     #9b59b6;
    --r-blue:        #2980b9;
    --n-silver:      #bdc3c7;

    --font-title:    'Cinzel', serif;
    --font-body:     'Zen Kaku Gothic New', sans-serif;
    --font-num:      'Outfit', sans-serif;
}

/* --- リセット＆ベース --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--dq-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* --- 背景パーティクル --- */
.bg-particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    color: rgba(245, 197, 24, 0.15);
    font-size: 1.2rem;
    animation: float-particle linear infinite;
}

.p1 { left: 5%;  top: 10%; animation-duration: 18s; animation-delay: 0s;   font-size: 1rem; }
.p2 { left: 20%; top: 70%; animation-duration: 22s; animation-delay: -5s;  font-size: 0.8rem; }
.p3 { left: 50%; top: 20%; animation-duration: 15s; animation-delay: -3s;  }
.p4 { left: 70%; top: 80%; animation-duration: 20s; animation-delay: -8s;  font-size: 0.9rem; }
.p5 { left: 85%; top: 40%; animation-duration: 25s; animation-delay: -12s; font-size: 1.1rem; }
.p6 { left: 35%; top: 55%; animation-duration: 17s; animation-delay: -6s;  font-size: 0.7rem; }

@keyframes float-particle {
    0%   { transform: translateY(0) rotate(0deg); opacity: 0.15; }
    50%  { opacity: 0.35; }
    100% { transform: translateY(-100vh) rotate(360deg); opacity: 0.1; }
}

/* --- メインコンテナ --- */
.app-container {
    position: relative;
    z-index: 1;
    max-width: 520px;
    margin: 0 auto;
    padding: 24px 16px 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- ヘッダー --- */
.app-header {
    text-align: center;
    padding: 32px 20px 24px;
    background: linear-gradient(180deg, rgba(42, 92, 170, 0.2) 0%, transparent 100%);
    border: 1px solid var(--dq-border);
    border-radius: 24px;
    position: relative;
    overflow: hidden;
}

.app-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--dq-gold), transparent);
}

.slime-deco {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.slime {
    font-size: 1.4rem;
    animation: slime-bounce 1.8s ease-in-out infinite;
    display: inline-block;
}
.slime.s2 { animation-delay: 0.3s; }
.slime.s3 { animation-delay: 0.6s; }

@keyframes slime-bounce {
    0%, 100% { transform: translateY(0) scaleY(1); }
    40%       { transform: translateY(-8px) scaleY(1.1); }
    60%       { transform: translateY(0) scaleY(0.9); }
}

.logo-en {
    font-family: var(--font-title);
    font-size: 0.75rem;
    letter-spacing: 4px;
    color: var(--dq-gold);
    opacity: 0.8;
    margin-bottom: 4px;
}

.logo-title {
    font-size: 2.4rem;
    font-weight: 900;
    background: linear-gradient(135deg, #ffd700, #fff8c0, #f5c518);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
    margin-bottom: 10px;
    text-shadow: none;
    letter-spacing: 2px;
}

.logo-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 8px;
}

.logo-flavor {
    font-size: 0.82rem;
    color: var(--dq-gold);
    opacity: 0.7;
    font-style: italic;
    letter-spacing: 0.5px;
}

/* --- ガチャパネル --- */
.gacha-panel {
    display: flex;
    justify-content: center;
}

/* --- ガチャトリガーボタン --- */
.gacha-trigger-btn {
    position: relative;
    width: 100%;
    max-width: 380px;
    padding: 22px 32px;
    background: linear-gradient(135deg, #1a3a7a 0%, #2a5caa 50%, #1a3a7a 100%);
    border: 2px solid var(--dq-gold);
    border-radius: 16px;
    color: var(--dq-gold);
    cursor: pointer;
    font-family: var(--font-body);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(245, 197, 24, 0.15), inset 0 1px 0 rgba(255,255,255,0.08);
    overflow: hidden;
}

.gacha-trigger-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 0 35px rgba(245, 197, 24, 0.35), inset 0 1px 0 rgba(255,255,255,0.1);
    border-color: #ffd700;
}

.gacha-trigger-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-glow {
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, rgba(245,197,24,0.3), transparent, rgba(245,197,24,0.3));
    border-radius: 16px;
    animation: glow-rotate 3s linear infinite;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.3s;
}
.gacha-trigger-btn:hover .btn-glow { opacity: 1; }

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

.btn-icon {
    font-size: 1.8rem;
    position: relative;
    z-index: 1;
    animation: sword-pulse 2s ease-in-out infinite;
}

@keyframes sword-pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.15) rotate(-5deg); }
}

.btn-text {
    font-size: 1.3rem;
    font-weight: 900;
    letter-spacing: 2px;
    position: relative;
    z-index: 1;
}

.btn-sub {
    font-family: var(--font-title);
    font-size: 0.7rem;
    letter-spacing: 3px;
    opacity: 0.6;
    position: relative;
    z-index: 1;
}

/* --- トースト・エラー --- */
.notice-toast,
.error-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.87rem;
}

.notice-toast {
    background: rgba(42, 92, 170, 0.25);
    border: 1px solid rgba(74, 143, 255, 0.3);
    color: var(--dq-blue-light);
}

.error-box {
    background: rgba(200, 60, 60, 0.15);
    border: 1px solid rgba(200, 60, 60, 0.3);
    color: #ff8080;
}

/* --- ガチャステージ --- */
.gacha-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

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

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

.ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    animation: spin linear infinite;
}

.r1 { border-top-color: var(--dq-gold);      animation-duration: 1.2s; }
.r2 { border-right-color: var(--dq-blue-light); animation-duration: 1.8s; inset: 8px; }
.r3 { border-bottom-color: #fff;              animation-duration: 2.4s; inset: 16px; }

.core {
    position: absolute;
    inset: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    animation: core-pulse 1s ease-in-out infinite;
}

@keyframes spin         { to { transform: rotate(360deg); } }
@keyframes core-pulse   { 0%, 100% { transform: scale(0.9); } 50% { transform: scale(1.1); } }

.loader-text {
    font-size: 0.9rem;
    color: var(--dq-gold);
    opacity: 0.8;
    letter-spacing: 0.5px;
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

/* --- 結果カードラッパー --- */
.card-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
}

/* --- 結果カード --- */
.result-card {
    width: 100%;
    background: var(--dq-panel);
    border: 1px solid var(--dq-border);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    animation: cardAppear 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--dq-gold), transparent);
}

@keyframes cardAppear {
    0%   { opacity: 0; transform: scale(0.85) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* --- レア度バッジ --- */
.rarity-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 50px;
    font-weight: 900;
    font-size: 0.85rem;
    font-family: var(--font-num);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.rarity-badge.rarity-ssr {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #111;
    animation: ssr-pulse 1.5s ease-in-out infinite;
}
@keyframes ssr-pulse { 0%,100%{box-shadow:0 0 8px rgba(255,200,0,0.5);} 50%{box-shadow:0 0 20px rgba(255,200,0,0.9);} }

.rarity-badge.rarity-sr  { background: var(--sr-purple); color: #fff; }
.rarity-badge.rarity-r   { background: var(--r-blue);    color: #fff; }
.rarity-badge.rarity-n   { background: var(--n-silver);  color: #333; }

/* --- 商品画像ボックス --- */
.card-image-box {
    width: 100%;
    height: 220px;
    background: rgba(255,255,255,0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--dq-border);
}

.image-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

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

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

.image-shine {
    position: absolute;
    top: -50%;
    left: -60%;
    width: 40%;
    height: 200%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
    transform: skewX(-20deg);
    animation: shine 4s ease-in-out infinite;
}

@keyframes shine {
    0%   { left: -60%; }
    100% { left: 160%; }
}

/* --- カード内コンテンツ --- */
.card-content {
    padding: 16px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.item-title {
    font-size: 1.05rem;
    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: 6px;
    font-size: 0.82rem;
}

.stars       { color: var(--dq-gold); letter-spacing: 1px; }
.rating-num  { font-weight: 800; color: #fff; }
.review-count { color: var(--text-muted); }

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

.price-currency {
    font-size: 1rem;
    font-weight: 800;
    color: var(--dq-gold);
    font-family: var(--font-num);
}

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

/* --- Amazonで見るボタン --- */
.amazon-buy-btn {
    margin-top: 6px;
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #ffa726, #fb8c00);
    color: #111;
    font-weight: 800;
    font-size: 0.95rem;
    text-decoration: none;
    border-radius: 12px;
    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, #ffa726);
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(255,153,0,0.4);
}

/* --- もう一度ボタン --- */
.retry-btn {
    width: 100%;
    padding: 13px;
    background: rgba(42, 92, 170, 0.2);
    border: 1px solid var(--dq-border);
    color: var(--text-main);
    font-size: 0.93rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: var(--font-body);
}

.retry-btn:hover {
    background: rgba(42, 92, 170, 0.35);
    border-color: rgba(245,197,24,0.4);
}

/* --- SNS セクション --- */
.sns-section { width: 100%; }

.sns-campaign-box {
    background: linear-gradient(135deg, rgba(42, 92, 170, 0.12), rgba(0,0,0,0.2));
    border: 1px solid rgba(74, 143, 255, 0.25);
    border-radius: 20px;
    padding: 24px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

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

@keyframes pulse { 0%,100%{transform:scale(1);} 50%{transform:scale(1.1);} }

.sns-title {
    font-size: 1.1rem;
    font-weight: 900;
    color: #fff;
}

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

.x-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #000;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 11px 22px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    margin-top: 4px;
    font-family: var(--font-body);
}

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

/* --- フッター --- */
.app-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.disclaimer { opacity: 0.65; }

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

/* --- レスポンシブ --- */
@media (max-width: 480px) {
    .logo-title { font-size: 2rem; }
    .card-image-box { height: 180px; }
    .sp-br { display: block; }
}
