/* ============================
   dashboard.css
   ダッシュボード・ユーザー管理・ポイント計算（共通部）
   ============================ */

/* ── ユーザーカード（ダッシュボード）── */
.user-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    text-align: center;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    border: 2px solid transparent;
}

.user-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary-light);
}

.user-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-xl);
}

/* ダッシュボード向けコンパクトサイズ */
.user-card.compact {
    padding: var(--space-xl);
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-md);
    width: 100%;
    min-height: 180px;
    /* アイテムカードに近い高さに */
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    border: 2px solid transparent;
}

.user-card.compact:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary-light);
}

.user-card.compact .user-avatar {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    border-width: 2px;
}

.user-card.compact .user-info-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.user-card.compact .user-name {
    font-size: 0.9rem;
    margin: 0;
}

.user-card.compact .user-grade {
    font-size: 0.7rem;
}

.user-card.compact .user-points {
    font-size: 1.1rem;
    margin-left: auto;
}

/* ── 統計カード ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 2px solid transparent;
    /* Changed from 1px to 2px for thicker unselected border */
    box-shadow: var(--shadow-sm);
    padding: var(--space-xl);
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

/* 教科ボタンの「完全な」枠線 (全周にカラーをつける) */
.card[data-subj="math"] {
    border-color: var(--color-subject-math);
}

.card[data-subj="japanese"] {
    border-color: var(--color-subject-japanese);
}

.card[data-subj="english"] {
    border-color: var(--color-subject-english);
}

/* Selected state: Background takes the color, text becomes white */
.card.selected[data-subj="math"] {
    background: var(--color-subject-math);
    color: #fff;
}

.card.selected[data-subj="japanese"] {
    background: var(--color-subject-japanese);
    color: #fff;
}

.card.selected[data-subj="english"] {
    background: var(--color-subject-english);
    color: #fff;
}

.stat-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.user-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    background: var(--bg-input);
    border: 4px solid var(--bg-surface);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    position: relative;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name {
    font-weight: 700;
    font-size: 1rem;
}

.user-grade {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 2px 10px;
    border-radius: var(--radius-full);
}

.user-points {
    font-size: 1.5rem;
    font-weight: 800;
    font-family: 'Inter', sans-serif;
    background: var(--grad-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* ── テーブル（ユーザー管理）── */
.user-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
}

.user-table th {
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
}

.user-table td {
    padding: var(--space-md) var(--space-lg);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

.user-table tbody tr:last-child td {
    border-bottom: none;
}

.user-table tbody tr {
    transition: background var(--transition-fast);
}

.user-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.grade-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bg-input);
    color: var(--text-secondary);
}

.points-display {
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    color: var(--color-gold);
}

.action-buttons {
    display: flex;
    gap: var(--space-sm);
}

/* ── ポイント計算レイアウト ── */
.calculator-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: var(--space-lg);
    align-items: start;
    /* Prevents vertical stretching between panels */
}

.calc-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

/* ── 電卓固有プレビューコンテナ（第5ステップ）── */
.calc-result-panel {
    grid-column: 1 / -1;
    /* スパンさせて全幅に戻す */
    background: var(--bg-card);
    border-radius: calc(var(--radius-lg) * 1.5);
    /* 丸みを強めに */
    padding: var(--space-2xl);
    min-height: 480px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    /* スムーズで高級感のある遷移 */
    border: 1px solid var(--border-dim);
}

/* 計算結果パネル下部：ショートカット＋ポイント反映ボタンを横並び */
.calc-footer-shortcuts {
    display: flex;
    gap: 8px;
    flex-grow: 1;
    flex-wrap: wrap;
}

.calc-footer-shortcuts~#btn-apply-points {
    flex-shrink: 0;
}

/* ショートカットボタンのスタイル */
.calc-footer-shortcuts .btn {
    padding: 6px 14px;
    font-size: 0.82rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: var(--text-color);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    white-space: nowrap;
}

.calc-footer-shortcuts .btn:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

/* ショートカットと適用ボタンを横並びにするためのフレックスラッパー */
.calc-result-panel .calc-footer-shortcuts,
.calc-result-panel #btn-apply-points {
    display: flex;
    align-items: center;
}

.calc-result-panel::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.calc-result-panel.theme-active::before {
    opacity: 1;
}

#btn-apply-points {
    align-self: flex-end;
    width: auto;
    padding: var(--space-md) var(--space-2xl);
    margin-top: var(--space-xl);
    border-radius: var(--radius-full);
}


/* 数式エリアのヘッダー行 (名前と計算結果を横一列に) */
.calc-formula-header-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    margin-top: 30px;
    padding: 24px 30px;
    background: var(--bg-input);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-dim);
}

