:root {
    --primary-red: #DC143C;
    --dark-red: #8B0000;
    --gold: #FFD700;
    --white: #FFFFFF;
    --black: #1A1A1A;
    --gray-light: #F5F5F5;
    --gray-medium: #E0E0E0;
    --gray-dark: #666666;
    --shadow: rgba(0, 0, 0, 0.1);
    --success: #4CAF50;
    --error: #F44336;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(to bottom, #FFF5F5, #FFFFFF);
    color: var(--black);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    padding: 40px 0;
    background: linear-gradient(135deg, var(--primary-red), var(--dark-red));
    color: var(--white);
    border-radius: 20px;
    margin-bottom: 40px;
    box-shadow: 0 10px 30px var(--shadow);
}

header h1 {
    font-size: 3em;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

/* Stats Section */
.stats-section {
    margin-bottom: 40px;
}

.stat-card {
    background: var(--white);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 5px 15px var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px var(--shadow);
}

.stat-card.total {
    background: linear-gradient(135deg, var(--primary-red), var(--dark-red));
    color: var(--white);
    margin-bottom: 20px;
    padding: 30px;
}

.stat-card h2, .stat-card h3 {
    margin-bottom: 10px;
    font-weight: normal;
}

.stat-value {
    font-size: 3em;
    font-weight: bold;
    display: inline-block;
}

.unit {
    font-size: 1.5em;
    margin-left: 5px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

/* Record Section */
.record-section {
    margin-bottom: 40px;
}

.record-button {
    width: 100%;
    padding: 30px;
    font-size: 1.5em;
    background: linear-gradient(135deg, var(--primary-red), var(--dark-red));
    color: var(--white);
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.record-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px var(--shadow);
}

.record-button:active {
    transform: translateY(0);
}

.record-button.animate .torii-icon {
    animation: toriiPulse 1s ease;
}

@keyframes toriiPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

.torii-icon {
    font-size: 1.5em;
}

.shrine-input {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 15px;
}

.shrine-input input,
.shrine-input select {
    padding: 15px;
    font-size: 1.1em;
    border: 2px solid var(--gray-medium);
    border-radius: 10px;
    transition: border-color 0.3s ease;
}

.shrine-input input:focus,
.shrine-input select:focus {
    outline: none;
    border-color: var(--primary-red);
}

/* History Section */
.history-section {
    margin-bottom: 40px;
}

.history-section h2 {
    font-size: 1.8em;
    margin-bottom: 20px;
    color: var(--dark-red);
}

.filter-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 20px;
    background: var(--white);
    border: 2px solid var(--gray-medium);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    border-color: var(--primary-red);
}

.filter-btn.active {
    background: var(--primary-red);
    color: var(--white);
    border-color: var(--primary-red);
}

.history-list {
    background: var(--white);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px var(--shadow);
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid var(--gray-light);
    transition: background 0.3s ease;
}

.history-item:hover {
    background: var(--gray-light);
}

.history-item:last-child {
    border-bottom: none;
}

.history-icon {
    font-size: 2em;
}

.history-details h4 {
    font-size: 1.1em;
    margin-bottom: 5px;
}

.history-details p {
    color: var(--gray-dark);
    font-size: 0.9em;
}

.empty-message {
    text-align: center;
    color: var(--gray-dark);
    padding: 40px;
}

/* Achievements Section */
.achievements-section {
    margin-bottom: 40px;
}

.achievements-section h2 {
    font-size: 1.8em;
    margin-bottom: 20px;
    color: var(--dark-red);
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.achievement {
    background: var(--white);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 5px 15px var(--shadow);
    transition: all 0.3s ease;
}

.achievement.unlocked {
    background: linear-gradient(135deg, var(--gold), #FFA500);
    color: var(--black);
}

.achievement.locked {
    opacity: 0.6;
}

.achievement:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px var(--shadow);
}

.achievement-icon {
    font-size: 3em;
    display: block;
    margin-bottom: 15px;
}

.achievement h4 {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.achievement p {
    font-size: 0.9em;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.modal.show {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--white);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-icon {
    font-size: 4em;
    margin-bottom: 20px;
    animation: modalBounce 0.5s ease;
}

@keyframes modalBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.modal h3 {
    font-size: 1.5em;
    margin-bottom: 15px;
    color: var(--dark-red);
}

.modal-close {
    margin-top: 20px;
    padding: 10px 30px;
    background: var(--primary-red);
    color: var(--white);
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1.1em;
    transition: background 0.3s ease;
}

.modal-close:hover {
    background: var(--dark-red);
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 10px;
    background: var(--white);
    box-shadow: 0 5px 15px var(--shadow);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1001;
}

.notification.show {
    transform: translateX(0);
}

.notification.achievement {
    background: linear-gradient(135deg, var(--gold), #FFA500);
}

.notification.error {
    background: var(--error);
    color: var(--white);
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 0;
    color: var(--gray-dark);
}

/* Responsive */
@media (max-width: 600px) {
    header h1 {
        font-size: 2em;
    }
    
    .shrine-input {
        grid-template-columns: 1fr;
    }
    
    .stat-value {
        font-size: 2em;
    }
    
    .achievements-grid {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar */
.history-list::-webkit-scrollbar {
    width: 8px;
}

.history-list::-webkit-scrollbar-track {
    background: var(--gray-light);
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--primary-red);
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: var(--dark-red);
}