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

:root {
    --primary-color: #5B47E0;
    --primary-hover: #4936C9;
    --secondary-color: #F7F7F8;
    --text-primary: #2B2F36;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

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

header {
    text-align: center;
    color: white;
    padding: 40px 0;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-bottom: 20px;
}

.language-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.lang-btn.active {
    background: white;
    color: var(--primary-color);
    font-weight: 600;
}

.card {
    background: white;
    border-radius: var(--radius);
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-lg);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.input-with-currency {
    display: flex;
    gap: 10px;
}

input[type="number"],
input[type="text"],
select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(91, 71, 224, 0.1);
}

select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    appearance: none;
}

.tip-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.tip-btn {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.95rem;
}

.tip-btn:hover {
    border-color: var(--primary-color);
    background: var(--secondary-color);
}

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

#customTip {
    width: 120px;
}

.split-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.split-btn {
    padding: 20px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.split-btn:hover {
    border-color: var(--primary-color);
    background: var(--secondary-color);
    transform: translateY(-2px);
}

.split-btn.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(91, 71, 224, 0.1) 0%, rgba(91, 71, 224, 0.05) 100%);
}

.split-btn .icon {
    font-size: 1.5rem;
}

.split-section {
    margin-top: 20px;
}

.split-section.hidden {
    display: none;
}

.people-counter {
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 200px;
}

.counter-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: white;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.counter-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

#peopleCount {
    width: 80px;
    text-align: center;
}

.participant-item {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.participant-name {
    flex: 1;
}

.participant-percentage {
    width: 80px;
}

.remove-participant {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--danger-color);
    background: white;
    color: var(--danger-color);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.remove-participant:hover {
    background: var(--danger-color);
    color: white;
}

.add-btn {
    width: 100%;
    padding: 12px;
    border: 2px dashed var(--border-color);
    background: var(--secondary-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.add-btn:hover {
    border-color: var(--primary-color);
    background: white;
    color: var(--primary-color);
}

.calculate-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.calculate-btn:active {
    transform: translateY(0);
}

.summary {
    background: var(--secondary-color);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 25px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 1rem;
}

.summary-item.total {
    border-top: 2px solid var(--border-color);
    margin-top: 10px;
    padding-top: 15px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.split-result {
    margin-top: 20px;
}

.per-person-amount {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.per-person-amount .amount {
    font-size: 1.5rem;
    font-weight: 700;
}

.people-list {
    display: grid;
    gap: 10px;
}

.person-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.person-item:hover {
    background: var(--secondary-color);
    transform: translateX(5px);
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 25px;
}

.share-btn,
.reset-btn {
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.share-btn {
    background: var(--success-color);
    color: white;
}

.share-btn:hover {
    background: #059669;
    transform: translateY(-2px);
}

.reset-btn {
    background: white;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.reset-btn:hover {
    background: var(--secondary-color);
    border-color: var(--text-secondary);
}

.quick-splits {
    background: white;
    border-radius: var(--radius);
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-lg);
}

.quick-splits h3 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.example-btn {
    padding: 20px 15px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.example-btn:hover {
    border-color: var(--primary-color);
    background: var(--secondary-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.example-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

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

footer {
    text-align: center;
    color: white;
    padding: 30px 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.hidden {
    display: none !important;
}

/* レスポンシブデザイン */
@media (max-width: 640px) {
    header h1 {
        font-size: 2rem;
    }
    
    .card {
        padding: 20px;
    }
    
    .split-options {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .examples-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .tip-buttons {
        flex-direction: row;
    }
    
    .input-with-currency {
        flex-direction: column;
    }
}

/* アニメーション */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease;
}

/* プリント用スタイル */
@media print {
    body {
        background: white;
    }
    
    header,
    footer,
    .language-selector,
    .quick-splits,
    .action-buttons {
        display: none;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
}