/**
 * WP Letter Gacha - プレミアム手紙デザイン
 * Version: 3.0.0 - 最高品質リニューアル版
 * ターゲット: 女性ユーザー向け高級アンティーク調デザイン
 */

/* ================================================================
   CSS変数定義 - エレガントなカラーパレット
   ================================================================ */
.wlg-wrapper {
    /* メインカラー - 温かみのあるアンティーク調 */
    --wlg-cream: #fdf8f0;
    --wlg-ivory: #fffef9;
    --wlg-beige: #f7f2e8;
    --wlg-sand: #e8dfd1;
    --wlg-taupe: #c4b5a0;
    --wlg-sepia: #8b7355;
    --wlg-chocolate: #6b5640;
    
    /* アクセントカラー - ローズゴールド系 */
    --wlg-rose-gold: #e8b4b4;
    --wlg-blush: #f5d5d5;
    --wlg-dusty-rose: #d4a5a5;
    --wlg-mauve: #c89fa7;
    
    /* メタリックカラー */
    --wlg-gold: #d4af37;
    --wlg-antique-gold: #c9a961;
    --wlg-bronze: #b08d57;
    --wlg-copper: #b87333;
    
    /* レアリティカラー */
    --wlg-ur-gradient: linear-gradient(135deg, #ff9a9e, #fad0c4, #ffecd2, #fcb69f, #ff9a9e);
    --wlg-ssr-gradient: linear-gradient(135deg, #d4af37, #f2d574, #d4af37);
    --wlg-sr-gradient: linear-gradient(135deg, #e8e8e8, #b8b8b8);
    
    /* 影の定義 */
    --wlg-shadow-soft: 0 2px 15px rgba(139, 115, 85, 0.08);
    --wlg-shadow-medium: 0 5px 25px rgba(139, 115, 85, 0.12);
    --wlg-shadow-deep: 0 10px 40px rgba(139, 115, 85, 0.18);
    --wlg-shadow-floating: 0 20px 60px rgba(139, 115, 85, 0.22);
}

/* ================================================================
   メインラッパー - カフェスタイルの背景
   ================================================================ */
.wlg-wrapper {
    position: relative;
    max-width: 520px;
    margin: 40px auto;
    padding: 50px 25px;
    background: 
        /* 上品なグラデーション */
        radial-gradient(ellipse at top left, rgba(247, 242, 232, 0.9), transparent 40%),
        radial-gradient(ellipse at bottom right, rgba(232, 223, 209, 0.8), transparent 40%),
        linear-gradient(135deg, var(--wlg-cream) 0%, var(--wlg-beige) 100%);
    border-radius: 24px;
    box-shadow: 
        var(--wlg-shadow-deep),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    overflow: hidden;
    font-family: 'Georgia', 'Times New Roman', serif;
    position: relative;
}

/* 装飾的な背景パターン */
.wlg-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 35px,
            rgba(196, 181, 160, 0.03) 35px,
            rgba(196, 181, 160, 0.03) 70px
        );
    pointer-events: none;
    z-index: 1;
}

/* ================================================================
   ヘッダー - エレガントなタイポグラフィ
   ================================================================ */
.wlg-header {
    text-align: center;
    margin-bottom: 35px;
    position: relative;
    z-index: 2;
}

.wlg-title {
    font-size: 32px;
    font-weight: 300;
    color: var(--wlg-sepia);
    margin: 0 0 12px;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-family: 'Didot', 'Bodoni MT', 'Georgia', serif;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.wlg-subtitle {
    font-size: 14px;
    color: var(--wlg-chocolate);
    opacity: 0.8;
    margin: 0;
    font-style: italic;
    letter-spacing: 1px;
}

/* 装飾ライン */
.wlg-header::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent,
        var(--wlg-rose-gold) 20%,
        var(--wlg-rose-gold) 80%,
        transparent
    );
}

/* ================================================================
   封筒エリア - 最高級アンティーク封筒
   ================================================================ */
.wlg-envelope-area {
    position: relative;
    width: 340px;
    height: 240px;
    margin: 0 auto 35px;
    perspective: 2000px;
    z-index: 3;
}

/* 封筒コンテナ - プレミアム品質 */
.wlg-envelope {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    animation: envelopeFloat 8s ease-in-out infinite;
}

