/* =============================================
   Artist Score Card – Frontend Styles (v8 fix)
   ============================================= */

/* ---------- Card Wrap ---------- */
.asc-card-wrap {
    max-width: 400px;
    margin: 24px auto;
    font-family: sans-serif;
}

.asc-card-meta { margin-bottom: 6px; }

.asc-card-type-label {
    display: inline-block;
    font-size: 11px;
    color: #A07830;
    letter-spacing: .08em;
    padding: 2px 10px;
    border: 1px solid rgba(255,215,0,.3);
    border-radius: 20px;
    background: #1A0D00;
}

.asc-user-label {
    color: #8090B8 !important;
    border-color: rgba(160,176,200,.3) !important;
    background: #0D1128 !important;
}

/* ---------- Card ---------- */
.asc-comparison-card {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #4A4A6A;
    display: flex;
    flex-direction: column;
}

/* ---------- Winner Side ---------- */
.asc-winner-side {
    background: #1A0D00;
    padding: 10px 14px 10px;
    position: relative;
    overflow: hidden;
}

.asc-winner-side::before {
    content: '';
    position: absolute;
    top: -30px; left: -30px;
    width: 120px; height: 120px;
    background: radial-gradient(circle, rgba(255,215,0,.12) 0%, transparent 70%);
    pointer-events: none;
}

.asc-winner-badge-row { margin-bottom: 4px; }

.asc-winner-badge {
    display: inline-block;
    background: #FFD700;
    color: #1A0A00;
    font-size: 8px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: .12em;
    text-transform: uppercase;
    text-shadow: 0 0 2px rgba(0,0,0,.6), 0 1px 2px rgba(0,0,0,.8);
    box-shadow: 0 0 0 1.5px #000, 0 1px 3px rgba(0,0,0,.5);
}

/* ---------- Header Row ---------- */
.asc-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    gap: 8px;
}

.asc-winner-name,
.asc-loser-name {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0;
}

