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

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;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
    line-height: 1.6;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    width: 90%;
    margin: 1rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: #666;
    font-size: 1.1rem;
}

.language-selector {
    position: absolute;
    top: 0;
    right: 0;
}

#languageSelect {
    padding: 0.5rem;
    border: 2px solid #667eea;
    border-radius: 8px;
    background: white;
    color: #667eea;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#languageSelect:hover {
    background: #667eea;
    color: white;
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.mode-button, .action-button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-button {
    background: #667eea;
    color: white;
}

.mode-button:hover {
    background: #5a5fcf;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.action-button {
    background: #e0e0e0;
    color: #333;
}

.action-button:hover {
    background: #d0d0d0;
    transform: translateY(-2px);
}

#saveButton {
    background: #4caf50;
    color: white;
}

#saveButton:hover {
    background: #45a049;
}

#clearButton {
    background: #f44336;
    color: white;
}

#clearButton:hover {
    background: #da190b;
}

.pattern-container {
    background: #2c3e50;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
}

#patternLock {
    display: block;
    touch-action: none;
    user-select: none;
}

.dot {
    fill: #34495e;
    stroke: #1a252f;
    stroke-width: 2;
    transition: all 0.3s ease;
    cursor: pointer;
}

.dot:hover {
    fill: #4a5f7a;
}

.dot.active {
    fill: #3498db;
    stroke: #2980b9;
    stroke-width: 3;
    filter: url(style.css);
}

.pattern-line {
    stroke: #3498db;
    stroke-width: 5;
    stroke-linecap: round;
    fill: none;
    opacity: 0.8;
}

.current-line {
    opacity: 0.4;
    stroke-dasharray: 5, 5;
}

.info-panel {
    width: 100%;
    max-width: 400px;
}

.stats {
    display: flex;
    justify-content: space-around;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    color: #666;
    font-size: 0.9rem;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
}

.feedback {
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.feedback.weak {
    background: #ffebee;
    color: #c62828;
    border: 2px solid #ef5350;
}

.feedback.medium {
    background: #fff3e0;
    color: #ef6c00;
    border: 2px solid #ff9800;
}

.feedback.strong {
    background: #e8f5e9;
    color: #2e7d32;
    border: 2px solid #4caf50;
}

.feedback.success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 2px solid #4caf50;
}

.feedback.fail {
    background: #ffebee;
    color: #c62828;
    border: 2px solid #ef5350;
}

.feedback.info {
    background: #e3f2fd;
    color: #1565c0;
    border: 2px solid #2196f3;
}

.saved-patterns {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 10px;
}

.saved-patterns h3 {
    margin-bottom: 1rem;
    color: #667eea;
}

.pattern-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pattern-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.pattern-item span {
    font-size: 0.9rem;
}

.load-btn, .delete-btn {
    padding: 0.25rem 0.75rem;
    border: none;
    border-radius: 5px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.load-btn {
    background: #3498db;
    color: white;
}

.load-btn:hover {
    background: #2980b9;
}

.delete-btn {
    background: #e74c3c;
    color: white;
}

.delete-btn:hover {
    background: #c0392b;
}

.tips {
    background: #f0f4ff;
    padding: 1.5rem;
    border-radius: 10px;
    max-width: 400px;
    width: 100%;
}

.tips h3 {
    margin-bottom: 1rem;
    color: #667eea;
}

#tipsList {
    list-style: none;
    padding-left: 0;
}

#tipsList li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: #555;
}

#tipsList li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #4caf50;
    font-weight: bold;
}

footer {
    text-align: center;
    margin-top: 2rem;
    color: #666;
    font-size: 0.9rem;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
        margin: 0.5rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .language-selector {
        position: static;
        margin-top: 1rem;
    }
    
    .pattern-container {
        padding: 1rem;
    }
    
    #patternLock {
        width: 250px;
        height: 250px;
    }
    
    .controls {
        width: 100%;
    }
    
    .mode-button, .action-button {
        flex: 1;
        min-width: 100px;
    }
}