/* 浮遊アニメーション - より自然な動き */
@keyframes envelopeFloat {
    0%, 100% { 
        transform: translateY(0) rotateX(0deg) rotateZ(0deg) scale(1);
    }
    25% { 
        transform: translateY(-4px) rotateX(2deg) rotateZ(0.5deg) scale(1.01);
    }
    50% { 
        transform: translateY(-6px) rotateX(1deg) rotateZ(-0.5deg) scale(1.015);
    }
    75% { 
        transform: translateY(-3px) rotateX(-1deg) rotateZ(0.3deg) scale(1.008);
    }
}

/* ホバーエフェクト */
.wlg-envelope:hover {
    transform: translateY(-10px) scale(1.05) rotateX(-3deg);
    filter: brightness(1.02);
}

/* ================================================================
   封筒本体 - 最高級和紙風テクスチャ
   ================================================================ */
.wlg-envelope-body {
    position: absolute;
    width: 100%;
    height: 200px;
    bottom: 0;
    background: 
        /* 光沢レイヤー */
        linear-gradient(
            125deg,
            rgba(255, 255, 255, 0.9) 0%,
            rgba(255, 255, 255, 0.4) 20%,
            transparent 40%
        ),
        /* メインカラー */
        linear-gradient(
            145deg,
            var(--wlg-ivory) 0%,
            #fffdfb 25%,
            #fdfaf6 50%,
            var(--wlg-cream) 75%,
            #f9f5ed 100%
        );
    border-radius: 3px;
    box-shadow: 
        /* 多層影で立体感 */
        0 1px 3px rgba(107, 86, 64, 0.1),
        0 3px 8px rgba(107, 86, 64, 0.08),
        0 8px 20px rgba(107, 86, 64, 0.06),
        0 15px 35px rgba(107, 86, 64, 0.04),
        /* 内側のハイライト */
        inset 0 1px 0 rgba(255, 255, 255, 1),
        inset 0 -1px 2px rgba(139, 115, 85, 0.05);
    position: relative;
    overflow: visible;
}

/* 和紙のテクスチャオーバーレイ */
.wlg-envelope-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        /* 繊維パターン */
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(196, 181, 160, 0.03) 2px,
            rgba(196, 181, 160, 0.03) 3px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(196, 181, 160, 0.03) 2px,
            rgba(196, 181, 160, 0.03) 3px
        ),
        /* 有機的なテクスチャ */
        radial-gradient(
            ellipse at 30% 40%,
            transparent 20%,
            rgba(232, 180, 180, 0.02) 40%,
            transparent 60%
        );
    mix-blend-mode: multiply;
    opacity: 0.6;
    pointer-events: none;
}

/* エッジの装飾 */
.wlg-envelope-body::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px solid;
    border-image: linear-gradient(
        135deg,
        rgba(196, 181, 160, 0.2),
        rgba(232, 180, 180, 0.15),
        rgba(196, 181, 160, 0.2)
    ) 1;
    border-radius: 3px;
    pointer-events: none;
}

/* ================================================================
   封筒フラップ - 精巧なV字デザイン
   ================================================================ */
.wlg-envelope-flap {
    position: absolute;
    width: 100%;
    height: 140px;
    top: 40px;
    left: 0;
    transform-origin: top center;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}

/* フラップ本体（三角形） */
.wlg-envelope-flap-triangle {
    position: absolute;
    width: 100%;
    height: 120px;
    top: 0;
    clip-path: polygon(0 0, 50% 100%, 100% 0);
    background: 
        /* ハイライト */
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.95) 0%,
            transparent 30%
        ),
        /* メインカラー */
        linear-gradient(
            145deg,
            var(--wlg-ivory) 0%,
            #fffefb 40%,
            var(--wlg-cream) 100%
        );
    box-shadow: 
        0 2px 8px rgba(107, 86, 64, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* V字の境界線 - エレガントな装飾線 */
.wlg-envelope-flap::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 120px;
    top: 0;
    left: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 340 120'%3E%3Cdefs%3E%3ClinearGradient id='line1' x1='0%25' y1='0%25' x2='100%25' y2='100%25'%3E%3Cstop offset='0%25' style='stop-color:%23c4b5a0;stop-opacity:0.3'/%3E%3Cstop offset='50%25' style='stop-color:%23e8b4b4;stop-opacity:0.5'/%3E%3Cstop offset='100%25' style='stop-color:%23c4b5a0;stop-opacity:0.3'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M 0 0 L 170 120 L 340 0' stroke='url(%23line1)' stroke-width='1.5' fill='none'/%3E%3Cpath d='M 0 1 L 170 121 L 340 1' stroke='rgba(255,255,255,0.6)' stroke-width='0.5' fill='none'/%3E%3C/svg%3E");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 10;
}

