/* ===================================================
   心のおみくじ - たまお悩み相談室
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@400;700&display=swap');

/* ---- ラッパー全体 ---- */
#tama-omikuji-wrap {
    position: relative;
    max-width: 540px;
    margin: 40px auto;
    padding: 40px 24px 48px;
    text-align: center;
    font-family: 'Noto Serif JP', '游明朝', 'YuMincho', 'ヒラギノ明朝 Pro', serif;
    background: linear-gradient(160deg, #fffdf5 0%, #fff8e7 60%, #fef0d4 100%);
    border-radius: 16px;
    box-shadow: 0 4px 32px rgba(139, 90, 43, 0.13), 0 1px 4px rgba(139, 90, 43, 0.08);
    overflow: hidden;
}

/* ---- 背景の和柄装飾（薄い菱形模様） ---- */
.tama-bg-deco {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.04;
    background-image:
        repeating-linear-gradient(45deg, #8B0000 0, #8B0000 1px, transparent 0, transparent 50%),
        repeating-linear-gradient(-45deg, #8B0000 0, #8B0000 1px, transparent 0, transparent 50%);
    background-size: 28px 28px;
}

/* ---- タイトルブロック ---- */
.tama-subtitle {
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    color: #8B0000;
    margin: 0 0 4px;
}

.tama-title {
    font-size: 2rem;
    font-weight: 700;
    color: #3E2B1A;
    margin: 0 0 10px;
    letter-spacing: 0.15em;
    text-shadow: 0 1px 0 rgba(255,255,255,0.8);
}

.tama-description {
    font-size: 0.875rem;
    color: #7a6040;
    margin: 0 0 32px;
    line-height: 1.8;
}

/* ===================================================
   おみくじ箱エリア
   =================================================== */
.tama-box-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 28px;
    min-height: 220px;
}

/* ---- 浮き沈みアニメーション ---- */
@keyframes tama-float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-10px); }
}

/* ---- シェイクアニメーション ---- */
@keyframes tama-shake {
    0%   { transform: rotate(0deg) translateY(0); }
    10%  { transform: rotate(-8deg) translateY(-4px); }
    20%  { transform: rotate(8deg) translateY(-6px); }
    30%  { transform: rotate(-7deg) translateY(-4px); }
    40%  { transform: rotate(7deg) translateY(-6px); }
    50%  { transform: rotate(-6deg) translateY(-4px); }
    60%  { transform: rotate(6deg) translateY(-5px); }
    70%  { transform: rotate(-4deg) translateY(-3px); }
    80%  { transform: rotate(4deg) translateY(-2px); }
    90%  { transform: rotate(-2deg) translateY(-1px); }
    100% { transform: rotate(0deg) translateY(0); }
}

/* ---- 棒が出るアニメーション ---- */
@keyframes tama-stick-rise {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(-60px); opacity: 1; }
}

/* ---- パーティクルアニメーション ---- */
@keyframes tama-particle {
    0%   { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--px), var(--py)) scale(0); opacity: 0; }
}

/* ---- ボックス本体 ---- */
.tama-box {
    position: relative;
    width: 110px;
    animation: tama-float 3s ease-in-out infinite;
    cursor: default;
    filter: drop-shadow(0 6px 16px rgba(139,90,43,0.28));
    transition: filter 0.3s;
    z-index: 2;
}

.tama-box.shaking {
    animation: tama-shake 1.4s ease-in-out forwards;
}

.tama-box.still {
    animation: none;
}

/* 上部フタ */
.tama-box-top {
    width: 110px;
    height: 24px;
    background: linear-gradient(180deg, #b8860b 0%, #D4AF37 60%, #a07800 100%);
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 -2px 0 #fff8c0 inset;
}

.tama-box-opening {
    width: 36px;
    height: 12px;
    background: #3E2B1A;
    border-radius: 50%;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

/* 胴体 */
.tama-box-body {
    width: 110px;
    min-height: 130px;
    background: linear-gradient(
        135deg,
        #8B4513 0%,
        #A0856C 20%,
        #6B3A1F 40%,
        #9C6B3C 60%,
        #7B4D2A 80%,
        #8B4513 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: inset 4px 0 8px rgba(0,0,0,0.2), inset -4px 0 8px rgba(0,0,0,0.1);
}

/* 縦書きラベル */
.tama-box-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.tama-kanji {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: #D4AF37;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
    letter-spacing: 0;
    line-height: 1.3;
}

/* 底部 */
.tama-box-bottom {
    width: 110px;
    height: 16px;
    background: linear-gradient(180deg, #6B3A1F 0%, #4a2410 100%);
    border-radius: 0 0 8px 8px;
}

/* ---- 棒（おみくじ棒） ---- */
.tama-stick {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, 40px);
    opacity: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.tama-stick.rising {
    animation: tama-stick-rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.tama-stick-tip {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #fff7c0, #D4AF37 60%, #a07800);
    box-shadow: 0 0 10px 4px rgba(212,175,55,0.7);
}

.tama-stick-body {
    width: 8px;
    height: 80px;
    background: linear-gradient(180deg, #f5e6a3 0%, #d4a853 50%, #c8922a 100%);
    border-radius: 0 0 4px 4px;
    box-shadow: inset 1px 0 2px rgba(255,255,255,0.4);
}

/* ---- シェイク中テキスト ---- */
.tama-shaking-text {
    margin: 12px 0 0;
    font-size: 0.9rem;
    color: #8B0000;
    letter-spacing: 0.1em;
    min-height: 1.5em;
    font-weight: 700;
}

/* ---- パーティクル ---- */
.tama-particles {
    position: absolute;
    top: 50%;
    left: 50%;
    pointer-events: none;
    z-index: 5;
}

.tama-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: tama-particle 0.9s ease-out forwards;
}

/* ===================================================
   ボタン
   =================================================== */
.tama-btn-wrap {
    margin-bottom: 8px;
}

.tama-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 36px;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #fff8e7;
    background: linear-gradient(135deg, #8B0000 0%, #C0392B 50%, #8B0000 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow:
        0 4px 16px rgba(139,0,0,0.35),
        0 1px 0 rgba(255,255,255,0.15) inset;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.3s;
    position: relative;
    overflow: hidden;
}

.tama-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.18) 0%, transparent 60%);
    border-radius: inherit;
}

.tama-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(139,0,0,0.4), 0 1px 0 rgba(255,255,255,0.15) inset;
}

.tama-btn:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(139,0,0,0.3);
}

