@charset "UTF-8";

/* =========================================================
   Rating System Styles - Final Adjustments
   ========================================================= */

.chiirate-v1-container {
    border: 2px solid #ff91b6;
    border-radius: 12px;
    padding: 20px 10px 30px; /* 横パディングをさらに詰める(スマホの星サイズ確保のため) */
    background: #fff;
    margin: 20px 0;
    font-family: "M PLUS Rounded 1c", sans-serif;
    box-sizing: border-box;
    width: 100%;
    position: relative;
    text-align: center;
}

/* --- ヘッダー --- */
/* --- 評価のお願いヘッダー --- */
.chiirate-v1-invite-header {
    font-size: 0.9rem;       /* 下の「お願いします」の文字サイズ */
    color: #8d6e63;          /* 優しい薄茶色 */
    margin-bottom: 25px;     /* 星エリアとの間隔 */
    line-height: 1.5;
    font-weight: normal;
}

/* キャラクター名 (ヘッダー帯としてデザイン) */
.chiirate-v1-target-name {
    display: block;             /* ブロック化して1行を占有 */
    background-color: #ffebee;  /* 背景：ごく薄いピンク */
    color: #d81b60;             /* 文字：濃いピンク */
    font-size: 1.15rem;         /* 名前を大きく強調 */
    font-weight: bold;
    
    padding: 8px 15px;          /* 帯の内側の余白 */
    border-radius: 30px;        /* カプセル型の丸み */
    border: 2px solid #ffcdd2;  /* 枠線：パステルレッド */
    
    margin-bottom: 8px;         /* 下のテキストとの隙間 */
    
    /* 横幅の調整（中央寄せの帯にする場合） */
    width: 75%;         /* 文字数に合わせた幅にする */
    max-width: 100%;            /* 画面からはみ出さない */
    margin-left: auto;          /* 中央揃え */
    margin-right: auto;
    box-sizing: border-box;
}

/* --- 投票エリア (星) --- */
.chiirate-v1-vote-area {
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    position: relative;
    width: 100%;
}

/* row-reverseで左側選択を実現 */
.chiirate-v1-stars {
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
    /* スマホ用に隙間を最小限に (30px*10 + 1px*9 = 309px -> 320px画面に収まる) */
    gap: 1px; 
    flex-wrap: nowrap;
}

/* 星ボタン (スマホ基準: 少し大きく 28px -> 30px) */
.chiirate-v1-star-btn {
    appearance: none;
    background: none;
    border: none;
    cursor: pointer;
    
    /* 星形クリップパスのサイズ */
    width: 30px; 
    height: 30px;
    
    font-family: sans-serif;
    font-weight: bold;
    font-size: 0.8rem; /* 文字も少し大きく */
    color: #fff;
    
    background-color: #bbb;
    
    /* 星形 */
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.2s;
    line-height: 1;
    padding-top: 4px;
    
    margin: 0;
    -webkit-tap-highlight-color: transparent;
}

/* PCサイズ調整 (画面幅600px以上) */
@media screen and (min-width: 600px) {
    .chiirate-v1-stars {
        gap: 8px; /* PCなら間隔をあける */
    }
    .chiirate-v1-star-btn {
        width: 48px;  /* 40px -> 48px に拡大 */
        height: 48px;
        font-size: 1.1rem;
    }
}

/* ホバーアクション */
.chiirate-v1-star-btn:hover,
.chiirate-v1-star-btn:hover ~ .chiirate-v1-star-btn {
    background-color: #ffc107;
    color: #5d4037;
}

/* 揺れアニメーション (振れ幅を小さく修正) */
.chiirate-v1-star-btn:hover {
    animation: star-shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
    transform: scale(1.2); /* 拡大率は維持 */
    z-index: 10;
}

@keyframes star-shake {
  /* 揺れ幅を半分程度(1px～2px)に抑える */
  10%, 90% { transform: translate3d(-1px, 0, 0) scale(1.2); }
  20%, 80% { transform: translate3d(1px, 0, 0) scale(1.2); }
  30%, 50%, 70% { transform: translate3d(-2px, 0, 0) scale(1.2); }
  40%, 60% { transform: translate3d(2px, 0, 0) scale(1.2); }
}