/* フラップ内側のパターン */
.wlg-flap-inner {
    position: absolute;
    width: 100%;
    height: 120px;
    top: 0;
    clip-path: polygon(0 0, 50% 100%, 100% 0);
    background: 
        repeating-linear-gradient(
            135deg,
            var(--wlg-beige) 0px,
            var(--wlg-beige) 2px,
            var(--wlg-cream) 2px,
            var(--wlg-cream) 4px
        );
    opacity: 0;
    transition: opacity 0.6s ease;
}

.wlg-envelope.opening .wlg-flap-inner {
    opacity: 1;
}

/* 開封アニメーション */
.wlg-envelope.opening .wlg-envelope-flap {
    transform: rotateX(-175deg);
}

/* ================================================================
   シーリングワックス - 最高級ローズゴールド
   ================================================================ */
.wlg-seal {
    position: absolute;
    width: 80px;
    height: 80px;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ワックス本体 */
.wlg-seal-wax {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: 
        /* 光沢 */
        radial-gradient(
            circle at 35% 35%,
            rgba(255, 255, 255, 0.8) 0%,
            rgba(255, 255, 255, 0.3) 15%,
            transparent 40%
        ),
        /* メインカラー（ローズゴールド） */
        radial-gradient(
            circle at center,
            #e8b4b4 0%,
            #d4a5a5 25%,
            #c89fa7 50%,
            #b08890 75%,
            #967078 100%
        );
    box-shadow: 
        /* エンボス効果 */
        inset 0 3px 5px rgba(255, 255, 255, 0.6),
        inset 0 -3px 5px rgba(107, 86, 64, 0.3),
        inset 3px 0 5px rgba(232, 180, 180, 0.3),
        inset -3px 0 5px rgba(150, 112, 120, 0.4),
        /* 外側の影 */
        0 4px 12px rgba(107, 86, 64, 0.3),
        0 8px 20px rgba(107, 86, 64, 0.2);
    overflow: hidden;
}

/* ワックスの模様 */
.wlg-seal-pattern {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* シールアイコン */
.wlg-seal-icon {
    font-size: 32px;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 
        0 2px 4px rgba(107, 86, 64, 0.5),
        0 1px 2px rgba(107, 86, 64, 0.7);
    font-family: 'Georgia', serif;
    font-weight: normal;
}

/* シールの輝き */
.wlg-seal-shine {
    position: absolute;
    top: 20%;
    left: 25%;
    width: 25%;
    height: 25%;
    background: radial-gradient(
        circle at center,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(255, 255, 255, 0.5) 30%,
        transparent 70%
    );
    border-radius: 50%;
    filter: blur(2px);
    pointer-events: none;
    animation: sealShine 4s ease-in-out infinite;
}

@keyframes sealShine {
    0%, 100% { 
        opacity: 0.8;
        transform: scale(1);
    }
    50% { 
        opacity: 1;
        transform: scale(1.2);
    }
}

/* ホバー効果 */
.wlg-seal:hover {
    transform: translateX(-50%) scale(1.08) rotate(5deg);
}

.wlg-seal:hover .wlg-seal-wax {
    box-shadow: 
        inset 0 3px 5px rgba(255, 255, 255, 0.7),
        inset 0 -3px 5px rgba(107, 86, 64, 0.4),
        0 6px 18px rgba(107, 86, 64, 0.35),
        0 10px 30px rgba(107, 86, 64, 0.25);
}

/* シール破壊アニメーション */
@keyframes sealBreak {
    0% {
        transform: translateX(-50%) scale(1) rotate(0deg);
    }
    25% {
        transform: translateX(-50%) scale(1.15) rotate(10deg);
    }
    50% {
        transform: translateX(-50%) scale(1.1) rotate(-5deg);
        filter: brightness(1.2);
    }
    100% {
        transform: translateX(-50%) scale(0.95) rotate(-8deg);
        opacity: 0.8;
        filter: brightness(0.9) saturate(0.8);
    }
}

.wlg-envelope.opening .wlg-seal {
    animation: sealBreak 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ================================================================
   背景装飾エフェクト
   ================================================================ */
.wlg-background-effects {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

/* 光の粒子 */
.wlg-particle-container {
    position: absolute;
    width: 100%;
    height: 100%;
}

.wlg-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: radial-gradient(
        circle,
        var(--wlg-rose-gold),
        transparent
    );
    border-radius: 50%;
    animation: particleFloat 20s linear infinite;
    opacity: 0.6;
}

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-100vh) rotate(360deg);
        opacity: 0;
    }
}

