:root {
    --primary-color: #dc2626;
    --primary-dark: #b91c1c;
    --secondary-color: #fef2f2;
    --gold-color: #fbbf24;
    --gold-dark: #f59e0b;
    --success-color: #10b981;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
}

body { background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%); min-height: 100vh; }
.subtitle { text-align: center; color: var(--text-secondary); font-size: 1.1rem; margin-bottom: 2rem; }

.info-banner {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 12px; padding: 1.5rem; margin-bottom: 2rem; color: white;
}
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; text-align: center; }
.info-label { font-size: 0.85rem; opacity: 0.9; }
.info-value { font-size: 1.25rem; font-weight: 700; }

.purchase-section, .scratch-area, .result-section, .stats-section, .probability-section, .action-section {
    background: white; border-radius: 12px; padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.section-title { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); margin-bottom: 1rem; }

.purchase-grid { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: end; }
.control-label { font-weight: 600; color: var(--text-primary); margin-bottom: 0.5rem; display: block; }
.ticket-select { width: 100%; padding: 0.75rem; border: 2px solid var(--border-color); border-radius: 8px; font-size: 1rem; }
.buy-btn {
    padding: 0.75rem 2rem; background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white; border: none; border-radius: 8px; font-size: 1.1rem; font-weight: 700; cursor: pointer;
}
.buy-btn:hover { transform: translateY(-2px); }

/* スクラッチカード */
.scratch-area.hidden { display: none; }
.scratch-hint { text-align: center; color: var(--text-secondary); margin-bottom: 1rem; font-size: 0.9rem; }

.scratch-card {
    max-width: 320px; margin: 0 auto; background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-radius: 16px; padding: 1rem; box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.scratch-header {
    display: flex; justify-content: space-between; align-items: center;
    padding-bottom: 0.75rem; border-bottom: 2px dashed rgba(255,255,255,0.5);
}
.scratch-logo { font-size: 1.5rem; font-weight: 900; color: white; text-shadow: 2px 2px 0 rgba(0,0,0,0.2); }
.scratch-price { background: white; color: var(--gold-dark); padding: 0.25rem 0.75rem; border-radius: 20px; font-weight: 700; }

.scratch-content {
    position: relative; margin: 1rem 0; background: white; border-radius: 12px;
    padding: 1rem; min-height: 140px;
}

.prize-display {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    display: flex; gap: 0.75rem; justify-content: center; align-items: center;
    width: 100%; padding: 0 1rem;
}

.prize-symbol {
    width: 80px; height: 80px; border-radius: 12px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; font-weight: 700;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 3px solid #cbd5e1;
}
.prize-symbol.match { background: linear-gradient(135deg, #fef3c7, #fde68a); border-color: #fbbf24; }
.prize-symbol .prize-icon { font-size: 2rem; }
.prize-symbol .prize-text { font-size: 0.7rem; color: var(--text-secondary); margin-top: 0.25rem; }

#scratchCanvas {
    position: absolute; top: 10px; left: 10px; cursor: crosshair;
    border-radius: 8px; touch-action: none;
}

.scratch-footer {
    text-align: center; padding-top: 0.75rem; color: white; font-size: 0.85rem;
    border-top: 2px dashed rgba(255,255,255,0.5);
}

.scratch-progress { text-align: center; margin-top: 1rem; }
.progress-bar { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; margin-bottom: 0.5rem; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--gold-color), var(--gold-dark)); width: 0%; transition: width 0.3s; }
#progressText { font-size: 0.85rem; color: var(--text-secondary); }

.scratch-actions { display: flex; gap: 1rem; justify-content: center; margin-top: 1rem; }
.reveal-btn {
    padding: 0.75rem 1.5rem; background: var(--text-secondary); color: white;
    border: none; border-radius: 8px; font-weight: 600; cursor: pointer;
}
.reveal-btn:hover { background: var(--text-primary); }
.next-btn {
    padding: 0.75rem 1.5rem; background: var(--success-color); color: white;
    border: none; border-radius: 8px; font-weight: 600; cursor: pointer;
}
.next-btn:hover { background: #059669; }
.next-btn.hidden { display: none; }

/* 結果 */
.result-section.hidden { display: none; }
.result-summary {
    text-align: center; padding: 1.5rem; background: linear-gradient(135deg, var(--gold-color), var(--gold-dark));
    border-radius: 12px; margin-bottom: 1rem; color: #78350f;
}
.result-summary .total-prize { font-size: 2rem; font-weight: 700; }
.result-summary .profit { font-size: 1.1rem; margin-top: 0.5rem; }
.result-summary.loss { background: #f1f5f9; color: var(--text-secondary); }

.result-details { display: grid; gap: 0.5rem; }
.result-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.75rem 1rem; background: #f8fafc; border-radius: 8px;
}
.result-item.win { background: #fef3c7; }
.result-item .ticket-num { font-weight: 600; color: var(--text-secondary); }
.result-item .ticket-result { font-weight: 700; }
.result-item .ticket-result.win { color: var(--gold-dark); }

.retry-btn {
    display: block; width: 100%; margin-top: 1rem; padding: 0.75rem;
    background: var(--primary-color); color: white; border: none; border-radius: 8px;
    font-weight: 600; cursor: pointer;
}
.retry-btn:hover { background: var(--primary-dark); }

/* 統計 */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1rem; }
.stat-card { background: #f8fafc; border-radius: 8px; padding: 1rem; text-align: center; }
.stat-label { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.25rem; }
.stat-value { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
.clear-stats-btn { display: block; margin: 0 auto; padding: 0.5rem 1rem; background: var(--border-color); color: var(--text-secondary); border: none; border-radius: 6px; cursor: pointer; }

.probability-table { overflow-x: auto; }
.info-table { width: 100%; border-collapse: collapse; }
.info-table th, .info-table td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--border-color); }
.info-table th { background: #f8fafc; font-weight: 600; }
.info-table .highlight-row { background: #fef3c7; }

.related-link-section { margin-bottom: 1.5rem; }
.related-links-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.related-link-card { display: flex; align-items: center; gap: 0.75rem; padding: 1rem; background: white; border: 2px solid var(--border-color); border-radius: 10px; text-decoration: none; transition: all 0.2s; }
.related-link-card:hover { border-color: var(--primary-color); transform: translateY(-2px); }
.related-link-icon { font-size: 1.5rem; }
.related-link-title { font-weight: 600; color: var(--text-primary); }

@media (max-width: 768px) {
    .info-grid { grid-template-columns: 1fr; gap: 0.5rem; }
    .purchase-grid { grid-template-columns: 1fr; }
    .buy-btn { width: 100%; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .related-links-grid { grid-template-columns: 1fr; }
    .scratch-card { max-width: 100%; }
    .prize-symbol { width: 70px; height: 70px; }
    .prize-symbol .prize-icon { font-size: 1.5rem; }
}
