/* movie_detail.css */
/* ===================================================
   Movie Detail Page - Pre-Play Information Screen
   =================================================== */

.detail-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 0 3rem;
}

/* === Hero Section: Thumbnail + Info === */
.detail-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

/* --- Thumbnail Area --- */
.detail-thumbnail-wrapper {
    position: relative;
    border-radius: var(--card-radius);
    overflow: hidden;
    aspect-ratio: 16/9;
    background: var(--code-bg);
    box-shadow: var(--card-shadow-hover);
}

.detail-thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.detail-thumbnail-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.7) 100%); /* design-allow: color-literal */
    pointer-events: none;
}

.detail-duration {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: var(--card-overlay-bg);
    color: #fff; /* design-allow: color-literal */
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.03em;
}

.detail-pv-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ⚠️ サムネイル画像の上に絶対配置される（_hero.html.erb:45）ので地もテーマ非依存で
   なければならない。--lh-success は light 濃色 / dark 明色に**反転**するため
   dark 5 テーマで 1.93 だった → light の値（#166534）で固定する。
   白サムネに重ねた最悪ケースでも #fff で 5.03（計画書 182 Phase 3-3） */
.detail-pv-badge.official {
    background: rgba(22, 101, 52, 0.85); /* design-allow: color-literal */
    color: #fff; /* design-allow: color-literal */
    border: 1px solid rgba(255,255,255,0.15); /* design-allow: color-literal */
}

.detail-pv-badge.cover {
    background: rgba(30, 90, 180, 0.85); /* design-allow: color-literal */
    color: #fff; /* design-allow: color-literal */
    border: 1px solid rgba(255,255,255,0.15); /* design-allow: color-literal */ /* design-allow: color-literal */
}

/* --- Info Area --- */
.detail-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.detail-title {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
}

/* --- Enriched Metadata (Artist / Song) --- */
.detail-enriched-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.detail-enriched-meta i {
    margin-right: 0.2rem;
    font-size: 0.9rem;
}

.detail-enriched-artist {
    font-weight: 600;
}

.detail-channel {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-decoration: none;
    margin-bottom: 0.75rem;
    transition: color 0.2s;
}

.detail-channel:hover {
    color: var(--accent);
}

.detail-channel i {
    font-size: 1.1rem;
}

.detail-creator-section {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.detail-creator-avatar-link {
    flex-shrink: 0;
}

.detail-creator-avatar-img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.detail-creator-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--tag-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.detail-creator-body {
    min-width: 0;
}

.detail-creator-link {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: color 0.2s;
}

.detail-creator-link:hover {
    color: var(--accent);
}

.detail-creator-desc {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.65;
    margin-top: 0.25rem;
}

.creator-works-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.creator-works-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.creator-works-more {
    text-align: right;
    margin-top: 0.5rem;
}

.creator-works-more-link {
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}

.creator-works-more-link:hover {
    opacity: 0.8;
}

.detail-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.detail-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--tag-bg);
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.detail-tag:hover {
    background: var(--tag-hover-bg);
    color: var(--text-primary);
}

/* --- Tag Display (read-only in hero) --- */
.tag-editor-display {
    display: contents;
}

/* --- Tag Edit Button --- */
.tag-editor-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border: 1px dashed var(--border-color);
    border-radius: 20px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.72rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    white-space: nowrap;
}

.tag-editor-open-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    border-style: solid;
}

/* --- Tag Editor Modal --- */
.tag-editor-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5); /* design-allow: color-literal */
    z-index: 1050;
}

.tag-editor-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    box-shadow: var(--modal-panel-shadow);
    z-index: 1051;
}

.tag-editor-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.tag-editor-modal-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tag-editor-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.tag-editor-modal-close:hover {
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--text-primary);
}

.tag-editor-modal-body {
    padding: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* --- Tag Editor (inside modal) --- */
.tag-editor-tags {
    display: contents;
}

.tag-editor-badge {
    gap: 2px;
}

.tag-editor-badge a {
    color: inherit;
    text-decoration: none;
}

.tag-editor-badge a:hover {
    color: var(--text-primary);
}

.tag-editor-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.7rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.tag-editor-remove:hover {
    background: rgba(var(--color-danger-rgb), 0.15);
    color: var(--color-danger);
}

.tag-editor-input-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    width: 100%;
    margin-top: 0.25rem;
}

.tag-editor-input {
    flex: 1;
    min-width: 0;
    max-width: 220px;
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.75rem;
    outline: none;
    transition: border-color 0.2s;
}

.tag-editor-input:focus {
    border-color: var(--accent);
}

.tag-editor-input::placeholder {
    color: var(--text-muted);
}

.tag-editor-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    flex-shrink: 0;
}

.tag-editor-add-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.tag-editor-presets {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    width: 100%;
}

.tag-editor-preset-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    width: 100%;
}

