/* Lani Rune Fortune Styles */

/* コンテナ */
.lanirune-container {
    text-align: center;
    background-color: #ffffff;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    position: relative;
    width: 90%;
    max-width: 700px;
    min-height: 550px; /* 十分な高さを確保 */
    overflow: hidden;
    border: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* 上から順に配置 */
    margin: 20px auto; /* 上下にマージン */
    box-sizing: border-box;
}

/* ローディング表示 */
.lanirune-loading {
    padding: 50px;
    color: #aaa;
    font-style: italic;
}

/* 上部ラッパー内の要素スタイル */
.lanirune-container h2 { /* h2はコンテナ内のものに限定 */
    margin-top: 0;
    margin-bottom: 10px;
    color: #4a4a4a;
    font-weight: 300;
}

/* 指示テキスト */
.lanirune-instruction-text {
    margin-top: 5px;
    margin-bottom: 15px;
    color: #555;
    font-size: 1.1em;
    min-height: 1.5em;
    transition: opacity 0.5s ease;
    position: relative;
    z-index: 15;
}

/* ルーンポーチ */
.lanirune-pouch {
    width: 100px; height: 80px; background-color: #6d4c41; border-radius: 10px 10px 40px 40px; margin: 0 auto 20px auto; position: relative; cursor: pointer; transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55), box-shadow 0.3s ease, opacity 0.5s ease; display: flex; justify-content: center; align-items: center; color: white; font-size: 14px; user-select: none; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); z-index: 10;
}
.lanirune-pouch:hover { transform: scale(1.1); box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3); }
.lanirune-pouch.lanirune-hidden { opacity: 0; pointer-events: none; transform: scale(0.5); }

/* 石の配置エリア */
.lanirune-stones-area {
    position: absolute; /* コンテナ基準で絶対配置 */
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; /* エリア自体はクリック透過 */
    z-index: 5;
    overflow: hidden;
    box-sizing: border-box;
}

/* ルーンストーン */
.lanirune-stone {
    position: absolute;
    width: 40px;
    height: 55px;
    background: linear-gradient(145deg, #e0e0e0, #f8f8f8);
    border: 1px solid #c5c5c5;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    color: transparent; /* シンボル非表示 */
    text-shadow: none;
    cursor: default;
    opacity: 0; /* 初期非表示 */
    transform: scale(0.1) rotate(0deg); /* 初期状態 */
    user-select: none;
    box-shadow: 3px 3px 6px rgba(0, 0, 0, 0.15), -1px -1px 3px rgba(255, 255, 255, 0.7);
    pointer-events: auto; /* 石自体はクリック可能 */
    will-change: transform, opacity, top, left;
    /* transition は JS で動的に設定 */
}

/* 選択可能な石 */
.lanirune-stone.lanirune-selectable {
    cursor: pointer;
}
.lanirune-stone.lanirune-selectable:hover {
    transform: translateY(-5px) scale(1.05) rotate(var(--hover-rotate, 0deg)) !important;
    box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2), -2px -2px 5px rgba(255, 255, 255, 0.9);
    border-color: #a0a0a0;
    z-index: 6;
}

/* 選択された石 */
.lanirune-stone.lanirune-selected {
    background: linear-gradient(145deg, #a8d8ff, #d0eaff);
    border-color: #007bff;
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.2), 0 0 10px rgba(0, 123, 255, 0.4);
    transform: translateY(-2px) scale(1.02) rotate(var(--final-rotate, 0deg)) !important;
    cursor: default;
    pointer-events: none;
    z-index: 7;
}

/* 選択されなかった石のフェードアウト */
.lanirune-stone.lanirune-clearing-fade {
    opacity: 0 !important;
    transform: scale(0.8) rotate(var(--final-rotate, 0deg));
    transition: opacity 0.5s ease-out, transform 0.5s ease-out !important;
    pointer-events: none;
}

/* 選択された石が上に移動するスタイル */
.lanirune-stone.lanirune-clearing-move {
    transition: top 0.8s cubic-bezier(0.68, -0.55, 0.27, 1.55), left 0.8s cubic-bezier(0.68, -0.55, 0.27, 1.55), transform 0.8s cubic-bezier(0.68, -0.55, 0.27, 1.55), opacity 0.5s ease, color 0.5s ease 0.5s !important;
    pointer-events: none;
    z-index: 8;
    color: #5a5a5a; /* シンボル表示 */
}


