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

:root {
    --primary-color: #4CAF50;
    --primary-dark: #388E3C;
    --text-primary: #333;
    --text-secondary: #666;
    --text-muted: #999;
    --bg-primary: #fff;
    --bg-secondary: #f9f9f9;
    --border-color: #eee;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --radius: 12px;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background-color: var(--bg-primary);
    box-shadow: var(--shadow);
}

/* Header */
.header {
    background-color: var(--bg-primary);
    padding: 16px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Main Content */
.main-content {
    padding-bottom: 32px;
}

/* Summary Section */
.summary-section {
    padding: 20px;
    background-color: var(--bg-primary);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.summary-label {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.summary-value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.total-row .summary-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.total-row .summary-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Passengers Section */
.passengers-section {
    padding: 16px 20px;
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

.passengers-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.passengers-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.passengers-control {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background-color: #555;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.btn-circle:hover {
    background-color: #444;
}

.btn-circle:active {
    transform: scale(0.95);
}

.passengers-count {
    font-size: 1.25rem;
    font-weight: 600;
    min-width: 32px;
    text-align: center;
}

/* Per Person Section */
.per-person-section {
    padding: 16px 20px;
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

.per-person-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.per-person-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.per-person-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Settings Section */
.settings-section {
    padding: 20px;
    background-color: var(--bg-primary);
    border-top: 8px solid var(--bg-secondary);
}

.settings-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Input Groups */
.input-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-field {
    flex: 1;
    height: 48px;
    padding: 0 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    text-align: right;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    -webkit-appearance: none;
    appearance: none;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--bg-primary);
}

.input-unit {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    min-width: 40px;
}

/* Fuel Type Buttons */
.fuel-type-buttons {
    display: flex;
    gap: 8px;
}

.fuel-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background-color: var(--bg-primary);
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.fuel-btn.active {
    border-color: var(--primary-color);
    background-color: rgba(76, 175, 80, 0.1);
}

.fuel-badge {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.fuel-badge.regular {
    background-color: #E53935;
}

.fuel-badge.highoc {
    background-color: #FF9800;
}

.fuel-badge.diesel {
    background-color: #43A047;
}

.fuel-price-input {
    width: 100%;
    min-width: 0;
    height: 32px;
    padding: 0 4px;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: right;
    background-color: transparent;
    color: var(--text-primary);
    -webkit-appearance: none;
    appearance: none;
}

.fuel-price-input:focus {
    outline: none;
    background-color: var(--bg-secondary);
}

.fuel-price-input::-webkit-inner-spin-button,
.fuel-price-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.fuel-price {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Checkbox Group */
.checkbox-group {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.checkbox-input {
    display: none;
}

.checkbox-custom {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.checkbox-input:checked + .checkbox-custom {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-input:checked + .checkbox-custom::after {
    content: '✓';
    color: #fff;
    font-size: 0.875rem;
    font-weight: 700;
}

.checkbox-text {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.checkbox-hint {
    margin-top: 8px;
    margin-left: 36px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Links Section */
.links-section {
    padding: 20px;
    background-color: var(--bg-primary);
    border-top: 8px solid var(--bg-secondary);
}

.external-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background-color: var(--bg-secondary);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-primary);
    transition: background-color 0.2s;
}

.external-link:hover {
    background-color: #f0f0f0;
}

.link-icon {
    font-size: 1.25rem;
}

.link-text {
    flex: 1;
    font-size: 0.9375rem;
    font-weight: 500;
}

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

/* Number input spinner hide */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* Safe area for notch devices */
@supports (padding-top: env(safe-area-inset-top)) {
    .header {
        padding-top: calc(16px + env(safe-area-inset-top));
    }

    .main-content {
        padding-bottom: calc(32px + env(safe-area-inset-bottom));
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #fff;
        --text-secondary: #aaa;
        --text-muted: #888;
        --bg-primary: #1c1c1e;
        --bg-secondary: #000;
        --border-color: #333;
    }

    .btn-circle {
        background-color: #666;
    }

    .btn-circle:hover {
        background-color: #777;
    }

    .fuel-btn {
        background-color: var(--bg-primary);
    }

    .fuel-btn.active {
        background-color: rgba(76, 175, 80, 0.2);
    }

    .external-link:hover {
        background-color: #2c2c2e;
    }
}