.tag-editor-preset-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.tag-editor-preset {
    padding: 2px 8px;
    border: 1px dashed var(--border-color);
    border-radius: 20px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.tag-editor-preset:hover {
    border-color: var(--accent);
    color: var(--accent);
    border-style: solid;
    background: rgba(var(--accent-rgb), 0.05);
}

.tag-editor-preset--my {
    border-color: var(--accent);
    color: var(--accent);
}

.tag-editor-error {
    width: 100%;
    font-size: 0.75rem;
    color: var(--color-danger);
    margin-top: 0.25rem;
}

/* --- Stats Grid --- */
.detail-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(5rem, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.detail-stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 0.75rem;
    text-align: center;
    transition: border-color 0.2s;
}

.detail-stat-card:hover {
    border-color: rgba(var(--accent-rgb), 0.3);
}

.detail-stat-icon {
    font-size: 1.1rem;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.detail-stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.detail-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

/* --- Level Rating --- */
.detail-level {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    margin-bottom: 1rem;
}

.detail-level-bar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.detail-level-bar {
    display: flex;
    gap: 3px;
}

.detail-level-segment {
    width: 1.5rem;
    height: 0.5rem;
    border-radius: 2px;
    background: var(--border-color);
    transition: background 0.2s;
}

.detail-level-segment.active {
    background: var(--trophy-gold);
    box-shadow: 0 0 4px rgba(var(--star-color-rgb),0.4);
}

.detail-level-stars {
    display: flex;
    gap: 2px;
    font-size: 1.1rem;
}

.detail-level-stars .active {
    color: var(--star-fg); /* ★は fg トークン（--star-active は light 面で 1.32） */
    text-shadow: 0 0 4px rgba(var(--star-color-rgb),0.5);
}

.detail-level-stars .inactive {
    color: var(--border-color);
}

.detail-level-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.detail-level-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

.detail-level-speed {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* === CTA Section: Start Buttons === */
.detail-cta-section {
    margin-bottom: 0;
    padding-bottom: 2rem;
}

/* CTA-Ad separator: visual separation to prevent accidental ad clicks */
.detail-cta-ad-separator {
    height: 1px;
    background: var(--border-color);
    margin: 0 0 0.5rem;
    opacity: 0.5;
}

.detail-cta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
}

.detail-cta-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 1.25rem 1rem;
    border-radius: var(--card-radius);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.detail-cta-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.3s;
}

.detail-cta-btn:hover::before {
    opacity: 1;
}

.detail-cta-btn-icon {
    font-size: 1.75rem;
    line-height: 1;
    position: relative;
    z-index: 1;
}

.detail-cta-btn-label {
    font-size: 0.9rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.detail-cta-btn-sub {
    font-size: 0.7rem;
    opacity: 0.7;
    position: relative;
    z-index: 1;
}

/* Primary CTA: Typing - Solid accent for maximum visibility */
.cta-typing {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-on-accent);
}

.cta-typing:hover {
    border-color: var(--accent);
    background: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(var(--accent-rgb), 0.35);
    filter: brightness(1.1);
}

.cta-typing::before {
    background: radial-gradient(ellipse at 50% 80%, rgba(255,255,255,0.1) 0%, transparent 60%); /* design-allow: color-literal */
}

.cta-typing .detail-cta-btn-icon,
.cta-typing .detail-cta-btn-label,
.cta-typing .detail-cta-btn-sub {
    /* ⚠️ 親 .cta-typing が accent を敷いている。#fff 固定だと accent が明色になる
       ダーク 5 テーマで 1.12。親と同じ反転トークンにする */
    color: var(--text-on-accent);
}

/* Secondary CTAs */
.cta-secondary {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.cta-secondary:hover {
    border-color: rgba(var(--accent-rgb), 0.3);
    transform: translateY(-2px);
    box-shadow: var(--player-menu-shadow);
}

.cta-secondary .detail-cta-btn-icon {
    color: var(--text-secondary);
}

/* === User Progress Section (Logged-in) === */
.detail-progress {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.detail-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.detail-progress-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-progress-title i {
    color: var(--accent);
}

.detail-progress-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-cleared {
    background: rgba(var(--lh-success-rgb), 0.12);
    color: var(--lh-success);
}

.badge-not-cleared {
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--accent);
}

.detail-progress-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.progress-item {
    text-align: center;
}

.progress-item-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.progress-item-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.progress-item-value-sm {
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.progress-trophy {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

/* Trophy colors (using CSS variables for theme adaptability) */
.trophy-gold { color: var(--medal-gold-fg); filter: drop-shadow(0 0 4px rgba(var(--star-color-rgb),0.4)); } /* 文字・アイコンは fg トークン（--trophy-* は light 面で 1.16〜2.89） */
.trophy-silver { color: var(--medal-silver-fg); filter: drop-shadow(0 0 4px rgba(var(--trophy-silver-rgb), 0.3)); }
.trophy-bronze { color: var(--medal-bronze-fg); filter: drop-shadow(0 0 4px rgba(var(--trophy-bronze-rgb), 0.3)); }

/* Mode tabs in progress */
.detail-progress-modes {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0;
}

.progress-mode-tab {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    transition: all 0.2s;
    margin-bottom: -1px;
}

.progress-mode-tab:hover {
    color: var(--text-secondary);
}

.progress-mode-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Share: platform-specific hover colors */
/* design-allow-start: color-literal */
/* SNS 公式ブランドカラー (X 黒/白 / FB / LINE)。テーマ非依存固定色 */
.share-btn-x:hover { color: #000; border-color: #000; }
[data-theme*="dark"] .share-btn-x:hover { color: #fff; border-color: #fff; }
.share-btn-fb:hover { color: #1877f2; border-color: #1877f2; }
.share-btn-line:hover { color: #06c755; border-color: #06c755; }
/* ⚠️ ブランド色をそのまま文字に使うと light テーマの面で FB 3.19 / LINE **1.70**。
   base は --text-muted(5.20) なので**ホバーで読みにくくなる逆転**だった。
   X が [data-theme*="dark"] で反転しているのと同じ形で、light だけ色相・彩度を保って明度を下げる */
[data-theme^="light-"] .share-btn-fb:hover { color: #0b5cc6; border-color: #0b5cc6; }
[data-theme^="light-"] .share-btn-line:hover { color: #037030; border-color: #037030; }
/* FB の青は暗面でも 3.70 なので両方向に振る（LINE の緑は暗面で 6.95 なので据え置き） */
[data-theme*="dark"] .share-btn-fb:hover { color: #3d8df4; border-color: #3d8df4; }
/* design-allow-end: color-literal */
.share-btn-copy:hover { color: var(--accent); border-color: var(--accent); }

/* === Ranking Preview === */
.detail-ranking {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.ranking-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.ranking-tab {
    flex: 1;
    padding: 0.625rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    transition: all 0.2s;
}

.ranking-tab:hover {
    color: var(--text-secondary);
    background: rgba(var(--accent-rgb), 0.03);
}

.ranking-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.ranking-body {
    padding: 0;
}

.ranking-row {
    display: grid;
    grid-template-columns: 40px 1fr 80px 60px 32px;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    border-bottom: 1px solid rgba(128,128,128,0.06); /* design-allow: color-literal */
    transition: background 0.15s;
}

.ranking-row:hover {
    background: rgba(var(--accent-rgb), 0.03);
}

.ranking-row:last-child {
    border-bottom: none;
}

.ranking-pos {
    font-weight: 700;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.ranking-pos.gold { color: var(--medal-gold-fg); } /* 文字・アイコンは fg トークン（--trophy-* は light 面で 1.16〜2.89） */
.ranking-pos.silver { color: var(--medal-silver-fg); }
.ranking-pos.bronze { color: var(--medal-bronze-fg); }

.ranking-name {
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking-name-link {
    text-decoration: none;
    color: var(--text-primary);
    transition: color 0.2s;
}

.ranking-name-link:hover {
    color: var(--accent);
}

.ranking-score {
    text-align: right;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.ranking-speed {
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.ranking-replay-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  padding: 0;
}
.ranking-replay-btn:hover {
  color: rgba(var(--accent-rgb), 1);
  background: rgba(var(--accent-rgb), 0.1);
}

/* うたたっぷランキング行（ランク+クリア率+リプレイボタン表示） */
.ranking-row-utatap {
    grid-template-columns: 40px 1fr 80px 32px 48px 32px;
}

.ranking-game-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 800;
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.ranking-game-rank[data-rank="S+"],
.ranking-game-rank[data-rank="S"] {
    /* design-allow-next-block: color-literal */
    background: linear-gradient(135deg, #ffd700, #ff8c00); /* design-allow: color-literal */
    color: #1a0800; /* design-allow: color-literal */
    border: none;
}
.ranking-game-rank[data-rank="A"] {
    background: linear-gradient(135deg, #1eff52, #00c853); /* design-allow: color-literal */
    color: #0a2e0a; /* design-allow: color-literal */
    border: none;
}
.ranking-game-rank[data-rank="B"] {
    background: linear-gradient(135deg, #4fc3f7, #0288d1); /* design-allow: color-literal */
    color: #0a1a2e; /* design-allow: color-literal */
    border: none;
}

.ranking-clear-rate {
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.ranking-more {
    display: block;
    width: 100%;
    text-align: center;
    padding: 0.625rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    background: none;
    border: none;
    border-top: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.ranking-more:hover {
    background: rgba(var(--accent-rgb), 0.05);
}

/* === Video Description (SEO) === */
.detail-description {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.detail-description-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.65;
}

.detail-description-more {
    display: inline;
    color: var(--accent);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
}

.detail-copyright {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}

.detail-copyright span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* === Original Description (YouTube) === */
.detail-original-description {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.detail-original-description-body {
    font-size: 0.825rem;
    color: var(--text-secondary);
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 8em;
    overflow: hidden;
    position: relative;
}

.detail-original-description-body:not(.expanded)::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3em;
    background: linear-gradient(transparent, var(--card-bg));
    pointer-events: none;
}

.detail-original-description-body.expanded {
    max-height: none;
    overflow: visible;
}

.detail-original-description-body.expanded::after {
    display: none;
}

.detail-original-description-body a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
}

.detail-original-description-body a:hover {
    text-decoration-style: solid;
}

/* URL text is selectable for easy copy */
.detail-original-description-body {
    user-select: text;
    -webkit-user-select: text;
}

.detail-original-description-more {
    display: block;
    margin-top: 0.5rem;
}

/* === External Link Confirmation Modal === */
.external-link-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.5); /* design-allow: color-literal */
    display: flex;
    align-items: center;
    justify-content: center;
}

.external-link-modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 1.5rem;
    max-width: 480px;
    width: 90%;
    text-align: center;
}

.external-link-modal-content p {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.external-link-url {
    font-size: 0.8rem;
    color: var(--text-muted);
    word-break: break-all;
    background: var(--body-bg);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
}

.external-link-dont-ask {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    margin-top: 0.75rem;
}

.external-link-dont-ask input {
    accent-color: var(--accent);
}

.external-link-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.25rem;
}

.external-link-modal-actions .btn-secondary {
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
}

.external-link-modal-actions .btn-primary {
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 6px;
    background: var(--accent);
    color: var(--text-on-accent);
    font-size: 0.85rem;
    cursor: pointer;
}

.external-link-modal-actions .btn-primary:hover {
    filter: brightness(1.1);
}

/* === Recommend Section === */
.detail-recommend {
    margin-bottom: 2rem;
}

.recommend-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

/* === Responsive === */
@media (max-width: 900px) {
    .detail-hero {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .detail-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .detail-cta-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .recommend-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* === Sticky CTA Bar (Mobile) === */
.detail-sticky-cta {
    display: none;
}

@media (max-width: 640px) {
    .detail-sticky-cta {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1061; /* Above cookie-consent-banner (1060) */
        padding: 0.625rem 1rem;
        background: var(--card-bg);
        border-top: 1px solid var(--border-color);
        box-shadow: var(--player-menu-shadow);
        gap: 0.5rem;
        align-items: center;
    }

    .detail-sticky-cta-btn {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
        border-radius: 8px;
        background: var(--accent);
        color: var(--text-on-accent);
        font-size: 0.9rem;
        font-weight: 700;
        border: none;
        cursor: pointer;
        transition: filter 0.2s;
    }

    .detail-sticky-cta-btn:hover {
        filter: brightness(1.1);
    }

    .detail-sticky-cta-btn i {
        font-size: 1.1rem;
    }

    .detail-sticky-cta-secondary {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: 8px;
        border: 1px solid var(--border-color);
        background: var(--card-bg);
        color: var(--text-secondary);
        font-size: 1.1rem;
        cursor: pointer;
        flex-shrink: 0;
    }

    /* Bottom padding to prevent content from being hidden behind sticky bar */
    .detail-container {
        padding-bottom: 5rem;
    }

    /* プレイヤーオーバーレイ表示中は sticky CTA を隠す（うたたっぷ等のモード起動中に下部CTA が被るのを防止） */
    .player-overlay.active ~ .detail-sticky-cta {
        display: none;
    }
}

@media (max-width: 640px) {
    .detail-container {
        padding: 0 0 5rem;
    }

    .detail-title {
        font-size: 1.25rem;
    }

    /* Thumbnail max-height to ensure CTA is in first view */
    .detail-thumbnail-wrapper {
        max-height: 200px;
    }

    .detail-thumbnail-wrapper img {
        object-fit: cover;
    }

    /* Description: line-clamp for initial state */
    .detail-description-text {
        display: -webkit-box;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .detail-description-text.expanded {
        display: block;
        -webkit-line-clamp: unset;
        line-clamp: unset;
        overflow: visible;
    }

    /* Mobile: reorder hero content so CTA is reachable faster */
    .detail-hero {
        display: flex;
        flex-direction: column;
    }

    .detail-info {
        order: 1;
    }

    .detail-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }

    .detail-stat-card {
        padding: 0.5rem;
    }

    .detail-stat-value {
        font-size: 1rem;
    }

    /* Mobile CTA: equal-size stacked buttons */
    .detail-cta-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .detail-progress-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .recommend-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .creator-works-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ranking-row {
        grid-template-columns: 32px 1fr 65px 50px 32px;
        font-size: 0.75rem;
        padding: 0.4rem 0.75rem;
    }
    .ranking-row-utatap {
        grid-template-columns: 32px 1fr 65px 28px 40px;
    }

    /* Original description: smaller max-height on mobile */
    .detail-original-description-body {
        max-height: 6em;
        font-size: 0.8rem;
    }

    .detail-original-description {
        padding: 1rem;
    }

    /* External link modal: full-width on mobile */
    .external-link-modal-content {
        width: 95%;
        padding: 1.25rem;
    }
}

/* === Player Overlay (shown after clicking start) === */
.player-overlay {
    position: fixed;
    top: var(--topbar-height);
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    z-index: 1025;
    background: var(--body-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

body.sidebar-collapsed .player-overlay {
    left: 0;
}

@media (max-width: 991.98px) {
    .player-overlay {
        left: 0;
    }
}

.player-overlay.active {
    opacity: 1;
    visibility: visible;
}

.player-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--player-surface);
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.player-close-btn:hover {
    background: var(--player-hover);
    border-color: rgba(var(--accent-rgb), 0.4);
    color: var(--text-primary);
}

.player-loading {
    color: var(--text-primary);
    text-align: center;
}

.player-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--player-spinner-track);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.player-loading-text {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.player-loading-mode {
    font-size: 1.15rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

/* === Like & Share Actions === */
.pub-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  margin: 0.5rem 0;
  flex-wrap: wrap;
}

.pub-like-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-default);
  border-radius: 2rem;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.pub-like-btn:hover:not(:disabled) {
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.pub-like-btn.liked {
  border-color: var(--color-danger);
  color: var(--color-danger);
  background: rgba(var(--color-danger-rgb), 0.08);
}

.pub-like-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.pub-like-btn i {
  font-size: 1.1rem;
}

/* === 学習系の曲の「単語帳で覚える」導線 (計画書 197 Phase 2) ===
   対応する単語帳がある曲にだけ出る。カバーは vocabulary_cover.css 側が描く。 */
.detail-vocab-decks {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.detail-vocab-decks__lead {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin: 0 0 0.85rem;
}

.detail-vocab-decks__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    /* ⚠️ 実データは 1 テーマ 1 冊が基本。auto-fill + 1fr だと 1 枚のとき
       220px の小さなカードが左端にぽつんと残るので、上限付きで伸ばす */
    grid-template-columns: repeat(auto-fill, minmax(240px, 340px));
    gap: 0.75rem;
}

.detail-vocab-decks__link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    text-decoration: none;
    color: var(--text-primary);
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.detail-vocab-decks__link:hover,
.detail-vocab-decks__link:focus-visible {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), 0.06);
}

/* ⚠️ .vcover は width:100% + aspect-ratio:16/9（縦積みの一覧カード向け）なので、
   横並びのこのカードに置くと flex で伸びてカードの 6 割を占める（実画面で確認）。
   幅を固定して伸縮も止める。高さは aspect-ratio が保つのでシフトしない。 */
.detail-vocab-decks .vcover {
    flex: 0 0 auto;
    width: 72px;
    border-radius: calc(var(--card-radius) / 2);
}

.detail-vocab-decks__body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.detail-vocab-decks__title {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.detail-vocab-decks__meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* SP では上限を外して幅いっぱいに使う（340px 上限のままだと右に余白が残る） */
@media (max-width: 640px) {
    .detail-vocab-decks__list {
        grid-template-columns: 1fr;
    }
}
/* lyrics_scroll.css */
/* ===================================================
   Lyrics Scroll Mode - YouTube sync lyrics viewer
   Theme-aware: uses CSS variables for all colors
   =================================================== */

/* --- Body scroll lock when overlay is open --- */
body.overlay-open {
    overflow: hidden;
}

/* --- Main Container --- */
.lyrics-scroll {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 720px;
    height: 100%;
    margin: 0 auto;
    position: relative;
}

/* --- YouTube Player --- */
.lyrics-scroll-player-wrap {
    flex-shrink: 0;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000; /* design-allow: color-literal */ /* 動画プレイヤー枠の固定黒背景 */
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.lyrics-scroll-player-wrap iframe {
    width: 100%;
    height: 100%;
}

/* Player size variants */
.lyrics-scroll-player-wrap.player-medium {
    width: 50%;
    aspect-ratio: 16 / 9;
    margin: 0 auto;
}

.lyrics-scroll-player-wrap.player-small {
    width: 30%;
    aspect-ratio: 16 / 9;
    margin: 0 auto;
}

.lyrics-scroll-player-wrap.player-audio {
    width: 0;
    height: 0;
    overflow: hidden;
    position: absolute;
    pointer-events: none;
}

.lyrics-scroll-player-wrap.player-none {
    display: none;
}

/* --- Controls Bar --- */
.lyrics-scroll-controls {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: var(--player-surface);
    border-bottom: 1px solid var(--player-border);
    user-select: none;
    -webkit-user-select: none;
}

.lyrics-scroll-controls-left {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.lyrics-scroll-controls-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lyrics-scroll-ctrl-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.lyrics-scroll-ctrl-btn:hover {
    background: var(--player-hover);
    color: var(--text-primary);
}

.lyrics-scroll-play-btn {
    width: 48px;
    height: 48px;
    font-size: 1.4rem;
    background: var(--player-surface);
}

.lyrics-scroll-play-btn:hover {
    background: var(--player-surface-strong);
}

.lyrics-scroll-kana-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.lyrics-scroll-kana-btn i {
    font-size: 0.9rem;
}

.lyrics-scroll-kana-btn:hover {
    border-color: rgba(var(--accent-rgb), 0.4);
    color: var(--text-primary);
}

/* ⚠️ 操作バー（--player-surface）の上では accent 文字が light-sakana で 4.2 前後まで落ちる。
   .flash と同じく地だけ accent の tint にして、文字は本文段へ上げる（7.54） */
.lyrics-scroll-kana-btn.active {
    background: rgba(var(--accent-rgb), 0.1);
    border-color: rgba(var(--accent-rgb), 0.5);
    color: var(--text-primary);
}

/* --- Speed Button --- */
.lyrics-scroll-speed-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 42px;
}

.lyrics-scroll-speed-btn:hover {
    border-color: rgba(var(--accent-rgb), 0.4);
    color: var(--text-primary);
}

.lyrics-scroll-speed-btn.active {
    background: rgba(var(--accent-rgb), 0.08);
    border-color: rgba(var(--accent-rgb), 0.4);
    color: var(--text-primary); /* ⚠️ accent 文字は操作バー面で 4.26（light-sakana）*/
}

/* ⚠️ フラッシュは 300ms の一瞬（lyrics_scroll_controller.js:184）だが、accent の 20% tint に
   accent を重ねると light-sakana で 3.59 まで落ちる。地だけ光らせ、文字は本文段に上げる */
.lyrics-scroll-speed-btn.flash {
    background: rgba(var(--accent-rgb), 0.2);
    color: var(--text-primary);
    transform: scale(1.1);
}

/* --- Repeat Button --- */
.lyrics-scroll-repeat-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.375rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.lyrics-scroll-repeat-btn i {
    font-size: 0.85rem;
}

.lyrics-scroll-repeat-btn:hover {
    border-color: rgba(var(--accent-rgb), 0.4);
    color: var(--text-primary);
}

/* AB Repeat の ON 状態。⚠️ 固定青 #64b4ff は .player-overlay(= --body-bg) の
   テーマ追従面に載るので light テーマで 1.54 だった。機能識別色は --color-info に載せる
   （tint は .08 まで = 実面である --player-surface 越しの --body-bg で 4.51。.12 だと 4.28）。
   計画書 182 Phase 3-3 */
.lyrics-scroll-repeat-btn.active {
    background: rgba(var(--color-info-rgb), 0.08);
    border-color: var(--color-info);
    color: var(--color-info);
}

/* --- Video Size Button & Dropdown --- */
.lyrics-scroll-video-size-wrap {
    position: relative;
}

.lyrics-scroll-video-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.375rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.lyrics-scroll-video-btn i {
    font-size: 0.85rem;
}

.lyrics-scroll-video-btn:hover,
.lyrics-scroll-video-btn[aria-expanded="true"] {
    border-color: rgba(var(--accent-rgb), 0.4);
    color: var(--text-primary);
}

.lyrics-scroll-video-size-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    display: flex;
    flex-direction: column;
    background: var(--player-menu-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    z-index: 100;
    min-width: 70px;
    box-shadow: var(--player-menu-shadow);
}

.video-size-option {
    padding: 0.5rem 0.85rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-align: center;
    white-space: nowrap;
}

.video-size-option:hover {
    background: var(--player-hover);
    color: var(--text-primary);
}

/* 選択中の項目。地は .lyrics-scroll-video-size-menu(= --player-menu-bg) でほぼ不透明なので
   同系 tint を残せる（--color-info で 5.52）。固定青 #64b4ff は light テーマで 1.88 だった */
.video-size-option.selected {
    background: rgba(var(--color-info-rgb), 0.12);
    color: var(--color-info);
    font-weight: 600;
}

/* --- Typing Link Button --- */
.lyrics-scroll-typing-link {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid rgba(var(--accent-rgb), 0.4);
    border-radius: 20px;
    /* ⚠️ 同系色の薄い tint を地にすると accent の文字が近づく（light-sakana で 4.15）。
       地は外し、alpha 付きの色（rgba(--accent-rgb,.9) = 3.59）も素の accent に戻す */
    background: transparent;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.lyrics-scroll-typing-link i {
    font-size: 0.85rem;
}

/* ホバーは accent で塗り潰す向き（押している間の方が濃い）。tint を濃くする向きだと
   文字の accent と近づいて逆に読みにくくなる */
.lyrics-scroll-typing-link:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-on-accent);
}

/* --- Progress Bar --- */
.lyrics-scroll-progress {
    flex-shrink: 0;
    height: 4px;
    background: var(--player-surface);
    cursor: pointer;
    position: relative;
    /* タップ領域を広げる（視覚的な高さは変えない） */
    padding: 8px 0;
    margin: -8px 0;
    background-clip: content-box;
    -webkit-touch-callout: none;
}

.lyrics-scroll-progress:hover .lyrics-scroll-progress-fill {
    transform: scaleY(1.5);
}

.lyrics-scroll-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
    transition: width 0.1s linear;
    transform-origin: bottom;
    pointer-events: none;
}

/* --- AB Repeat: Setting Mode (waiting for A or B click) --- */
.lyrics-scroll.repeat-setting .lyrics-line {
    cursor: crosshair;
}

/* AB Repeat の hover / A・B マーカー / 範囲ハイライト。
   ⚠️ .lyrics-scroll-area は面を持たず .player-overlay(= --body-bg) の**テーマ追従**面なので、
   固定青では light テーマで沈む（A/B マーカーの文字が 1.88 だった）。
   .lyrics-scroll-repeat-btn.active と同じ --color-info に揃える（計画書 182 Phase 3-3） */
.lyrics-scroll.repeat-setting .lyrics-line:hover {
    background: rgba(var(--color-info-rgb), 0.1);
    border-left-color: rgba(var(--color-info-rgb), 0.5);
}

/* --- AB Repeat Range Highlight --- */
/* :hover (0,3,0) より優先するため .lyrics-scroll を前置して詳細度を上げる */
.lyrics-scroll .lyrics-line.repeat-range {
    background: rgba(var(--color-info-rgb), 0.06);
}

.lyrics-scroll .lyrics-line.repeat-a,
.lyrics-scroll .lyrics-line.repeat-b {
    border-left-color: var(--color-info);
}

.lyrics-line.repeat-a .lyrics-line-text::before,
.lyrics-line.repeat-b .lyrics-line-text::before {
    display: inline-block;
    width: 1.2em;
    margin-right: 0.25em;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--color-info);
    vertical-align: middle;
}

.lyrics-line.repeat-a .lyrics-line-text::before {
    content: "A";
}

.lyrics-line.repeat-b .lyrics-line-text::before {
    content: "B";
}

/* Repeat range lines: override past opacity so range stays visible */
.lyrics-line.repeat-range.past {
    opacity: 0.55;
}

/* --- Lyrics Area --- */
.lyrics-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 0 1.5rem;

    /* 歌詞テキストの選択・コピー禁止 */
    -webkit-user-select: none;
    user-select: none;

    /* Scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: var(--player-scrollbar) transparent;
}

.lyrics-scroll-area::-webkit-scrollbar {
    width: 6px;
}

.lyrics-scroll-area::-webkit-scrollbar-track {
    background: transparent;
}

.lyrics-scroll-area::-webkit-scrollbar-thumb {
    background: var(--player-scrollbar);
    border-radius: 3px;
}

.lyrics-scroll-area::-webkit-scrollbar-thumb:hover {
    background: var(--player-scrollbar-hover);
}

/* Spacers allow first/last lines to be centered */
.lyrics-scroll-spacer {
    height: 35vh;
}

/* --- Lyrics Lines --- */
.lyrics-line {
    padding: 0.625rem 1rem;
    margin: 0.125rem 0;
    border-radius: 8px;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: opacity 0.4s ease, border-color 0.3s ease, background 0.3s ease,
                transform 0.3s ease, padding-left 0.3s ease;
    opacity: 0.75;
}

.lyrics-line:hover {
    background: var(--player-surface);
}

/* Tap feedback (press feel) */
.lyrics-line:active {
    transform: scale(0.98);
    transition-duration: 0.05s;
}

/* Past lines */
.lyrics-line.past {
    opacity: 0.4;
}

/* Current line */
.lyrics-line.current {
    opacity: 1;
    border-left-color: var(--accent);
    background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.1) 0%, transparent 60%);
    padding-left: 1.25rem;
    transform: scale(1.02);
}

.lyrics-line.current .lyrics-line-text {
    font-weight: 700;
    font-size: 1.2em;
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(var(--accent-rgb), 0.3);
}

/* Upcoming lines */
.lyrics-line.upcoming {
    opacity: 0.75;
}

/* Line text */
.lyrics-line-text {
    font-size: 1.05rem;
    line-height: 1.5;
    color: var(--text-primary);
    transition: font-size 0.3s ease, font-weight 0.3s ease, color 0.3s ease;
}

/* Kana sub-line */
.lyrics-line-kana {
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--text-muted);
    margin-top: 0.125rem;
    letter-spacing: 0.02em;
}

.lyrics-line.current .lyrics-line-kana {
    color: var(--text-secondary);
}

/* --- Return to Current Button --- */
.lyrics-scroll-return-btn {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: var(--player-float-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    box-shadow: var(--player-float-shadow);
}

.lyrics-scroll-return-btn:hover {
    background: var(--player-surface-strong);
    border-color: rgba(var(--accent-rgb), 0.3);
    color: var(--text-primary);
}

/* --- Loading State --- */
.lyrics-scroll-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
}

.lyrics-scroll-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--player-spinner-track);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* --- Empty State --- */
.lyrics-scroll-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* --- 動画エラー表示 --- */
.lyrics-scroll-video-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem 1rem;
    text-align: center;
}

.lyrics-scroll-video-error i {
    font-size: 2rem;
    color: var(--color-warning);
}

.lyrics-scroll-video-error p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* === Responsive === */
@media (max-width: 640px) {
    .lyrics-scroll {
        max-width: 100%;
    }

    .lyrics-scroll-player-wrap {
        border-radius: 0;
    }

    .lyrics-scroll-controls {
        padding: 0.375rem 0.75rem;
    }

    .lyrics-scroll-ctrl-btn {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }

    .lyrics-scroll-play-btn {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }

    .lyrics-scroll-area {
        padding: 0 1rem;
    }

    .lyrics-line {
        padding: 0.5rem 0.75rem;
    }

    .lyrics-line-text {
        font-size: 0.95rem;
    }

    .lyrics-line.current .lyrics-line-text {
        font-size: 1.1em;
    }

    .lyrics-scroll-return-btn {
        bottom: 1rem;
        font-size: 0.75rem;
        padding: 0.4rem 1rem;
    }

    .lyrics-scroll-speed-btn {
        font-size: 0.7rem;
        min-width: 38px;
        min-height: 44px;
        padding: 0 0.4rem;
    }

    .lyrics-scroll-repeat-btn,
    .lyrics-scroll-kana-btn,
    .lyrics-scroll-video-btn,
    .lyrics-scroll-typing-link {
        font-size: 0.7rem;
        min-height: 44px;
        padding: 0 0.5rem;
        gap: 0.25rem;
    }

    .lyrics-scroll-typing-link span,
    .lyrics-scroll-repeat-btn span,
    .lyrics-scroll-kana-btn span,
    .lyrics-scroll-video-btn span {
        display: none;
    }

    .lyrics-scroll-spacer {
        height: 15vh; /* 35vh → 15vh: reduces ~233px to ~100px on iPhone SE */
    }
}
/* typing_replay.css */
/* ===================================================
   Typing Replay Mode - Keystroke replay viewer
   旧プレイヤー(userscript_rtcombat)の配色を踏襲した画面だが、
   親の .player-overlay は --body-bg のテーマ追従面なので、
   判定色（正解 / ミス / ライン完了）は --color-info / --color-danger / --color-success に載せた。
   固定色を残すのは自前で暗面を敷く .typing-replay-summary の中だけ。
   =================================================== */

/* --- Main Container --- */
.typing-replay {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 720px;
    height: 100%;
    margin: 0 auto;
    position: relative;
}

/* --- YouTube Player --- */
.typing-replay-player-wrap {
    flex-shrink: 0;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000; /* design-allow: color-literal */
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.typing-replay-player-wrap iframe {
    width: 100%;
    height: 100%;
}

/* --- Controls Bar --- */
.typing-replay-controls {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: var(--player-surface);
    border-bottom: 1px solid var(--player-border);
    user-select: none;
    -webkit-user-select: none;
}

.typing-replay-controls-left {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.typing-replay-controls-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.typing-replay-ctrl-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.typing-replay-ctrl-btn:hover {
    background: var(--player-hover);
    color: var(--text-primary);
}

.typing-replay-play-btn {
    width: 48px;
    height: 48px;
    font-size: 1.4rem;
    background: var(--player-surface);
}

.typing-replay-play-btn:hover {
    background: var(--player-surface-strong);
}

/* --- Speed Button --- */
.typing-replay-speed-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 42px;
}

.typing-replay-speed-btn:hover {
    border-color: rgba(var(--accent-rgb), 0.4);
    color: var(--text-primary);
}

.typing-replay-speed-btn.active {
    background: rgba(var(--accent-rgb), 0.08);
    border-color: rgba(var(--accent-rgb), 0.4);
    color: var(--text-primary); /* ⚠️ accent 文字は操作バー面で 4.26（light-sakana）*/
}

/* ⚠️ lyrics_scroll と同型。地だけ光らせ、文字は本文段に上げる（accent on 20% tint = 3.59） */
.typing-replay-speed-btn.flash {
    background: rgba(var(--accent-rgb), 0.2);
    color: var(--text-primary);
    transform: scale(1.1);
}

/* --- Time Display --- */
.typing-replay-time {
    font-family: "Courier New", monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

/* --- Typing Link Button --- */
.typing-replay-typing-link {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid rgba(var(--accent-rgb), 0.4);
    border-radius: 20px;
    /* lyrics_scroll と同型。同系 tint を外し、alpha 付きの色も素の accent に戻す */
    background: transparent;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.typing-replay-typing-link i {
    font-size: 0.85rem;
}

.typing-replay-typing-link:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-on-accent);
}

/* --- Progress Bar --- */
.typing-replay-progress {
    flex-shrink: 0;
    height: 4px;
    background: var(--player-surface);
    cursor: pointer;
    position: relative;
    padding: 8px 0;
    margin: -8px 0;
    background-clip: content-box;
    -webkit-touch-callout: none;
}

.typing-replay-progress:hover .typing-replay-progress-fill {
    transform: scaleY(1.5);
}

.typing-replay-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
    transition: width 0.1s linear;
    transform-origin: bottom;
    pointer-events: none;
}

/* === Replay Info Bar: 旧システム準拠 2行×4列グリッド === */
.typing-replay-info {
    flex-shrink: 0;
    border-bottom: 1px solid var(--player-border);
}

.typing-replay-info-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 1rem 0.25rem;
    border-bottom: 1px solid var(--player-surface);
}

.typing-replay-info-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Input Mode Badge */
.typing-replay-info-mode {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    /* .typing-replay-info は面を持たないので地は .player-overlay = --body-bg。
       同系 tint .15 + alpha 付き accent で 3.62 だった → tint を薄め、色は素の accent（4.65） */
    background: rgba(var(--accent-rgb), 0.08);
    color: var(--accent);
    letter-spacing: 0.03em;
}

/* 2行×4列 Stats Grid */
.typing-replay-info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.typing-replay-info-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.25rem 0;
    border-right: 1px solid var(--player-surface);
}

.typing-replay-info-cell:nth-child(4n) {
    border-right: none;
}

/* Row 2 separator */
.typing-replay-info-cell:nth-child(n+5) {
    border-top: 1px solid var(--player-surface);
}

.typing-replay-info-cell-label {
    font-size: 0.55rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
}

.typing-replay-info-cell-value {
    font-family: "Courier New", monospace;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

/* === Typing Zone: ターゲットテキスト＋入力再現＋歌詞 === */
.typing-replay-typing-zone {
    flex: 1;
}

/* === Target Text: ソロプレイ準拠 3分割表示 === */
.typing-replay-target-text {
    min-height: 1.6em;
    padding: 0.5rem 1rem 0.25rem;
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    line-height: 1.6;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
}

.typing-replay-target-text:empty {
    display: none;
}

/* design-allow-start: color-literal */
/* リプレイ画面は旧プレイヤー (userscript_rtcombat) のダーク前提固定配色を踏襲。テーマ非依存の機能識別色 (typed=青/miss=赤/clear=緑) と暗背景 + 半透明白文字のレイアウト */

/* 入力済み文字: 旧システム correct-word-color #0099CC */
.target-typed {
    color: var(--color-info);
}

/* 次の入力文字: 太字＋下線（ソロプレイ準拠） */
.target-next {
    color: var(--text-primary);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    position: relative;
}

/* 残りの文字: 半透明（旧 word-color） */
.target-remaining {
    color: var(--text-muted);
}

/* === Input Replay Area === */
.typing-replay-input-area {
    min-height: 2.5rem;
    max-height: 5rem;
    padding: 0.375rem 1rem 0.5rem;
    font-family: "Courier New", monospace;
    font-size: 1.1rem;
    line-height: 1.6;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    transition: opacity 0.15s ease;
}

/* Line fade transition (G5) */
.typing-replay-input-area.line-fade {
    opacity: 0.3;
}

/* Miss flash effect (G4) */
.typing-replay-input-area.miss-flash {
    background: rgba(212, 131, 106, 0.08);
}

/* Line complete flash (GD-2: 旧システム #1eff52 緑) */
.typing-replay-typing-zone.line-complete-flash {
    animation: lineCompleteFlash 0.4s ease-out;
}

@keyframes lineCompleteFlash {
    0% { box-shadow: inset 3px 0 0 var(--color-success); background: rgba(var(--color-success-rgb), 0.08); }
    100% { box-shadow: inset 3px 0 0 transparent; background: transparent; }
}

/* Character coloring: 旧システム配色 */
.replay-char-correct {
    color: var(--color-info);
}

.replay-char-miss {
    color: var(--color-danger);
    text-decoration: underline wavy var(--color-danger);
}

/* ライン完了文字 (将来の拡張用) */
.replay-char-complete {
    color: var(--color-success);
}

/* === Lyric Display (ソロプレイ準拠: 現在行 + 次行) === */
.typing-replay-lyric {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 0.75rem 0 0.25rem;
    padding: 0 1rem;
    font-weight: 500;
    min-height: 1.6em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.typing-replay-next-lyric {
    font-size: 0.82rem;
    color: var(--text-muted);
    padding: 0 1rem;
    min-height: 1.6em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === Replay Score Animation === */
.typing-replay-score-current {
    font-family: "Courier New", monospace;
    font-weight: 700;
}

.typing-replay-score-current.score-up {
    color: var(--color-info);
}

.typing-replay-score-current.score-down {
    color: var(--color-danger);
}

/* Combo highlight */
.typing-replay-info-cell-value.combo-active {
    color: var(--color-info);
    text-shadow: 0 0 8px rgba(var(--color-info-rgb), 0.4);
}

/* === End Summary Overlay (G3) === */
.typing-replay-summary {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    /* ⚠️ 中身（成績・ボタン・広告の箱 280px。計画 251 §2-3-4）が器より高い画面では、上から並べてスクロールさせる。
       ただの center だと上下が切れ、切れた上側はスクロールでも戻れない。safe 非対応のブラウザは上の center のまま */
    align-items: safe center;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.4s ease;
}

.typing-replay-summary-inner {
    text-align: center;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
}

.typing-replay-summary-title {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
}

.typing-replay-summary-player {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.25rem;
}

/* ⚠️ summary は rgba(0,0,0,.85) の暗面。light テーマの --accent（濃色）をそのまま置くと
   1.26 まで沈むので、.battle-play-page と同じく light 5 テーマだけ明度を上げた accent に差し替える。
   さらに alpha .8 を掛けると暗面に沈むので alpha は外す。
   ⚠️ 2026-08-20: 旧値（L 43〜64%）は**監査が面を二重に暗くしていた**ときに選んだもので、
   実際の面では .typing-replay-summary-typing-btn（自前で accent 15% の地を敷く）が 3.58〜3.67 だった。
   色相・彩度は据え置きで明度だけ +10pt 上げて 4.76 以上に（計画書 182 Phase 6）。 */
[data-theme="light-classic"] .typing-replay-summary { --accent: #ea8b8b; --accent-rgb: 234,139,139; }
[data-theme="light-slate"] .typing-replay-summary { --accent: #88a8d6; --accent-rgb: 136,168,214; }
[data-theme="light-sakana"] .typing-replay-summary { --accent: #db958a; --accent-rgb: 219,149,138; }
[data-theme="light-botanical"] .typing-replay-summary { --accent: #53ba6a; --accent-rgb: 83,186,106; }
[data-theme="light-shell"] .typing-replay-summary { --accent: #94a8c3; --accent-rgb: 148,168,195; }
/* ⚠️ accent を借り物に差し替えたら --text-on-accent も対で差し替える。light の #fff を
   明度を上げた accent の上に置くと 3.38 まで落ちる（計画書 182 Phase 3-4）。#1a1a1a なら 5.05 */
[data-theme="light-classic"] .typing-replay-summary,
[data-theme="light-slate"] .typing-replay-summary,
[data-theme="light-sakana"] .typing-replay-summary,
[data-theme="light-botanical"] .typing-replay-summary,
[data-theme="light-shell"] .typing-replay-summary { --text-on-accent: #1a1a1a; }

.typing-replay-summary-mode {
    font-size: 0.75rem;
    color: var(--accent);
    margin-bottom: 1rem;
}

.typing-replay-summary-score {
    font-family: "Courier New", monospace;
    font-size: 2.5rem;
    font-weight: 700;
    color: #0099CC;
    margin-bottom: 1.5rem;
}

.typing-replay-summary-score small {
    font-size: 0.5em;
    color: rgba(255, 255, 255, 0.5);
}

.typing-replay-summary-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.typing-replay-summary-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.typing-replay-summary-stat-value {
    font-family: "Courier New", monospace;
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
}

.typing-replay-summary-stat-label {
    font-size: 0.65rem;
    /* alpha .45 では 4.44 で AA を割る（暗面に白を薄く重ねる形は alpha がそのまま効く） */
    color: rgba(255, 255, 255, 0.6);
}

.typing-replay-summary-typing-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid rgba(var(--accent-rgb), 0.5);
    border-radius: 24px;
    background: rgba(var(--accent-rgb), 0.15);
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.typing-replay-summary-typing-btn:hover {
    background: var(--accent);
    color: var(--text-on-accent);
    border-color: var(--accent);
}

.typing-replay-summary-replay-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.75rem;
}

.typing-replay-summary-replay-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}
/* design-allow-end: color-literal */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- 動画エラー表示 --- */
.typing-replay-video-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    text-align: center;
}

.typing-replay-video-error i {
    font-size: 2rem;
    color: var(--color-warning);
}

.typing-replay-video-error p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* --- Loading / Error Overlay --- */
.typing-replay-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7); /* design-allow: color-literal */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* --- Loading State --- */
.typing-replay-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
}

.typing-replay-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--player-spinner-track);
    border-top-color: #0099CC; /* design-allow: color-literal */ /* リプレイ系の機能識別色 */
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* --- Empty State --- */
.typing-replay-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* --- Screen Reader Only --- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* === Responsive === */
@media (max-width: 640px) {
    .typing-replay {
        max-width: 100%;
    }

    .typing-replay-player-wrap {
        border-radius: 0;
    }

    .typing-replay-controls {
        padding: 0.25rem 0.5rem;
    }

    .typing-replay-ctrl-btn {
        min-width: 44px;
        min-height: 44px;
        font-size: 0.95rem;
    }

    .typing-replay-play-btn {
        width: 40px;
        height: 40px;
        font-size: 1.15rem;
    }

    .typing-replay-info-header {
        padding: 0.25rem 0.75rem 0.2rem;
    }

    .typing-replay-info-name {
        font-size: 0.75rem;
    }

    .typing-replay-info-mode {
        font-size: 0.6rem;
    }

    .typing-replay-info-cell {
        padding: 0.2rem 0;
    }

    .typing-replay-info-cell-label {
        font-size: 0.5rem;
    }

    .typing-replay-info-cell-value {
        font-size: 0.7rem;
    }

    .typing-replay-target-text {
        font-size: 1.1rem;
        padding: 0.375rem 0.75rem 0.2rem;
        min-height: 1.2rem;
    }

    .typing-replay-input-area {
        font-size: 0.95rem;
        min-height: 2rem;
        max-height: 3.5rem;
        padding: 0.25rem 0.75rem 0.375rem;
    }

    .typing-replay-lyric {
        font-size: 0.9rem;
        margin: 0.5rem 0 0.2rem;
        padding: 0 0.75rem;
    }

    .typing-replay-next-lyric {
        font-size: 0.75rem;
        padding: 0 0.75rem;
    }

    .typing-replay-speed-btn {
        font-size: 0.7rem;
        min-width: 38px;
        padding: 0.2rem 0.4rem;
    }

    .typing-replay-time {
        font-size: 0.6rem;
    }

    .typing-replay-typing-link {
        font-size: 0.7rem;
        padding: 0.3rem 0.5rem;
        gap: 0.25rem;
    }

    .typing-replay-typing-link span {
        display: none;
    }

    /* Summary responsive */
    .typing-replay-summary-score {
        font-size: 1.8rem;
    }

    .typing-replay-summary-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .typing-replay-summary-stat-value {
        font-size: 1.1rem;
    }

    .typing-replay-summary-typing-btn {
        font-size: 0.8rem;
        padding: 0.6rem 1.2rem;
    }
}
/* area_tap.css */
/* ========================================
   うたたっぷ (Area Tap) ゲームCSS
   ゲーム画面は常にダーク配色（テーマ非依存）
   ======================================== */
/* design-allow-start: color-literal */
/* ゲーム画面はダーク前提固定配色。--at-* ローカル変数 + 半透明白文字レイアウト + 判定色（PERFECT 金/GREAT 緑/GOOD 青/MISS 赤）はテーマに依存しない */

/* --- ゲーム専用カラー変数 --- */
.area-tap {
  --at-bg: #0a0a0f;
  --at-bg2: #14141f;
  --at-bg3: #1a1a2e;
  --at-text: #e0e0e0;
  --at-text2: #888;
  --at-text3: #777;
  --at-text-secondary: var(--at-text2);
  --at-accent: #7c6aef;
  --at-accent2: #f0a030;
  /* 用途: accent を「地」に敷くボタン用。--at-accent は中間の明るさで #fff が 4.07 しか出ない
     （文字色として暗面に置く用途では 4.86 で足りているので --at-accent 自体は動かさない）。
     既定 5.02 → hover 5.96 と、押す前より押している間が濃くなる向きを保つ */
  --at-accent-strong: #6b56ed;
  --at-accent-hover: #5f4ade;
  --at-border: #2a2a3a;
  --at-danger: #ff3554;
  --at-success: #1eb450;
  /* 用途: タップゾーングリッドの行列数。難易度に応じて JS から style.setProperty() で上書きされる */
  --zone-cols: 2;
  --zone-rows: 3;
}

/* --- コンテナ --- */
.area-tap {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 720px;
  height: 100%;
  margin: 0 auto;
  position: relative;
  background: var(--at-bg);
  color: var(--at-text);
  overflow: hidden;
}

/* --- YouTube Player --- */
.area-tap-player-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  background: #000;
  flex-shrink: 0;
  overflow: hidden;
}

.area-tap-player-wrap > div {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.area-tap-player-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Player size variants */
.area-tap-player-wrap.player-medium {
  width: 50%;
  padding-bottom: 28.125%; /* 56.25% * 0.5 */
  margin: 0 auto;
}

.area-tap-player-wrap.player-small {
  width: 30%;
  padding-bottom: 16.875%; /* 56.25% * 0.3 */
  margin: 0 auto;
}

.area-tap-player-wrap.player-none {
  display: none;
}

/* --- 開始画面サムネイル --- */
.area-tap-start-thumb {
  width: 100%;
  max-width: 280px;
}

.area-tap-start-thumb img {
  width: 100%;
  border-radius: 8px;
  display: block;
}

/* --- ステータスバー --- */
.area-tap-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--at-bg2);
  border-bottom: 1px solid var(--at-border);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  min-height: 44px;
}

.area-tap-status-score {
  color: var(--at-accent);
  font-variant-numeric: tabular-nums;
}

.area-tap-status-combo {
  color: var(--at-accent2);
  font-variant-numeric: tabular-nums;
}

.area-tap-status-miss {
  color: var(--at-danger);
  font-variant-numeric: tabular-nums;
}

.area-tap-status-line {
  color: var(--at-text2);
  font-variant-numeric: tabular-nums;
}

/* --- ガイドテキスト --- */
.area-tap-guide {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  background: var(--at-bg2);
  border-bottom: 1px solid var(--at-border);
  font-size: 14px;
  min-height: 44px;
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
}

.area-tap-guide-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.area-tap-guide-text .done {
  color: var(--at-text2);
}

.area-tap-guide-text .current {
  color: var(--at-accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.area-tap-guide-text .remaining {
  color: var(--at-text);
}

.area-tap-guide-text .skip-prompt {
  color: var(--at-accent);
  font-weight: 600;
  animation: skip-prompt-blink 1.2s ease-in-out infinite;
}

@keyframes skip-prompt-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* --- プログレスバー --- */
.area-tap-progress {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.area-tap-progress-line,
.area-tap-progress-song {
  width: 100%;
  height: 3px;
  background: var(--at-bg3);
  overflow: hidden;
}

.area-tap-progress-line-fill,
.area-tap-progress-song-fill {
  height: 100%;
  width: 0%;
  transition: width 0.15s ease;
}

.area-tap-progress-line-fill {
  background: var(--at-accent);
}

.area-tap-progress-song-fill {
  background: var(--at-text2);
}

/* --- ゲームアリーナ --- */
.area-tap-arena {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(var(--zone-cols), 1fr);
  grid-template-rows: repeat(var(--zone-rows), 1fr);
  gap: 1px;
  background: var(--at-border);
  touch-action: manipulation;
  -webkit-touch-callout: none;
  user-select: none;
  min-height: 0;
}

/* --- 一時停止オーバーレイ --- */
.area-tap-pause-overlay {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  background: var(--at-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  color: var(--at-text3); /* design-allow: contrast-context — 48px の大文字。4.41 ≥ 3:1 */
  font-size: 48px;
}

/* --- ゾーン --- */
.area-tap-zone {
  position: relative;
  background: var(--at-bg);
  overflow: hidden;
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.area-tap-zone:active {
  background: var(--at-bg2);
}

/* ゾーン番号ラベル（薄く表示） */
.area-tap-zone-label {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 11px;
  /* ⚠️ --at-text3 は 24px 以上の大きい文字（3:1）向け。11px は 4.5 が要るので --at-text2 */
  color: var(--at-text2);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

/* --- 断片テキスト --- */
.area-tap-fragment {
  position: absolute;
  padding: 0.13em 0.4em;
  border-radius: 0.25em;
  font-size: 15px;
  font-weight: 600;
  color: var(--at-text);
  background: rgba(124, 106, 239, 0.15);
  border: clamp(1px, 0.06em, 4px) solid rgba(124, 106, 239, 0.3);
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100% - 8px);
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.area-tap-fragment.collected {
  opacity: 0;
  transform: scale(0.8) translateY(-0.6em);
}

/* --- タップフィードバック --- */
.area-tap-zone.flash-correct {
  animation: zone-correct 0.2s ease;
}

.area-tap-zone.flash-combo {
  animation: zone-combo 0.15s ease;
}

.area-tap-zone.flash-miss {
  animation: zone-miss 0.3s ease;
}

.area-tap-zone.flash-hint {
  animation: zone-hint 0.4s ease;
}

@keyframes zone-correct {
  0%   { background: rgba(30, 180, 80, 0.4); }
  100% { background: var(--at-bg); }
}

@keyframes zone-combo {
  0%   { background: rgba(30, 200, 80, 0.6); }
  50%  { background: rgba(240, 160, 48, 0.4); }
  100% { background: var(--at-bg); }
}

@keyframes zone-miss {
  0%, 20%, 40% { background: rgba(212, 131, 106, 0.2); transform: translateX(3px); }
  10%, 30%     { transform: translateX(-3px); }
  50%          { transform: translateX(0); }
  100%         { background: var(--at-bg); }
}

@keyframes zone-hint {
  0%   { box-shadow: inset 0 0 0 2px rgba(240, 200, 40, 0.8); }
  100% { box-shadow: inset 0 0 0 2px transparent; }
}

/* --- ライン完成演出 --- */
.area-tap-line-complete {
  animation: line-flash 0.5s ease;
}

@keyframes line-flash {
  0%   { background: rgba(124, 106, 239, 0.2); }
  50%  { background: rgba(124, 106, 239, 0.05); }
  100% { background: var(--at-bg); }
}

/* --- コンボポップアップ --- */
.area-tap-combo-popup {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  font-weight: 900;
  color: var(--at-accent2);
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  z-index: 100;
}

.area-tap-combo-popup.show {
  animation: combo-pop 0.6s ease forwards;
}

@keyframes combo-pop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  30%  { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
  60%  { transform: translate(-50%, -50%) scale(1.0); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1.0); }
}

/* --- 判定テキスト --- */
.area-tap-judgment {
  position: fixed;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  z-index: 100;
}

.area-tap-judgment.show {
  animation: judgment-pop 0.8s ease forwards;
}

.area-tap-judgment.PERFECT { color: #ffd700; }
.area-tap-judgment.GREAT   { color: #1eff52; }
.area-tap-judgment.GOOD    { color: #4fc3f7; }
.area-tap-judgment.OK      { color: #aaa; }
.area-tap-judgment.MISS    { color: #ff3554; }

@keyframes judgment-pop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  50%  { transform: translate(-50%, -50%) scale(1.0); }
  100% { opacity: 0; transform: translate(-50%, -60%); }
}

/* --- 開始前画面 --- */
.area-tap-start-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 15, 0.95);
  z-index: 50;
  padding: 24px;
  gap: 16px;
}

.area-tap-start-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--at-accent);
}

.area-tap-start-song {
  font-size: 14px;
  color: var(--at-text2);
  text-align: center;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.area-tap-start-best {
  font-size: 13px;
  color: var(--at-text2);
}

.area-tap-start-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 280px;
}

.area-tap-option-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.area-tap-option-label {
  font-size: 12px;
  color: var(--at-text2);
  font-weight: 600;
}

.area-tap-option-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.area-tap-option-btn {
  padding: 6px 12px;
  border: 1px solid var(--at-border);
  border-radius: 6px;
  background: var(--at-bg2);
  color: var(--at-text2);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.area-tap-option-btn:hover {
  border-color: var(--at-accent);
  color: var(--at-text);
}

.area-tap-option-btn.selected {
  background: var(--at-accent-strong);
  border-color: var(--at-accent-strong);
  color: #fff;
}

.area-tap-option-btn.disabled {
  opacity: 0.3;
  pointer-events: none;
  cursor: not-allowed;
}

.area-tap-start-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  background: var(--at-accent-strong);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
  width: 100%;
  max-width: 280px;
}

.area-tap-start-btn:hover {
  background: var(--at-accent-hover);
}

.area-tap-back-btn {
  padding: 10px 24px;
  border: 1px solid var(--at-border);
  border-radius: 8px;
  background: transparent;
  color: var(--at-text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
  width: 100%;
  max-width: 280px;
  margin-top: 8px;
}

.area-tap-back-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* --- 結果画面オーバーレイ --- */
.area-tap-result {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* ⚠️ 中身（結果・ボタン・広告の箱 280px。計画 251 §2-3-4）が器より高い画面では上から並べる。
     ただの center だと、はみ出した上側はスクロールでも戻れない。safe 非対応のブラウザは上の center のまま */
  justify-content: safe center;
  background: rgba(10, 10, 15, 0.95);
  z-index: 50;
  padding: 24px;
  gap: 12px;
  overflow-y: auto;
}

.area-tap-result-score {
  font-size: 40px;
  font-weight: 900;
  color: var(--at-accent);
  font-variant-numeric: tabular-nums;
}

.area-tap-result-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 24px;
  font-weight: 900;
}

.area-tap-result-rank[data-rank="S+"],
.area-tap-result-rank[data-rank="S"] {
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #1a0800;
}
.area-tap-result-rank[data-rank="A"] {
  background: linear-gradient(135deg, #1eff52, #00c853);
  color: #002200;
}
.area-tap-result-rank[data-rank="B"] {
  background: linear-gradient(135deg, #4fc3f7, #0288d1);
  color: #001830;
}
.area-tap-result-rank[data-rank="C"] {
  background: var(--at-bg3);
  color: var(--at-text2);
}
.area-tap-result-rank[data-rank="D"] {
  background: var(--at-bg3);
  color: var(--at-text3); /* design-allow: contrast-context — 24px/900 の大文字。3.81 ≥ 3:1 */
}

.area-tap-result-judgments {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 320px;
  text-align: center;
}

.area-tap-result-judgment-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.area-tap-result-judgment-label {
  font-size: 11px;
  font-weight: 700;
}

.area-tap-result-judgment-label.PERFECT { color: #ffd700; }
.area-tap-result-judgment-label.GREAT   { color: #1eff52; }
.area-tap-result-judgment-label.GOOD    { color: #4fc3f7; }
.area-tap-result-judgment-label.MISS    { color: #ff3554; }

.area-tap-result-judgment-count {
  font-size: 20px;
  font-weight: 800;
  color: var(--at-text);
  font-variant-numeric: tabular-nums;
}

.area-tap-result-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--at-text2);
}

.area-tap-result-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 280px;
  margin-top: 8px;
}

.area-tap-result-btn {
  padding: 10px 20px;
  border: 1px solid var(--at-border);
  border-radius: 8px;
  background: var(--at-bg2);
  color: var(--at-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.area-tap-result-btn:hover {
  border-color: var(--at-accent);
}

.area-tap-result-btn.primary {
  background: var(--at-accent-strong);
  border-color: var(--at-accent-strong);
  color: #fff;
}

.area-tap-result-btn.primary:hover {
  background: var(--at-accent-hover);
}

/* --- 結果画面: ソーシャル共有 --- */
.area-tap-result-share {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
}

.area-tap-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.3);
  background: transparent;
  color: rgba(255,255,255,0.7);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
}

.area-tap-share-btn:hover {
  border-color: var(--at-accent);
  color: var(--at-accent);
  transform: scale(1.1);
}

/* --- 結果画面: サーバー情報（自己ベスト・ランキング位置） --- */
.area-tap-result-server-info {
  text-align: center;
  margin: 8px 0;
  min-height: 20px;
}

.area-tap-result-best-update {
  color: var(--at-accent2);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.area-tap-result-ranking-pos {
  color: var(--at-text2);
  font-size: 14px;
}

/* --- 結果画面: 次ランクプログレス --- */
.area-tap-result-next-rank {
  text-align: center;
  margin: 8px 0 12px;
  font-size: 12px;
  color: var(--at-text2);
}

.area-tap-result-next-rank-bar {
  width: 200px;
  max-width: 80%;
  height: 6px;
  background: var(--at-bg3);
  border-radius: 3px;
  margin: 6px auto 0;
  overflow: hidden;
}

.area-tap-result-next-rank-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--at-accent), var(--at-accent2));
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* --- 結果画面: OK判定ラベル色 --- */
.area-tap-result-judgment-label.OK {
  color: #aaa;
}

/* --- 動画エラー表示 --- */
.area-tap-error-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 16px;
  text-align: center;
}

.area-tap-error-message i {
  font-size: 32px;
  color: var(--at-accent2);
}

.area-tap-error-message p {
  margin: 0;
  font-size: 14px;
  color: var(--at-text2);
  line-height: 1.5;
}

/* --- レスポンシブ --- */
@media (max-width: 480px) {
  .area-tap-status {
    padding: 4px 8px;
    font-size: 12px;
    min-height: 44px;
  }

  .area-tap-guide {
    padding: 4px 8px;
    font-size: 13px;
    min-height: 44px;
  }

  .area-tap-fragment {
    font-size: 13px;
  }

  .area-tap-result-score {
    font-size: 32px;
  }

  .area-tap-combo-popup {
    font-size: 36px;
  }
}

/* --- カウントダウン --- */
.area-tap-countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 15, 0.8);
  z-index: 60;
  font-size: 72px;
  font-weight: 900;
  color: var(--at-accent);
  pointer-events: none;
}

.area-tap-countdown.fade {
  animation: countdown-fade 0.8s ease forwards;
}

@keyframes countdown-fade {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.5); }
}

/* === 練習モード ヒント表示 === */
.area-tap-zone.zone-hint {
  border: 3px solid var(--at-accent);
  animation: hint-pulse 0.8s ease-in-out infinite;
  box-shadow: inset 0 0 20px rgba(255, 215, 0, 0.3);
}

@keyframes hint-pulse {
  0%, 100% { border-color: var(--at-accent); box-shadow: inset 0 0 20px rgba(255, 215, 0, 0.3); }
  50% { border-color: #fff; box-shadow: inset 0 0 30px rgba(255, 215, 0, 0.5); }
}

.practice-hint-text {
  color: var(--at-accent);
  font-size: 0.85em;
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* === チャレンジモード === */
.area-tap-status-lives {
  color: #ff6b6b;
  font-weight: bold;
}

.lives-full { color: #ff4757; } /* --at-bg の暗面で 5.11 */
.lives-empty { color: var(--at-text2); } /* #555 は暗面で 2.29 */

.lives-danger {
  animation: lives-shake 0.3s ease-in-out;
}

@keyframes lives-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.area-tap-gameover-title {
  font-size: 2.5rem;
  font-weight: 900;
  color: #ff4757;
  text-align: center;
  margin-bottom: 16px;
  text-shadow: 0 0 20px rgba(255, 71, 87, 0.5);
  animation: gameover-appear 0.5s ease-out;
}

@keyframes gameover-appear {
  0% { transform: scale(2); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* === タイムアタックモード === */
.area-tap-result-ta-info {
  text-align: center;
  font-size: 1.3rem;
  color: #ddd;
  margin: 8px 0;
}

.area-tap-result-ta-info .ta-completed {
  font-size: 2rem;
  font-weight: 900;
  color: var(--at-accent);
}

/* === モード別ランキング サブタブ === */
.ranking-subtabs {
  display: flex;
  gap: 4px;
  margin: 8px 12px 12px;
  padding: 3px;
  background: var(--card-actions-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.ranking-subtab {
  flex: 1;
  padding: 6px 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.ranking-subtab:hover {
  color: var(--text-secondary);
  background: rgba(var(--accent-rgb), 0.06);
}

.ranking-subtab.active {
  color: var(--text-on-accent);
  background: var(--accent);
}

/* design-allow-end: color-literal */
/* typing_videos.css */
/* ===================================================
   Typing Videos Section - "打ってみた" Card Grid & Modal
   =================================================== */

/* --- Section Header with Post Button --- */
.tv-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tv-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tv-section-title h2 {
  margin: 0;
}

.tv-header-post-btn {
  padding: 0.4rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--text-on-accent);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

.tv-header-post-btn:hover {
  opacity: 0.85;
}

/* --- Card Grid --- */
.detail-typing-videos {
  margin-bottom: 2rem;
}

.tv-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 1rem;
}

/* --- Card --- */
.tv-card {
  border-radius: var(--card-radius);
  background: var(--card-bg);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tv-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--player-float-shadow);
}

/* --- Thumbnail --- */
.tv-thumb-link {
  display: block;
  text-decoration: none;
}

.tv-thumb {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--code-bg);
  overflow: hidden;
}

.tv-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tv-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--text-muted);
  font-size: 2rem;
}

.tv-platform-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--card-overlay-bg);
  color: var(--card-overlay-fg);
  backdrop-filter: blur(4px);
}

/* --- Info --- */
.tv-info {
  padding: 0.6rem 0.75rem;
}

.tv-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  text-decoration: none;
  margin-bottom: 0.3rem;
}

.tv-title:hover {
  color: var(--accent);
}

.tv-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tv-user {
  color: var(--text-muted);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 50%;
}

.tv-user:hover {
  color: var(--accent);
}

.tv-stats {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.tv-views {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* 一覧カードのいいね数アイコン (計画書 165 §3.4)。
   歌詞 / 単語帳でカード partial を共有するにあたり、ERB の
   inline style="color: #e53e3e" をトークン参照のクラスへ移した。 */
.tv-like-icon {
  color: var(--color-danger);
}

/* --- Like Button --- */
.tv-like-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: color 0.15s ease;
}

.tv-like-btn:hover {
  color: var(--color-danger);
}

.tv-like-btn.liked {
  color: var(--color-danger);
}

/* --- More Button --- */
.tv-more {
  text-align: center;
  margin-top: 0.5rem;
}

.tv-more-btn {
  padding: 0.5rem 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tv-more-btn:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

/* --- Empty State --- */
.tv-empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.tv-empty-icon {
  display: block;
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.tv-empty p {
  margin: 0 0 0.3rem;
}

.tv-empty-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===================================================
   Modal
   —— .tv-modal 系の骨格は application.css に集約済み（レイアウトが常に読む）。
   ここにはこのページ固有のフォーム部品だけを残す
   =================================================== */
.tv-form-group {
  margin-bottom: 1rem;
}

.tv-form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.tv-form-group input,
.tv-form-group textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.tv-form-group input:focus,
.tv-form-group textarea:focus {
  border-color: var(--accent);
}

.tv-form-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* --- Preview --- */
.tv-preview {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border-radius: 8px;
  background: var(--hover-bg);
}

.tv-preview-thumb {
  width: 120px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 16/9;
  background: var(--code-bg);
}

.tv-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tv-preview-info {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* --- Error --- */
.tv-form-error {
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.5rem;
  border-radius: 6px;
  background: rgba(var(--color-danger-rgb), 0.12);
  color: var(--color-danger);
  font-size: 0.8rem;
}

.tv-cancel-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
}

.tv-cancel-btn:hover {
  background: var(--hover-bg);
}

.tv-submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.2rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: var(--text-on-accent);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.tv-submit-btn:hover {
  opacity: 0.9;
}

.tv-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===================================================
   Post Guide (shared across index + ranking pages)
   =================================================== */
.tvi-post-guide {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.tvi-post-guide i {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===================================================
   Responsive
   =================================================== */
@media (max-width: 768px) {
  .tv-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .tv-info {
    padding: 0.5rem 0.6rem;
  }

  .tv-title {
    font-size: 0.8rem;
  }

  .tv-header-post-btn {
    padding: 0.35rem 0.8rem;
    font-size: 0.75rem;
  }

  .tvi-post-guide {
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
  }
}

/* share_modal.css */
/* =============================================
   Share Modal
   ============================================= */

.share-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.5); /* design-allow: color-literal */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.share-modal-backdrop[hidden] {
  display: none;
}

.share-modal {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--modal-panel-shadow);
  animation: shareModalIn 0.2s ease-out;
}

@keyframes shareModalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Header */
.share-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.share-modal-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.share-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.15s, color 0.15s;
}

.share-modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Body */
.share-modal-body {
  padding: 1.25rem;
}

.share-modal-section {
  margin-bottom: 1rem;
}

.share-modal-section[hidden] {
  display: none;
}

.share-modal-section-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

/* Pattern radio buttons */
.share-modal-patterns {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.share-modal-pattern {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text-primary);
}

.share-modal-pattern:hover {
  border-color: rgba(var(--accent-rgb), 0.4);
  background: rgba(var(--accent-rgb), 0.03);
}

.share-modal-pattern.active {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.06);
}

.share-modal-pattern input[type="radio"] {
  margin-top: 0.15rem;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.share-modal-pattern-text {
  flex: 1;
  word-break: break-word;
}

/* Tag checkboxes */
.share-modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.share-modal-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.625rem;
  border: 1px solid var(--border-color);
  border-radius: 2rem;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
}

.share-modal-tag:hover {
  border-color: rgba(var(--accent-rgb), 0.4);
  color: var(--text-primary);
}

.share-modal-tag:has(input:checked) {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
  font-weight: 500;
}

.share-modal-tag input[type="checkbox"] {
  display: none;
}

/* Preview */
.share-modal-preview {
  margin-top: 0.75rem;
}

.share-modal-preview-box {
  padding: 0.75rem;
  background: var(--body-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.5;
}

.share-modal-preview-text {
  margin: 0 0 0.25rem;
  color: var(--text-primary);
  word-break: break-word;
  white-space: pre-wrap;
}

.share-modal-preview-url {
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
  word-break: break-all;
}

.share-modal-char-count {
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.share-modal-char-count .over-limit {
  color: var(--color-danger);
  font-weight: 600;
}

/* Footer buttons */
.share-modal-footer {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.share-modal-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  flex: 1;
  justify-content: center;
  min-width: 0;
  white-space: nowrap;
}

.share-modal-btn:hover {
  border-color: var(--text-secondary);
}

/* design-allow-start: color-literal */
/* SNS 共有ボタンの公式ブランドカラー（X=黒/白 / LINE=#06c755 / Facebook=#1877f2）。テーマ非依存の固定識別色 */
.share-modal-btn-x:hover {
  background: #000;
  color: #fff;
  border-color: #000;
}

[data-theme*="dark"] .share-modal-btn-x:hover {
  background: #fff;
  color: #000;
  border-color: #fff;
}

.share-modal-btn-line:hover {
  /* design-allow: contrast-context — 可視文字が「LINE」= ブランド名そのもの（WCAG 1.4.3 の logotype 除外）。地は LINE 公式ブランドカラーで、白文字も公式指定。実測 2.26 */
  background: #06c755;
  color: #fff;
  border-color: #06c755;
}

.share-modal-btn-fb:hover {
  /* design-allow: contrast-context — 中身は bi-facebook のアイコンだけで文字を持たない（_share_modal.html.erb:54）＝非テキスト 3:1。実測 4.23 */
  background: #1877f2;
  color: #fff;
  border-color: #1877f2;
}
/* design-allow-end: color-literal */

.share-modal-btn-copy:hover {
  background: rgba(var(--accent-rgb), 0.08);
  border-color: var(--accent);
  color: var(--accent);
}

/* Responsive */
@media (max-width: 480px) {
  .share-modal {
    max-width: 100%;
    border-radius: 12px 12px 0 0;
    max-height: 85vh;
  }

  .share-modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .share-modal-footer {
    flex-wrap: wrap;
  }

  .share-modal-btn {
    flex: 1 1 calc(50% - 0.25rem);
  }
}
/* venue_visual.css */
/* ===========================
   会場の見た目（live_events/_venue_visual・_venue_audience と、固定デコレーションの層・購入モーダル）
   計画 259 §2-5 で live_events.css から移した。曲ページ（この曲のライブイベント）は live_events.css を読まずにこれだけを読む。
   ⚠️ live_events.css を読むページは、その**直前**でこのファイルを読む（元は live_events.css の中にあった規則。
      後ろの live_events.css の規則が上書きする前提の並びを崩さない）。検査 = test/integration/venue_visual_css_test.rb
   =========================== */


/* ===========================
   Venue Visual
   =========================== */
/* design-allow-start: color-literal */
/* 会場ビジュアル (.venue-visual) はダーク前提固定配色。--venue-bg/--venue-stage 等のローカル変数および装飾色（飾り照明・ドロップシャドウ）はテーマ依存しない */

/* ⚠️ **ダーク固定画面の作法**: この世界が使うテーマ追従トークンは全部ここで上書きする
   （.battle-play-page / .bge-container と同じ形。計画書 182 Phase 3-5）。
   上書き漏れがあると light テーマの濃色文字が暗い会場に乗って沈む
   （実測 --lh-success 1.93 / --lh-warning 1.95 / --text-muted 2.00 / --color-danger 2.13）。
   使っているトークンは「.venue-(?!fixed-) のセレクタが参照する var() のうちテーマで値が変わるもの」
   を機械的に洗って確定させた。値は会場 9 tier の地すべてで AA を満たす
   （danger 4.99 / success 6.05 / warning 8.26 / muted 4.90）。
   ⚠️ .venue-fixed-{slot,modal}-* は中で --card-bg のテーマ追従面を自前で敷く「島」だが、
      ここで上書きしたトークンはどれも使っていない（--text-primary / --text-secondary /
      --accent / --border-color だけ）ので
      打ち消しは不要。**この島でトークンを使い始めるときは素のテーマ値に戻すこと**。 */
.venue-visual,
.venue-visual-wrap {
  --color-danger: #f87171;
  --color-danger-rgb: 248, 113, 113;
  --color-success: #22c55e;
  --color-success-rgb: 34, 197, 94;
  --color-warning: #fbbf24;
  --color-warning-rgb: 251, 191, 36;
  --lh-success: var(--color-success);
  --lh-success-rgb: var(--color-success-rgb);
  --lh-warning: var(--color-warning);
  --text-muted: #9a9a9a;
}

.venue-visual {
  --venue-bg: #1a1a2e;
  --venue-accent: var(--color-warning);
  /* 用途: accent を**文字色**として使うときの値。tier 2/5/6 は accent のままだと自分の
     暗い地の上で 3.62〜4.20 しか出ないので、ERB が明度を上げた版を渡す（同 ERB:40〜） */
  --venue-accent-fg: var(--venue-accent);
  --venue-stage: #2d2d44;
  --venue-accent-rgb: 255, 193, 7;
  position: relative;
  /* ⚠️ **ここは宣言どおりダーク固定の世界**（計画書 182 Phase 3-5）。
     以前は background: transparent で、背景画像を持たないイベントでは親の
     --lh-surface-subtle（テーマ追従）が透けていた。中の配色は照明・ステージ・観客ドット・
     文字までダーク前提なので、light テーマでは会場の文字がほぼ全部読めなかった
     （エリアラベル 1.08 / 参加率 1.12 / 進捗ラベル 1.13〜3.23 = 9 tier 全滅）。
     --venue-bg は ERB (_venue_visual.html.erb:62) が tier ごとの暗色を inline で渡す。
     ⚠️ background-color だけを指定すること。ERB が inline で background-image を重ねる。 */
  background-color: var(--venue-bg);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1.5rem;
  /* 背景画像(16:9)が常に全体表示されるよう比率を固定 */
  aspect-ratio: 16 / 9;
  display: flex;
  flex-direction: column;
}

/* --- Stage (compact top: small screen + lighting glow) --- */
.venue-stage {
  position: relative;
  padding: 0.5rem 0.75rem 0.2rem;
  overflow: hidden;
  flex-shrink: 0;
}
/* スクリーン非表示時のステージ（最小化） */
.venue-stage-minimal {
  padding: 0.25rem;
}

/* Screen — small distant stage backdrop */
.venue-screen-area {
  position: relative;
  display: flex;
  justify-content: center;
  z-index: 1;
}
.venue-screen {
  position: relative;
  width: 32%;
  max-width: 160px;
  aspect-ratio: 16 / 9;
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid rgba(var(--venue-accent-rgb), 0.35);
  box-shadow:
    0 0 12px rgba(var(--venue-accent-rgb), 0.2),
    0 0 40px rgba(var(--venue-accent-rgb), 0.06);
}
.venue-screen-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.8) saturate(1.1);
}
.venue-screen-fallback {
  width: 100%;
  height: 100%;
  background: var(--venue-stage);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  padding-bottom: 20%;
}
.venue-screen-fallback-bar {
  width: 3px;
  background: rgba(var(--venue-accent-rgb), 0.5);
  border-radius: 1px 1px 0 0;
  animation: venue-eq-bar 1.2s ease-in-out infinite;
}
.venue-screen-fallback-bar:nth-child(1) { height: 30%; animation-delay: 0s; }
.venue-screen-fallback-bar:nth-child(2) { height: 55%; animation-delay: 0.15s; }
.venue-screen-fallback-bar:nth-child(3) { height: 75%; animation-delay: 0.3s; }
.venue-screen-fallback-bar:nth-child(4) { height: 45%; animation-delay: 0.45s; }
.venue-screen-fallback-bar:nth-child(5) { height: 60%; animation-delay: 0.6s; }
@keyframes venue-eq-bar {
  0%, 100% { transform: scaleY(0.3); opacity: 0.3; }
  50% { transform: scaleY(1); opacity: 0.8; }
}

.venue-screen-glow {
  position: absolute;
  inset: -4px;
  border-radius: 4px;
  pointer-events: none;
  box-shadow:
    0 4px 30px rgba(var(--venue-accent-rgb), 0.25),
    0 8px 60px rgba(var(--venue-accent-rgb), 0.08);
  animation: venue-screen-pulse 4s ease-in-out infinite;
}

/* Stage animations */
@keyframes venue-screen-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
/* --- Decorations Overlay --- */
.venue-decorations {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
}
.venue-decorations:empty {
  display: none;
}
/* design-allow-end: color-literal */

/* --- Audience --- */
.venue-audience {
  padding: 0.75rem 1rem;
  padding-bottom: 4px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-items: center;
  align-content: center;
  overflow: hidden;
}
/* メダルが overflow: hidden でクリップされないよう、はみ出し分を内側に収める */
.venue-person {
  margin: 3px;
}

.venue-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 1rem;
}
.venue-empty i {
  font-size: 1.5rem;
}

/* --- Person Avatar ---
   width/height は内部 .venue-person-img (mini variant 20x20 を 100% で表示) に依存。
   旧設計の min-width/min-height: 44px + flex-shrink:0 は venue サイズに関係なく 44px を強制し、
   (1) 20x20 元画像を 44x44 にアップスケールして画質劣化
   (2) 小さい venue で audience が wrap し aspect-ratio:16/9 を破る
   の不具合を起こすため撤回。 必要なら親側で width/height を指定する */
.venue-person {
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}
.venue-person-gold  { border-color: #ffd700; box-shadow: 0 0 6px rgba(255, 215, 0, 0.4); }
.venue-person-silver { border-color: #c0c0c0; box-shadow: 0 0 6px rgba(192, 192, 192, 0.3); }
.venue-person-bronze { border-color: #cd7f32; box-shadow: 0 0 6px rgba(205, 127, 50, 0.3); }

.venue-person-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.venue-person-default {
  width: 100%;
  height: 100%;
  background: #555;
}

.venue-person-medal {
  position: absolute;
  bottom: -1px;
  right: -1px;
  font-size: 0.6rem;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.venue-person-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(var(--venue-accent-rgb), 0.35);
}

/* --- Top 3 Row --- */
.venue-top3 {
  display: flex;
  gap: 8px;
  justify-content: center;
  width: 100%;
  margin-bottom: 0.5rem;
}

/* --- Dots --- */
.venue-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  align-items: center;
  width: 100%;
}
.venue-dots-more {
  font-size: 0.7rem;
  color: var(--venue-accent-fg);
  padding: 0.125rem 0.375rem;
}

/* --- Progress Bar --- */
.venue-progress {
  width: 100%;
  margin-top: 0.375rem;
}
.venue-progress-track {
  height: 10px;
  background: rgba(var(--venue-accent-rgb), 0.12);
  border-radius: 5px;
  overflow: hidden;
}
.venue-progress-fill {
  height: 100%;
  background: var(--venue-accent);
  border-radius: 5px;
  transition: width 0.5s;
}
.venue-progress-label {
  font-size: 0.75rem;
  color: var(--venue-accent-fg);
  text-align: center;
  margin-top: 0.375rem;
}

/* --- Area Grid (Tier 5-6) --- */
.venue-area-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: 100%;
}
.venue-area-block {
  background: var(--venue-accent);
  border-radius: 4px;
  padding: 0.5rem;
  text-align: center;
}
.venue-area-label {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.7);
}
.venue-area-pct {
  font-size: 0.85rem;
  color: #fff; /* design-allow: color-literal */
  font-weight: bold;
}

/* --- Overview (Tier 7-8) --- */
.venue-overview {
  width: 100%;
  height: 80px;
  border-radius: 8px;
  background: rgba(var(--venue-accent-rgb), 0.08);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.venue-overview-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(0deg, var(--venue-accent), transparent);
  opacity: 0.3;
  transition: height 0.5s;
}
.venue-overview-pct {
  font-size: 2rem;
  font-weight: bold;
  color: #fff; /* design-allow: color-literal */
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 1;
}

/* --- Recruit Message --- */
/* ⚠️ 募集ゲージ本体（.venue-recruit / -header / -track / -fill / -success）は
   ERB・JS のどこからも出力されないデッドコードだったので削除した
   （動的なクラス名組み立ても無いことを確認済み。計画書 182 Phase 3-5）。
   実際に出るのは _venue_visual.html.erb:153 の .venue-recruit-msg{,-ok,-fail} だけ。 */
.venue-recruit-msg {
  font-size: 0.75rem;
  margin-top: auto;
  padding-bottom: 0.5rem;
  text-align: center;
  flex-shrink: 0;
}
.venue-recruit-msg-ok   { color: var(--lh-success); }
.venue-recruit-msg-fail { color: var(--color-danger); }

/* --- Settled --- */
.venue-settled-msg {
  text-align: center;
  margin-top: auto;
  padding: 0 0.5rem 0.5rem;
  font-size: 0.85rem;
  color: var(--venue-accent-fg);
  flex-shrink: 0;
}

/* --- Venue responsive --- */
@media (max-width: 480px) {
  .venue-stage {
    padding: 0.4rem 0.5rem 0.2rem;
  }
  .venue-screen {
    width: 40%;
  }
  .venue-person {
    width: 28px;
    height: 28px;
  }
}

/* ========================================
   観客アイコン配置 (audience_layout)
   ======================================== */

/* outside モード: .venue-visual を縦積みコンテナで包み、観客を枠外に出す */
.venue-visual-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.venue-audience-outside {
  flex: 0 0 auto;
  max-height: none;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
  padding: 0.5rem 0.75rem;
  /* ⚠️ outside モードでは観客エリアが .venue-visual の**外**に出るが、中身は同じ partial
     （_venue_audience）でダーク前提の配色を使う。rgba(0,0,0,.15) だと light テーマで
     明るい帯になって同じ文字が読めなくなるので、会場と同じ地に揃える。
     --venue-bg は親の .venue-visual-wrap が inline で持っている（同 ERB:63） */
  background-color: var(--venue-bg);
  border-radius: 6px;
}

/* outside モードの内部レイアウト: ステージを伸ばし、内部観客プレースホルダを非表示 */
.venue-visual[data-audience-layout="outside"] .venue-stage {
  flex: 1;
}
.venue-audience--placeholder {
  flex: 0 0 auto;
  padding: 0;
  min-height: 0;
}

/* hidden モードの内部レイアウト: 観客エリアを最小化 */
.venue-visual[data-audience-layout="hidden"] .venue-audience {
  flex: 0 0 auto;
  padding: 0.4rem 1rem;
}
.venue-visual[data-audience-layout="hidden"] .venue-stage {
  flex: 1;
}

/* anonymous_crowd モード: 順位演出を排除 */
.venue-person--anonymous {
  border-color: transparent;
  box-shadow: none;
}
.venue-person--anonymous .venue-person-medal {
  display: none;
}

/* custom モード: スロットを絶対配置 */
.venue-visual[data-audience-layout="custom"] .venue-audience {
  display: block;
  position: relative;
  overflow: visible;
}
.venue-person--slot {
  position: absolute;
  margin: 0;
}
.venue-person--clip-bottom-half { clip-path: inset(0 0 50% 0); }
.venue-person--clip-top-half    { clip-path: inset(50% 0 0 0); }
.venue-person--clip-oval        { clip-path: ellipse(50% 35% at 50% 35%); }
.venue-person--no-medal .venue-person-medal { display: none; }
.venue-slot-overflow {
  position: absolute;
  bottom: 4%;
  right: 4%;
  font-size: 0.75rem;
  /* ⚠️ 同系色の薄い tint の上に同じ accent。文字だけ明度を上げた版にする（tint は据え置き） */
  color: var(--venue-accent-fg);
  background: rgba(var(--venue-accent-rgb), 0.15);
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  z-index: 2;
  pointer-events: none;
}

/* プログレスバーマーカー (success / pending) */
.venue-progress-marker {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: rgba(255, 255, 255, 0.3);
  z-index: 1;
  border-radius: 1px;
}
.venue-progress-marker--success {
  background: var(--color-success);
}

@media (max-width: 600px) {
  .venue-audience-outside {
    flex-wrap: wrap;
    overflow-x: visible;
    max-height: 120px;
    overflow-y: hidden;
  }
  .venue-audience-outside .venue-person {
    min-width: 36px;
    min-height: 36px;
  }
}
/* 会場プログレスバー用 */
.venue-progress-fill.venue-progress-ok {
  background: var(--lh-success);
}
.venue-progress-fill.venue-progress-full {
  background: linear-gradient(90deg, var(--color-warning), var(--color-warning));
}

/* --- 固定デコレーション 背面レイヤー (視聴者側) ---
 * 階層:
 *   venue-visual の background-image = z軸最下
 *   venue-fixed-decoration-layer (z:0) = 背景の上
 *   venue-stage / venue-screen-area (z:1+) = スクリーン・UI = 上
 *   venue-decorations (reactions) = 更に上
 */
/* 仮想 960x540 px 座標系: スロットは px ベースで配置し、
 * レイヤー全体を transform: scale() で venue サイズに合わせる。
 * 用途: venue-visual の実描画幅 / 960 を JS (ResizeObserver) で代入。 */
.venue-fixed-decoration-layer {
  --venue-scale: 1;
  position: absolute;
  top: 0;
  left: 0;
  width: 960px;
  height: 540px;
  pointer-events: none;
  z-index: 0;
  transform-origin: 0 0;
  transform: scale(var(--venue-scale));
}

.venue-fixed-slot {
  position: absolute;
  pointer-events: auto;
  transform-origin: top left;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible; /* タップ領域擬似要素をクリップしないため */
}

/* motion スロット: offset-path に沿ってアニメーション。
 * Web Animations API (Element.animate) で各スロットに個別の animation を
 * セットするため CSS の animation-* を上書き指定する必要はない。 */
.venue-fixed-slot.is-motion { transform-origin: center; }

.venue-fixed-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* --- 固定アイテム購入モーダル --- */
.venue-fixed-modal {
  position: fixed;
  inset: 0;
  background: var(--card-overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
}

.venue-fixed-modal[hidden] {
  display: none;
}

.venue-fixed-modal-box {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 1.5rem;
  max-width: 360px;
  width: 90%;
  text-align: center;
}

.venue-fixed-modal-close {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.3rem;
}

.venue-fixed-modal-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--text-primary);
}

.venue-fixed-modal-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0 0 0.75rem;
  line-height: 1.6;
}

.venue-fixed-modal-preview {
  width: 120px;
  height: 120px;
  margin: 0 auto 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.venue-fixed-modal-name {
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.venue-fixed-modal-price {
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 1rem;
}

.venue-fixed-modal-error {
  color: var(--accent);
  font-size: 0.75rem;
  margin-bottom: 0.75rem;
}

.venue-fixed-modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

/* モーダル開示中の body scroll ロック */
body.venue-fixed-modal-open {
  overflow: hidden;
}

/* --- 購入完了 toast --- */
.venue-fixed-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  box-shadow: 0 4px 12px var(--card-overlay-bg);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 1100;
  pointer-events: none;
}

.venue-fixed-toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
/* movies_live_events.css */
/* Movie 詳細ページ「この曲のライブイベント」セクション
 *
 * - mle-* prefix で名前空間を分離
 * - venue 描画は live_events.css の .venue-visual 系を完全流用 (背景画像/装飾/観客等)
 *   このファイルでは mle-* のレイアウトと、各 venue を card サイズへ収めるための
 *   .mle-card-venue 内のサイズ調整のみを記述する
 */

/* セクション全体 */
.mle-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.mle-section-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mle-section-title .bi {
  color: var(--color-warning);
}

.mle-section-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
  max-width: 720px;
}

/* 統計バー (3 stat cards) */
.mle-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.mle-stat-card {
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem 0.5rem;
  text-align: center;
}

.mle-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-color);
  line-height: 1.1;
}

.mle-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

@media (max-width: 600px) {
  .mle-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
  }
  .mle-stat-card {
    padding: 0.5rem 0.25rem;
  }
  .mle-stat-value {
    font-size: 1.1rem;
  }
  .mle-stat-label {
    font-size: 0.65rem;
  }
}

/* イベントカードグリッド */
.mle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
  .mle-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .mle-grid {
    grid-template-columns: 1fr;
  }
}

.mle-card {
  background: var(--surface-bg, var(--card-bg));
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.mle-card:hover {
  border-color: var(--color-warning);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px -6px rgba(var(--color-warning-rgb), 0.35);
}

/* 失敗イベントは透過と彩度低下で「優先度低い記録」と分かるよう視覚的に区別 */
.mle-card-failed {
  opacity: 0.78;
  filter: saturate(0.7);
}

.mle-card-failed:hover {
  opacity: 1;
  filter: saturate(1);
}

.mle-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.mle-card-link:hover,
.mle-card-link:focus {
  text-decoration: none;
  color: inherit;
}

/* venue は live_events.css の .venue-visual 系をそのまま流用。
 * card サイズに合わせて 16:9 比率のコンテナとして配置する。
 * margin-bottom と border-radius のみ上書き (元は詳細ページ向けの値)。*/
.mle-card-venue {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  overflow: hidden;
}

.mle-card-venue .venue-visual {
  width: 100%;
  height: 100%;
  margin-bottom: 0;
  border-radius: 0;
}

/* card 内では装飾クリックで親 <a> ナビゲーションが効くよう pass-through。
 * (詳細ページでは購入モーダルを開くため click 可、preview ではナビ優先) */
.mle-card-venue .venue-fixed-slot {
  pointer-events: none;
}

.mle-card-meta {
  padding: 0.6rem 0.75rem 0.5rem;
}

.mle-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-color);
  line-height: 1.35;
  margin: 0 0 0.4rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mle-card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.35rem;
}

.mle-card-stats {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.mle-card-played {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.mle-card-success-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(var(--color-success-rgb), 0.12);
  color: var(--color-success);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

.mle-card-host {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.75rem 0.6rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  border-top: 1px solid var(--border-color);
  background: var(--surface-2, transparent);
}

.mle-card-host:hover {
  color: var(--color-warning);
  text-decoration: none;
}

.mle-card-host-inactive {
  cursor: default;
}

.mle-card-host-inactive:hover {
  color: var(--text-muted);
}

/* CTA */
/* 計画137: 初満員ボーナス CTA (未達成曲でボーナス有効時のみ表示) */
.mle-first-bonus-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.5rem 0.75rem 0.5rem 0;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--color-warning);
  border-radius: 6px;
  color: var(--color-warning);
  font-size: 0.85rem;
}

.mle-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.mle-cta:hover {
  border-color: var(--color-warning);
  text-decoration: none;
}