.tama-btn:disabled,
.tama-btn.disabled {
    background: linear-gradient(135deg, #aaa 0%, #888 100%);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.7;
}

.tama-btn-icon {
    font-size: 1.2em;
}

.tama-limit-msg {
    margin-top: 12px;
    font-size: 0.85rem;
    color: #8B6914;
    line-height: 1.8;
}

/* ===================================================
   結果カード
   =================================================== */
@keyframes tama-result-in {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.tama-result {
    margin-top: 24px;
    animation: tama-result-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.tama-result-inner {
    background: linear-gradient(160deg, #fffef9 0%, #fff8e7 100%);
    border: 2px solid #D4AF37;
    border-radius: 12px;
    padding: 28px 24px 24px;
    box-shadow:
        0 2px 20px rgba(139,90,43,0.14),
        0 0 0 6px rgba(212,175,55,0.1);
    position: relative;
}

.tama-result-inner::before,
.tama-result-inner::after {
    content: '✿';
    position: absolute;
    top: 12px;
    font-size: 1rem;
    color: #D4AF37;
    opacity: 0.6;
}

.tama-result-inner::before { left: 14px; }
.tama-result-inner::after  { right: 14px; }

.tama-result-deco-top,
.tama-result-deco-bottom {
    font-size: 0.75rem;
    color: #c8922a;
    letter-spacing: 0.05em;
    margin: 0 0 8px;
    opacity: 0.7;
}

.tama-result-deco-bottom {
    margin: 8px 0 0;
}

.tama-result-from {
    font-size: 0.8rem;
    color: #8B0000;
    letter-spacing: 0.2em;
    margin: 0 0 16px;
    font-weight: 700;
}

.tama-result-message {
    font-size: 1.05rem;
    line-height: 2;
    color: #3E2B1A;
    margin: 0;
    padding: 0;
    border: none;
    font-style: normal;
    letter-spacing: 0.05em;
}

.tama-result-message::before { content: '\300C'; }
.tama-result-message::after  { content: '\300D'; }

.tama-result-sign {
    margin: 12px 0 0;
    font-size: 0.78rem;
    color: #8B6914;
    letter-spacing: 0.05em;
}

/* ---- SNSシェア ---- */
.tama-share {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px dashed #D4AF37;
}

.tama-share-label {
    font-size: 0.8rem;
    color: #8B6914;
    margin: 0 0 10px;
    letter-spacing: 0.15em;
}

.tama-share-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.tama-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 50px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;
    letter-spacing: 0.05em;
}

.tama-share-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex-shrink: 0;
}

.tama-share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}

.tama-share-x {
    background: #000;
    color: #fff;
}

.tama-share-line {
    background: #06C755;
    color: #fff;
}

/* ---- もう一度ボタン ---- */
.tama-retry-btn {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 11px 20px;
    font-family: inherit;
    font-size: 0.9rem;
    color: #8B6914;
    background: transparent;
    border: 1.5px solid #D4AF37;
    border-radius: 50px;
    cursor: not-allowed;
    opacity: 0.65;
    letter-spacing: 0.08em;
    transition: opacity 0.2s;
}

/* ===================================================
   レスポンシブ（スマホ対応）
   =================================================== */
@media (max-width: 480px) {
    #tama-omikuji-wrap {
        padding: 28px 16px 36px;
        margin: 20px 12px;
    }

    .tama-title {
        font-size: 1.6rem;
    }

    .tama-box {
        width: 90px;
    }

    .tama-box-top,
    .tama-box-body,
    .tama-box-bottom {
        width: 90px;
    }

    .tama-box-body {
        min-height: 110px;
    }

    .tama-kanji {
        font-size: 0.9rem;
    }

    .tama-result-message {
        font-size: 0.97rem;
    }

    .tama-share-buttons {
        flex-direction: column;
        align-items: center;
    }

    .tama-share-btn {
        width: 100%;
        justify-content: center;
    }
}