.asc-winner-name { color: #FFD700; }
.asc-loser-name  { color: #ffffff; text-shadow: 0 0 3px #000, 0 1px 3px rgba(0,0,0,.8); }

.asc-total-wrap { text-align: right; flex-shrink: 0; }

.asc-total-label {
    font-size: 9px;
    letter-spacing: .06em;
    display: block;
    margin-bottom: 1px;
}

.asc-total-label-w { color: #A07830; }
.asc-total-label-l { color: #6070A0; }

.asc-winner-total,
.asc-loser-total {
    font-size: 26px;
    font-weight: 500;
    line-height: 1;
    margin: 0;
}

.asc-winner-total { color: #FFD700; }
.asc-loser-total  { color: #A0B0C8; }

.asc-total-max { font-size: 10px; }
.asc-total-max-w { color: #A07830; }
.asc-total-max-l { color: #6070A0; }

/* ---------- Divider Lines ---------- */
.asc-divider-line-w,
.asc-divider-line-l {
    border: none;
    margin: 6px 0 5px;
}

.asc-divider-line-w { border-top: 1px solid rgba(255,215,0,.25); }
.asc-divider-line-l { border-top: 1px solid rgba(160,176,200,.2); }

/* ---------- Score Rows ---------- */
.asc-score-row {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 4px;
}

.asc-score-label {
    font-size: 11px;
    min-width: 60px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

.asc-score-label-w { color: #C8A050; }
.asc-score-label-l { color: #6070A0; }

.asc-bar-bg {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
    min-width: 0;
}

.asc-bar-bg-w { background: rgba(255,215,0,.1); }
.asc-bar-bg-l { background: rgba(160,176,200,.1); }

.asc-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width .35s ease;
}

.asc-bar-fill-w { background: linear-gradient(90deg, #B8860B, #FFD700); }
.asc-bar-fill-l { background: linear-gradient(90deg, #4A5A80, #A0B0C8); }

.asc-score-num {
    font-size: 13px;
    font-weight: 500;
    min-width: 24px;
    text-align: right;
    flex-shrink: 0;
}

.asc-score-num-w { color: #FFD700; }
.asc-score-num-l { color: #A0B0C8; }

/* ---------- VS ---------- */
.asc-vs-divider {
    background: #0D0A1A;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
}

.asc-vs-text {
    color: #FFD700;
    font-size: 16px;
    font-weight: 500;
    padding: 5px 20px;
    letter-spacing: .25em;
    border: 2px solid #FFFFFF;
    border-radius: 20px;
    background: #1A0D00;
}

/* ---------- Loser Side ---------- */
.asc-loser-side {
    background: #0D1128;
    padding: 10px 14px 10px;
    position: relative;
    overflow: hidden;
}

.asc-loser-side::before {
    content: '';
    position: absolute;
    top: -30px; right: -30px;
    width: 120px; height: 120px;
    background: radial-gradient(circle, rgba(180,190,220,.08) 0%, transparent 70%);
    pointer-events: none;
}

/* ---------- Share Button ---------- */
.asc-share-area { margin-top: 10px; text-align: center; }

.asc-share-btn {
    display: inline-block;
    padding: 9px 20px;
    background: linear-gradient(135deg, #B8860B, #FFD700);
    color: #1A0A00;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    letter-spacing: .04em;
    transition: opacity .2s;
}

.asc-share-btn:hover { opacity: .85; }

/* ==============================================
   ユーザー評価セクション
   ============================================== */
.asc-user-section {
    margin: 32px 0;
    font-family: sans-serif;
}

/* 2カラム：左=カードプレビュー、右=フォーム */
.asc-user-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.asc-preview-col {
    flex: 0 0 360px;
    max-width: 360px;
}

.asc-preview-col .asc-card-wrap {
    max-width: 100%;
    margin: 0;
}

.asc-form-col {
    flex: 1;
    min-width: 220px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 16px;
}

/* ---------- フォーム ---------- */
.asc-form-row { margin-bottom: 14px; }

.asc-form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 5px;
}

.asc-nickname-input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    box-sizing: border-box;
}

.asc-score-inputs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.asc-score-input-group {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 110px;
}

.asc-input-artist-label {
    font-size: 10px;
    color: #666;
    flex-shrink: 0;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.asc-score-input-group input[type="number"] {
    width: 56px;
    padding: 5px 6px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 13px;
    text-align: center;
}

.asc-input-max {
    font-size: 10px;
    color: #999;
    flex-shrink: 0;
}

.asc-submit-btn {
    display: block;
    width: 100%;
    padding: 11px;
    background: linear-gradient(135deg, #1A0D00, #3A2010);
    color: #FFD700;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid rgba(255,215,0,.4);
    border-radius: 8px;
    cursor: pointer;
    letter-spacing: .04em;
    transition: opacity .2s;
    margin-top: 4px;
}

.asc-submit-btn:hover   { opacity: .85; }
.asc-submit-btn:disabled { opacity: .5; cursor: not-allowed; }

.asc-submit-note {
    font-size: 11px;
    color: #999;
    margin: 6px 0 0;
    text-align: center;
}

/* ---------- Modal ---------- */
.asc-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.75);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.asc-modal-box {
    background: #1A0D00;
    border: 1px solid rgba(255,215,0,.5);
    border-radius: 12px;
    padding: 24px 20px;
    max-width: 300px;
    width: 90%;
    text-align: center;
}

.asc-modal-box p {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 18px;
    color: #FFD700;
}

.asc-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.asc-modal-ok,
.asc-modal-cancel {
    padding: 8px 22px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

.asc-modal-ok     { background: #FFD700; color: #1A0A00; }
.asc-modal-cancel { background: transparent; color: #888; border: 1px solid #555; }

/* ==============================================
   レスポンシブ
   ============================================== */
@media (max-width: 700px) {
    .asc-user-layout {
        flex-direction: column;
        gap: 20px;
    }

    .asc-preview-col {
        flex: none;
        width: 100%;
        max-width: 100%;
    }

    .asc-form-col { width: 100%; }
}

@media (max-width: 400px) {
    .asc-card-wrap { max-width: 100%; }

    .asc-score-label {
        min-width: 48px;
        max-width: 62px;
        font-size: 10px;
    }
}

/* ---------- ユーザー名表示行（WINNERバッジ上） ---------- */
.asc-user-nickname-row {
    font-size: 11px;
    color: #FFD700;
    letter-spacing: .06em;
    margin-bottom: 4px;
    min-height: 0;
}

.asc-user-nickname-row:empty {
    display: none;
}

.asc-nickname-display {
    display: inline-block;
    background: rgba(255,215,0,.12);
    border: 1px solid rgba(255,215,0,.3);
    border-radius: 12px;
    padding: 1px 10px;
    font-size: 11px;
    color: #FFD700;
    letter-spacing: .04em;
}

/* ==============================================
   iOS 長押し保存オーバーレイ
   ============================================== */
.asc-img-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.88);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.asc-img-overlay-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-width: 420px;
    width: 100%;
}

.asc-img-overlay-hint {
    color: #FFD700;
    font-size: 15px;
    text-align: center;
    line-height: 1.7;
    margin: 0;
    background: rgba(255,215,0,.1);
    border: 1px solid rgba(255,215,0,.3);
    border-radius: 10px;
    padding: 10px 18px;
}

.asc-img-overlay-hint strong {
    font-size: 17px;
    color: #fff;
}

.asc-img-overlay-img {
    width: 100%;
    max-width: 380px;
    border-radius: 12px;
    display: block;
    /* タッチ操作を妨げないようにポインターイベントは通す */
    -webkit-touch-callout: default;
}

.asc-img-overlay-close {
    padding: 8px 28px;
    background: transparent;
    color: #888;
    border: 1px solid #555;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
}

/* ---------- iOS 長押し保存オーバーレイ ---------- */
.asc-img-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.88);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.asc-img-overlay-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-width: 100%;
}

.asc-img-overlay-msg {
    color: #fff;
    font-size: 15px;
    text-align: center;
    line-height: 1.7;
    margin: 0;
}

.asc-img-overlay-msg strong {
    color: #FFD700;
    font-size: 18px;
}

.asc-img-preview {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 10px;
    display: block;
    /* 長押しメニューが出るよう user-select は触らない */
}

.asc-img-overlay-close {
    padding: 9px 32px;
    background: transparent;
    color: #aaa;
    border: 1px solid #555;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
}

/* ---------- iOS画像モーダル ---------- */
.asc-img-modal-overlay {
    overflow-y: auto;
    padding: 20px;
    align-items: flex-start;
}

.asc-img-modal-box {
    background: #111;
    border-radius: 12px;
    padding: 16px;
    max-width: 420px;
    width: 100%;
    margin: auto;
    text-align: center;
}

.asc-img-modal-hint {
    font-size: 13px;
    color: #FFD700;
    line-height: 1.6;
    margin-bottom: 14px;
    padding: 10px 12px;
    background: rgba(255,215,0,.1);
    border: 1px solid rgba(255,215,0,.3);
    border-radius: 8px;
}

.asc-img-modal-img {
    width: 100%;
    border-radius: 8px;
    display: block;
    margin-bottom: 14px;
    -webkit-touch-callout: default; /* iOSで長押しメニューを有効化 */
}

.asc-img-modal-close {
    display: inline-block;
    padding: 8px 28px;
    background: transparent;
    color: #aaa;
    border: 1px solid #444;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
}

/* ---------- 画像保存モーダル ---------- */
.asc-image-modal-overlay {
    align-items: flex-end !important; /* スマホで下から出す */
    padding-bottom: 0;
}

@media (min-width: 600px) {
    .asc-image-modal-overlay {
        align-items: center !important;
    }
}

.asc-image-modal-box {
    background: #111;
    border: 1px solid rgba(255,215,0,.4);
    border-radius: 16px 16px 0 0;
    padding: 20px 16px 32px;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

@media (min-width: 600px) {
    .asc-image-modal-box {
        border-radius: 16px;
        padding: 24px 20px;
        width: auto;
        max-width: 420px;
    }
}

.asc-image-modal-instruction {
    font-size: 13px;
    color: #FFD700;
    margin-bottom: 14px;
    line-height: 1.6;
    font-weight: 600;
}

.asc-image-modal-img-wrap {
    border-radius: 8px;
    overflow: hidden;
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