/* 結果表示エリアラッパー */
.lanirune-result-wrapper {
    margin-top: auto; /* コンテナ下部に配置 */
    padding-top: 20px;
    width: 100%;
    position: relative; /* z-index のため */
    z-index: 1; /* 石よりは後ろ */
}

/* 結果表示エリア本体 */
.lanirune-result-area {
    padding: 20px;
    background-color: #fdfdfd;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    min-height: 120px;
    text-align: left;
    opacity: 0; /* 初期非表示 */
    transform: translateY(20px);
    transition: opacity 0.8s ease 0.2s, transform 0.8s ease 0.2s;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
}
.lanirune-result-area.lanirune-visible {
    opacity: 1;
    transform: translateY(0);
}
.lanirune-result-area h3 {
    margin-top: 0; margin-bottom: 15px; color: #4a4a4a; font-weight: 400; border-bottom: 1px solid #eee; padding-bottom: 10px;
}

/* 基本的な意味表示エリア */
.lanirune-basic-meaning {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #ddd;
}
.lanirune-basic-meaning-item {
     display: flex; align-items: center; margin-bottom: 10px;
}
.lanirune-rune-symbol-basic { /* クラス名変更 */
    font-size: 1.8em; margin-right: 10px; color: #6d4c41; min-width: 30px; text-align: center;
}
.lanirune-basic-meaning-item strong { font-size: 1.1em; color: #333; margin-right: 8px; }
.lanirune-basic-meaning-item span { color: #666; font-size: 0.9em; }

/* WordPressからの結果表示エリア */
.lanirune-wp-result-content {
    /* スタイルがあれば記述 */
}
/* WPブロック内の要素のスタイル調整が必要な場合はここに追加 */
.lanirune-wp-result-content .wp-block-heading {
    /* 例: 見出しのスタイル調整 */
    /* font-size: 1.5em; */
}

/* WordPressブロック用の非表示クラス (変更しない) */
.nodisplay {
    display: none;
}

/* リセットボタン */
.lanirune-reset-button {
    margin-top: 20px;
    margin-bottom: 5px; /* 下に少し余白 */
    padding: 12px 25px;
    background-color: #795548;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease, opacity 0.5s ease 0.5s;
    opacity: 0; /* 初期非表示 */
    pointer-events: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.lanirune-reset-button.lanirune-visible {
    opacity: 1;
    pointer-events: auto;
}
.lanirune-reset-button:hover { background-color: #5d4037; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.3); }
.lanirune-reset-button:active { transform: translateY(0px); box-shadow: 0 1px 3px rgba(0,0,0,0.2); }

.lanirune-theme-shell {
    background:
        radial-gradient(circle at 18% 8%, rgba(125, 227, 238, 0.16), transparent 28%),
        radial-gradient(circle at 92% 0%, rgba(74, 116, 126, 0.28), transparent 34%),
        linear-gradient(145deg, #07111f 0%, #102632 56%, #070c13 100%);
    border: 1px solid rgba(125, 227, 238, 0.24);
    box-shadow: 0 18px 50px rgba(7, 17, 31, 0.28);
    color: #f3f8ff;
    min-height: 0;
    overflow: visible;
    padding: 26px 18px 24px;
}

.lanirune-theme-card {
    align-items: center;
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: flex-start;
    margin: 0 auto;
    max-width: 520px;
    width: 100%;
}

.lanirune-theme-kicker {
    color: #9be8e6 !important;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    line-height: 1.2;
    margin: 0 0 16px;
    text-transform: uppercase;
}

.lanirune-theme-shell h2 {
    background: transparent !important;
    border: 0 !important;
    border-left: 4px solid #29c9ee !important;
    box-shadow: none !important;
    color: #f3f8ff !important;
    display: block !important;
    font-size: clamp(22px, 5.5vw, 30px);
    font-weight: 700;
    line-height: 1.45;
    margin: 0 0 16px !important;
    max-width: 330px;
    padding: 0 0 0 16px !important;
    text-align: left;
    text-shadow: none;
    width: 100%;
}

.lanirune-theme-shell h2::before,
.lanirune-theme-shell h2::after {
    display: none !important;
}

.lanirune-theme-shell .lanirune-instruction-text {
    color: #e4f4f7 !important;
    font-size: 15px;
    line-height: 1.75;
    margin: 0 auto 20px;
    max-width: 360px;
}

.lanirune-theme-pouch {
    align-items: center;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(125, 227, 238, 0.32);
    border-radius: 26px;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
    color: #f3f8ff !important;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    font-size: 15px;
    font-weight: 800;
    gap: 8px;
    line-height: 1.5;
    max-width: 222px;
    padding: 15px 18px 17px;
    transition: transform 0.22s ease, box-shadow 0.22s ease, opacity 0.22s ease;
    width: min(70vw, 222px);
}

.lanirune-theme-pouch:hover,
.lanirune-theme-pouch:focus {
    box-shadow: 0 20px 42px rgba(0, 0, 0, 0.32), 0 0 0 4px rgba(125, 227, 238, 0.14);
    outline: none;
    transform: translateY(-3px) scale(1.02);
}

.lanirune-theme-pouch.is-drawing {
    opacity: 0.72;
    pointer-events: none;
    transform: scale(0.98) rotate(-1deg);
}

.lanirune-theme-pouch img {
    display: block;
    height: auto;
    max-width: 118px;
}

.lanirune-theme-pouch-symbol {
    color: #7de3ee !important;
    font-size: 58px;
    line-height: 1;
}

.lanirune-theme-result {
    animation: laniruneTroubleReveal 0.42s ease both;
    background: rgba(8, 22, 37, 0.76);
    border: 1px solid rgba(125, 227, 238, 0.24);
    border-radius: 20px;
    margin-top: 18px;
    max-width: 300px;
    padding: 17px 16px 18px;
    width: 100%;
}

.lanirune-theme-result[hidden] {
    display: none;
}

.lanirune-theme-result-label {
    color: #b7c6d8;
    font-size: 13px;
    margin: 0 0 12px;
}

.lanirune-theme-result img {
    background: rgba(7, 17, 31, 0.72);
    border: 1px solid rgba(125, 227, 238, 0.28);
    border-radius: 14px;
    display: block;
    margin: 0 auto 10px;
    max-width: 78px;
    padding: 8px;
}

.lanirune-theme-result strong,
.lanirune-theme-result span {
    display: block;
}

.lanirune-theme-result strong {
    color: #f3f8ff;
    font-size: 21px;
    line-height: 1.4;
}

.lanirune-theme-result span {
    color: #cfe0ec;
    font-size: 14px;
    line-height: 1.7;
}

.lanirune-theme-result .lanirune-reset-button {
    background: linear-gradient(135deg, #20b7d8 0%, #258a99 48%, #1d5f75 100%) !important;
    border: 1px solid rgba(180, 244, 250, 0.42) !important;
    border-radius: 999px !important;
    box-shadow: 0 10px 24px rgba(20, 170, 205, 0.22) !important;
    color: #ffffff !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    letter-spacing: 0.02em;
    margin: 14px auto 0;
    min-width: 128px;
    padding: 10px 18px !important;
}

.lanirune-theme-result .lanirune-reset-button:hover,
.lanirune-theme-result .lanirune-reset-button:focus {
    background: linear-gradient(135deg, #38d4ef 0%, #269eb0 52%, #1e6d84 100%) !important;
    box-shadow: 0 14px 30px rgba(20, 170, 205, 0.32), 0 0 0 4px rgba(125, 227, 238, 0.13) !important;
    outline: none;
    transform: translateY(-2px);
}

.lanirune-error {
    color: #8b1e1e;
    font-weight: 700;
    line-height: 1.7;
    margin: auto;
}

@keyframes laniruneTroubleReveal {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 520px) {
    .lanirune-theme-shell {
        border-radius: 18px;
        margin: 18px auto;
        padding: 24px 14px;
        width: 94%;
    }
}
