@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;
}