/* ================================================================
   ボタンデザイン - エレガントなローズゴールド
   ================================================================ */
.wlg-button-area {
    text-align: center;
    margin-top: 25px;
    position: relative;
    z-index: 3;
}

.wlg-button {
    padding: 14px 42px;
    background: linear-gradient(
        135deg,
        var(--wlg-rose-gold) 0%,
        var(--wlg-dusty-rose) 100%
    );
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 15px rgba(232, 180, 180, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    font-family: 'Georgia', serif;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

/* ボタンの光沢エフェクト */
.wlg-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.5s ease;
}

.wlg-button:hover::before {
    left: 100%;
}

.wlg-button:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(232, 180, 180, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.wlg-button:active {
    transform: translateY(0);
}

.wlg-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ================================================================
   レアリティエフェクト - プレミアム演出
   ================================================================ */
.wlg-rarity-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    display: none;
    z-index: 9999;
}

.wlg-rarity-effect.active {
    display: block;
}

/* URエフェクト - パステルレインボー */
.wlg-rarity-effect.rarity-ur .wlg-rarity-effect-bg {
    background: radial-gradient(
        circle at center,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(255, 154, 158, 0.3) 30%,
        transparent 60%
    );
    animation: urSoftGlow 2s ease-out;
}

@keyframes urSoftGlow {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
    100% {
        opacity: 0.7;
        transform: scale(1);
    }
}

/* SSRエフェクト - ゴールド */
.wlg-rarity-effect.rarity-ssr .wlg-rarity-effect-bg {
    background: radial-gradient(
        circle at center,
        rgba(212, 175, 55, 0.9) 0%,
        rgba(212, 175, 55, 0.4) 30%,
        transparent 60%
    );
    animation: ssrGoldPulse 1.5s ease-out;
}

/* ================================================================
   結果表示オーバーレイ
   ================================================================ */
.wlg-result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(247, 242, 232, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.4s ease;
}

/* 手紙コンテナ */
.wlg-result-container {
    max-width: 480px;
    width: 90%;
    animation: letterReveal 0.6s ease;
}

@keyframes letterReveal {
    0% {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* 手紙本体 */
.wlg-letter {
    background: 
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.95) 0%,
            rgba(255, 255, 255, 0.9) 100%
        ),
        var(--wlg-ivory);
    border-radius: 20px;
    padding: 35px;
    box-shadow: 
        0 15px 50px rgba(139, 115, 85, 0.2),
        0 5px 20px rgba(139, 115, 85, 0.15);
    position: relative;
    overflow: hidden;
}

/* 手紙の装飾枠 */
.wlg-letter::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    border: 1px solid var(--wlg-rose-gold);
    border-radius: 15px;
    opacity: 0.3;
    pointer-events: none;
}

/* 手紙ヘッダー */
.wlg-letter-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--wlg-sand);
    position: relative;
}

/* キャラクターアイコン */
.wlg-letter-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--wlg-cream);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    box-shadow: 
        0 3px 10px rgba(232, 180, 180, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.wlg-letter-icon img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top; /* 顔部分を中心に表示 */
    border: 2px solid var(--wlg-rose-gold);
    box-shadow: 0 3px 10px rgba(232, 180, 180, 0.2);
}

/* キャラクター情報 */
.wlg-character-name {
    font-size: 22px;
    font-weight: 600;
    color: var(--wlg-sepia);
    margin: 0 0 5px;
    font-family: 'Georgia', serif;
}

.wlg-source-name {
    font-size: 13px;
    color: var(--wlg-chocolate);
    opacity: 0.8;
    margin: 0 0 8px;
    font-style: italic;
}