.header-name-display {
    font-size: 1.05rem;
    /* 0.7rem * 1.5 */
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding-left: 4px;
    margin-bottom: 8px;
}

.header-value-badge {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 950;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    padding: 12px 30px;
    border-radius: 14px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: baseline;
    gap: 4px;
    min-width: 200px;
    justify-content: center;
}

.header-value-badge small {
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.7;
}

.calc-formula-group {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
}

/* 計算記号 */
.calc-symbol {
    color: var(--text-primary) !important;
    /* 強制的に濃い色を適用 */
    font-weight: 950;
    font-size: 2rem;
    /* さらに一回り大きく */
    opacity: 1.0;
    width: 30px;
    text-align: center;
    margin-top: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Reusing these classes to avoid JS refactor errors, but removing the glow */
.calc-panel.glow-math {
    border-color: var(--color-subject-math) !important;
}

.calc-panel.glow-english {
    border-color: var(--color-subject-english) !important;
}

.calc-panel.glow-japanese {
    border-color: var(--color-subject-japanese) !important;
}

.panel-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-subtle);
}

.calc-user-select {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-base);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-md) center;
    background-size: 1.2rem;
    margin-top: var(--space-sm);
    box-shadow: var(--shadow-sm);
}

.calc-user-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.calc-user-select option {
    padding: 10px;
}

.task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    margin-bottom: var(--space-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--bg-input);
}

.task-item:hover {
    border-color: var(--color-primary);
}

.task-item.checked {
    background: rgba(108, 99, 255, 0.15);
    border-color: var(--color-primary);
}

.task-item input[type="checkbox"] {
    display: none;
}

.task-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.task-item.checked .task-check {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.task-name {
    flex: 1;
    margin: 0 var(--space-md);
    font-size: 0.875rem;
}

.task-pts {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-gold);
    font-family: 'Inter', sans-serif;
}

.subsection-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    margin-top: var(--space-md);
}

.subsection-title:first-child {
    margin-top: 0;
}

.bonus-item,
.penalty-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    margin-bottom: var(--space-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--bg-input);
}

.bonus-item.checked {
    background: rgba(67, 233, 123, 0.1);
    border-color: var(--color-success);
}

.penalty-item.checked {
    background: rgba(255, 71, 87, 0.1);
    border-color: var(--color-danger);
}

.bonus-pts {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-success);
    font-family: 'Inter', sans-serif;
}

.penalty-pts {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-danger);
    font-family: 'Inter', sans-serif;
}

.bonus-type-badge,
.penalty-type-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    margin-left: var(--space-sm);
}

.bonus-type-badge {
    background: rgba(67, 233, 123, 0.2);
    color: var(--color-success);
}

.penalty-type-badge {
    background: rgba(255, 71, 87, 0.2);
    color: var(--color-danger);
}

/* ── ポイント計算：選択済みリスト (Super Compact) ── */
.selected-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: var(--space-md);
}

.selected-task-card.item-card {
    padding: var(--space-md);
    width: 100%;
    /* Grid handles width */
    min-width: unset;
    min-height: 226px;
    aspect-ratio: auto;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    /* 改良：アイコンをはみ出させるため overflow: visible に */
    overflow: visible;
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* 計算パネル内ではよりコンパクトに表示（大量に並ぶことを想定） */
.calc-result-panel .selected-task-card.item-card {
    min-height: 140px;
    padding: var(--space-sm) var(--space-md);
}

.selected-task-card.item-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border-color: var(--color-primary-light);
}

.selected-task-card .item-visual-mini {
    position: absolute;
    top: -10px;
    left: -10px;
    width: 36px;
    height: 36px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff !important;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
    z-index: 10;
    transition: transform 0.3s ease;
}

.selected-task-card.item-card:hover .item-visual-mini {
    transform: scale(1.1) rotate(-5deg);
}

/* テーマ別の背景透過設定を解除（常に白背景で浮き彫りにするため） */
.selected-task-card[class*="card-theme-"] .item-visual-mini {
    background: #fff !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18) !important;
}

/* テーマ別の透過背景を削除し、一貫したフロートアイコンへ */
.theme-math .selected-task-card .item-visual-mini,
.theme-english .selected-task-card .item-visual-mini,
.theme-japanese .selected-task-card .item-visual-mini,
.selected-task-card.penalty .item-visual-mini {
    background: #fff !important;
}

.selected-task-card .item-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    text-align: center;
    padding-top: var(--space-md);
}

.calc-result-panel .selected-task-card .item-body {
    padding-top: 8px;
}

