:root {
    --primary-color: #0d9488;
    --primary-hover: #0f766e;
    --primary-light: #ccfbf1;
    --success-color: #059669;
    --success-dark: #047857;
    --success-light: #ecfdf5;
    --bg-color: #f0fdfa;
    /* 薄いミント系 */
    --card-bg: #ffffff;
    --text-main: #134e4a;
    --text-muted: #64748b;
    --border-color: #ccfbf1;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --font-family: 'Inter', 'Noto Sans JP', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding: 16px;
    padding-bottom: 40px;
}

.app-container {
    max-width: 650px;
    margin: 0 auto;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 10px;
    margin-bottom: 24px;
    padding: 0 8px;
}

.app-header .header-icon img {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.app-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.divider {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 20px 0;
}

/* Form Elements */
.form-row {
    display: flex;
    gap: 24px;
}

@media (max-width: 480px) {
    .form-row {
        flex-direction: column;
        gap: 20px;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.half {
    flex: 1;
}

label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.input-wrapper {
    position: relative;
    width: 100%;
}

.input-wrapper input {
    width: 100%;
    padding: 14px 16px;
    font-size: 1.2rem;
    font-family: inherit;
    font-weight: 500;
    color: var(--text-main);
    border: 2px solid #5eead4;
    border-radius: var(--radius-sm);
    outline: none;
    transition: all 0.2s ease;
    text-align: right;
    background-color: #f0fdfa;
}

.input-wrapper input:focus {
    border-color: var(--primary-color);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

/* Stepper (＋/ーボタングループ) */
.input-stepper {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.stepper-btn {
    flex: 0 0 44px;
    background-color: #ffffff;
    border: 2px solid #5eead4;
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.stepper-btn:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    border-right: none;
}

.stepper-btn:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    border-left: none;
}

.stepper-btn:active {
    background-color: var(--primary-light);
}

.stepper-input input {
    border-radius: 0;
    text-align: center;
}

/* Toggle Buttons (片目/両目) */
.eye-toggle {
    display: flex;
    width: 100%;
    background-color: #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 4px;
}

.toggle-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.toggle-btn.active {
    background-color: #ffffff;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* Quick Buttons */
.quick-buttons {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.quick-buttons-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 4px;
}

.btn.quick-btn {
    flex: 1;
    background-color: #ffffff;
    border: 1px solid #99f6e4;
    padding: 10px 0;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    color: #0f766e;
    cursor: pointer;
    transition: all 0.15s ease;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn.quick-btn:hover {
    background-color: var(--primary-light);
}

.btn.quick-btn.active-quick-btn {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn.quick-btn:active {
    transform: scale(0.97);
}

.hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

.mt-2 {
    margin-top: 8px;
}

.mt-3 {
    margin-top: 16px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-3 {
    margin-bottom: 16px;
}

.w-100 {
    width: 100%;
}

/* Results Section */
.results-card {
    border: 2px solid #5eead4;
    background-color: #ffffff;
}

.results-header h2 {
    font-size: 1.3rem;
    text-align: center;
    margin-bottom: 16px;
    color: var(--primary-hover);
    font-weight: 700;
}

.results-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.result-box {
    padding: 24px 20px;
    border-radius: var(--radius-md);
    text-align: center;
}

.primary-result {
    background-color: var(--success-light);
    border: 1px solid #6ee7b7;
    position: relative;
    padding-top: 32px;
}

.eyes-status-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--primary-color);
    color: white;
    font-size: 0.85rem;
    font-weight: bold;
    padding: 4px 16px;
    border-radius: 20px;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.result-box .label {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.value-large {
    font-size: 3rem;
    line-height: 1;
    font-weight: 800;
    color: var(--success-dark);
    margin-bottom: 12px;
}

.value-large .unit {
    font-size: 1.1rem;
    font-weight: 600;
    margin-left: 4px;
}

.result-details {
    font-size: 0.95rem;
    line-height: 1.5;
    font-weight: 500;
}

.text-success-dark {
    color: var(--success-dark);
}

.result-details span {
    font-weight: 700;
    font-size: 1.1em;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    border-top: 1px dashed #99f6e4;
    padding-top: 24px;
}

.stat-box {
    background: #f0fdfa;
    padding: 16px 12px;
    border-radius: var(--radius-sm);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid var(--border-color);
}

.footer-notice {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* Back Button */
.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    text-decoration: none;
    font-size: 1.3rem;
    margin-right: 8px;
    flex-shrink: 0;
    transition: transform 0.2s;
    box-shadow: var(--shadow-sm);
}

.back-btn:active {
    transform: scale(0.95);
    background: #f1f5f9;
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    line-height: 1.3;
}

.stat-label small {
    font-size: 0.75rem;
    font-weight: normal;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-value.text-primary {
    color: var(--primary-hover);
}

/* Animation Utility */
@keyframes flash {
    0% {
        background-color: var(--primary-light);
    }

    100% {
        background-color: transparent;
    }
}

.flash {
    animation: flash 0.4s ease-out;
}