/* 投票済みメッセージ */
.chiirate-v1-voted-message {
    display: none;
    font-weight: bold;
    color: #4caf50;
    font-size: 1.1em;
    padding: 15px;
    border: 2px dashed #a5d6a7;
    border-radius: 8px;
    background: #e8f5e9;
    margin-bottom: 20px;
}

/* --- 結果エリア --- */
.chiirate-v1-result-section {
    margin-top: 20px;
    text-align: left;
}

.chiirate-v1-data-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 5px;
    padding: 0 5px;
}

.chiirate-v1-score-display {
    font-weight: bold;
    color: #333;
}
.chiirate-v1-score-num {
    font-size: 1.8em;
    color: #e91e63;
    margin-left: 5px;
}

.chiirate-v1-vote-count {
    font-size: 0.9em;
    color: #888;
}

/* プログレスバー */
.chiirate-v1-bar-wrap {
    position: relative;
    height: 30px;
    margin-bottom: 25px;
    margin-top: 25px;
}

.chiirate-v1-bar-bg {
    width: 100%;
    height: 20px;
    background: #f0f0f0;
    border-radius: 10px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    top: 10px;
}

.chiirate-v1-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff91b6, #ff4081);
    width: 0%;
    border-radius: 10px;
    transition: width 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 全体平均線 */
.chiirate-v1-global-line {
    position: absolute;
    top: -10px;
    bottom: -5px;
    width: 2px;
    background-color: #2196f3;
    z-index: 5;
}

/* 全体平均ラベル (数値を表示できるように幅などを調整) */
.chiirate-v1-global-label-text {
    position: absolute;
    top: -22px; /* 少し上に */
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75em;
    color: #fff;
    font-weight: bold;
    white-space: nowrap;
    background: #2196f3; /* 青背景で見やすく */
    padding: 2px 6px;
    border-radius: 4px;
}
/* 吹き出しの三角 */
.chiirate-v1-global-label-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -4px;
    border-width: 4px;
    border-style: solid;
    border-color: #2196f3 transparent transparent transparent;
}

/* 目盛り */
.chiirate-v1-ticks {
    position: absolute;
    top: 34px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: #999;
    padding: 0 2px;
}
.chiirate-v1-tick-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* =========================================================
   全体平均ラベルの位置調整 (両端での見切れ対策)
   ========================================================= */

/* 左端付近 (0%~15%): 左揃えにして右へ伸ばす */
.chiirate-v1-global-label-text.is-left {
    left: 0;
    transform: none; /* 中央揃え解除 */
}
/* 三角の位置も合わせる */
.chiirate-v1-global-label-text.is-left::after {
    left: 1px; /* 線の太さの中心 */
    margin-left: -4px; /* 三角の幅の半分戻す */
}

/* 右端付近 (85%~100%): 右揃えにして左へ伸ばす */
.chiirate-v1-global-label-text.is-right {
    left: auto;
    right: 0;
    transform: none; /* 中央揃え解除 */
}
/* 三角の位置も合わせる */
.chiirate-v1-global-label-text.is-right::after {
    left: auto;
    right: 1px; /* 線の太さの中心 */
    margin-right: -4px; /* 三角の幅の半分戻す */
    margin-left: 0;
}

/* --- 前略: 既存のRating CSS --- */

/* =========================================================
   タブUI & 購入アンケート 拡張スタイル (上部重ね配置)
   ========================================================= */

/* 全体ラッパー */
.chiirate-wrapper {
    position: relative;
    margin: 30px 0;
    width: 100%;
}

/* タブがある場合はコンテナの上部パディングを増やす */
.chiirate-v1-container.has-tabs {
    padding-top: 45px;
    margin: 0;
}