/* レアリティバッジ */
.wlg-rarity-display {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.wlg-rarity-ur .wlg-rarity-display {
    background: var(--wlg-ur-gradient);
    color: white;
    animation: urShimmer 3s linear infinite;
}

@keyframes urShimmer {
    0%, 100% {
        filter: hue-rotate(0deg) brightness(1);
    }
    50% {
        filter: hue-rotate(30deg) brightness(1.1);
    }
}

.wlg-rarity-ssr .wlg-rarity-display {
    background: var(--wlg-ssr-gradient);
    color: var(--wlg-chocolate);
}

.wlg-rarity-sr .wlg-rarity-display {
    background: var(--wlg-sr-gradient);
    color: var(--wlg-chocolate);
}

/* メッセージ本文 */
.wlg-message {
    font-size: 16px;
    line-height: 1.8;
    color: var(--wlg-chocolate);
    margin: 0 0 20px;
    white-space: pre-wrap;
    font-family: 'Georgia', serif;
}

/* 署名 */
.wlg-signature {
    text-align: right;
    font-style: italic;
    color: var(--wlg-sepia);
    margin: 0;
    font-family: 'Brush Script MT', cursive;
    font-size: 18px;
}

/* ================================================================
   排出率表示 - エレガントなバッジスタイル
   ================================================================ */
.wlg-rarity-rates {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.wlg-rarity-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(139, 115, 85, 0.1);
    transition: all 0.3s ease;
    background: white;
    border: 1px solid;
}

.wlg-rarity-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 115, 85, 0.15);
}

.wlg-rarity-badge.wlg-rarity-ur {
    border-color: var(--wlg-rose-gold);
    background: linear-gradient(135deg, rgba(255, 154, 158, 0.1), rgba(252, 182, 159, 0.1));
    color: var(--wlg-dusty-rose);
}

.wlg-rarity-badge.wlg-rarity-ssr {
    border-color: var(--wlg-gold);
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(242, 213, 116, 0.1));
    color: var(--wlg-bronze);
}

.wlg-rarity-badge.wlg-rarity-sr {
    border-color: #b8b8b8;
    background: linear-gradient(135deg, rgba(184, 184, 184, 0.1), rgba(232, 232, 232, 0.1));
    color: #666;
}

.wlg-rarity-badge.wlg-rarity-r {
    border-color: #a5c9ff;
    background: linear-gradient(135deg, rgba(165, 201, 255, 0.1), rgba(126, 179, 255, 0.1));
    color: #4a7dc7;
}

.wlg-rarity-badge.wlg-rarity-n {
    border-color: #d0d0d0;
    background: linear-gradient(135deg, rgba(208, 208, 208, 0.1), rgba(158, 158, 158, 0.1));
    color: #888;
}

/* ================================================================
   レスポンシブ対応
   ================================================================ */
@media (max-width: 768px) {
    .wlg-wrapper {
        margin: 30px auto;
        padding: 40px 20px;
    }
    
    .wlg-title {
        font-size: 28px;
    }
    
    .wlg-envelope-area {
        width: 300px;
        height: 210px;
    }
    
    .wlg-envelope-body {
        height: 180px;
    }
    
    .wlg-seal {
        width: 70px;
        height: 70px;
        top: 90px;
    }
    
    .wlg-seal-icon {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .wlg-wrapper {
        border-radius: 20px;
        margin: 20px auto;
    }
    
    .wlg-title {
        font-size: 24px;
        letter-spacing: 2px;
    }
    
    .wlg-envelope-area {
        width: 280px;
        height: 195px;
    }
    
    .wlg-letter {
        padding: 25px;
    }
    
    .wlg-letter-header {
        flex-direction: column;
        text-align: center;
    }
    
    .wlg-rarity-rates {
        gap: 6px;
    }
    
    .wlg-rarity-badge {
        font-size: 10px;
        padding: 6px 10px;
    }
}

/* ================================================================
   追加アニメーション定義
   ================================================================ */

/* 星のエフェクト */
.wlg-stars-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 20;
}

.wlg-star {
    position: absolute;
    font-size: 20px;
    color: var(--wlg-gold);
    opacity: 0;
    animation: starFloat 2s ease-out forwards;
}

@keyframes starFloat {
    0% {
        opacity: 0;
        transform: scale(0) rotate(0deg) translateY(0);
    }
    50% {
        opacity: 1;
        transform: scale(1.5) rotate(180deg) translateY(-30px);
    }
    100% {
        opacity: 0;
        transform: scale(1) rotate(360deg) translateY(-80px);
    }
}

/* トースト通知 */
@keyframes slideUp {
    from {
        transform: translate(-50%, 100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* ローディングスピナー */
.wlg-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
}

.wlg-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--wlg-sand);
    border-top-color: var(--wlg-rose-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ================================================================
   最終仕上げ - 細部の調整
   ================================================================ */

/* フォーカス時のアウトライン除去 */
.wlg-button:focus,
.wlg-seal:focus {
    outline: none;
}

/* 選択不可にする */
.wlg-wrapper {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* メッセージ部分は選択可能 */
.wlg-message,
.wlg-signature {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}