.selected-task-card .item-name {
    font-size: 1rem;
    font-weight: 850;
    color: #1e293b;
    margin-bottom: var(--space-md);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.4em;
    line-height: 1.2;
}

.calc-result-panel .selected-task-card .item-name {
    margin-bottom: 8px;
}

/* 計算行の中央寄せ */
.item-calc-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.calc-result-panel .item-calc-row {
    margin-bottom: 8px;
}

.unit-price {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* ボーナスタグ（角丸デザイン） */
.multiplier-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-bottom: var(--space-lg);
}

.multi-toggle {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    /* 中間の角丸 */
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
}

.multi-toggle.active {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 4px 12px var(--color-primary-glow);
}

.selected-task-card .item-footer {
    margin-top: auto;
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-subtle);
}

.calc-result-panel .selected-task-card .item-footer {
    padding-top: 8px;
}

.result-display-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.unit-price-footer {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.total-mult-badge {
    font-size: 0.75rem;
    background: rgba(251, 191, 36, 0.15);
    color: #d97706;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 800;
}

.entry-subtotal {
    font-size: 1.6rem;
    font-weight: 950;
    color: var(--color-primary);
    line-height: 1;
}

.selected-task-card.penalty .entry-subtotal {
    color: var(--color-danger);
}

/* 削除ボタン - 見切れないよう絶妙な位置へ */
.selected-task-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 20;
    box-shadow: var(--shadow-sm);
}

.selected-task-remove:hover {
    background: #fffafa;
    color: var(--color-danger);
    border-color: var(--color-danger);
    transform: scale(1.1);
}

.selected-task-card.bonus {
    border: 2px solid rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.05);
}

/* 計算記号の色分け */
.symbol-plus {
    color: var(--color-primary) !important;
}

.symbol-minus {
    color: var(--color-danger) !important;
}

/* 赤 */
.symbol-equal {
    color: var(--text-secondary);
}

/* パネル内テーマ時は記号の色を調整（白背景用だと見にくい場合があるため） */
.calc-result-panel[class*="theme-"] .symbol-plus {
    color: var(--color-primary) !important;
}

.calc-result-panel[class*="theme-"] .symbol-minus {
    color: var(--color-danger) !important;
}

.calc-result-panel[class*="theme-"] .symbol-equal {
    color: var(--text-primary) !important;
}

/* Removed legacy .compact-mini styles */

.calc-result-panel[class*="theme-"] .selected-task-card {
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}


