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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

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

header {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    padding: 25px 20px;
    margin: -20px -20px 20px -20px;
    box-shadow: 0 4px 20px rgba(76, 175, 80, 0.3);
    text-align: center;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { left: -100%; }
    100% { left: 100%; }
}

h1 {
    margin: 0;
    font-size: 2em;
    flex-grow: 1;
}

.refresh-btn {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    backdrop-filter: blur(10px);
}

.refresh-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-50%) scale(1.1);
}

.refresh-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.refresh-btn svg {
    transition: transform 0.3s ease;
}

.refresh-btn:hover svg {
    transform: rotate(180deg);
}

.refresh-btn.loading svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.add-item-container {
    display: flex;
    gap: 10px;
    background-color: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

#new-item-input {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    outline: none;
    -webkit-appearance: none;
    -webkit-border-radius: 5px;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    transition: border-color 0.3s;
    /* iOS Safari向けの改善 */
    -webkit-user-select: text;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

#new-item-input:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
    /* iOS Safari: キーボード表示時のズーム防止 */
    transform: translateZ(0);
}

#add-item-btn {
    background-color: #45a049;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
    -webkit-appearance: none;
    -webkit-border-radius: 5px;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

#add-item-btn:hover,
#add-item-btn:active {
    background-color: #3d8b40;
}

#add-item-btn:active {
    transform: scale(0.98);
}

section {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

h2 {
    color: #4CAF50;
    margin-bottom: 15px;
    font-size: 1.5em;
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 10px;
}

.item-list {
    list-style: none;
    min-height: 50px;
}

.item {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item:hover {
    background-color: #e8f5e8;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.item-text {
    flex: 1;
    font-size: 16px;
}

.delete-btn {
    background-color: #f44336;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s;
}

.delete-btn:hover {
    background-color: #da190b;
}

.shopping-list .item {
    border-left: 4px solid #4CAF50;
}

.candidate-list .item {
    border-left: 4px solid #ff9800;
}

.empty-state {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 20px;
}

.app-footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 30px;
    border-top: 1px solid #eee;
}

.version {
    color: #999;
    font-size: 14px;
    font-weight: 500;
}

#update-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #4CAF50;
    color: white;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.update-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    max-width: 600px;
    margin: 0 auto;
}

.update-content span {
    flex: 1;
    font-weight: 500;
}

#update-btn {
    background-color: white;
    color: #4CAF50;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    margin-right: 10px;
    transition: background-color 0.3s;
}

#update-btn:hover {
    background-color: #f0f0f0;
}

#dismiss-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s;
}

#dismiss-btn:hover {
    background-color: rgba(255,255,255,0.2);
}

/* iOS Safari向けの追加スタイル */
input[type="text"] {
    -webkit-appearance: none;
    -webkit-border-radius: 0;
}

button {
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    header {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.5em;
    }

    .refresh-btn {
        right: 15px;
        width: 40px;
        height: 40px;
    }

    .refresh-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .add-item-container {
        flex-direction: column;
        gap: 15px;
    }
    
    #new-item-input, #add-item-btn {
        width: 100%;
        font-size: 17px; /* iOS Safariのズーム防止 */
    }
    
    #new-item-input {
        padding: 15px 12px;
    }
    
    #add-item-btn {
        padding: 15px 20px;
        min-height: 44px; /* iOSのタップターゲット推奨サイズ */
    }
}