/* タブボタン (枠の上部に重ねる) */
.chiirate-tabs {
    position: absolute;
    top: -18px; /* 枠の線の上に半分乗るように */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    gap: 15px;
    z-index: 10;
    width: 90%;
    max-width: 400px;
}
.chiirate-tab-btn {
    flex: 1;
    padding: 8px 0;
    border-radius: 30px; /* カプセル型に */
    border: 2px solid #ff91b6;
    background: #fff;
    color: #ec407a;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.95em;
    transition: all 0.2s;
    outline: none;
    font-family: inherit;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.chiirate-tab-btn:hover { background: #fff5f7; }
/* アクティブ時のデザイン (画像に合わせる) */
.chiirate-tab-btn.active {
    background: #e91e63; /* 濃いピンク */
    color: #fff;
    border-color: #d81b60;
    box-shadow: 0 3px 6px rgba(233, 30, 99, 0.3);
    pointer-events: none;
}

/* コンテンツ表示切替 */
.chiirate-tab-content { display: none; animation: chiiTabFadeIn 0.3s ease; }
.chiirate-tab-content.active { display: block; }
@keyframes chiiTabFadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* 区切り線の追加 (タブの下) */
.chiirate-v1-container.has-tabs::before {
    content: "";
    display: block;
    border-bottom: 2px dashed #ffebee;
    margin: -10px 0 20px;
}

/* タイトルの1行化調整 */
.chiirate-v1-target-name, .chiipoll-target-name {
    display: block;
    background-color: #ffebee;
    color: #d81b60;
    font-weight: bold;
    border-radius: 30px;
    border: 2px solid #ffcdd2;
    margin: 0 auto 12px;
    box-sizing: border-box;
    text-align: center;
    
    width: 90%;
    max-width: 320px;
    font-size: 1.05rem;
    padding: 6px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chiipoll-target-name {
    background-color: #fff8e1;
    color: #f57c00;
    border-color: #ffe0b2;
}

/* アンケートUI */
.chiipoll-invite-header { font-size: 0.95em; color: #555; margin-bottom: 20px; line-height: 1.5; }

.chiipoll-vote-area { display: flex; justify-content: center; gap: 10px; margin-bottom: 15px; }
.chiipoll-btn {
    flex: 1;
    max-width: 145px;
    padding: 12px 2px;
    border-radius: 8px;
    border: none;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    box-shadow: 0 4px 0 rgba(0,0,0,0.1);
    white-space: nowrap;
}
.chiipoll-btn:active { transform: translateY(4px); box-shadow: none !important; }

/* 視認性の改善 */
.chiipoll-btn.btn-buy { background: #ff8a65; color: #fff; box-shadow: 0 4px 0 #d84315; text-shadow: 0 1px 1px rgba(0,0,0,0.2); }
.chiipoll-btn.btn-skip { background: #90a4ae; color: #fff; box-shadow: 0 4px 0 #546e7a; text-shadow: 0 1px 1px rgba(0,0,0,0.2); }

/* 結果バー */
.chiipoll-result-area { margin: 15px 0 0; text-align: left; background: #fafafa; border-radius: 8px; padding: 15px; border: 1px solid #eee; }
.chiipoll-stats-text { display: flex; justify-content: space-between; font-size: 0.85em; font-weight: bold; }
.chiipoll-stats-text .text-buy { color: #d84315; }
.chiipoll-stats-text .text-skip { color: #546e7a; }

.chiipoll-result-bar-wrap { display: flex; height: 18px; border-radius: 9px; overflow: hidden; margin: 8px 0 5px; background: #cfd8dc; }
.chiipoll-bar-buy { background: #ff8a65; transition: width 1s cubic-bezier(0.22, 1, 0.36, 1); height: 100%; }
.chiipoll-bar-skip { background: #cfd8dc; transition: width 1s cubic-bezier(0.22, 1, 0.36, 1); height: 100%; }

.chiipoll-closed-msg { font-size: 0.8em; color: #999; margin-top: 10px; text-align: center; }

@media screen and (max-width: 480px) {
    .chiirate-v1-target-name, .chiipoll-target-name { width: 100%; font-size: 0.95em; }
    .chiipoll-vote-area { gap: 6px; }
    .chiipoll-btn { font-size: 0.85rem; padding: 10px 0; }
    .chiirate-tab-btn { font-size: 0.85em; padding: 8px 0; }
}