.selected-task-header.compact {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.selected-task-name {
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.selected-task-remove {
    position: absolute;
    top: 6px;
    right: 8px;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
}

.selected-task-remove:hover {
    color: var(--color-danger);
}

.selected-task-controls.compact {
    grid-area: controls;
    display: flex;
    align-items: center;
    gap: 12px;
}

.qty-stepper.small {
    gap: 4px;
    background: var(--bg-input);
    padding: 2px;
    border-radius: var(--radius-sm);
}

.qty-stepper.small .stepper-btn {
    width: 22px;
    height: 22px;
    font-size: 0.8rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-stepper.small .qty-val {
    min-width: 20px;
    font-size: 0.85rem;
    text-align: center;
}

.qty-unit {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
}

.subtotal-box {
    grid-area: subtotal;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 1px;
}

.total-mult-badge {
    font-size: 0.65rem;
    color: var(--color-accent);
    font-weight: 800;
    background: rgba(247, 151, 30, 0.08);
    padding: 1px 6px;
    border-radius: var(--radius-full);
}

.entry-subtotal {
    font-weight: 900;
    color: var(--color-primary);
    font-size: 1.1rem;
    line-height: 1;
}

.entry-subtotal.penalty {
    color: var(--color-danger);
}

.multiplier-group.compact {
    grid-area: multi;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}

.multi-toggle.small {
    padding: 2px 8px;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 4px;
    background: var(--bg-input);
    border: 1px solid var(--border-dim);
    color: var(--text-muted);
}

.multi-toggle.small.active {
    background: var(--color-primary);
    color: #fff;
    border-color: transparent;
}

/* 比較表示 (Fixed positioning) */
.pt-comparison-wrapper {
    margin-top: -10px;
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
}

.point-comparison-centered {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-input);
    padding: 6px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
}

.pt-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.pt-val.current {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.pt-val.after {
    color: var(--color-primary);
    font-size: 1rem;
}

.pt-arrow {
    color: var(--text-muted);
    font-size: 1rem;
}

/* 計算結果 */
.result-display {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    background: var(--bg-surface);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.result-breakdown {
    min-height: 40px;
    max-height: 450px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-dim);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* スタイリッシュなスクロールバー */
.result-breakdown::-webkit-scrollbar {
    width: 6px;
}
.result-breakdown::-webkit-scrollbar-track {
    background: transparent;
}
.result-breakdown::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}
.result-breakdown::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* 教科別カードテーマ (視覚的判別を容易にするため不透明度とボーダーを調整) */
.selected-task-card.item-card.card-theme-math {
    background-color: rgba(59, 130, 246, 0.15) !important;
    border: 1px solid rgba(59, 130, 246, 0.4) !important;
}
.selected-task-card.item-card.card-theme-japanese {
    background-color: rgba(16, 185, 129, 0.15) !important;
    border: 1px solid rgba(16, 185, 129, 0.4) !important;
}
.selected-task-card.item-card.card-theme-english {
    background-color: rgba(249, 115, 22, 0.15) !important;
    border: 1px solid rgba(249, 115, 22, 0.4) !important;
}
.selected-task-card.item-card.card-theme-bonuses {
    background-color: rgba(108, 92, 231, 0.15) !important; /* 紫系 */
    border: 3px solid var(--color-primary) !important; /* 太線で強調 */
}
.selected-task-card.item-card.card-theme-penalties {
    background-color: rgba(214, 48, 49, 0.12) !important; /* 赤系 */
    border: 2px dashed var(--color-danger) !important; /* 破線で警告 */
}
.selected-task-card.item-card.card-theme-challenges {
    background-color: rgba(253, 203, 110, 0.2) !important; /* 金・黄系 */
    border: 4px double var(--color-gold) !important; /* 二重線で特別感 */
}

@media (max-width: 1200px) {
    .result-breakdown {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 768px) {
    .result-breakdown {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* タスクと計算式の距離を広くとる */


.result-total {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-xl);
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 2px solid var(--border-subtle);
}

.total-value {
    font-size: 3.5rem;
    font-weight: 900;
    font-family: 'Inter', sans-serif;
    color: var(--color-primary);
    line-height: 1;
}

.total-unit {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-secondary);
}

/* Shop Purchaser Select Spacing */
.shop-header {
    margin-bottom: 25px !important;
}

.shop-user-select {
    margin: 20px 0 35px 0 !important;
    padding: 15px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

/* ============================================================
   ポイント計算：新ヒーローUI (ポイント推移の比較表示)
   ============================================================ */
.p2-modern-container {
    background: #fff;
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-dim);
    margin-bottom: 20px;
    width: 100%;
}

.p2-user-info {
    font-size: 1.25rem;
    font-weight: 850;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.p2-user-info::before {
    content: '👤';
    font-size: 1.4rem;
}

.p2-stats-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 24px;
    background: var(--bg-body);
    padding: 20px;
    border-radius: var(--radius-lg);
}

.p2-stat-item {
    text-align: center;
    flex: 1;
}

.p2-stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.p2-stat-value {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1.1;
}

.p2-stat-value .unit {
    font-size: 0.9rem;
    margin-left: 4px;
    color: var(--text-secondary);
    font-weight: 600;
}

.p2-stat-divider {
    font-size: 2.4rem;
    color: var(--border-color);
    font-weight: 300;
    margin-top: 15px;
}

.p2-stat-divider .symbol {
    display: inline-block;
    transform: translateY(-4px);
}

.p2-stat-item.change.text-primary .p2-stat-value { color: var(--color-primary); }
.p2-stat-item.change.text-danger .p2-stat-value { color: var(--color-danger); }

.p2-result-hero {
    background: linear-gradient(135deg, var(--color-primary), #4facfe);
    color: white;
    padding: 30px 20px;
    border-radius: 16px;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(108, 99, 255, 0.3);
}

.p2-result-hero .label {
    font-size: 1rem;
    font-weight: 700;
    opacity: 0.9;
    margin-bottom: 10px;
    letter-spacing: 0.1em;
}

.p2-result-hero .value {
    font-size: 4rem;
    font-weight: 950;
    line-height: 1;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.p2-result-hero .unit {
    font-size: 1.4rem;
    margin-left: 8px;
    opacity: 0.8;
}

.p2-result-hero .glow-effect {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 60%);
    pointer-events: none;
    animation: p2-glow 8s infinite linear;
}

@keyframes p2-glow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media (max-width: 600px) {
    .p2-stats-row {
        flex-direction: column;
        gap: 10px;
    }
    .p2-stat-divider {
        display: none;
    }
    .p2-stat-value {
        font-size: 1.8rem;
    }
    .p2-result-hero .value {
        font-size: 3rem;
    }
}



